Re: [PATCH] D24785: [AVX512] Fix return types on __builtin_ia32_gather3XivXdi builtins

2016-09-20 Thread Igor Breger via cfe-commits
igorb accepted this revision.
igorb added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

https://reviews.llvm.org/D24785



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Justin Lebar via cfe-commits
jlebar added a comment.

> I was not able to figure out how to comandeer a revision, so i just went 
> ahead and pushed it.


Under "leap into action", one of the options is to commandeer the revision.


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Justin Lebar via cfe-commits
jlebar added a subscriber: jlebar.
jlebar added a comment.

FWIW I have run into this in the past and just not managed to muster up the 
energy to fix it.  So, thank you!


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Modules: Suggestion on how to fix a regression caused by r259901

2016-09-20 Thread Manman via cfe-commits
Hi Richard,

Any suggestion on this?

Thanks,
Manman

> On Sep 7, 2016, at 12:40 PM, Manman  wrote:
> 
> Hi Richard,
> 
> We noticed a regression for this simple testing case:
> rm -rf tmp3
> clang -cc1 -fimplicit-module-maps -x objective-c -fmodules 
> -fmodules-cache-path=tmp3 -emit-obj standalone.c -I Inputs/
> —>
> standalone.c:4:6: error: variable has incomplete type 'void'
> void foo __P(());
> ^
> standalone.c:4:9: error: expected ';' after top level declarator
> void foo __P(());
>^
>;
> 2 errors generated.
> clang -cc1 -fimplicit-module-maps -x objective-c -fmodules 
> -fmodules-cache-path=tmp3 -emit-obj standalone.c -I Inputs/
> —> This runs fine.
> 
> cat standalone.c
> #import "C.h"
> #import "A.h"
> 
> void foo __P(());
> 
> cat Inputs/module.map 
> module X {
>  header "A.h"
>  export *
> }
> // Y imports X, it also uses “__P” as a parameter name
> module Y {
>  header "B.h"
>  export *
> }
> // Z imports X and Y
> module Z {
>  header "C.h”
> }
> 
> cat Inputs/A.h 
> #define __P(protos) ()
> 
> cat Inputs/B.h
> #import "A.h"
> #import "B2.h”
> 
> cat Inputs/B2.h 
> void test(int __P) {
> }
> 
> cat Inputs/C.h 
> #import "A.h"
> #import “B.h”
> 
> r259901 causes the compiler to write out identifier “__P” without the macro 
> information for module Y, which seems to be incorrect. Any suggestion on how 
> to fix this?
> Why the 2nd run works is related to global index. Global Index only considers 
> interesting identifiers, so it skips module Y when calling 
> ModuleManager::visit.
> 
> Cheers,
> Manman
> 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24785: [AVX512] Fix return types on __builtin_ia32_gather3XivXdi builtins

2016-09-20 Thread Cameron McInally via cfe-commits
cameron.mcinally created this revision.
cameron.mcinally added reviewers: delena, igorb, craig.topper.
cameron.mcinally added a subscriber: cfe-commits.
cameron.mcinally set the repository for this revision to rL LLVM.

The return types on the AVX512 __builtin_ia32_gather3XivXdi builtins are 
incorrect. The return type should match the type of the pass through vector.

The corresponding LLVM diff is D24744.

Repository:
  rL LLVM

https://reviews.llvm.org/D24785

Files:
  include/clang/Basic/BuiltinsX86.def

Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -1037,17 +1037,17 @@
 TARGET_BUILTIN(__builtin_ia32_extractf32x4_mask, "V4fV16fIiV4fUc", "", 
"avx512f")
 
 TARGET_BUILTIN(__builtin_ia32_gather3div2df, "V2dV2ddC*V2LLiUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3div2di, 
"V4iV2LLiLLiC*V2LLiUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3div2di, 
"V2LLiV2LLiLLiC*V2LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div4df, "V4dV4ddC*V4LLiUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3div4di, 
"V8iV4LLiLLiC*V4LLiUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3div4di, 
"V4LLiV4LLiLLiC*V4LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div4sf, "V4fV4ffC*V2LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div4si, "V4iV4iiC*V2LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div8sf, "V4fV4ffC*V4LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div8si, "V4iV4iiC*V4LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv2df, "V2dV2ddC*V4iUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3siv2di, 
"V4iV2LLiLLiC*V4iUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3siv2di, 
"V2LLiV2LLiLLiC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv4df, "V4dV4ddC*V4iUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3siv4di, 
"V8iV4LLiLLiC*V4iUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3siv4di, 
"V4LLiV4LLiLLiC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv4sf, "V4fV4ffC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv4si, "V4iV4iiC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv8sf, "V8fV8ffC*V8iUci","","avx512vl")


Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -1037,17 +1037,17 @@
 TARGET_BUILTIN(__builtin_ia32_extractf32x4_mask, "V4fV16fIiV4fUc", "", "avx512f")
 
 TARGET_BUILTIN(__builtin_ia32_gather3div2df, "V2dV2ddC*V2LLiUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3div2di, "V4iV2LLiLLiC*V2LLiUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3div2di, "V2LLiV2LLiLLiC*V2LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div4df, "V4dV4ddC*V4LLiUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3div4di, "V8iV4LLiLLiC*V4LLiUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3div4di, "V4LLiV4LLiLLiC*V4LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div4sf, "V4fV4ffC*V2LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div4si, "V4iV4iiC*V2LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div8sf, "V4fV4ffC*V4LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3div8si, "V4iV4iiC*V4LLiUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv2df, "V2dV2ddC*V4iUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3siv2di, "V4iV2LLiLLiC*V4iUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3siv2di, "V2LLiV2LLiLLiC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv4df, "V4dV4ddC*V4iUci","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_gather3siv4di, "V8iV4LLiLLiC*V4iUci","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_gather3siv4di, "V4LLiV4LLiLLiC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv4sf, "V4fV4ffC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv4si, "V4iV4iiC*V4iUci","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_gather3siv8sf, "V8fV8ffC*V8iUci","","avx512vl")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-20 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Here is the discussion on cfe-dev. 
http://lists.llvm.org/pipermail/cfe-dev/2016-September/050800.html

What's going on is that the path-sensitive unreachable code checker traverses 
blocks in the unoptimized CFG and emits a diagnostic if a block in that CFG is 
not reachable. But it decides whether a block is reachable by using the 
exploded node graph, which itself refers to the *optimized* CFG.

Normally this isn't a problem because the difference between the unoptimized 
and optimized CFGs is that the latter prunes edges that are trivially false 
(but the two CFGs have the same blocks). Unfortunately, there is a bug in CFG 
construction for do-while loops that also prunes a block. Since the block ids 
are constructed sequentially, the block IDs between the two CFGs don't match up 
and so the unreachable code checker gets confused.

I think the best fix here is to change construction of the optimized CFG to not 
prune the block in VisitDoStmt(). This matches what I think is the expected 
meaning of the 'PruneTriviallyFalseEdges' CFG option.


https://reviews.llvm.org/D24759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-20 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

@danielmarjamaki I see what you mean -- thanks for providing the patch.

I don't think this is the right approach. It should be sufficient to reason 
about blocks and not individual statements; further some blocks may be 
non-empty but not have any statements.

Instead, I think the better approach is make sure the optimized and unoptimized 
CFGs match block IDs. It looks like the only situation where there is currently 
a mismatch is `do { } while (0);`.

I sketched out an approach on cfe-dev for hoisting block creation (but not edge 
creation) in CFGBuilder::VisitDoStmt() during CFG construction to match the 
other control flow constructs. That is the approach I would recommend taking.


https://reviews.llvm.org/D24759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-20 Thread Alex Lorenz via cfe-commits
arphaman added inline comments.


Comment at: clang-refactor/driver/Driver.cpp:36
@@ +35,3 @@
+argv[1] = (llvm::Twine(argv[0]) + " " + 
llvm::Twine(argv[1])).str().c_str();
+Manager.dispatch(Command, argc - 1, argv + 1);
+  } else {

Is there a particular reason why you don't return a value that's returned by 
Manager.dispatch here? It seems odd to me that Manager.dispatch returns an 
integer value that's not actually used here.


https://reviews.llvm.org/D24192



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24784: [change-namespace] fix name qualifiers in UsingShadowDecl and NestedNameSpecifier.

2016-09-20 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added a reviewer: hokein.
ioeric added a subscriber: cfe-commits.

https://reviews.llvm.org/D24784

Files:
  change-namespace/ChangeNamespace.cpp
  change-namespace/ChangeNamespace.h
  unittests/change-namespace/ChangeNamespaceTests.cpp

Index: unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- unittests/change-namespace/ChangeNamespaceTests.cpp
+++ unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -229,6 +229,89 @@
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, FixUsingShadowDecl) {
+  std::string Code = "namespace na {\n"
+ "namespace nc {\n"
+ "class SAME {};\n"
+ "}\n"
+ "namespace nd {\n"
+ "class SAME {};\n"
+ "}\n"
+ "namespace nb {\n"
+ "using nc::SAME;\n"
+ "typedef nc::SAME IDENTICAL;\n"
+ "void f(nd::SAME Same) {}\n"
+ "} // namespace nb\n"
+ "} // namespace na\n";
+
+  std::string Expected = "namespace na {\n"
+ "namespace nc {\n"
+ "class SAME {};\n"
+ "}\n"
+ "namespace nd {\n"
+ "class SAME {};\n"
+ "}\n"
+ "\n"
+ "} // namespace na\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "using ::na::nc::SAME;\n"
+ "typedef na::nc::SAME IDENTICAL;\n"
+ "void f(na::nd::SAME Same) {}\n"
+ "} // namespace y\n"
+ "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
+TEST_F(ChangeNamespaceTest, TypeInNestedNameSpecifier) {
+  std::string Code =
+  "namespace na {\n"
+  "class C_A {\n"
+  "public:\n"
+  "  class Nested {\n"
+  "public:\n"
+  "  static int NestedX;\n"
+  "  static void nestedFunc() {}\n"
+  "  };\n"
+  "};\n"
+  "namespace nb {\n"
+  "class C_X {\n"
+  "  C_A na;\n"
+  "  C_A::Nested nested;\n"
+  "  void f() {\n"
+  "C_A::Nested::nestedFunc();\n"
+  "int X = C_A::Nested::NestedX;\n"
+  "  }\n"
+  "};\n"
+  "}  // namespace nb\n"
+  "}  // namespace na\n";
+  std::string Expected =
+  "namespace na {\n"
+  "class C_A {\n"
+  "public:\n"
+  "  class Nested {\n"
+  "public:\n"
+  "  static int NestedX;\n"
+  "  static void nestedFunc() {}\n"
+  "  };\n"
+  "};\n"
+  "\n"
+  "}  // namespace na\n"
+  "namespace x {\n"
+  "namespace y {\n"
+  "class C_X {\n"
+  "  na::C_A na;\n"
+  "  na::C_A::Nested nested;\n"
+  "  void f() {\n"
+  "na::C_A::Nested::nestedFunc();\n"
+  "int X = na::C_A::Nested::NestedX;\n"
+  "  }\n"
+  "};\n"
+  "}  // namespace y\n"
+  "}  // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 } // anonymous namespace
 } // namespace change_namespace
 } // namespace clang
Index: change-namespace/ChangeNamespace.h
===
--- change-namespace/ChangeNamespace.h
+++ change-namespace/ChangeNamespace.h
@@ -73,6 +73,9 @@
   void fixTypeLoc(const ast_matchers::MatchFinder::MatchResult ,
   SourceLocation Start, SourceLocation End, TypeLoc Type);
 
+  void fixUsingShadowDecl(const ast_matchers::MatchFinder::MatchResult ,
+  const UsingDecl *UsingDeclaration);
+
   // Information about moving an old namespace.
   struct MoveNamespace {
 // The start offset of the namespace block being moved in the original
Index: change-namespace/ChangeNamespace.cpp
===
--- change-namespace/ChangeNamespace.cpp
+++ change-namespace/ChangeNamespace.cpp
@@ -231,9 +231,6 @@
 }
 
 // FIXME: handle the following symbols:
-//   - Types in `UsingShadowDecl` (e.g. `using a::b::c;`) which are not matched
-//   by `typeLoc`.
-//   - Types in nested name specifier, e.g. "na::X" in "na::X::Nested".
 //   - Function references.
 //   - Variable references.
 void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
@@ -266,7 +263,6 @@
   // Match TypeLocs on the declaration. Carefully match only the outermost
   // TypeLoc that's directly linked to the old class and don't handle nested
   // name specifier locs.
-  // FIXME: match and handle nested name specifier locs.
   Finder->addMatcher(
   typeLoc(IsInMovedNs,
   loc(qualType(hasDeclaration(DeclMatcher.bind("from_decl",
@@ 

Re: [PATCH] D24609: [ARM] Add missing Interlocked intrinsics

2016-09-20 Thread Saleem Abdulrasool via cfe-commits
compnerd added a comment.

Im happy to do so, but, could you please rebase the patch?


https://reviews.llvm.org/D24609



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21506: [analyzer] Block in critical section

2016-09-20 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282011: [analyzer] Add a checker that detects blocks in 
critical sections (authored by zaks).

Changed prior to commit:
  https://reviews.llvm.org/D21506?vs=71375=71977#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D21506

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
  cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
  cfe/trunk/test/Analysis/block-in-critical-section.cpp

Index: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -436,6 +436,10 @@
   HelpText<"Check for misuses of stream APIs">,
   DescFile<"SimpleStreamChecker.cpp">;
 
+def BlockInCriticalSectionChecker : Checker<"BlockInCriticalSection">,
+  HelpText<"Check for calls to blocking functions inside a critical section">,
+  DescFile<"BlockInCriticalSectionChecker.cpp">;
+
 } // end "alpha.unix"
 
 let ParentPackage = CString in {
Index: cfe/trunk/test/Analysis/block-in-critical-section.cpp
===
--- cfe/trunk/test/Analysis/block-in-critical-section.cpp
+++ cfe/trunk/test/Analysis/block-in-critical-section.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.unix.BlockInCriticalSection -std=c++11 -verify %s
+
+void sleep(int x) {}
+
+namespace std {
+struct mutex {
+  void lock() {}
+  void unlock() {}
+};
+}
+
+void testBlockInCriticalSection() {
+  std::mutex m;
+  m.lock();
+  sleep(3); // expected-warning {{A blocking function %s is called inside a critical section}}
+  m.unlock();
+}
+
+void testBlockInCriticalSectionWithNestedMutexes() {
+  std::mutex m, n, k;
+  m.lock();
+  n.lock();
+  k.lock();
+  sleep(3); // expected-warning {{A blocking function %s is called inside a critical section}}
+  k.unlock();
+  sleep(5); // expected-warning {{A blocking function %s is called inside a critical section}}
+  n.unlock();
+  sleep(3); // expected-warning {{A blocking function %s is called inside a critical section}}
+  m.unlock();
+  sleep(3); // no-warning
+}
+
+void f() {
+  sleep(1000); // expected-warning {{A blocking function %s is called inside a critical section}}
+}
+
+void testBlockInCriticalSectionInterProcedural() {
+  std::mutex m;
+  m.lock();
+  f();
+  m.unlock();
+}
+
+void testBlockInCriticalSectionUnexpectedUnlock() {
+  std::mutex m;
+  m.unlock();
+  sleep(1); // no-warning
+  m.lock();
+  sleep(1); // expected-warning {{A blocking function %s is called inside a critical section}}
+}
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
@@ -0,0 +1,109 @@
+//===-- BlockInCriticalSectionChecker.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// Defines a checker for blocks in critical sections. This checker should find
+// the calls to blocking functions (for example: sleep, getc, fgets, read,
+// recv etc.) inside a critical section. When sleep(x) is called while a mutex
+// is held, other threades cannot lock the same mutex. This might take some
+// time, leading to bad performance or even deadlock.
+//
+//===--===//
+
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+
+using namespace clang;
+using namespace ento;
+
+namespace {
+
+class BlockInCriticalSectionChecker : public Checker {
+
+  CallDescription LockFn, UnlockFn, SleepFn, GetcFn, FgetsFn, ReadFn, RecvFn;
+
+  std::unique_ptr BlockInCritSectionBugType;
+
+  void reportBlockInCritSection(SymbolRef FileDescSym,
+const CallEvent ,
+CheckerContext ) const;
+
+public:
+  BlockInCriticalSectionChecker();
+
+  void checkPreCall(const CallEvent , CheckerContext ) const;
+
+  /// Process unlock.
+  /// Process lock.
+  /// Process blocking functions (sleep, getc, fgets, read, recv)
+  void checkPostCall(const CallEvent , CheckerContext ) const;
+
+};

r282011 - [analyzer] Add a checker that detects blocks in critical sections

2016-09-20 Thread Anna Zaks via cfe-commits
Author: zaks
Date: Tue Sep 20 15:28:50 2016
New Revision: 282011

URL: http://llvm.org/viewvc/llvm-project?rev=282011=rev
Log:
[analyzer] Add a checker that detects blocks in critical sections

This checker should find the calls to blocking functions (for example: sleep, 
getc, fgets,read,recv etc.) inside a critical section. When sleep(x) is called 
while a mutex is held, other threads cannot lock the same mutex. This might 
take some time, leading to bad performance or even deadlock.

Example:

mutex_t m;

void f() {
  sleep(1000); // Error: sleep() while m is locked! [f() is called from 
foobar() while m is locked]
  // do some work
}

void foobar() {
  lock(m);
  f();
  unlock(m);
}

A patch by zdtorok (Zoltán Dániel Török)!

Differential Revision: https://reviews.llvm.org/D21506

Added:
cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
cfe/trunk/test/Analysis/block-in-critical-section.cpp
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=282011=282010=282011=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Tue Sep 20 
15:28:50 2016
@@ -436,6 +436,10 @@ def SimpleStreamChecker : Checker<"Simpl
   HelpText<"Check for misuses of stream APIs">,
   DescFile<"SimpleStreamChecker.cpp">;
 
+def BlockInCriticalSectionChecker : Checker<"BlockInCriticalSection">,
+  HelpText<"Check for calls to blocking functions inside a critical section">,
+  DescFile<"BlockInCriticalSectionChecker.cpp">;
+
 } // end "alpha.unix"
 
 let ParentPackage = CString in {

Added: cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp?rev=282011=auto
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp 
(added)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp Tue 
Sep 20 15:28:50 2016
@@ -0,0 +1,109 @@
+//===-- BlockInCriticalSectionChecker.cpp ---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// Defines a checker for blocks in critical sections. This checker should find
+// the calls to blocking functions (for example: sleep, getc, fgets, read,
+// recv etc.) inside a critical section. When sleep(x) is called while a mutex
+// is held, other threades cannot lock the same mutex. This might take some
+// time, leading to bad performance or even deadlock.
+//
+//===--===//
+
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+
+using namespace clang;
+using namespace ento;
+
+namespace {
+
+class BlockInCriticalSectionChecker : public Checker {
+
+  CallDescription LockFn, UnlockFn, SleepFn, GetcFn, FgetsFn, ReadFn, RecvFn;
+
+  std::unique_ptr BlockInCritSectionBugType;
+
+  void reportBlockInCritSection(SymbolRef FileDescSym,
+const CallEvent ,
+CheckerContext ) const;
+
+public:
+  BlockInCriticalSectionChecker();
+
+  void checkPreCall(const CallEvent , CheckerContext ) const;
+
+  /// Process unlock.
+  /// Process lock.
+  /// Process blocking functions (sleep, getc, fgets, read, recv)
+  void checkPostCall(const CallEvent , CheckerContext ) const;
+
+};
+
+} // end anonymous namespace
+
+REGISTER_TRAIT_WITH_PROGRAMSTATE(MutexCounter, unsigned)
+
+BlockInCriticalSectionChecker::BlockInCriticalSectionChecker()
+: LockFn("lock"), UnlockFn("unlock"), SleepFn("sleep"), GetcFn("getc"),
+  FgetsFn("fgets"), ReadFn("read"), RecvFn("recv") {
+  // Initialize the bug type.
+  BlockInCritSectionBugType.reset(
+  new BugType(this, "Call to blocking function in critical section",
+"Blocking Error"));
+}
+
+void BlockInCriticalSectionChecker::checkPreCall(const CallEvent ,
+ CheckerContext ) const {
+}
+
+void BlockInCriticalSectionChecker::checkPostCall(const 

Re: [PATCH] D24192: [clang-refactor] introducing clang-refactor

2016-09-20 Thread Alex Lorenz via cfe-commits
arphaman added inline comments.


Comment at: clang-refactor/core/SymbolIndexClient.h:31
@@ +30,3 @@
+} // end namespace refactor
+} // end namespace refactor
+

End namespace clang?


https://reviews.llvm.org/D24192



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24775: Add -Wignored-pragma-intrinsic flag

2016-09-20 Thread Albert Gutowski via cfe-commits
OK, thanks for the note about referring to Chromium, I fixed that.
As to -Wunknown-pragma, I feel that it would be inconsistent with other
pragmas unless I moved whole pragma to lexer instead of parser - I've just
discovered that I can do that, how should I decide if it's supposed to be
here or there?

On Tue, Sep 20, 2016 at 12:30 PM, Nico Weber  wrote:

> Thanks! Some bikesheddy comments, ignore as you see fit:
>
> - I think it's good to keep Chromium's bug tracker out of LLVM as far as
> possible (most LLVM devs don't need to care about Chromium, and since
> Chromium's bug tracker refers to LLVM's bug tracker frequently since
> chromium depends on llvm, adding links the other way round adds a
> dependency cycle of sorts), so maybe describe the motivation in your own
> words instead of linking ("People might want to receive warnings about
> pragmas but not about intrinsics we don't yet implement")
>
> - Should this be part of -Wunknown-pragma instead of -Wignored-pragma? (Or
> maybe even in -Wmicrosoft somewhere?) That seems to fit a tiny bit better
> imho (but as I said, feel free to disagree and ignore)
>
> On Tue, Sep 20, 2016 at 2:38 PM, Albert Gutowski 
> wrote:
>
>> agutowski created this revision.
>> agutowski added reviewers: thakis, hans.
>> agutowski added a subscriber: cfe-commits.
>>
>> https://bugs.chromium.org/p/chromium/issues/detail?id=644841#c9
>>
>> https://reviews.llvm.org/D24775
>>
>> Files:
>>   include/clang/Basic/DiagnosticGroups.td
>>   include/clang/Basic/DiagnosticParseKinds.td
>>   test/Preprocessor/pragma_microsoft.c
>>
>> Index: include/clang/Basic/DiagnosticParseKinds.td
>> ===
>> --- include/clang/Basic/DiagnosticParseKinds.td
>> +++ include/clang/Basic/DiagnosticParseKinds.td
>> @@ -914,7 +914,7 @@
>>  // - #pragma intrinsic
>>  def warn_pragma_intrinsic_builtin : Warning<
>>"%0 is not a recognized builtin%select{|; consider including
>>  to access non-builtin intrinsics}1">,
>> -  InGroup;
>> +  InGroup;
>>  // - #pragma unused
>>  def warn_pragma_unused_expected_var : Warning<
>>"expected '#pragma unused' argument to be a variable name">,
>> Index: include/clang/Basic/DiagnosticGroups.td
>> ===
>> --- include/clang/Basic/DiagnosticGroups.td
>> +++ include/clang/Basic/DiagnosticGroups.td
>> @@ -439,8 +439,9 @@
>>  def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
>>  def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
>>
>> UninitializedStaticSelfInit]>;
>> +def IgnoredPragmaIntrinsic : DiagGroup<"ignored-pragma-intrinsic">;
>>  def UnknownPragmas : DiagGroup<"unknown-pragmas">;
>> -def IgnoredPragmas : DiagGroup<"ignored-pragmas">;
>> +def IgnoredPragmas : DiagGroup<"ignored-pragmas",
>> [IgnoredPragmaIntrinsic]>;
>>  def Pragmas : DiagGroup<"pragmas", [UnknownPragmas, IgnoredPragmas]>;
>>  def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
>>  def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
>> Index: test/Preprocessor/pragma_microsoft.c
>> ===
>> --- test/Preprocessor/pragma_microsoft.c
>> +++ test/Preprocessor/pragma_microsoft.c
>> @@ -178,3 +178,15 @@
>>  #pragma intrinsic(memset) // no-warning
>>  #undef __INTRIN_H
>>  #pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized
>> builtin; consider including }}
>> +
>> +#pragma clang diagnostic push
>> +#pragma clang diagnostic ignored "-Wignored-pragma-intrinsic"
>> +#pragma intrinsic(asdf) // no-warning
>> +#pragma clang diagnostic pop
>> +#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized
>> builtin; consider including }}
>> +
>> +#pragma clang diagnostic push
>> +#pragma clang diagnostic ignored "-Wignored-pragmas"
>> +#pragma intrinsic(asdf) // no-warning
>> +#pragma clang diagnostic pop
>> +#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized
>> builtin; consider including }}
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24513: [AMDGPU] Expose flat work group size, register and wave control attributes

2016-09-20 Thread Konstantin Zhuravlyov via cfe-commits
kzhuravl added inline comments.


Comment at: lib/Sema/SemaDeclAttr.cpp:4967
@@ +4966,3 @@
+
+  D->addAttr(::new (S.Context)
+ AMDGPUFlatWorkGroupSizeAttr(Attr.getLoc(), S.Context, Min, Max,

aaron.ballman wrote:
> Is it okay to supply `0, 0` as the min, max arguments?
Yes, I mentioned `0, 0` case in the docs.


Comment at: lib/Sema/SemaDeclAttr.cpp:4997
@@ +4996,3 @@
+
+  D->addAttr(::new (S.Context)
+ AMDGPUWavesPerEUAttr(Attr.getLoc(), S.Context, Min, Max,

aaron.ballman wrote:
> Is it okay to supply `0, 0` as the min, max arguments?
Yes, I mentioned `0, 0` case in the docs.


Comment at: lib/Sema/SemaDeclAttr.cpp:6039-6043
@@ -5976,3 +6038,7 @@
   D->setInvalidDecl();
-} else if (Attr *A = D->getAttr()) {
+} else if (Attr *A = D->getAttr()) {
+  Diag(D->getLocation(), diag::err_attribute_wrong_decl_type)
+<< A << ExpectedKernelFunction;
+  D->setInvalidDecl();
+} else if (Attr *A = D->getAttr()) {
   Diag(D->getLocation(), diag::err_attribute_wrong_decl_type)

aaron.ballman wrote:
> Yes, totally fine to be a follow-up patch. I was hoping it would look 
> something like (we can bikeshed the name):
> ```
> def SomeAttr {
>   /* Blah */
> }
> 
> def SomeOtherAttr {
>   let RequiredCompanionAttributes = [SomeAttr];
> }
> ```
This seems like a good start. Thanks :)


https://reviews.llvm.org/D24513



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24513: [AMDGPU] Expose flat work group size, register and wave control attributes

2016-09-20 Thread Konstantin Zhuravlyov via cfe-commits
kzhuravl updated this revision to Diff 71970.
kzhuravl added a comment.
Herald added a subscriber: kzhuravl.

Mention `0, 0` case in the docs.


https://reviews.llvm.org/D24513

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/TargetInfo.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenOpenCL/amdgpu-attrs.cl
  test/CodeGenOpenCL/amdgpu-num-gpr-attr.cl
  test/SemaCUDA/amdgpu-attrs.cu
  test/SemaCUDA/amdgpu-num-gpr-attr.cu
  test/SemaOpenCL/amdgpu-attrs.cl
  test/SemaOpenCL/amdgpu-num-register-attrs.cl

Index: test/SemaOpenCL/amdgpu-num-register-attrs.cl
===
--- test/SemaOpenCL/amdgpu-num-register-attrs.cl
+++ test/SemaOpenCL/amdgpu-num-register-attrs.cl
@@ -1,40 +0,0 @@
-// RUN: %clang_cc1 -triple r600-- -verify -fsyntax-only %s
-
-typedef __attribute__((amdgpu_num_vgpr(128))) struct FooStruct { // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}}
-  int x;
-  float y;
-} FooStruct;
-
-
-__attribute__((amdgpu_num_vgpr("ABC"))) kernel void foo2() {} // expected-error {{'amdgpu_num_vgpr' attribute requires an integer constant}}
-__attribute__((amdgpu_num_sgpr("ABC"))) kernel void foo3() {} // expected-error {{'amdgpu_num_sgpr' attribute requires an integer constant}}
-
-
-__attribute__((amdgpu_num_vgpr(40))) void foo4() {} // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}}
-__attribute__((amdgpu_num_sgpr(64))) void foo5() {} // expected-error {{'amdgpu_num_sgpr' attribute only applies to kernel functions}}
-
-__attribute__((amdgpu_num_vgpr(40))) kernel void foo7() {}
-__attribute__((amdgpu_num_sgpr(64))) kernel void foo8() {}
-__attribute__((amdgpu_num_vgpr(40), amdgpu_num_sgpr(64))) kernel void foo9() {}
-
-// Check 0 VGPR is accepted.
-__attribute__((amdgpu_num_vgpr(0))) kernel void foo10() {}
-
-// Check 0 SGPR is accepted.
-__attribute__((amdgpu_num_sgpr(0))) kernel void foo11() {}
-
-// Check both 0 SGPR and VGPR is accepted.
-__attribute__((amdgpu_num_vgpr(0), amdgpu_num_sgpr(0))) kernel void foo12() {}
-
-// Too large VGPR value.
-__attribute__((amdgpu_num_vgpr(4294967296))) kernel void foo13() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
-
-__attribute__((amdgpu_num_sgpr(4294967296))) kernel void foo14() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
-
-__attribute__((amdgpu_num_sgpr(4294967296), amdgpu_num_vgpr(4294967296))) kernel void foo15() {} // expected-error 2 {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
-
-
-// Make sure it is accepted with kernel keyword before the attribute.
-kernel __attribute__((amdgpu_num_vgpr(40))) void foo16() {}
-
-kernel __attribute__((amdgpu_num_sgpr(40))) void foo17() {}
Index: test/SemaOpenCL/amdgpu-attrs.cl
===
--- test/SemaOpenCL/amdgpu-attrs.cl
+++ test/SemaOpenCL/amdgpu-attrs.cl
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -triple amdgcn-- -verify -fsyntax-only %s
+
+typedef __attribute__((amdgpu_flat_work_group_size(32, 64))) struct struct_flat_work_group_size_32_64 { // expected-error {{'amdgpu_flat_work_group_size' attribute only applies to kernel functions}}
+  int x;
+  float y;
+} struct_flat_work_group_size_32_64;
+typedef __attribute__((amdgpu_waves_per_eu(2))) struct struct_waves_per_eu_2 { // expected-error {{'amdgpu_waves_per_eu' attribute only applies to kernel functions}}
+  int x;
+  float y;
+} struct_waves_per_eu_2;
+typedef __attribute__((amdgpu_waves_per_eu(2, 4))) struct struct_waves_per_eu_2_4 { // expected-error {{'amdgpu_waves_per_eu' attribute only applies to kernel functions}}
+  int x;
+  float y;
+} struct_waves_per_eu_2_4;
+typedef __attribute__((amdgpu_num_sgpr(32))) struct struct_num_sgpr_32 { // expected-error {{'amdgpu_num_sgpr' attribute only applies to kernel functions}}
+  int x;
+  float y;
+} struct_num_sgpr_32;
+typedef __attribute__((amdgpu_num_vgpr(64))) struct struct_num_vgpr_64 { // expected-error {{'amdgpu_num_vgpr' attribute only applies to kernel functions}}
+  int x;
+  float y;
+} struct_num_vgpr_64;
+
+__attribute__((amdgpu_flat_work_group_size(32, 64))) void func_flat_work_group_size_32_64() {} // expected-error {{'amdgpu_flat_work_group_size' attribute only applies to kernel functions}}
+__attribute__((amdgpu_waves_per_eu(2))) void func_waves_per_eu_2() {} // expected-error {{'amdgpu_waves_per_eu' attribute only applies to kernel functions}}
+__attribute__((amdgpu_waves_per_eu(2, 4))) void func_waves_per_eu_2_4() {} // expected-error {{'amdgpu_waves_per_eu' attribute only applies to kernel functions}}
+__attribute__((amdgpu_num_sgpr(32))) void func_num_sgpr_32() {} // expected-error 

r282007 - Remove some boilerplate comments that don't explain anything.

2016-09-20 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Tue Sep 20 14:45:06 2016
New Revision: 282007

URL: http://llvm.org/viewvc/llvm-project?rev=282007=rev
Log:
Remove some boilerplate comments that don't explain anything.

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=282007=282006=282007=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Sep 20 14:45:06 2016
@@ -108,8 +108,6 @@ static const char *getSparcAsmModeForCPU
   }
 }
 
-/// CheckPreprocessingOptions - Perform some validation of preprocessing
-/// arguments that is shared with gcc.
 static void CheckPreprocessingOptions(const Driver , const ArgList ) {
   if (Arg *A = Args.getLastArg(options::OPT_C, options::OPT_CC)) {
 if (!Args.hasArg(options::OPT_E) && !Args.hasArg(options::OPT__SLASH_P) &&
@@ -121,8 +119,6 @@ static void CheckPreprocessingOptions(co
   }
 }
 
-/// CheckCodeGenerationOptions - Perform some validation of code generation
-/// arguments that is shared with gcc.
 static void CheckCodeGenerationOptions(const Driver , const ArgList ) {
   // In gcc, only ARM checks this, but it seems reasonable to check 
universally.
   if (Args.hasArg(options::OPT_static))


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r281277 - [Sema] Fix PR30346: relax __builtin_object_size checks.

2016-09-20 Thread George Burgess IV via cfe-commits
Noted; thanks for the correction. :)

On Tue, Sep 20, 2016 at 3:04 AM, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Mon, Sep 19, 2016 at 09:21:33PM -0700, George Burgess IV wrote:
> > I'm entirely unfamiliar with struct-path-tbaa, so Hal, do you see a
> reason
> > why struct-path-tbaa wouldn't play nicely with flexible arrays at the end
> > of types? Glancing at it, I don't think it should cause problems, but a
> > more authoritative answer would really be appreciated. :) If it might
> cause
> > issues now or in the future, I'm happy to be conservative here if
> > -fno-strict-path-tbaa is given, too.
>
> Please don't call them flexible types. That's a misname. The standard
> provides a clear mechanism for arrays with statically undefined size --
> which is providing no size at all. We do provide the same support for
> array size of 1 for legacy compat. Any other size is basically abuse.
>
> Joerg
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24775: Add -Wignored-pragma-intrinsic flag

2016-09-20 Thread Nico Weber via cfe-commits
Thanks! Some bikesheddy comments, ignore as you see fit:

- I think it's good to keep Chromium's bug tracker out of LLVM as far as
possible (most LLVM devs don't need to care about Chromium, and since
Chromium's bug tracker refers to LLVM's bug tracker frequently since
chromium depends on llvm, adding links the other way round adds a
dependency cycle of sorts), so maybe describe the motivation in your own
words instead of linking ("People might want to receive warnings about
pragmas but not about intrinsics we don't yet implement")

- Should this be part of -Wunknown-pragma instead of -Wignored-pragma? (Or
maybe even in -Wmicrosoft somewhere?) That seems to fit a tiny bit better
imho (but as I said, feel free to disagree and ignore)

On Tue, Sep 20, 2016 at 2:38 PM, Albert Gutowski 
wrote:

> agutowski created this revision.
> agutowski added reviewers: thakis, hans.
> agutowski added a subscriber: cfe-commits.
>
> https://bugs.chromium.org/p/chromium/issues/detail?id=644841#c9
>
> https://reviews.llvm.org/D24775
>
> Files:
>   include/clang/Basic/DiagnosticGroups.td
>   include/clang/Basic/DiagnosticParseKinds.td
>   test/Preprocessor/pragma_microsoft.c
>
> Index: include/clang/Basic/DiagnosticParseKinds.td
> ===
> --- include/clang/Basic/DiagnosticParseKinds.td
> +++ include/clang/Basic/DiagnosticParseKinds.td
> @@ -914,7 +914,7 @@
>  // - #pragma intrinsic
>  def warn_pragma_intrinsic_builtin : Warning<
>"%0 is not a recognized builtin%select{|; consider including 
> to access non-builtin intrinsics}1">,
> -  InGroup;
> +  InGroup;
>  // - #pragma unused
>  def warn_pragma_unused_expected_var : Warning<
>"expected '#pragma unused' argument to be a variable name">,
> Index: include/clang/Basic/DiagnosticGroups.td
> ===
> --- include/clang/Basic/DiagnosticGroups.td
> +++ include/clang/Basic/DiagnosticGroups.td
> @@ -439,8 +439,9 @@
>  def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
>  def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
>
> UninitializedStaticSelfInit]>;
> +def IgnoredPragmaIntrinsic : DiagGroup<"ignored-pragma-intrinsic">;
>  def UnknownPragmas : DiagGroup<"unknown-pragmas">;
> -def IgnoredPragmas : DiagGroup<"ignored-pragmas">;
> +def IgnoredPragmas : DiagGroup<"ignored-pragmas",
> [IgnoredPragmaIntrinsic]>;
>  def Pragmas : DiagGroup<"pragmas", [UnknownPragmas, IgnoredPragmas]>;
>  def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
>  def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
> Index: test/Preprocessor/pragma_microsoft.c
> ===
> --- test/Preprocessor/pragma_microsoft.c
> +++ test/Preprocessor/pragma_microsoft.c
> @@ -178,3 +178,15 @@
>  #pragma intrinsic(memset) // no-warning
>  #undef __INTRIN_H
>  #pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized
> builtin; consider including }}
> +
> +#pragma clang diagnostic push
> +#pragma clang diagnostic ignored "-Wignored-pragma-intrinsic"
> +#pragma intrinsic(asdf) // no-warning
> +#pragma clang diagnostic pop
> +#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized
> builtin; consider including }}
> +
> +#pragma clang diagnostic push
> +#pragma clang diagnostic ignored "-Wignored-pragmas"
> +#pragma intrinsic(asdf) // no-warning
> +#pragma clang diagnostic pop
> +#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized
> builtin; consider including }}
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24775: Add -Wignored-pragma-intrinsic flag

2016-09-20 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm!


https://reviews.llvm.org/D24775



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282004 - Fix a regex error breaking tests.

2016-09-20 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Tue Sep 20 14:10:56 2016
New Revision: 282004

URL: http://llvm.org/viewvc/llvm-project?rev=282004=rev
Log:
Fix a regex error breaking tests.

Modified:
cfe/trunk/test/Driver/warning-options.cpp

Modified: cfe/trunk/test/Driver/warning-options.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/warning-options.cpp?rev=282004=282003=282004=diff
==
--- cfe/trunk/test/Driver/warning-options.cpp (original)
+++ cfe/trunk/test/Driver/warning-options.cpp Tue Sep 20 14:10:56 2016
@@ -5,4 +5,4 @@
 
 // Check that -isysroot warns on nonexistent paths.
 // RUN: %clang -### -c -target i386-apple-darwin10 -isysroot 
%T/warning-options %s 2>&1 | FileCheck --check-prefix=CHECK-ISYSROOT %s
-// CHECK-ISYSROOT: warning: no such sysroot directory: 
'{{([A-Za-z]:.*)?}}/warning-options'
+// CHECK-ISYSROOT: warning: no such sysroot directory: '{{.*}}/warning-options'


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r282003 - [CMake] Support overriding CLANG_VERSION_*

2016-09-20 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Sep 20 14:09:21 2016
New Revision: 282003

URL: http://llvm.org/viewvc/llvm-project?rev=282003=rev
Log:
[CMake] Support overriding CLANG_VERSION_*

As with how we handle LLVM_VERSION_* variables we should support
overriding clang version variables.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=282003=282002=282003=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Tue Sep 20 14:09:21 2016
@@ -261,10 +261,16 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_
   endif()
 endif()
 
-# Compute the Clang version from the LLVM version.
-set(CLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
-set(CLANG_VERSION_MINOR ${LLVM_VERSION_MINOR})
-set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
+# If CLANG_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
+if(NOT DEFINED CLANG_VERSION_MAJOR)
+  set(CLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+endif()
+if(NOT DEFINED CLANG_VERSION_MINOR)
+  set(CLANG_VERSION_MINOR ${LLVM_VERSION_MINOR})
+endif()
+if(NOT DEFINED CLANG_VERSION_PATCHLEVEL)
+  set(CLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH})
+endif()
 # Unlike PACKAGE_VERSION, CLANG_VERSION does not include LLVM_VERSION_SUFFIX.
 set(CLANG_VERSION 
"${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}.${CLANG_VERSION_PATCHLEVEL}")
 message(STATUS "Clang version: ${CLANG_VERSION}")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281997 - CodeGen: further merge cstring literal construction

2016-09-20 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Tue Sep 20 13:38:54 2016
New Revision: 281997

URL: http://llvm.org/viewvc/llvm-project?rev=281997=rev
Log:
CodeGen: further merge cstring literal construction

Use the new CreateCStringLiteral in an additional site.  Now all the C string
literals are created in one function.  Furthermore, mark the additional literal
as an `unnamed_addr constant`.

Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=281997=281996=281997=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Sep 20 13:38:54 2016
@@ -1026,7 +1026,9 @@ public:
   bool AddToUsed);
 
   llvm::GlobalVariable *CreateCStringLiteral(StringRef Name,
- ObjCLabelType LabelType);
+ ObjCLabelType LabelType,
+ bool ForceNonFragileABI = false,
+ bool NullTerminate = true);
 
 protected:
   CodeGen::RValue EmitMessageSend(CodeGen::CodeGenFunction ,
@@ -2586,10 +2588,9 @@ llvm::Constant *CGObjCCommonMac::getBitm
 }
   }
 
-  llvm::GlobalVariable *Entry = CreateMetadataVar(
-  "OBJC_CLASS_NAME_",
-  llvm::ConstantDataArray::getString(VMContext, BitMap, false),
-  "__TEXT,__objc_classname,cstring_literals", CharUnits::One(), true);
+  auto *Entry = CreateCStringLiteral(BitMap, ObjCLabelType::ClassName,
+ /*ForceNonFragileABI=*/true,
+ /*NullTerminate=*/false);
   return getConstantGEP(VMContext, Entry, 0, 0);
 }
 
@@ -3661,7 +3662,9 @@ llvm::GlobalVariable *CGObjCCommonMac::C
 }
 
 llvm::GlobalVariable *
-CGObjCCommonMac::CreateCStringLiteral(StringRef Name, ObjCLabelType Type) {
+CGObjCCommonMac::CreateCStringLiteral(StringRef Name, ObjCLabelType Type,
+  bool ForceNonFragileABI,
+  bool NullTerminate) {
   StringRef Label;
   switch (Type) {
   case ObjCLabelType::ClassName: Label = "OBJC_CLASS_NAME_"; break;
@@ -3670,26 +3673,29 @@ CGObjCCommonMac::CreateCStringLiteral(St
   case ObjCLabelType::PropertyName:  Label = "OBJC_PROP_NAME_ATTR_"; break;
   }
 
+  bool NonFragile = ForceNonFragileABI || isNonFragileABI();
+
   StringRef Section;
   switch (Type) {
   case ObjCLabelType::ClassName:
-Section = isNonFragileABI() ? "__TEXT,__objc_classname,cstring_literals"
-: "__TEXT,__cstring,cstring_literals";
+Section = NonFragile ? "__TEXT,__objc_classname,cstring_literals"
+ : "__TEXT,__cstring,cstring_literals";
 break;
   case ObjCLabelType::MethodVarName:
-Section = isNonFragileABI() ? "__TEXT,__objc_methname,cstring_literals"
-: "__TEXT,__cstring,cstring_literals";
+Section = NonFragile ? "__TEXT,__objc_methname,cstring_literals"
+ : "__TEXT,__cstring,cstring_literals";
 break;
   case ObjCLabelType::MethodVarType:
-Section = isNonFragileABI() ? "__TEXT,__objc_methtype,cstring_literals"
-: "__TEXT,__cstring,cstring_literals";
+Section = NonFragile ? "__TEXT,__objc_methtype,cstring_literals"
+ : "__TEXT,__cstring,cstring_literals";
 break;
   case ObjCLabelType::PropertyName:
 Section = "__TEXT,__cstring,cstring_literals";
 break;
   }
 
-  llvm::Constant *Value = llvm::ConstantDataArray::getString(VMContext, Name);
+  llvm::Constant *Value =
+  llvm::ConstantDataArray::getString(VMContext, Name, NullTerminate);
   llvm::GlobalVariable *GV =
   new llvm::GlobalVariable(CGM.getModule(), Value->getType(),
/*isConstant=*/true,

Modified: cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm?rev=281997=281996=281997=diff
==
--- cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/arc-blocks.mm Tue Sep 20 13:38:54 2016
@@ -2,7 +2,7 @@
 
 // CHECK: [[A:.*]] = type { i64, [10 x i8*] }
 
-// CHECK: [[LAYOUT0:@.*]] = private global [3 x i8] c" 9\00"
+// CHECK: [[LAYOUT0:@.*]] = private unnamed_addr constant [3 x i8] c" 9\00"
 
 // rdar://13045269
 // If a __block variable requires extended layout information *and*


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-09-20 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

LGTM. Thanks.


https://reviews.llvm.org/D22494



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281998 - Add some entropy to the folder name in Driver/warning-options.cpp.

2016-09-20 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Tue Sep 20 13:41:19 2016
New Revision: 281998

URL: http://llvm.org/viewvc/llvm-project?rev=281998=rev
Log:
Add some entropy to the folder name in Driver/warning-options.cpp.

It was trying to check that things behave correctly when a
non-existant folder was specified for -isysroot.  Incidentally,
I have a folder named FOO in the root of my drive, so this test
was failing.  Make this impossible by using %T to refer to a
definitely non-existant folder.:

Modified:
cfe/trunk/test/Driver/warning-options.cpp

Modified: cfe/trunk/test/Driver/warning-options.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/warning-options.cpp?rev=281998=281997=281998=diff
==
--- cfe/trunk/test/Driver/warning-options.cpp (original)
+++ cfe/trunk/test/Driver/warning-options.cpp Tue Sep 20 13:41:19 2016
@@ -4,5 +4,5 @@
 // LARGE_VALUE_COPY_JOINED: -Wlarge-by-value-copy=128
 
 // Check that -isysroot warns on nonexistent paths.
-// RUN: %clang -### -c -target i386-apple-darwin10 -isysroot /FOO %s 2>&1 | 
FileCheck --check-prefix=CHECK-ISYSROOT %s
-// CHECK-ISYSROOT: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO'
+// RUN: %clang -### -c -target i386-apple-darwin10 -isysroot 
%T/warning-options %s 2>&1 | FileCheck --check-prefix=CHECK-ISYSROOT %s
+// CHECK-ISYSROOT: warning: no such sysroot directory: 
'{{([A-Za-z]:.*)?}}/warning-options'


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281996 - Fix typo in documentation.

2016-09-20 Thread Nick Lewycky via cfe-commits
Author: nicholas
Date: Tue Sep 20 13:37:25 2016
New Revision: 281996

URL: http://llvm.org/viewvc/llvm-project?rev=281996=rev
Log:
Fix typo in documentation.

Since this is a header it will break links to this section.

Modified:
cfe/trunk/docs/UndefinedBehaviorSanitizer.rst

Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=281996=281995=281996=diff
==
--- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
+++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Tue Sep 20 13:37:25 2016
@@ -66,8 +66,8 @@ pointer.
 
 .. _ubsan-checks:
 
-Availablle checks
-=
+Available checks
+
 
 Available checks are:
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


OpenBSD/arm types

2016-09-20 Thread Mark Kettenis via cfe-commits
As discussed in cfe-dev@:

Like NetBSD, OpenBSD prefers having a consistent set of typedefs
across the architectures it supports over strictly following the ARM
ABIs.  The diff below makes sure that clang's view of those types
matches OpenBSD's system header files.  It also adds a test that
checks the relevant types on all OpenBSD platforms that clang works
on.  Hopefully we can add mips64 and powerpc to that list in the
future.


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp   (revision 281825)
+++ lib/Basic/Targets.cpp   (working copy)
@@ -4679,8 +4679,10 @@
 DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64;
 const llvm::Triple  = getTriple();
 
-// size_t is unsigned long on MachO-derived environments, NetBSD and 
Bitrig.
+// size_t is unsigned long on MachO-derived environments, NetBSD,
+// OpenBSD and Bitrig.
 if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD ||
+T.getOS() == llvm::Triple::OpenBSD ||
 T.getOS() == llvm::Triple::Bitrig)
   SizeType = UnsignedLong;
 else
@@ -4688,6 +4690,7 @@
 
 switch (T.getOS()) {
 case llvm::Triple::NetBSD:
+case llvm::Triple::OpenBSD:
   WCharType = SignedInt;
   break;
 case llvm::Triple::Win32:
@@ -4885,6 +4888,7 @@
 
 switch (getTriple().getOS()) {
 case llvm::Triple::NetBSD:
+case llvm::Triple::OpenBSD:
   PtrDiffType = SignedLong;
   break;
 default:
Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c(revision 281825)
+++ test/Preprocessor/init.c(working copy)
@@ -8463,6 +8463,29 @@
 // RUN: %clang_cc1 -triple lanai-unknown-unknown -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix LANAI %s
 // LANAI: #define __lanai__ 1
 //
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=amd64-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
+// RUN: %clang_cc1 -E -dM -ffreestanding 
-triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck 
-match-full-lines -check-prefix OPENBSD %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
+// OPENBSD:#define __ELF__ 1
+// OPENBSD:#define __INT16_TYPE__ short
+// OPENBSD:#define __INT32_TYPE__ int
+// OPENBSD:#define __INT64_TYPE__ long long int
+// OPENBSD:#define __INT8_TYPE__ signed char
+// OPENBSD:#define __INTMAX_TYPE__ long long int
+// OPENBSD:#define __INTPTR_TYPE__ long int
+// OPENBSD:#define __OpenBSD__ 1
+// OPENBSD:#define __PTRDIFF_TYPE__ long int
+// OPENBSD:#define __SIZE_TYPE__ long unsigned int
+// OPENBSD:#define __UINT16_TYPE__ unsigned short
+// OPENBSD:#define __UINT32_TYPE__ unsigned int
+// OPENBSD:#define __UINT64_TYPE__ long long unsigned int
+// OPENBSD:#define __UINT8_TYPE__ unsigned char
+// OPENBSD:#define __UINTMAX_TYPE__ long long unsigned int
+// OPENBSD:#define __UINTPTR_TYPE__ long unsigned int
+// OPENBSD:#define __WCHAR_TYPE__ int
+// OPENBSD:#define __WINT_TYPE__ int
+//
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-freebsd < 
/dev/null | FileCheck -match-full-lines -check-prefix PPC64-FREEBSD %s
 // PPC64-FREEBSD-NOT: #define __LONG_DOUBLE_128__ 1
 //
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24751: [cleanup] Remove excessive padding from TextTokenRetokenizer::Position

2016-09-20 Thread Alexander Shaposhnikov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL281995: [cleanup] Remove excessive padding from 
TextTokenRetokenizer::Position (authored by alexshap).

Changed prior to commit:
  https://reviews.llvm.org/D24751?vs=71897=71963#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24751

Files:
  cfe/trunk/lib/AST/CommentParser.cpp

Index: cfe/trunk/lib/AST/CommentParser.cpp
===
--- cfe/trunk/lib/AST/CommentParser.cpp
+++ cfe/trunk/lib/AST/CommentParser.cpp
@@ -40,11 +40,11 @@
 
   /// A position in \c Toks.
   struct Position {
-unsigned CurToken;
 const char *BufferStart;
 const char *BufferEnd;
 const char *BufferPtr;
 SourceLocation BufferStartLoc;
+unsigned CurToken;
   };
 
   /// Current position in Toks.


Index: cfe/trunk/lib/AST/CommentParser.cpp
===
--- cfe/trunk/lib/AST/CommentParser.cpp
+++ cfe/trunk/lib/AST/CommentParser.cpp
@@ -40,11 +40,11 @@
 
   /// A position in \c Toks.
   struct Position {
-unsigned CurToken;
 const char *BufferStart;
 const char *BufferEnd;
 const char *BufferPtr;
 SourceLocation BufferStartLoc;
+unsigned CurToken;
   };
 
   /// Current position in Toks.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281995 - [cleanup] Remove excessive padding from TextTokenRetokenizer::Position

2016-09-20 Thread Alexander Shaposhnikov via cfe-commits
Author: alexshap
Date: Tue Sep 20 13:32:48 2016
New Revision: 281995

URL: http://llvm.org/viewvc/llvm-project?rev=281995=rev
Log:
[cleanup] Remove excessive padding from TextTokenRetokenizer::Position

Reorder the fields of the struct TextTokenRetokenizer::Position to remove 
excessive padding.
Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D24751

Modified:
cfe/trunk/lib/AST/CommentParser.cpp

Modified: cfe/trunk/lib/AST/CommentParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentParser.cpp?rev=281995=281994=281995=diff
==
--- cfe/trunk/lib/AST/CommentParser.cpp (original)
+++ cfe/trunk/lib/AST/CommentParser.cpp Tue Sep 20 13:32:48 2016
@@ -40,11 +40,11 @@ class TextTokenRetokenizer {
 
   /// A position in \c Toks.
   struct Position {
-unsigned CurToken;
 const char *BufferStart;
 const char *BufferEnd;
 const char *BufferPtr;
 SourceLocation BufferStartLoc;
+unsigned CurToken;
   };
 
   /// Current position in Toks.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24775: Add -Wignored-pragma-intrinsic flag

2016-09-20 Thread Albert Gutowski via cfe-commits
agutowski created this revision.
agutowski added reviewers: thakis, hans.
agutowski added a subscriber: cfe-commits.

https://bugs.chromium.org/p/chromium/issues/detail?id=644841#c9

https://reviews.llvm.org/D24775

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticParseKinds.td
  test/Preprocessor/pragma_microsoft.c

Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -914,7 +914,7 @@
 // - #pragma intrinsic
 def warn_pragma_intrinsic_builtin : Warning<
   "%0 is not a recognized builtin%select{|; consider including  to 
access non-builtin intrinsics}1">,
-  InGroup;
+  InGroup;
 // - #pragma unused
 def warn_pragma_unused_expected_var : Warning<
   "expected '#pragma unused' argument to be a variable name">,
Index: include/clang/Basic/DiagnosticGroups.td
===
--- include/clang/Basic/DiagnosticGroups.td
+++ include/clang/Basic/DiagnosticGroups.td
@@ -439,8 +439,9 @@
 def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
 def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
  UninitializedStaticSelfInit]>;
+def IgnoredPragmaIntrinsic : DiagGroup<"ignored-pragma-intrinsic">;
 def UnknownPragmas : DiagGroup<"unknown-pragmas">;
-def IgnoredPragmas : DiagGroup<"ignored-pragmas">;
+def IgnoredPragmas : DiagGroup<"ignored-pragmas", [IgnoredPragmaIntrinsic]>;
 def Pragmas : DiagGroup<"pragmas", [UnknownPragmas, IgnoredPragmas]>;
 def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
 def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
Index: test/Preprocessor/pragma_microsoft.c
===
--- test/Preprocessor/pragma_microsoft.c
+++ test/Preprocessor/pragma_microsoft.c
@@ -178,3 +178,15 @@
 #pragma intrinsic(memset) // no-warning
 #undef __INTRIN_H
 #pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized 
builtin; consider including }}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-pragma-intrinsic"
+#pragma intrinsic(asdf) // no-warning
+#pragma clang diagnostic pop
+#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized 
builtin; consider including }}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-pragmas"
+#pragma intrinsic(asdf) // no-warning
+#pragma clang diagnostic pop
+#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized 
builtin; consider including }}


Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -914,7 +914,7 @@
 // - #pragma intrinsic
 def warn_pragma_intrinsic_builtin : Warning<
   "%0 is not a recognized builtin%select{|; consider including  to access non-builtin intrinsics}1">,
-  InGroup;
+  InGroup;
 // - #pragma unused
 def warn_pragma_unused_expected_var : Warning<
   "expected '#pragma unused' argument to be a variable name">,
Index: include/clang/Basic/DiagnosticGroups.td
===
--- include/clang/Basic/DiagnosticGroups.td
+++ include/clang/Basic/DiagnosticGroups.td
@@ -439,8 +439,9 @@
 def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
 def Uninitialized  : DiagGroup<"uninitialized", [UninitializedSometimes,
  UninitializedStaticSelfInit]>;
+def IgnoredPragmaIntrinsic : DiagGroup<"ignored-pragma-intrinsic">;
 def UnknownPragmas : DiagGroup<"unknown-pragmas">;
-def IgnoredPragmas : DiagGroup<"ignored-pragmas">;
+def IgnoredPragmas : DiagGroup<"ignored-pragmas", [IgnoredPragmaIntrinsic]>;
 def Pragmas : DiagGroup<"pragmas", [UnknownPragmas, IgnoredPragmas]>;
 def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
 def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
Index: test/Preprocessor/pragma_microsoft.c
===
--- test/Preprocessor/pragma_microsoft.c
+++ test/Preprocessor/pragma_microsoft.c
@@ -178,3 +178,15 @@
 #pragma intrinsic(memset) // no-warning
 #undef __INTRIN_H
 #pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized builtin; consider including }}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-pragma-intrinsic"
+#pragma intrinsic(asdf) // no-warning
+#pragma clang diagnostic pop
+#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized builtin; consider including }}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-pragmas"
+#pragma intrinsic(asdf) // no-warning
+#pragma clang diagnostic pop
+#pragma 

Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Abe Skolnik via cfe-commits
Abe updated this revision to Diff 71959.
Abe added a comment.

Collapsed 4 test-case files that didn`t really need to be separate into 1 file, 
as suggested by Yaxun Liu.


https://reviews.llvm.org/D24481

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-scalar-fma.c
  clang/test/CodeGen/fp-contract-pragma.cpp
  
clang/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
  
clang/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c
  clang/test/Driver/clang_f_opts.c

Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -34,10 +34,13 @@
 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
 
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffast-math%s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
+// RUN: %clang -### -S -ffp-contract=off  %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK  %s
+// RUN: %clang -### -S -ffp-contract=on   %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK   %s
+
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
-// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-OFF-CHECK:  -ffp-contract=off
+// FP-CONTRACT-ON-CHECK:   -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: clang/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c
===
--- /dev/null
+++ clang/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+// CHECK-NEXT: ret
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+// CHECK-NEXT: ret
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: clang/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
===
--- /dev/null
+++ clang/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple aarch64 -O0 -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: clang/test/CodeGen/fp-contract-pragma.cpp
===
--- clang/test/CodeGen/fp-contract-pragma.cpp
+++ clang/test/CodeGen/fp-contract-pragma.cpp
@@ -1,27 +1,25 @@
 // RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
 
-// Is FP_CONTRACT honored in a simple case?
-float fp_contract_1(float a, float b, float c) {
-// CHECK: _Z13fp_contract_1fff
+// Is FP_CONTRACT on by default, at least at -O3?
+float fp_contract_8(float a, float b, float c) {
+// CHECK: _Z13fp_contract_8fff
 // CHECK: tail call float @llvm.fmuladd
-  #pragma STDC FP_CONTRACT ON
   return a * b + c;
 }
 
 // Is FP_CONTRACT state cleared on exiting compound statements?
 float fp_contract_2(float a, float b, float c) {
 // CHECK: _Z13fp_contract_2fff
 // CHECK: %[[M:.+]] = fmul float %a, %b
 // CHECK-NEXT: fadd float %[[M]], %c
+  #pragma STDC FP_CONTRACT OFF
   {
 #pragma STDC FP_CONTRACT ON
   }
   return a * b + c;  
 }
 
 // Does FP_CONTRACT survive template instantiation?
-class Foo {};
-Foo operator+(Foo, Foo);
 
 template 
 T template_muladd(T a, T b, T c) {
@@ -62,15 +60,23 @@
   return a * b + c;
 }
 
+// Does FP_CONTRACT inside a function override the same in the file scope?
+float fp_contract_1(float a, float b, float c) {
+// CHECK: _Z13fp_contract_1fff
+// CHECK: tail call float @llvm.fmuladd
+  #pragma STDC FP_CONTRACT ON
+  return a * b + c;
+}
+
+
 // If the multiply has multiple uses, don't produce fmuladd.
 // This used to assert (PR25719):
 // 

Re: [PATCH] D24507: Add attribute for return values that shouldn't be cast to bool

2016-09-20 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: test/Analysis/ReturnNonBoolTest.c:67
@@ +66,3 @@
+
+  if (rc < 0)
+// error handling

How about addressing this as follows: in checkBranchCondition, you check for 
any comparisons of the tracked value other than comparisons to bool. If you see 
such a comparison, you assume that the error handling has occurred and remove 
the symbol from the set of tracked symbols. This will ensure that any code 
after the cleansing condition (error handling) can cast the return value to 
bool. 

The warning will still get triggered if the error handling is **after** the 
comparison to bool. That could be avoided as well, but the solution would be 
more complicated. I am thinking something along the lines of tracking all 
comparisons until the symbol goes out of scope. For each symbol, you'd track 
it's state (for example, "performedErrorHandling  | 
comparedToBoolAndNoErrorHandling | notSeen"). You can draw the automaton to see 
what the transitions should be. When the symbol goes out of scope, you'd check 
if it's state is "comparedToBoolAndNoErrorHandling". Further, we'd need to walk 
up the path to find the location where we compared the symbol and use that for 
error reporting.


Repository:
  rL LLVM

https://reviews.llvm.org/D24507



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

2016-09-20 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Sorry, I do not understand the question. What are block numbers?


https://reviews.llvm.org/D24759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Abe Skolnik via cfe-commits
Abe added a comment.

In https://reviews.llvm.org/D24481#547694, @yaxunl wrote:

> Is it possible to merge 
> cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O[0-3]___aarch64-backend.c
>  as one and remove 
> cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h?
>  They look the same except the RUN commands. Why not using one file with 
> multiple RUn commands?


That seems like a good idea.  I didn`t write it that way yet b/c I was unsure 
of the semantics of multiple "RUN" command-comments in a single file.  If a 
single file has e.g.:

  // RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %s
  // RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %s
  // RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %s

... then that will cause 3 compilations and 3 tests, right?


https://reviews.llvm.org/D24481



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Abe Skolnik via cfe-commits
Abe updated this revision to Diff 71953.
Abe added a comment.

Removed some comments that I felt were good for clarity but at least 2 people 
disagreed.


https://reviews.llvm.org/D24481

Files:
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/aarch64-neon-fma.c
  cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
  cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1___aarch64-backend.c
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O2___aarch64-backend.c
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O3___aarch64-backend.c
  cfe/trunk/test/Driver/clang_f_opts.c

Index: cfe/trunk/test/Driver/clang_f_opts.c
===
--- cfe/trunk/test/Driver/clang_f_opts.c
+++ cfe/trunk/test/Driver/clang_f_opts.c
@@ -34,10 +34,13 @@
 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
 
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffast-math%s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
+// RUN: %clang -### -S -ffp-contract=off  %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK  %s
+// RUN: %clang -### -S -ffp-contract=on   %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK   %s
+
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
-// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-OFF-CHECK:  -ffp-contract=off
+// FP-CONTRACT-ON-CHECK:   -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O3___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O3___aarch64-backend.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %S/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
+// REQUIRES: aarch64-registered-target
+
+#include "fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h"
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O2___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O2___aarch64-backend.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %S/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
+// REQUIRES: aarch64-registered-target
+
+#include "fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h"
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1___aarch64-backend.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %S/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
+// REQUIRES: aarch64-registered-target
+
+#include "fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h"
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
@@ -0,0 +1,14 @@
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+// CHECK-NEXT: ret
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+// CHECK-NEXT: ret
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple aarch64 -O0 -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+float  

Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

> ... then that will cause 3 compilations and 3 tests, right?


Right.


https://reviews.llvm.org/D24481



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24770: [libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)

2016-09-20 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs accepted this revision.
jroelofs added a reviewer: jroelofs.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D24770



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

Is it possible to merge 
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O[0-3]___aarch64-backend.c
 as one and remove 
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h?
 They look the same except the RUN commands. Why not using one file with 
multiple RUn commands?


https://reviews.llvm.org/D24481



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Valentin Churavy via cfe-commits
vchuravy added a comment.

@jpienaar Since I don't have commit access, I think somebody else needs to 
commit this.


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Valentin Churavy via cfe-commits
vchuravy updated this revision to Diff 71951.
vchuravy added a comment.

Fix spelling in comment


https://reviews.llvm.org/D9168

Files:
  lib/Target/NVPTX/NVPTXISelLowering.cpp
  lib/Target/NVPTX/NVPTXISelLowering.h
  test/CodeGen/NVPTX/zero-cs.ll

Index: test/CodeGen/NVPTX/zero-cs.ll
===
--- /dev/null
+++ test/CodeGen/NVPTX/zero-cs.ll
@@ -0,0 +1,10 @@
+; RUN: not llc < %s -march=nvptx 2>&1 | FileCheck %s
+; used to seqfault and now fails with a "Cannot select"
+
+; CHECK: LLVM ERROR: Cannot select: t7: i32 = ExternalSymbol'__powidf2'
+define double @powi() {
+  %1 = call double @llvm.powi.f64(double 1.00e+00, i32 undef)
+  ret double %1
+}
+
+declare double @llvm.powi.f64(double, i32) nounwind readnone
Index: lib/Target/NVPTX/NVPTXISelLowering.h
===
--- lib/Target/NVPTX/NVPTXISelLowering.h
+++ lib/Target/NVPTX/NVPTXISelLowering.h
@@ -539,7 +539,8 @@
   SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo ) const override;
 
   unsigned getArgumentAlignment(SDValue Callee, const ImmutableCallSite *CS,
-Type *Ty, unsigned Idx) const;
+Type *Ty, unsigned Idx,
+const DataLayout ) const;
 };
 } // namespace llvm
 
Index: lib/Target/NVPTX/NVPTXISelLowering.cpp
===
--- lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -1024,11 +1024,15 @@
   return O.str();
 }
 
-unsigned
-NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
-  const ImmutableCallSite *CS,
-  Type *Ty,
-  unsigned Idx) const {
+unsigned NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
+   const ImmutableCallSite *CS,
+   Type *Ty, unsigned Idx,
+   const DataLayout ) const {
+  if (!CS) {
+// CallSite is zero, fallback to ABI type alignment
+return DL.getABITypeAlignment(Ty);
+  }
+
   unsigned Align = 0;
   const Value *DirectCallee = CS->getCalledFunction();
 
@@ -1046,7 +1050,7 @@
 
   const Value *CalleeV = cast(CalleeI)->getCalledValue();
   // Ignore any bitcast instructions
-  while(isa(CalleeV)) {
+  while (isa(CalleeV)) {
 const ConstantExpr *CE = cast(CalleeV);
 if (!CE->isCast())
   break;
@@ -1069,7 +1073,6 @@
 
   // Call is indirect or alignment information is not available, fall back to
   // the ABI type alignment
-  auto  = CS->getCaller()->getParent()->getDataLayout();
   return DL.getABITypeAlignment(Ty);
 }
 
@@ -1126,7 +1129,8 @@
 ComputePTXValueVTs(*this, DAG.getDataLayout(), Ty, vtparts, ,
0);
 
-unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1);
+unsigned align =
+getArgumentAlignment(Callee, CS, Ty, paramCount + 1, DL);
 // declare .param .align  .b8 .param[];
 unsigned sz = DL.getTypeAllocSize(Ty);
 SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue);
@@ -1166,7 +1170,8 @@
   }
   if (Ty->isVectorTy()) {
 EVT ObjectVT = getValueType(DL, Ty);
-unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1);
+unsigned align =
+getArgumentAlignment(Callee, CS, Ty, paramCount + 1, DL);
 // declare .param .align  .b8 .param[];
 unsigned sz = DL.getTypeAllocSize(Ty);
 SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue);
@@ -1426,7 +1431,7 @@
   DeclareRetOps);
   InFlag = Chain.getValue(1);
 } else {
-  retAlignment = getArgumentAlignment(Callee, CS, retTy, 0);
+  retAlignment = getArgumentAlignment(Callee, CS, retTy, 0, DL);
   SDVTList DeclareRetVTs = DAG.getVTList(MVT::Other, MVT::Glue);
   SDValue DeclareRetOps[] = { Chain,
   DAG.getConstant(retAlignment, dl, MVT::i32),
@@ -1633,9 +1638,10 @@
 } else {
   SmallVector VTs;
   SmallVector Offsets;
-  ComputePTXValueVTs(*this, DAG.getDataLayout(), retTy, VTs, , 0);
+  auto  = DAG.getDataLayout();
+  ComputePTXValueVTs(*this, DL, retTy, VTs, , 0);
   assert(VTs.size() == Ins.size() && "Bad value decomposition");
-  unsigned RetAlign = getArgumentAlignment(Callee, CS, retTy, 0);
+  unsigned RetAlign = getArgumentAlignment(Callee, CS, retTy, 0, DL);
   for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
 unsigned sz = VTs[i].getSizeInBits();
 unsigned AlignI = GreatestCommonDivisor64(RetAlign, Offsets[i]);
___
cfe-commits mailing 

r281988 - [docs] Extend the code coverage docs some more

2016-09-20 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Tue Sep 20 12:11:18 2016
New Revision: 281988

URL: http://llvm.org/viewvc/llvm-project?rev=281988=rev
Log:
[docs] Extend the code coverage docs some more

Flesh out the section on interpreting coverage reports, mention the
coverage export feature, and add notes on how to build llvm with
coverage turned on.

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=281988=281987=281988=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Tue Sep 20 12:11:18 2016
@@ -177,6 +177,13 @@ A few final notes:
 
   % llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata
 
+Exporting coverage data
+===
+
+Coverage data can be exported into JSON using the ``llvm-cov export``
+sub-command. There is a comprehensive reference which defines the structure of
+the exported data at a high level in the llvm-cov source code.
+
 Interpreting reports
 
 
@@ -187,15 +194,23 @@ There are four statistics tracked in a c
   instantiations are executed.
 
 * Instantiation coverage is the percentage of function instantiations which
-  have been executed at least once.
+  have been executed at least once. Template functions and static inline
+  functions from headers are two kinds of functions which may have multiple
+  instantiations.
 
 * Line coverage is the percentage of code lines which have been executed at
-  least once.
+  least once. Only executable lines within function bodies are considered to be
+  code lines, so e.g coverage for macro definitions in a header might not be
+  included.
 
 * Region coverage is the percentage of code regions which have been executed at
   least once. A code region may span multiple lines (e.g a large function with
   no control flow). However, it's also possible for a single line to contain
-  multiple code regions (e.g some short-circuited logic).
+  multiple code regions or even nested code regions (e.g "return x || y && z").
+
+Of these four statistics, function coverage is usually the least granular while
+region coverage is the most granular. The project-wide totals for each
+statistic are listed in the summary.
 
 Format compatibility guarantees
 ===
@@ -213,6 +228,11 @@ Format compatibility guarantees
   into instrumented binaries. Tools must retain **backwards** compatibility
   with these formats. These formats are not forwards-compatible.
 
+* The JSON coverage export format has a (major, minor, patch) version triple.
+  Only a major version increment indicates a backwards-incompatible change. A
+  minor version increment is for added functionality, and patch version
+  increments are for bugfixes.
+
 Using the profiling runtime without static initializers
 ===
 
@@ -238,6 +258,18 @@ without using static initializers, do th
   otherwise. Calling this function multiple times appends profile data to an
   existing on-disk raw profile.
 
+Collecting coverage reports for the llvm project
+
+
+To prepare a coverage report for llvm (and any of its sub-projects), add
+``-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On`` to the cmake configuration. Raw
+profiles will be written to ``$BUILD_DIR/profiles/``. To prepare an html
+report, run ``llvm/utils/prepare-code-coverage-artifact.py``.
+
+To specify an alternate directory for raw profiles, use
+``-DLLVM_PROFILE_DATA_DIR``. To change the size of the profile merge pool, use
+``-DLLVM_PROFILE_MERGE_POOL_SIZE``.
+
 Drawbacks and limitations
 =
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24770: [libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)

2016-09-20 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: mclow.lists, EricWF.
rmaprath added a subscriber: cfe-commits.
Herald added subscribers: mgorny, beanz.

Align the naming / use of the macro ``LIBCXXABI_HAS_NO_THREADS`` to follow what 
we have in `libcxx`.

This change is mostly NFC, thought of putting it up for review as it involves a 
change in naming, and sometimes that can cause disagreements.

Will commit if there isn't much interest.

https://reviews.llvm.org/D24770

Files:
  CMakeLists.txt
  src/config.h
  src/cxa_exception.cpp
  src/cxa_exception_storage.cpp
  src/cxa_guard.cpp
  src/fallback_malloc.ipp
  test/libcxxabi/test/config.py
  test/test_exception_storage.pass.cpp
  test/test_guard.pass.cpp

Index: test/test_guard.pass.cpp
===
--- test/test_guard.pass.cpp
+++ test/test_guard.pass.cpp
@@ -12,7 +12,7 @@
 
 #include 
 
-#if !LIBCXXABI_HAS_NO_THREADS
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 #include 
 #endif
 
@@ -80,7 +80,7 @@
 }
 }
 
-#if !LIBCXXABI_HAS_NO_THREADS
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 // A simple thread test of two threads racing to initialize a variable. This
 // isn't guaranteed to catch any particular threading problems.
 namespace test4 {
@@ -132,14 +132,14 @@
 assert(run_count == 1);
 }
 }
-#endif /* LIBCXXABI_HAS_NO_THREADS */
+#endif /* _LIBCXXABI_HAS_NO_THREADS */
 
 int main()
 {
 test1::test();
 test2::test();
 test3::test();
-#if !LIBCXXABI_HAS_NO_THREADS
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 test4::test();
 test5::test();
 #endif
Index: test/test_exception_storage.pass.cpp
===
--- test/test_exception_storage.pass.cpp
+++ test/test_exception_storage.pass.cpp
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#if !LIBCXXABI_HAS_NO_THREADS
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 #  include 
 #endif
 #include 
@@ -38,29 +38,16 @@
 return parm;
 }
 
-#if !LIBCXXABI_HAS_NO_THREADS
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 #define NUMTHREADS  10
 size_t  thread_globals [ NUMTHREADS ] = { 0 };
 pthread_t   threads[ NUMTHREADS ];
 #endif
 
-void print_sizes ( size_t *first, size_t *last ) {
-std::cout << "{ " << std::hex;
-for ( size_t *iter = first; iter != last; ++iter )
-std::cout << *iter << " ";
-std::cout << "}" << std::dec << std::endl;
-}
-
 int main ( int argc, char *argv [] ) {
 int retVal = 0;
 
-#if LIBCXXABI_HAS_NO_THREADS
-size_t thread_globals;
-// Check that __cxa_get_globals() is not NULL.
-if (thread_code(_globals) == 0) {
-retVal = 1;
-}
-#else
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 //  Make the threads, let them run, and wait for them to finish
 for ( int i = 0; i < NUMTHREADS; ++i )
 pthread_create( threads + i, NULL, thread_code, (void *) (thread_globals + i));
@@ -73,15 +60,18 @@
 retVal = 1;
 }
 
-//  print_sizes ( thread_globals, thread_globals + NUMTHREADS );
 std::sort ( thread_globals, thread_globals + NUMTHREADS );
 for ( int i = 1; i < NUMTHREADS; ++i )
 if ( thread_globals [ i - 1 ] == thread_globals [ i ] ) {
 std::cerr << "Duplicate thread globals (" << i-1 << " and " << i << ")" << std::endl;
 retVal = 2;
 }
-//  print_sizes ( thread_globals, thread_globals + NUMTHREADS );
-
-#endif
-return retVal;
+#else // _LIBCXXABI_HAS_NO_THREADS
+size_t thread_globals;
+// Check that __cxa_get_globals() is not NULL.
+if (thread_code(_globals) == 0) {
+retVal = 1;
 }
+#endif // !_LIBCXXABI_HAS_NO_THREADS
+return retVal;
+}
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -47,7 +47,7 @@
 else:
 self.cxx.compile_flags += ['-fno-exceptions', '-DLIBCXXABI_HAS_NO_EXCEPTIONS']
 if not self.get_lit_bool('enable_threads', True):
-self.cxx.compile_flags += ['-DLIBCXXABI_HAS_NO_THREADS=1']
+self.cxx.compile_flags += ['-D_LIBCXXABI_HAS_NO_THREADS']
 super(Configuration, self).configure_compile_flags()
 
 def configure_compile_flags_header_includes(self):
Index: src/fallback_malloc.ipp
===
--- src/fallback_malloc.ipp
+++ src/fallback_malloc.ipp
@@ -26,25 +26,25 @@
 namespace {
 
 // When POSIX threads are not available, make the mutex operations a nop
-#if LIBCXXABI_HAS_NO_THREADS
-static void * heap_mutex = 0;
-#else
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 static pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
+#else
+static void * heap_mutex = 0;
 #endif
 
 class mutexor {
 public:
-#if LIBCXXABI_HAS_NO_THREADS
-mutexor ( void * ) {}
-~mutexor () {}
-#else
+#ifndef _LIBCXXABI_HAS_NO_THREADS
 mutexor ( pthread_mutex_t *m ) : mtx_(m) { 

Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Simon Dardis via cfe-commits
sdardis closed this revision.
sdardis added a comment.

As stated I'll do a follow-up patch to fix the test. Committed as r281975.

Thanks,
Simon


https://reviews.llvm.org/D24674



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24767: clang-format: [JS] do not wrapp @returns tags.

2016-09-20 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D24767



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Jacques Pienaar via cfe-commits
jpienaar accepted this revision.
jpienaar added a reviewer: jpienaar.
jpienaar added a comment.
This revision is now accepted and ready to land.

Looks good to me, do you need help submitting?



Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:1032
@@ +1031,3 @@
+  if (!CS) {
+// callsize is zero, fallback to ABI type alignment
+return DL.getABITypeAlignment(Ty);

s/callsize/Call site/ ?


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D24674#547589, @vkalintiris wrote:

> @sdardis: can you update the review request before committing this because I 
> don't think that test/CodeGen/builtins-mips-msa.c has ever been properly 
> reviewed before.


Never mind, I didn't realize that you intend to write a follow-up patch.


https://reviews.llvm.org/D24674



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281979 - Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which handles more cases. Noticed by inspection.

2016-09-20 Thread Nick Lewycky via cfe-commits
Author: nicholas
Date: Tue Sep 20 10:49:58 2016
New Revision: 281979

URL: http://llvm.org/viewvc/llvm-project?rev=281979=rev
Log:
Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which 
handles more cases. Noticed by inspection.

Because of how the IR generation works, this isn't expected to cause an 
observable difference.

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=281979=281978=281979=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Sep 20 10:49:58 2016
@@ -29,6 +29,7 @@
 #include "clang/CodeGen/SwiftCallingConv.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/IR/CallSite.h"
@@ -2905,10 +2906,6 @@ static bool isProvablyNull(llvm::Value *
   return isa(addr);
 }
 
-static bool isProvablyNonNull(llvm::Value *addr) {
-  return isa(addr);
-}
-
 /// Emit the actual writing-back of a writeback.
 static void emitWriteback(CodeGenFunction ,
   const CallArgList::Writeback ) {
@@ -2921,7 +2918,7 @@ static void emitWriteback(CodeGenFunctio
 
   // If the argument wasn't provably non-null, we need to null check
   // before doing the store.
-  bool provablyNonNull = isProvablyNonNull(srcAddr.getPointer());
+  bool provablyNonNull = llvm::isKnownNonNull(srcAddr.getPointer());
   if (!provablyNonNull) {
 llvm::BasicBlock *writebackBB = CGF.createBasicBlock("icr.writeback");
 contBB = CGF.createBasicBlock("icr.done");
@@ -3061,7 +3058,7 @@ static void emitWritebackArg(CodeGenFunc
   // If the address is *not* known to be non-null, we need to switch.
   llvm::Value *finalArgument;
 
-  bool provablyNonNull = isProvablyNonNull(srcAddr.getPointer());
+  bool provablyNonNull = llvm::isKnownNonNull(srcAddr.getPointer());
   if (provablyNonNull) {
 finalArgument = temp.getPointer();
   } else {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris requested changes to this revision.
vkalintiris added a comment.
This revision now requires changes to proceed.

@sdardis: can you update the review request before committing this because I 
don't think that test/CodeGen/builtins-mips-msa.c has ever been properly 
reviewed before.


https://reviews.llvm.org/D24674



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Valentin Churavy via cfe-commits
vchuravy updated this revision to Diff 71946.
vchuravy added a comment.

addresses review comments.


https://reviews.llvm.org/D9168

Files:
  lib/Target/NVPTX/NVPTXISelLowering.cpp
  lib/Target/NVPTX/NVPTXISelLowering.h
  test/CodeGen/NVPTX/zero-cs.ll

Index: test/CodeGen/NVPTX/zero-cs.ll
===
--- /dev/null
+++ test/CodeGen/NVPTX/zero-cs.ll
@@ -0,0 +1,10 @@
+; RUN: not llc < %s -march=nvptx 2>&1 | FileCheck %s
+; used to seqfault and now fails with a "Cannot select"
+
+; CHECK: LLVM ERROR: Cannot select: t7: i32 = ExternalSymbol'__powidf2'
+define double @powi() {
+  %1 = call double @llvm.powi.f64(double 1.00e+00, i32 undef)
+  ret double %1
+}
+
+declare double @llvm.powi.f64(double, i32) nounwind readnone
Index: lib/Target/NVPTX/NVPTXISelLowering.h
===
--- lib/Target/NVPTX/NVPTXISelLowering.h
+++ lib/Target/NVPTX/NVPTXISelLowering.h
@@ -539,7 +539,8 @@
   SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo ) const override;
 
   unsigned getArgumentAlignment(SDValue Callee, const ImmutableCallSite *CS,
-Type *Ty, unsigned Idx) const;
+Type *Ty, unsigned Idx,
+const DataLayout ) const;
 };
 } // namespace llvm
 
Index: lib/Target/NVPTX/NVPTXISelLowering.cpp
===
--- lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -1024,11 +1024,15 @@
   return O.str();
 }
 
-unsigned
-NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
-  const ImmutableCallSite *CS,
-  Type *Ty,
-  unsigned Idx) const {
+unsigned NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
+   const ImmutableCallSite *CS,
+   Type *Ty, unsigned Idx,
+   const DataLayout ) const {
+  if (!CS) {
+// callsize is zero, fallback to ABI type alignment
+return DL.getABITypeAlignment(Ty);
+  }
+
   unsigned Align = 0;
   const Value *DirectCallee = CS->getCalledFunction();
 
@@ -1046,7 +1050,7 @@
 
   const Value *CalleeV = cast(CalleeI)->getCalledValue();
   // Ignore any bitcast instructions
-  while(isa(CalleeV)) {
+  while (isa(CalleeV)) {
 const ConstantExpr *CE = cast(CalleeV);
 if (!CE->isCast())
   break;
@@ -1069,7 +1073,6 @@
 
   // Call is indirect or alignment information is not available, fall back to
   // the ABI type alignment
-  auto  = CS->getCaller()->getParent()->getDataLayout();
   return DL.getABITypeAlignment(Ty);
 }
 
@@ -1126,7 +1129,8 @@
 ComputePTXValueVTs(*this, DAG.getDataLayout(), Ty, vtparts, ,
0);
 
-unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1);
+unsigned align =
+getArgumentAlignment(Callee, CS, Ty, paramCount + 1, DL);
 // declare .param .align  .b8 .param[];
 unsigned sz = DL.getTypeAllocSize(Ty);
 SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue);
@@ -1166,7 +1170,8 @@
   }
   if (Ty->isVectorTy()) {
 EVT ObjectVT = getValueType(DL, Ty);
-unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1);
+unsigned align =
+getArgumentAlignment(Callee, CS, Ty, paramCount + 1, DL);
 // declare .param .align  .b8 .param[];
 unsigned sz = DL.getTypeAllocSize(Ty);
 SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue);
@@ -1426,7 +1431,7 @@
   DeclareRetOps);
   InFlag = Chain.getValue(1);
 } else {
-  retAlignment = getArgumentAlignment(Callee, CS, retTy, 0);
+  retAlignment = getArgumentAlignment(Callee, CS, retTy, 0, DL);
   SDVTList DeclareRetVTs = DAG.getVTList(MVT::Other, MVT::Glue);
   SDValue DeclareRetOps[] = { Chain,
   DAG.getConstant(retAlignment, dl, MVT::i32),
@@ -1633,9 +1638,10 @@
 } else {
   SmallVector VTs;
   SmallVector Offsets;
-  ComputePTXValueVTs(*this, DAG.getDataLayout(), retTy, VTs, , 0);
+  auto  = DAG.getDataLayout();
+  ComputePTXValueVTs(*this, DL, retTy, VTs, , 0);
   assert(VTs.size() == Ins.size() && "Bad value decomposition");
-  unsigned RetAlign = getArgumentAlignment(Callee, CS, retTy, 0);
+  unsigned RetAlign = getArgumentAlignment(Callee, CS, retTy, 0, DL);
   for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
 unsigned sz = VTs[i].getSizeInBits();
 unsigned AlignI = GreatestCommonDivisor64(RetAlign, Offsets[i]);
___
cfe-commits mailing 

Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Valentin Churavy via cfe-commits
vchuravy added a comment.

>   You don't own revision D9168: "[NVPTX] Check if callsite is defined when

>   computing argument allignment". Normally, you should only update

>   revisions you own. You can "Commandeer" this revision from the web

>   interface if you want to become the owner.


I was not able to figure out how to comandeer a revision, so i just went ahead 
and pushed it.


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24448: [atomics] New warning -Watomic-libcall when atomic operation expands to a library call

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a subscriber: vkalintiris.
vkalintiris added a comment.

I removed myself from the reviewers because I'm not quite familiar with this 
area. @joerg I added you as reviewer because you've already commented, feel 
free to undo my change if you don't have time to review this.


https://reviews.llvm.org/D24448



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Jacques Pienaar via cfe-commits
jpienaar added a comment.

Cool. I didn't know the review system allows having the patch updated like this 
:) It still reports me as the author and you as a subscriber. I don't think 
that matters.



Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:1033
@@ +1032,3 @@
+  const DataLayout ) const {
+  if (CS) {
+unsigned Align = 0;

There is a preference to early exits. So perhaps:
  if (!CS)
return DL.getABITTypeAlignment(Ty);


Comment at: lib/Target/NVPTX/NVPTXISelLowering.cpp:1131
@@ -1128,3 +1130,3 @@
 
-unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1);
+unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1, 
DL);
 // declare .param .align  .b8 .param[];

Move this to a new line to avoid exceeding 80 chars.

There are a couple of other formatting changes needed to. The simplest way is 
to use clang-format. To have the changes you added reformatted you could use 
clang-format-diff.py:
svn diff --diff-cmd=diff -x-U0 | 
./tools/clang/tools/clang-format/clang-format-diff.py 


Comment at: test/CodeGen/NVPTX/zero-cs.ll:1
@@ +1,2 @@
+; RUN: not llc < %s -march=nvptx 2>&1 | FileCheck %s
+

Could you add a comment explaining what this test is testing?

So this test case would fail previously (dereference null pointer) and now pass 
(return error)?


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23712: [OpenCL] Override supported OpenCL extensions with -cl-ext option

2016-09-20 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

I think we need two more tests for concatenating and overriding the option, e.g

  -cl-ext=-cl_khr_fp64 -cl-ext=+cl_khr_fp64

and

  -cl-ext=-cl_khr_fp64,+cl_khr_fp64



Comment at: include/clang/Basic/OpenCLOptions.h:35
@@ +34,3 @@
+  void setAll(bool Enable = true) {
+#define OPENCLEXT(nm)   nm = Enable ? 1 : 0;
+#include "clang/Basic/OpenCLExtensions.def"

  nm = Enable;


Comment at: include/clang/Basic/OpenCLOptions.h:39
@@ +38,3 @@
+
+  void set(llvm::StringRef Ext, bool Enable = true) {
+assert(!Ext.empty() && "Extension is empty.");

It seems Enable should be a local variable.


Comment at: include/clang/Basic/OpenCLOptions.h:59
@@ +58,3 @@
+if (Ext.equals(#nm)) {  \
+  nm = Enable ? 1 : 0;  \
+}

  nm = Enable;


Comment at: include/clang/Driver/Options.td:395
@@ -394,1 +394,3 @@
+def cl_ext_EQ : CommaJoined<["-"], "cl-ext=">, Group, 
Flags<[CC1Option]>,
+  HelpText<"OpenCL only. Enable or disable specific OpenCL extensions.">;
 def client__name : JoinedOrSeparate<["-"], "client_name">;

maybe something like 

  ... Enable or disable specific OpenCL extensions separated by comma. Use 
'all' for all extensions.


https://reviews.llvm.org/D23712



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Valentin Churavy via cfe-commits
vchuravy updated this revision to Diff 71936.
vchuravy added a comment.

Rebases the original changes and adds a test-case


https://reviews.llvm.org/D9168

Files:
  lib/Target/NVPTX/NVPTXISelLowering.cpp
  lib/Target/NVPTX/NVPTXISelLowering.h
  test/CodeGen/NVPTX/zero-cs.ll

Index: test/CodeGen/NVPTX/zero-cs.ll
===
--- /dev/null
+++ test/CodeGen/NVPTX/zero-cs.ll
@@ -0,0 +1,9 @@
+; RUN: not llc < %s -march=nvptx 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: Cannot select: t7: i32 = ExternalSymbol'__powidf2'
+define double @powi() {
+  %1 = call double @llvm.powi.f64(double 1.00e+00, i32 undef)
+  ret double %1
+}
+
+declare double @llvm.powi.f64(double, i32) nounwind readnone
Index: lib/Target/NVPTX/NVPTXISelLowering.h
===
--- lib/Target/NVPTX/NVPTXISelLowering.h
+++ lib/Target/NVPTX/NVPTXISelLowering.h
@@ -539,7 +539,7 @@
   SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo ) const override;
 
   unsigned getArgumentAlignment(SDValue Callee, const ImmutableCallSite *CS,
-Type *Ty, unsigned Idx) const;
+Type *Ty, unsigned Idx, const DataLayout ) const;
 };
 } // namespace llvm
 
Index: lib/Target/NVPTX/NVPTXISelLowering.cpp
===
--- lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -1028,48 +1028,50 @@
 NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
   const ImmutableCallSite *CS,
   Type *Ty,
-  unsigned Idx) const {
-  unsigned Align = 0;
-  const Value *DirectCallee = CS->getCalledFunction();
-
-  if (!DirectCallee) {
-// We don't have a direct function symbol, but that may be because of
-// constant cast instructions in the call.
-const Instruction *CalleeI = CS->getInstruction();
-assert(CalleeI && "Call target is not a function or derived value?");
-
-// With bitcast'd call targets, the instruction will be the call
-if (isa(CalleeI)) {
-  // Check if we have call alignment metadata
-  if (llvm::getAlign(*cast(CalleeI), Idx, Align))
-return Align;
+  unsigned Idx,
+  const DataLayout ) const {
+  if (CS) {
+unsigned Align = 0;
+const Value *DirectCallee = CS->getCalledFunction();
+
+if (!DirectCallee) {
+  // We don't have a direct function symbol, but that may be because of
+  // constant cast instructions in the call.
+  const Instruction *CalleeI = CS->getInstruction();
+  assert(CalleeI && "Call target is not a function or derived value?");
+
+  // With bitcast'd call targets, the instruction will be the call
+  if (isa(CalleeI)) {
+// Check if we have call alignment metadata
+if (llvm::getAlign(*cast(CalleeI), Idx, Align))
+  return Align;
+
+const Value *CalleeV = cast(CalleeI)->getCalledValue();
+// Ignore any bitcast instructions
+while(isa(CalleeV)) {
+  const ConstantExpr *CE = cast(CalleeV);
+  if (!CE->isCast())
+break;
+  // Look through the bitcast
+  CalleeV = cast(CalleeV)->getOperand(0);
+}
 
-  const Value *CalleeV = cast(CalleeI)->getCalledValue();
-  // Ignore any bitcast instructions
-  while(isa(CalleeV)) {
-const ConstantExpr *CE = cast(CalleeV);
-if (!CE->isCast())
-  break;
-// Look through the bitcast
-CalleeV = cast(CalleeV)->getOperand(0);
+// We have now looked past all of the bitcasts.  Do we finally have a
+// Function?
+if (isa(CalleeV))
+  DirectCallee = CalleeV;
   }
-
-  // We have now looked past all of the bitcasts.  Do we finally have a
-  // Function?
-  if (isa(CalleeV))
-DirectCallee = CalleeV;
 }
-  }
 
-  // Check for function alignment information if we found that the
-  // ultimate target is a Function
-  if (DirectCallee)
-if (llvm::getAlign(*cast(DirectCallee), Idx, Align))
-  return Align;
+// Check for function alignment information if we found that the
+// ultimate target is a Function
+if (DirectCallee)
+  if (llvm::getAlign(*cast(DirectCallee), Idx, Align))
+return Align;
+  }
 
   // Call is indirect or alignment information is not available, fall back to
   // the ABI type alignment
-  auto  = CS->getCaller()->getParent()->getDataLayout();
   return DL.getABITypeAlignment(Ty);
 }
 
@@ -1126,7 +1128,7 @@
 ComputePTXValueVTs(*this, DAG.getDataLayout(), Ty, vtparts, ,
0);
 
-unsigned align = getArgumentAlignment(Callee, CS, Ty, paramCount + 1);
+unsigned align = 

Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Matthew Fortune via cfe-commits
mpf added inline comments.


Comment at: test/CodeGen/builtins-mips-msa.c:8
@@ -13,4 +7,3 @@
+
 typedef __fp16 v8f16 __attribute__ ((vector_size(16)));
 

vkalintiris wrote:
> @mpf
> 
> Would it be problematic to expose this typedef from msa.h?
Yes it would unfortunately.

We don't have an __fp16 type in the MIPS ABIs so it doesn't really exist. The 
MSA builtins are in fact not defined in terms of half-float they are just 
represented as integers via v8i16. This is because there is very little you can 
do with the half-float type in general apart from the conversions.

I also notice in the test case that v8f16 is used in numerous places where it 
should be v4f32 and v4f32 where it should be v2f64 (I think). I'll highlight an 
example below.


Comment at: test/CodeGen/builtins-mips-msa.c:361
@@ -367,3 +360,3 @@
 
-  v8f16_r = __builtin_msa_fexdo_h(v4f32_a, v4f32_b); // CHECK: call <8 x half> 
@llvm.mips.fexdo.h(
-  v4f32_r = __builtin_msa_fexdo_w(v2f64_a, v2f64_b); // CHECK: call <4 x 
float> @llvm.mips.fexdo.w(
+  v8f16_r = __msa_fexdo_h(v4f32_a, v4f32_b); // CHECK: call <8 x half> 
@llvm.mips.fexdo.h(
+  v4f32_r = __msa_fexdo_w(v2f64_a, v2f64_b); // CHECK: call <4 x float> 
@llvm.mips.fexdo.w(

This is a correct use of v8f16.


Comment at: test/CodeGen/builtins-mips-msa.c:390
@@ -396,3 +389,3 @@
 
-  v4f32_r = __builtin_msa_flog2_w(v8f16_a); // CHECK: call <4 x float>  
@llvm.mips.flog2.w(
-  v2f64_r = __builtin_msa_flog2_d(v4f32_a); // CHECK: call <2 x double> 
@llvm.mips.flog2.d(
+  v4f32_r = __msa_flog2_w(v8f16_a); // CHECK: call <4 x float>  
@llvm.mips.flog2.w(
+  v2f64_r = __msa_flog2_d(v4f32_a); // CHECK: call <2 x double> 
@llvm.mips.flog2.d(

This is an incorrect use of v8f16. There are many more.


Comment at: test/CodeGen/builtins-mips-msa.c:391
@@ -399,1 +390,3 @@
+  v4f32_r = __msa_flog2_w(v8f16_a); // CHECK: call <4 x float>  
@llvm.mips.flog2.w(
+  v2f64_r = __msa_flog2_d(v4f32_a); // CHECK: call <2 x double> 
@llvm.mips.flog2.d(
 

This should be v2f64 I believe, there are many more of these too.


https://reviews.llvm.org/D24674



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9168: [NVPTX] Check if callsite is defined when computing argument allignment

2016-09-20 Thread Valentin Churavy via cfe-commits
vchuravy added a comment.

This is my first contribution to llvm so please let me know if I did something 
wrong in the process


https://reviews.llvm.org/D9168



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22507: Clang-tidy - Enum misuse check

2016-09-20 Thread Peter Szecsi via cfe-commits
szepet updated the summary for this revision.
szepet updated this revision to Diff 71925.
szepet marked 7 inline comments as done.
szepet added a comment.
Herald added subscribers: mgorny, beanz.

In order to decrease false positive rate, the bitmask specific checker part 
investigate only the enumconstans which was initilized by a literal. (If this 
is too strong it can be modified)

Renamed the checker to be more consistent with the checkers used for similar 
purpose.

Documentation code examples updated.


https://reviews.llvm.org/D22507

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/SuspiciousEnumUsageCheck.cpp
  clang-tidy/misc/SuspiciousEnumUsageCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-suspicious-enum-usage.rst
  test/clang-tidy/misc-suspicious-enum-usage-strict.cpp
  test/clang-tidy/misc-suspicious-enum-usage.cpp

Index: test/clang-tidy/misc-suspicious-enum-usage.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-suspicious-enum-usage.cpp
@@ -0,0 +1,85 @@
+// RUN: %check_clang_tidy %s misc-suspicious-enum-usage %t -- -config="{CheckOptions: [{key: misc-suspicious-enum-usage.StrictMode, value: 0}]}" --
+
+enum Empty {
+};
+
+enum A {
+  A = 1,
+  B = 2,
+  C = 4,
+  D = 8,
+  E = 16,
+  F = 32,
+  G = 63
+};
+
+enum X {
+  X = 8,
+  Y = 16,
+  Z = 4
+};
+
+enum {
+  P = 2,
+  Q = 3,
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: enum type seems like a bitmask (contains mostly power-of-2 literals), but this literal is not a power-of-2 [misc-suspicious-enum-usage]
+  R = 4,
+  S = 8,
+  T = 16
+};
+
+enum {
+  H,
+  I,
+  J,
+  K,
+  L
+};
+
+enum Days {
+  Monday,
+  Tuesday,
+  Wednesday,
+  Thursday,
+  Friday,
+  Saturday,
+  Sunday
+};
+
+Days bestDay() {
+  return Friday;
+}
+
+int trigger() {
+  if (bestDay() | A)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:17: warning: enum values are from different enum types 
+  if (I | Y)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: enum values are from different enum types
+  unsigned p;
+  p = Q | P;
+}
+
+int dont_trigger() {
+  if (A + G == E)
+return 1;
+  else if ((Q | R) == T)
+return 1;
+  else
+int k = T | Q;
+  Empty EmptyVal;
+  int emptytest = EmptyVal | B;
+  int a = 1, b = 5;
+  int c = a + b;
+  int d = c | H, e = b * a;
+  a = B | C;
+  b = X | Z;
+  if (Tuesday != Monday + 1 ||
+  Friday - Thursday != 1 ||
+  Sunday + Wednesday == (Sunday | Wednesday))
+return 1;
+  if (H + I + L == 42)
+return 1;
+  return 42;
+}
Index: test/clang-tidy/misc-suspicious-enum-usage-strict.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-suspicious-enum-usage-strict.cpp
@@ -0,0 +1,92 @@
+// RUN: %check_clang_tidy %s misc-suspicious-enum-usage %t -- -config="{CheckOptions: [{key: misc-suspicious-enum-usage.StrictMode, value: 1}]}" --
+
+enum A {
+  A = 1,
+  B = 2,
+  C = 4,
+  D = 8,
+  E = 16,
+  F = 32,
+  G = 63
+};
+
+enum X {
+  X = 8,
+  Y = 16,
+  Z = 4,
+  ZZ = 3
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: enum type seems like a bitmask (contains mostly power-of-2 literals), but this literal is not a power-of-2 [misc-suspicious-enum-usage]
+};
+// CHECK-MESSAGES: :[[@LINE+1]]:1: warning: enum type seems like a bitmask (contains mostly power-of-2 literals) but some literal(s) are not a power-of-2
+enum PP {
+  P = 2,
+  Q = 3,
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: enum type seems like a bitmask (contains mostly power-of-2 literals), but this literal is not a power-of-2
+  R = 4,
+  S = 8,
+  T = 16,
+  U = 31
+};
+
+enum {
+  H,
+  I,
+  J,
+  K,
+  L
+};
+
+enum Days {
+  Monday,
+  Tuesday,
+  Wednesday,
+  Thursday,
+  Friday,
+  Saturday,
+  Sunday
+};
+
+Days bestDay() {
+  return Friday;
+}
+
+int trigger() {
+  if (bestDay() | A)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:17: warning: enum values are from different enum types
+  if (I | Y)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: enum values are from different enum types
+  if (P + Q == R)
+return 1;
+  else if ((Q | R) == T)
+return 1;
+  else
+int k = ZZ | Z;
+  unsigned p = R;
+  PP pp = Q;
+  p |= pp;
+  // [LINE-1] triggers the LINE:17 warning
+  p = A | G;
+  return 0;
+}
+
+int dont_trigger() {
+  int a = 1, b = 5;
+  int c = a + b;
+  int d = c | H, e = b * a;
+  a = B | C;
+  b = X | Z;
+
+  unsigned bitflag;
+  enum A aa = B;
+  bitflag = aa | C;
+
+  if (Tuesday != Monday + 1 ||
+  Friday - Thursday != 1 ||
+  Sunday + Wednesday == (Sunday | Wednesday))
+return 1;
+  if (H + I + L == 42)
+return 1;
+  return 42;
+}
Index: docs/clang-tidy/checks/misc-suspicious-enum-usage.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-suspicious-enum-usage.rst
@@ -0,0 +1,71 @@
+.. title:: clang-tidy - 

[PATCH] D24767: clang-format: [JS] do not wrapp @returns tags.

2016-09-20 Thread Martin Probst via cfe-commits
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

@returns is incorrect code, the standard is @return. However wrapping it can 
still confuse users.

https://reviews.llvm.org/D24767

Files:
  lib/Format/Format.cpp

Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -613,7 +613,8 @@
 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
 GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
 GoogleStyle.BreakBeforeTernaryOperators = false;
-GoogleStyle.CommentPragmas = 
"(taze:|@(export|requirecss|return|see|visibility)) ";
+GoogleStyle.CommentPragmas =
+"(taze:|@(export|requirecss|return|returns|see|visibility)) ";
 GoogleStyle.MaxEmptyLinesToKeep = 3;
 GoogleStyle.NamespaceIndentation = FormatStyle::NI_All;
 GoogleStyle.SpacesInContainerLiterals = false;


Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -613,7 +613,8 @@
 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
 GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
 GoogleStyle.BreakBeforeTernaryOperators = false;
-GoogleStyle.CommentPragmas = "(taze:|@(export|requirecss|return|see|visibility)) ";
+GoogleStyle.CommentPragmas =
+"(taze:|@(export|requirecss|return|returns|see|visibility)) ";
 GoogleStyle.MaxEmptyLinesToKeep = 3;
 GoogleStyle.NamespaceIndentation = FormatStyle::NI_All;
 GoogleStyle.SpacesInContainerLiterals = false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Simon Dardis via cfe-commits
sdardis added a comment.

@mpf
I'll correct the incorrect uses in a followup patch.

Thanks,
Simon


https://reviews.llvm.org/D24674



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-09-20 Thread Tavian Barnes via cfe-commits
tavianator updated this revision to Diff 71934.
tavianator marked an inline comment as done.
tavianator added a comment.

s/indended/intended/


https://reviews.llvm.org/D21803

Files:
  src/cxa_thread_atexit.cpp
  test/CMakeLists.txt
  test/cxa_thread_atexit_test.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in
  test/thread_local_destruction_order.pass.cpp

Index: test/thread_local_destruction_order.pass.cpp
===
--- test/thread_local_destruction_order.pass.cpp
+++ test/thread_local_destruction_order.pass.cpp
@@ -0,0 +1,56 @@
+//===-- thread_local_destruction_order.pass.cpp ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+#include 
+#include 
+
+int seq = 0;
+
+class OrderChecker {
+public:
+  explicit OrderChecker(int n) : n_{n} { }
+
+  ~OrderChecker() {
+assert(seq++ == n_);
+  }
+
+private:
+  int n_;
+};
+
+template 
+class CreatesThreadLocalInDestructor {
+public:
+  ~CreatesThreadLocalInDestructor() {
+thread_local OrderChecker checker{ID};
+  }
+};
+
+OrderChecker global{7};
+
+void thread_fn() {
+  static OrderChecker fn_static{5};
+  thread_local CreatesThreadLocalInDestructor<2> creates_tl2;
+  thread_local OrderChecker fn_thread_local{1};
+  thread_local CreatesThreadLocalInDestructor<0> creates_tl0;
+}
+
+int main() {
+  static OrderChecker fn_static{6};
+
+  std::thread{thread_fn}.join();
+  assert(seq == 3);
+
+  thread_local OrderChecker fn_thread_local{4};
+  thread_local CreatesThreadLocalInDestructor<3> creates_tl;
+
+  return 0;
+}
Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -13,7 +13,6 @@
 config.enable_32bit = "@LIBCXXABI_BUILD_32_BITS@"
 config.target_info  = "@LIBCXXABI_TARGET_INFO@"
 config.executor = "@LIBCXXABI_EXECUTOR@"
-config.thread_atexit= "@LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 config.enable_shared= "@LIBCXX_ENABLE_SHARED@"
 config.enable_exceptions= "@LIBCXXABI_ENABLE_EXCEPTIONS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -37,8 +37,6 @@
 super(Configuration, self).configure_features()
 if not self.get_lit_bool('enable_exceptions', True):
 self.config.available_features.add('libcxxabi-no-exceptions')
-if self.get_lit_bool('thread_atexit', True):
-self.config.available_features.add('thread_atexit')
 
 def configure_compile_flags(self):
 self.cxx.compile_flags += ['-DLIBCXXABI_NO_TIMER']
Index: test/cxa_thread_atexit_test.pass.cpp
===
--- test/cxa_thread_atexit_test.pass.cpp
+++ test/cxa_thread_atexit_test.pass.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 // REQUIRES: linux
-// REQUIRES: thread_atexit
 
 #include 
 #include 
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -16,7 +16,6 @@
 pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
 set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
 "TargetInfo to use when setting up test environment.")
 set(LIBCXXABI_EXECUTOR "None" CACHE STRING
Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -7,20 +7,133 @@
 //
 //===--===//
 
+#include "abort_message.h"
 #include "cxxabi.h"
+#include 
+#include 
 
 namespace __cxxabiv1 {
-extern "C" {
 
-#ifdef HAVE___CXA_THREAD_ATEXIT_IMPL
+  using Dtor = void(*)(void*);
 
-_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*dtor)(void *), void *obj,
-void *dso_symbol) throw() {
-  extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *);
-  return __cxa_thread_atexit_impl(dtor, obj, dso_symbol);
-}
+  extern "C"
+#ifndef HAVE___CXA_THREAD_ATEXIT_IMPL
+  // A weak symbol is used to detect this function's presence in the C library
+  // at runtime, even if libc++ is built against an older libc
+  __attribute__((__weak__))
+#endif
+  int __cxa_thread_atexit_impl(Dtor, void*, 

Re: [PATCH] D24235: [OpenCL] Improve double literal handling

2016-09-20 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: lib/Sema/SemaExpr.cpp:3431
@@ -3410,1 +3430,3 @@
+.getSupportedOpenCLOpts()
+.cl_khr_fp64) ||
getOpenCLOptions().cl_khr_fp64)) {

neil.hickey wrote:
> yaxunl wrote:
> > This check 
> >   (getLangOpts().OpenCLVersion >= 120 &&
> > Context.getTargetInfo()
> > .getSupportedOpenCLOpts()
> > .cl_khr_fp64)
> > 
> > is redundant since for CL 1.2 and above getOpenCLOptions().cl_khr_fp64 is 
> > set to be true by default.
> This is get**Supported**OpenCLOpts(). Some hardware may not support doubles
In Sema::Initialize(), there is code to initialize enabled extensions:

```
  // Initialize predefined OpenCL types and supported optional core features.
  if (getLangOpts().OpenCL) {
#define OPENCLEXT(Ext) \
 if 
(Context.getTargetInfo().getSupportedOpenCLOpts().is_##Ext##_supported_core( \
 getLangOpts().OpenCLVersion)) \
   getOpenCLOptions().Ext = 1;
#include "clang/Basic/OpenCLExtensions.def"

```
`is_##Ext##_supported_core` accounts for two factors: 1. whether the target 
supports the extension; 2. whether the extension has become OpenCL core featrue.

Since getOpenCLOptions().cl_khr_fp64 is initialized with the same value as in 
the mentioned check, the check is redundant.


https://reviews.llvm.org/D24235



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24507: Add attribute for return values that shouldn't be cast to bool

2016-09-20 Thread Anton Urusov via cfe-commits
urusant added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/ReturnNonBoolChecker.cpp:50
@@ +49,3 @@
+  if (!State->contains(SR)) return;
+
+  ExplodedNode *N = C.generateErrorNode(C.getState());

I have just noticed that I didn't specify the style option when I ran it the 
first time. Now it should be fine.


Comment at: test/ReturnNonBoolTest.c:7
@@ +6,3 @@
+
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))

danielmarjamaki wrote:
> sorry but why do you have a #ifdef __clang__ isn't it always defined?
If I were to add the attribute to a function in some real codebase, I would 
probably want to save different compilers compatibility. However, it might not 
be necessary for the testcases.


Repository:
  rL LLVM

https://reviews.llvm.org/D24507



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24507: Add attribute for return values that shouldn't be cast to bool

2016-09-20 Thread Anton Urusov via cfe-commits
urusant updated this revision to Diff 71927.

Repository:
  rL LLVM

https://reviews.llvm.org/D24507

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/ReturnNonBoolChecker.cpp
  test/Analysis/ReturnNonBoolTest.c
  test/Analysis/ReturnNonBoolTest.cpp
  test/SemaCXX/ReturnNonBoolTestCompileTime.cpp
  test/SemaObjC/ReturnNonBoolTestCompileTime.m

Index: test/SemaObjC/ReturnNonBoolTestCompileTime.m
===
--- /dev/null
+++ test/SemaObjC/ReturnNonBoolTestCompileTime.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1  -fsyntax-only -verify %s
+
+@interface INTF
+- (int) fee __attribute__((warn_impcast_to_bool)); // expected-warning{{'warn_impcast_to_bool' attribute only applies to functions}}
++ (int) c __attribute__((warn_impcast_to_bool)); // expected-warning{{'warn_impcast_to_bool' attribute only applies to functions}}
+@end
Index: test/SemaCXX/ReturnNonBoolTestCompileTime.cpp
===
--- /dev/null
+++ test/SemaCXX/ReturnNonBoolTestCompileTime.cpp
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wbool-conversion -verify %s
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))
+#else
+#define RETURNS_NON_BOOL
+#endif
+
+int NoAttributes() { return 2; }
+
+int NonBool(int x) RETURNS_NON_BOOL;
+int NonBool(int x) {  // expected-note{{'NonBool' declared here}}
+  return x * 2;
+}
+
+int good(int x) { return x * 2; }
+
+void test1() {
+  if (NonBool(2)) {  // expected-warning{{implicit conversion turns non-bool into bool: 'int' to 'bool'}}
+return;
+  }
+}
+
+void test3() {
+  if ((bool)NonBool(2)) {  // no warning, explicit cast
+return;
+  }
+}
+
+void test5() {
+  if (good(2)) {  // no warning, return value isn't marked as dangerous
+return;
+  }
+}
+
+double InvalidReturnType() RETURNS_NON_BOOL;  // expected-warning{{'warn_impcast_to_bool' attribute only applies to integer return types}}
+
+int AttributeWithArguments() __attribute__((warn_impcast_to_bool(2)));  // expected-error {{'warn_impcast_to_bool' attribute takes no arguments}}
+
+int NonFunction RETURNS_NON_BOOL; // expected-warning{{'warn_impcast_to_bool' attribute only applies to functions}}
+
+class Base {
+  int data;
+ public:
+  virtual int SafeMember();
+  virtual int NonBoolMember() RETURNS_NON_BOOL;
+};
+
+class DerivedCorrect : public Base {
+ public:
+  int SafeMember();
+  int NonBoolMember() RETURNS_NON_BOOL; // expected-note{{'NonBoolMember' declared here}}
+};
+
+class DerivedIncorrect : public Base {
+ public:
+  int SafeMember() RETURNS_NON_BOOL; // expected-note {{'SafeMember' declared here}}
+  int NonBoolMember();
+};
+
+void TestMemberFunctions() {
+  DerivedCorrect DC;
+  DerivedIncorrect DI;
+  if (DC.SafeMember()) {}
+  if (DI.SafeMember()) {} // expected-warning{{implicit conversion turns non-bool into bool: 'int' to 'bool'}}
+  if (DC.NonBoolMember()) {} // expected-warning{{implicit conversion turns non-bool into bool: 'int' to 'bool'}}
+  if (DI.NonBoolMember()) {}
+}
+
+
+
Index: test/Analysis/ReturnNonBoolTest.cpp
===
--- /dev/null
+++ test/Analysis/ReturnNonBoolTest.cpp
@@ -0,0 +1,88 @@
+// RUN: %clang_cc1 -std=c++11 -analyze -analyzer-checker=alpha.core.ReturnNonBool -Wno-bool-conversion -verify %s
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))
+#else
+#define RETURNS_NON_BOOL
+#endif
+
+int NoAttributes() { return 2; }
+
+int NonBool(int x) RETURNS_NON_BOOL;
+
+int good(int x);
+
+int wrap(int x) {
+  int r = NonBool(x);
+  return r;
+}
+
+void test1() {
+  if (NonBool(1)) {  // expected-warning{{implicit cast to bool is dangerous for this value}}
+return;
+  }
+}
+
+void test2() {
+  if (wrap(2)) {  // expected-warning{{implicit cast to bool is dangerous for this value}}
+return;
+  }
+}
+
+void test3() {
+  if ((bool)NonBool(3)) {  // no warning, explicit cast
+return;
+  }
+}
+
+void test4(int x) {
+  if (bool(wrap(2 * x))) {  // no warning, explicit cast
+return;
+  }
+}
+
+void test5() {
+  if (good(5)) {  // no warning, return value isn't marked as dangerous
+return;
+  }
+}
+
+void test6() {
+  if (good(wrap(2))) {  // no warning, wrap is treated as int, not as bool
+return;
+  }
+}
+
+double InvalidAttributeUsage()
+RETURNS_NON_BOOL;  // expected-warning{{'warn_impcast_to_bool' attribute only applies to integer return types}}
+
+void test_function_pointer(void (*f)()) {
+  // This is to test the case when Call.getDecl() returns NULL, because f()
+  // doesn't have a declaration
+  f();
+}
+
+bool universal_bool_wrapper(int (*f)(int), int x) {
+  // When we call universal_bool_wrapper 

Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a subscriber: mpf.
vkalintiris added a comment.
This revision is now accepted and ready to land.

LGTM with one comment/question inline.



Comment at: test/CodeGen/builtins-mips-msa.c:8
@@ -13,4 +7,3 @@
+
 typedef __fp16 v8f16 __attribute__ ((vector_size(16)));
 

@mpf

Would it be problematic to expose this typedef from msa.h?


https://reviews.llvm.org/D24674



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24507: Add attribute for return values that shouldn't be cast to bool

2016-09-20 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: danielmarjamaki.


Comment at: include/clang/Basic/AttrDocs.td:2055
@@ -2054,1 +2054,3 @@
 }
+def WarnImpcastToBoolDocs : Documentation {
+  let Category = DocCatFunction;

I saw your email on cfe-dev. This sounds like a good idea to me.


Comment at: lib/StaticAnalyzer/Checkers/ReturnNonBoolChecker.cpp:49
@@ +48,3 @@
+  // needed.
+  if (!State->contains(SR)) return;
+

It seems you need to run clang-format on this file also.


Comment at: test/ReturnNonBoolTest.c:7
@@ +6,3 @@
+
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))

sorry but why do you have a #ifdef __clang__ isn't it always defined?


Repository:
  rL LLVM

https://reviews.llvm.org/D24507



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24712: Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull.

2016-09-20 Thread John McCall via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

In that case, you probably will not be able to test this difference, because 
the argument is basically required to be the address of a local variable, a 
parameter, or null (or a various things that propagate such values).  And our 
IR-generation scheme for parameters will never make them just an llvm::Argument.

LGTM, then.


https://reviews.llvm.org/D24712



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24507: Add attribute for return values that shouldn't be cast to bool

2016-09-20 Thread Anton Urusov via cfe-commits
urusant updated this revision to Diff 71921.
urusant added a comment.

In https://reviews.llvm.org/D24507#546380, @aaron.ballman wrote:

> We try to keep our tests segregated by functionality. e.g., tests relating to 
> the way the attribute is handled (what it appertains to, args, etc) should 
> live in Sema, tests relating to the static analyzer behavior should live in 
> test/Analysis, etc.
>
> Tests that are still missing are: applying to a non-function type, applying 
> to a member function, applying to an Obj-C method. For member functions, what 
> should happen if the function is virtual? What if the overriders do not 
> specify the attribute? What if an override specifies the attribute but the 
> base does not?


I have added the test cases about member functions.
As for ObjC methods, I didn't pay much attention to them while developing the 
check as ObjC wasn't the primary target. I tried to make a test case for it, 
and it turned out that it is OK to put an attribute on ObjC method, but you 
wouldn't get neither compiler warning nor StaticAnalyzer report. That is why I 
removed ObjC methods from the attribute subjects and replaced the ObjC test 
case with another one that shows that you cannot apply the attribute to ObjC 
methods (not sure if it is still necessary, because it seems not very different 
from applying the attribute to a non-function variable - in both cases we get 
the same warning). Do you think it's worth digging into how to make it work 
with ObjC? In this case I might need some help because I don't really speak 
Objective C.

> > > Have you considered making this a type attribute on the return type of 
> > > the function rather than a declaration attribute on the function 
> > > declaration?

> 

> > 

> 

> > 

> 

> > No, I hadn't. On a quick look though, I couldn't find a way to simplify my 
> > solution using this idea, because as far as I understand, the type 
> > attribute isn't inherited, so, for example, if I have something like `int r 
> > = X509_verify_cert(...)` and the function `X509_verify_cert` has a return 
> > type with attribute, `r` won't have the attribute. If that is correct, we 
> > still need to backtrace the value to the function declaration. Is there 
> > something I am missing?

> 

> 

> I was thinking it would be diagnosed if you attempted to assign from your 
> attributed type to a type that is not compatible. However, that may still be 
> problematic because it raises other questions (can you SFINAE on it? 
> Overload? etc).


This might also make the check itself easier (as we don't need path-sensitive 
analysis), however, it would make the use more complicated as all the users of 
the dangerous function would have to change their code (even if they are using 
it correctly). For example, if we refer to the original motivation, annotating 
dangerous OpenSSL functions would allow us to protect dozens of codebases using 
them without changing every one of them.


Repository:
  rL LLVM

https://reviews.llvm.org/D24507

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/ReturnNonBoolChecker.cpp
  test/Analysis/ReturnNonBoolTest.c
  test/Analysis/ReturnNonBoolTest.cpp
  test/SemaCXX/ReturnNonBoolTestCompileTime.cpp
  test/SemaObjC/ReturnNonBoolTestCompileTime.m

Index: test/SemaObjC/ReturnNonBoolTestCompileTime.m
===
--- /dev/null
+++ test/SemaObjC/ReturnNonBoolTestCompileTime.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1  -fsyntax-only -verify %s
+
+@interface INTF
+- (int) fee __attribute__((warn_impcast_to_bool)); // expected-warning{{'warn_impcast_to_bool' attribute only applies to functions}}
++ (int) c __attribute__((warn_impcast_to_bool)); // expected-warning{{'warn_impcast_to_bool' attribute only applies to functions}}
+@end
Index: test/SemaCXX/ReturnNonBoolTestCompileTime.cpp
===
--- /dev/null
+++ test/SemaCXX/ReturnNonBoolTestCompileTime.cpp
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wbool-conversion -verify %s
+#ifdef __clang__
+#define RETURNS_NON_BOOL __attribute__((warn_impcast_to_bool))
+#else
+#define RETURNS_NON_BOOL
+#endif
+
+int NoAttributes() { return 2; }
+
+int NonBool(int x) RETURNS_NON_BOOL;
+int NonBool(int x) {  // expected-note{{'NonBool' declared here}}
+  return x * 2;
+}
+
+int good(int x) { return x * 2; }
+
+void test1() {
+  if (NonBool(2)) {  // expected-warning{{implicit conversion turns non-bool into bool: 'int' to 'bool'}}
+return;
+  }
+}
+
+void test3() {
+  if ((bool)NonBool(2)) {  // no warning, explicit cast
+return;
+  }
+}
+
+void test5() {
+  if (good(2)) {  // no warning, return value isn't marked as dangerous
+

Re: [PATCH] D23712: [OpenCL] Override supported OpenCL extensions with -cl-ext option

2016-09-20 Thread Andrew Savonichev via cfe-commits
asavonic added a comment.

Hi @Anastasia,

Sorry for my late reply.

> > > What would be the use case to override the supported extensions for the 
> > > end user?

> 

> > 

> 

> > 

> 

> > Some extensions may be supported by the platform in general, but not by the

> 

> >  specific version of the OpenCL runtime.

> 

> 

> Would triple not be suitable in this case, because they include OS/RT 
> information?


This can be achieved with a custom triple, yes, but it is not a flexible 
solution. 
We need to create a triple for every combination of extensions. If we want to 
change it, we need to modify the clang source code and recompile it.

I think it is better to have a default set of extensions (from target triple) 
and allow user to tweak it without creating one more triple.

So instead of:

  clang -cc1 -triple spir-unknown-intel-skl-nofp64-nofp16 <...>

we could write:

  clang -cc1 -triple spir-unknown-unknown -cl-ext=-cl_khr_fp64,-cl_khr_fp16 
<...>

Both have the same result, but the latter one is more flexible and it can be 
changed without changing the clang code.


https://reviews.llvm.org/D23712



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r281277 - [Sema] Fix PR30346: relax __builtin_object_size checks.

2016-09-20 Thread Joerg Sonnenberger via cfe-commits
On Mon, Sep 19, 2016 at 09:21:33PM -0700, George Burgess IV wrote:
> I'm entirely unfamiliar with struct-path-tbaa, so Hal, do you see a reason
> why struct-path-tbaa wouldn't play nicely with flexible arrays at the end
> of types? Glancing at it, I don't think it should cause problems, but a
> more authoritative answer would really be appreciated. :) If it might cause
> issues now or in the future, I'm happy to be conservative here if
> -fno-strict-path-tbaa is given, too.

Please don't call them flexible types. That's a misname. The standard
provides a clear mechanism for arrays with statically undefined size --
which is providing no size at all. We do provide the same support for
array size of 1 for legacy compat. Any other size is basically abuse.

Joerg
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24235: [OpenCL] Improve double literal handling

2016-09-20 Thread Neil Hickey via cfe-commits
neil.hickey added inline comments.


Comment at: lib/Sema/SemaExpr.cpp:3431
@@ -3410,1 +3430,3 @@
+.getSupportedOpenCLOpts()
+.cl_khr_fp64) ||
getOpenCLOptions().cl_khr_fp64)) {

yaxunl wrote:
> This check 
>   (getLangOpts().OpenCLVersion >= 120 &&
> Context.getTargetInfo()
> .getSupportedOpenCLOpts()
> .cl_khr_fp64)
> 
> is redundant since for CL 1.2 and above getOpenCLOptions().cl_khr_fp64 is set 
> to be true by default.
This is get**Supported**OpenCLOpts(). Some hardware may not support doubles


https://reviews.llvm.org/D24235



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24704: PR30401: Fix substitutions for functions with abi_tag

2016-09-20 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

Richard, please take another look.


https://reviews.llvm.org/D24704



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24754: [cleanup] Remove excessive padding from RedeclarableResult

2016-09-20 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a comment.

F2435929: Screen Shot 2016-09-20 at 12.19.51 AM.png 



Repository:
  rL LLVM

https://reviews.llvm.org/D24754



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24754: [cleanup] Remove excessive padding from RedeclarableResult

2016-09-20 Thread Alexander Shaposhnikov via cfe-commits
alexshap created this revision.
alexshap added reviewers: rtrieu, rsmith, bkramer, mehdi_amini.
alexshap added a subscriber: cfe-commits.
alexshap set the repository for this revision to rL LLVM.
alexshap changed the visibility of this Differential Revision from "Public (No 
Login Required)" to "All Users".

This diff reorders the fields of the class RedeclarableResult to remove 
excessive padding.
Test plan: make -j8 check-clang

Repository:
  rL LLVM

https://reviews.llvm.org/D24754

Files:
  lib/Serialization/ASTReaderDecl.cpp

Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -146,13 +146,13 @@
 
 /// Results from loading a RedeclarableDecl.
 class RedeclarableResult {
-  GlobalDeclID FirstID;
   Decl *MergeWith;
+  GlobalDeclID FirstID;
   bool IsKeyDecl;
 
 public:
-  RedeclarableResult(GlobalDeclID FirstID, Decl *MergeWith, bool IsKeyDecl)
-  : FirstID(FirstID), MergeWith(MergeWith), IsKeyDecl(IsKeyDecl) {}
+  RedeclarableResult(Decl *MergeWith, GlobalDeclID FirstID, bool IsKeyDecl)
+  : MergeWith(MergeWith), FirstID(FirstID), IsKeyDecl(IsKeyDecl) {}
 
   /// \brief Retrieve the first ID.
   GlobalDeclID getFirstID() const { return FirstID; }
@@ -2311,7 +2311,7 @@
   if (IsFirstLocalDecl)
 Reader.PendingDeclChains.push_back(std::make_pair(DAsT, RedeclOffset));
 
-  return RedeclarableResult(FirstDeclID, MergeWith, IsKeyDecl);
+  return RedeclarableResult(MergeWith, FirstDeclID, IsKeyDecl);
 }
 
 /// \brief Attempts to merge the given declaration (D) with another declaration
@@ -2353,8 +2353,9 @@
  DeclID DsID, bool IsKeyDecl) {
   auto *DPattern = D->getTemplatedDecl();
   auto *ExistingPattern = Existing->getTemplatedDecl();
-  RedeclarableResult Result(DPattern->getCanonicalDecl()->getGlobalID(),
-/*MergeWith*/ ExistingPattern, IsKeyDecl);
+  RedeclarableResult Result(/*MergeWith*/ ExistingPattern,  
+DPattern->getCanonicalDecl()->getGlobalID(), 
+IsKeyDecl);
 
   if (auto *DClass = dyn_cast(DPattern)) {
 // Merge with any existing definition.


Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -146,13 +146,13 @@
 
 /// Results from loading a RedeclarableDecl.
 class RedeclarableResult {
-  GlobalDeclID FirstID;
   Decl *MergeWith;
+  GlobalDeclID FirstID;
   bool IsKeyDecl;
 
 public:
-  RedeclarableResult(GlobalDeclID FirstID, Decl *MergeWith, bool IsKeyDecl)
-  : FirstID(FirstID), MergeWith(MergeWith), IsKeyDecl(IsKeyDecl) {}
+  RedeclarableResult(Decl *MergeWith, GlobalDeclID FirstID, bool IsKeyDecl)
+  : MergeWith(MergeWith), FirstID(FirstID), IsKeyDecl(IsKeyDecl) {}
 
   /// \brief Retrieve the first ID.
   GlobalDeclID getFirstID() const { return FirstID; }
@@ -2311,7 +2311,7 @@
   if (IsFirstLocalDecl)
 Reader.PendingDeclChains.push_back(std::make_pair(DAsT, RedeclOffset));
 
-  return RedeclarableResult(FirstDeclID, MergeWith, IsKeyDecl);
+  return RedeclarableResult(MergeWith, FirstDeclID, IsKeyDecl);
 }
 
 /// \brief Attempts to merge the given declaration (D) with another declaration
@@ -2353,8 +2353,9 @@
  DeclID DsID, bool IsKeyDecl) {
   auto *DPattern = D->getTemplatedDecl();
   auto *ExistingPattern = Existing->getTemplatedDecl();
-  RedeclarableResult Result(DPattern->getCanonicalDecl()->getGlobalID(),
-/*MergeWith*/ ExistingPattern, IsKeyDecl);
+  RedeclarableResult Result(/*MergeWith*/ ExistingPattern,  
+DPattern->getCanonicalDecl()->getGlobalID(), 
+IsKeyDecl);
 
   if (auto *DClass = dyn_cast(DPattern)) {
 // Merge with any existing definition.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24609: [ARM] Add missing Interlocked intrinsics

2016-09-20 Thread Martin Storsjö via cfe-commits
mstorsjo added a comment.

Thanks! Can you/someone commit it?


https://reviews.llvm.org/D24609



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits