Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-22 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG with a small nit



Comment at: lib/Sema/SemaOpenMP.cpp:6384-6386
@@ -6383,1 +6383,5 @@
+} else {
+  auto *OED = dyn_cast(S);
+  if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()))
+OMPTeamsFound = false;
 }

I'd prefer something like this:
```
auto *OED = dyn_cast(S);
OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind());
```


http://reviews.llvm.org/D21617



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


Re: [PATCH] D21564: [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

2016-06-22 Thread Alexey Bataev via cfe-commits
ABataev requested changes to this revision.
This revision now requires changes to proceed.


Comment at: lib/CodeGen/CGStmtOpenMP.cpp:1868-1871
@@ -1867,1 +1867,6 @@
 
+void CodeGenFunction::EmitOMPDistributeParallelForDirective(
+const OMPDistributeParallelForDirective ) {
+  EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt());
+}
+

No, it won't work. Use the following code:
```
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
CGM.getOpenMPRuntime().emitInlinedDirective(
  *this, OMPD_distribute_parallel_for, [](CodeGenFunction , 
PrePostActionTy &) {
  OMPLoopScope PreInitScope(CGF, S);
  CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt());
});
```


Comment at: lib/Sema/SemaOpenMP.cpp:4985-4987
@@ +4984,5 @@
+
+  PrevLBDecl->setType(VType);
+  PrevUBDecl->setType(VType);
+
+  // Previous lower and upper bounds are obtained from the region

Not sure that this is a good solution. I'd prefer not to change the types of 
parameters. Maybe it is better to pass them as pointers and then cast to proper 
types?


Repository:
  rL LLVM

http://reviews.llvm.org/D21564



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


Re: [PATCH] Restructure the propagation of -fPIC/-fPIE.

2016-06-22 Thread Sean Silva via cfe-commits
-def fpie : Flag<["-"], "fpie">, Group;
+def fpie : Flag<["-"], "fpie">, Group, Flags<[CC1Option]>;


I don't think this is the right solution as "-fpie" doesn't mean the same
thing to the driver and CC1 is sort of confusing (in CC1 it doesn't mean
anything by itself). Can you change the existing `-pie-level` Separate to
be a CC1-only `-pic-is-pie` Flag? (name is a bikeshed)

With that, this LGTM. Nice cleanup!

-- Sean Silva

On Tue, Jun 21, 2016 at 3:53 PM, Rafael Espíndola <
cfe-commits@lists.llvm.org> wrote:

> The PIC and PIE levels are not independent. In fact, if PIE is defined
> it is always the same as PIC.
>
> This is clear in the driver where ParsePICArgs returns a PIC level and
> a IsPIE boolean. Unfortunately that is currently lost and we pass two
> redundant levels down the pipeline.
>
> This patch keeps a bool and a PIC level all the way down to codegen. I
> intend to send a patch for LLVM tomorrow so that CodeGen too can be
> simplified.
>
> Cheers,
> Rafael
>
> ___
> 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


r273522 - Use ranges to concisely express iteration

2016-06-22 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Wed Jun 22 19:15:04 2016
New Revision: 273522

URL: http://llvm.org/viewvc/llvm-project?rev=273522=rev
Log:
Use ranges to concisely express iteration

No functional change is intended, this should just clean things up a
little.

Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Index/IndexBody.cpp
cfe/trunk/lib/Sema/ScopeInfo.cpp
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/lib/Serialization/ModuleManager.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=273522=273521=273522=diff
==
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Jun 22 19:15:04 2016
@@ -3970,11 +3970,10 @@ private:
   /// expression.
   Designator *Designators;
 
-
-  DesignatedInitExpr(const ASTContext , QualType Ty, unsigned NumDesignators,
- const Designator *Designators,
+  DesignatedInitExpr(const ASTContext , QualType Ty,
+ llvm::ArrayRef Designators,
  SourceLocation EqualOrColonLoc, bool GNUSyntax,
- ArrayRef IndexExprs, Expr *Init);
+ ArrayRef IndexExprs, Expr *Init);
 
   explicit DesignatedInitExpr(unsigned NumSubExprs)
 : Expr(DesignatedInitExprClass, EmptyShell()),
@@ -4134,8 +4133,7 @@ public:
   };
 
   static DesignatedInitExpr *Create(const ASTContext ,
-Designator *Designators,
-unsigned NumDesignators,
+llvm::ArrayRef Designators,
 ArrayRef IndexExprs,
 SourceLocation EqualOrColonLoc,
 bool GNUSyntax, Expr *Init);
@@ -4147,48 +4145,15 @@ public:
   unsigned size() const { return NumDesignators; }
 
   // Iterator access to the designators.
-  typedef Designator *designators_iterator;
-  designators_iterator designators_begin() { return Designators; }
-  designators_iterator designators_end() {
-return Designators + NumDesignators;
-  }
-
-  typedef const Designator *const_designators_iterator;
-  const_designators_iterator designators_begin() const { return Designators; }
-  const_designators_iterator designators_end() const {
-return Designators + NumDesignators;
+  llvm::MutableArrayRef designators() {
+return {Designators, NumDesignators};
   }
 
-  typedef llvm::iterator_range designators_range;
-  designators_range designators() {
-return designators_range(designators_begin(), designators_end());
-  }
-
-  typedef llvm::iterator_range
-  designators_const_range;
-  designators_const_range designators() const {
-return designators_const_range(designators_begin(), designators_end());
-  }
-
-  typedef std::reverse_iterator
-  reverse_designators_iterator;
-  reverse_designators_iterator designators_rbegin() {
-return reverse_designators_iterator(designators_end());
-  }
-  reverse_designators_iterator designators_rend() {
-return reverse_designators_iterator(designators_begin());
-  }
-
-  typedef std::reverse_iterator
-  const_reverse_designators_iterator;
-  const_reverse_designators_iterator designators_rbegin() const {
-return const_reverse_designators_iterator(designators_end());
-  }
-  const_reverse_designators_iterator designators_rend() const {
-return const_reverse_designators_iterator(designators_begin());
+  llvm::ArrayRef designators() const {
+return {Designators, NumDesignators};
   }
 
-  Designator *getDesignator(unsigned Idx) { return _begin()[Idx]; }
+  Designator *getDesignator(unsigned Idx) { return ()[Idx]; }
 
   void setDesignators(const ASTContext , const Designator *Desigs,
   unsigned NumDesigs);

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=273522=273521=273522=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Jun 22 19:15:04 2016
@@ -5430,19 +5430,17 @@ Expr *ASTNodeImporter::VisitDesignatedIn
   }
 
   SmallVector Designators(DIE->size());
-  std::transform(DIE->designators_begin(), DIE->designators_end(),
-  

[PATCH] D21629: [libcxx] [test] Add assertions to quiet analysis warnings about array bounds.

2016-06-22 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Add assertions to quiet analysis warnings about array bounds.

In the partial_sort tests, the N >= M assertion is just a good sanity check, to 
detect bogus testcases. MSVC's /analyze needs to see the i < N assertion 
explicitly, otherwise it worries that array[i] might be out-of-bounds. I gave 
those ones comments because they are technically redundant.

In eval.pass.cpp, the assertions simply say that we aren't going to try to 
access arrays out-of-bounds, which I assume is guaranteed by the logic of the 
test, but this is far from obvious, so the assertions are valuable in their own 
right.

Fixes MSVC warnings of the form:
warning C6385: Reading invalid data from 'array':  the readable size is 'N*4' 
bytes, but '8' bytes may be read.
These warnings are valuable, so I'd prefer to suppress them locally instead of 
globally, especially given that so few places are affected.

http://reviews.llvm.org/D21629

Files:
  test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
  
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp

Index: 
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
===
--- 
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ 
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -243,6 +243,7 @@
 a = 0;
 for (int j = 0; j < k; ++j)
 a += areas[j];
+assert(k < Np);
 m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
 bk = b[k];
 c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
@@ -281,6 +282,7 @@
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
 {
+assert(i < Np);
 areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
 S += areas[i];
 }
@@ -296,6 +298,7 @@
 a = 0;
 for (int j = 0; j < k; ++j)
 a += areas[j];
+assert(k < Np);
 m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
 bk = b[k];
 c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
Index: 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
===
--- 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
+++ 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
@@ -35,13 +35,17 @@
 test_larger_sorts(unsigned N, unsigned M)
 {
 assert(N != 0);
+assert(N >= M);
 int* array = new int[N];
 for (int i = 0; i < N; ++i)
 array[i] = i;
 std::random_shuffle(array, array+N);
 std::partial_sort(array, array+M, array+N, std::greater());
 for (int i = 0; i < M; ++i)
+{
+assert(i < N); // quiet analysis warnings
 assert(array[i] == N-i-1);
+}
 delete [] array;
 }
 
Index: 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
===
--- test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
+++ test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
@@ -22,13 +22,17 @@
 test_larger_sorts(unsigned N, unsigned M)
 {
 assert(N != 0);
+assert(N >= M);
 int* array = new int[N];
 for (int i = 0; i < N; ++i)
 array[i] = i;
 std::random_shuffle(array, array+N);
 std::partial_sort(array, array+M, array+N);
 for (int i = 0; i < M; ++i)
+{
+assert(i < N); // quiet analysis warnings
 assert(array[i] == i);
+}
 delete [] array;
 }
 


Index: test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
===
--- test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -243,6 +243,7 @@
 a = 0;
 for (int j = 0; j < k; ++j)
 a += areas[j];
+assert(k < Np);
 m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
 bk = b[k];
 c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
@@ -281,6 +282,7 @@
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
 {
+assert(i < Np);
 areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
 S += areas[i];
 }
@@ -296,6 +298,7 @@
 a = 0;
 for (int j = 0; j < k; ++j)
 a += areas[j];
+assert(k < Np);
 m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
 bk = b[k];
 c = 

Re: [PATCH] D18073: Add memory allocating functions

2016-06-22 Thread Alexander Riccio via cfe-commits
ariccio added a comment.

Bump?


http://reviews.llvm.org/D18073



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


[PATCH] D21626: Lit C++11 Compatibility Patch #10

2016-06-22 Thread Charles Li via cfe-commits
tigerleapgorge created this revision.
tigerleapgorge added a reviewer: rsmith.
tigerleapgorge added a subscriber: cfe-commits.

Hi Everyone,

I am continuing with updating the Lit tests for C++11 compatibility.
11 tests this time.


test/Modules/Inputs/merge-using-decls/a.h
test/Modules/Inputs/merge-using-decls/b.h
test/Modules/merge-using-decls.cpp
  This test verifies the interaction between Modules and Using declarations.
  Part of this test, template struct “E” checks for mismatch between using 
declarations in a.h and Access declarations in b.h.
  Since C++11 has deprecated Access declarations, module “B” will fail to build.
  Therefore, I have restricted this part of the test to only use C++98. 


test/OpenMP/declare_reduction_messages.cpp
  In C++11, an opening square bracket is the start of a lambda capture.
  Therefore, a unmatched opening square bracket will cause the following 
diagnostics change.
C++98: error: expected '(' after 'initializer'
   error: expected expression
   warning: extra tokens at the end of '#pragma omp declare reduction' 
are ignored [-Wextra-tokens]
C++11: error: expected '(' after 'initializer'
   error: expected variable name or 'this' in lambda capture list
   error: expected ')'
   note: to match this '('


test/OpenMP/openmp_check.cpp
  This test is created in response to bug 25221, where C++11 code running under 
C++98 causes the parser to go into an infinite loop.
  Since this is C++11 code, all expected diagnostics will go away when 
compiling at C++11.
  Therefore, guard all of the following diagnostics under C++98.
C++98: warning: 'auto' type specifier is a C++11 extension 
[-Wc++11-extensions]
   error: expected expression
   error: expected ';' at end of declaration
C++98: error: C++ requires a type specifier for all declarations
C++98: error: expected unqualified-id
C++98: error: extraneous closing brace ('}')


test/SemaCXX/MicrosoftExtensions.cpp
  This test checks for Microsoft extensions.
  Portions of this test check for unsupported C++11 features when compiling at 
C++98.
  Guard all such diagnostics under C++98.
  
  Base destructor being marked with “throw()”, derived destructor is not.
  This no longer results in the following diagnostics in C++11.
C++98: warning: exception specification of overriding function is more lax 
than base version [-Wmicrosoft-exception-spec]
   note: overridden virtual function is here

  Enum with underlying type is now supported in C++11. Guard the following 
under C++98.
C++98: warning: enumeration types with a fixed underlying type are a C++11 
extension [-Wc++11-extensions]
C++98: warning: enumeration types with a fixed underlying type are a C++11 
extension [-Wc++11-extensions]

  “override” is now supported in C++11. Guard the following under C++98.
C++98: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]


test/SemaCXX/PR9572.cpp
This test verifies 2 types of diagnostics.

  Type 1:
  Warning for unsupported C++11 feature when compiling at C++98.
  Guard the following Warning under C++98.
C++98: warning: in-class initialization of non-static data member is a 
C++11 extension [-Wc++11-extensions]

  Type 2:
  Errors when derived class inherit a private virtual destructor in the base 
class.
  Class Base has a private virtual destructor.
  Struct Foo inherits Base. Foo does not explicitly declare a destructor.
  Struct Bar inherits Foo. Bar explicitly declares a destructor.
  Struct Baz contains an instance of Foo as its member.
  Because C++11 introduced ‘delete’, this results in the following changes in 
diagnostics.
  C++98 issues 1 Error on Base’s private destructor.
  C++11 issues 4 Errors at all points of the inheritance chain where the 
destructor is implicitly deleted.
C++98: error: base class 'Base' has private destructor
   note: implicitly declared private here
   note: implicit destructor for 'Foo' first required here
C++11: error: deleted function '~Foo' cannot override a non-deleted function
   note: overridden virtual function is here
C++11: error: non-deleted function '~Bar' cannot override a deleted function
   note: overridden virtual function is here
C++11: error: attempt to use a deleted function
   note: destructor of 'Foo' is implicitly deleted because base class 
'Base' has an inaccessible destructor
C++11: error: attempt to use a deleted function
   note: destructor of 'Foo' is implicitly deleted because base class 
'Base' has an inaccessible destructor


test/SemaCXX/default-assignment-operator.cpp
  C++11 introduced ‘delete’.
  Change in diagnostics regarding implicitly deleted copy assignment operator. 
  This test change contains 3 parts: Test1, Test5, ProtectedCheck.

  Test1
Class Base has a member “int ” that is never initialized.
Class X is derived from Base. 
Neither Base nor X 

[PATCH] D21625: [libcxx] [test] Mark throw_bad_alloc_helper() as [[noreturn]].

2016-06-22 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Mark throw_bad_alloc_helper() as [[noreturn]].

This avoids MSVC /analyze warnings about new returning null, since [[noreturn]] 
allows the analyzer to see what's happening.

http://reviews.llvm.org/D21625

Files:
  test/support/count_new.hpp

Index: test/support/count_new.hpp
===
--- test/support/count_new.hpp
+++ test/support/count_new.hpp
@@ -24,6 +24,9 @@
 
 namespace detail
 {
+#if TEST_STD_VER >= 11
+   [[noreturn]]
+#endif
inline void throw_bad_alloc_helper() {
 #ifndef TEST_HAS_NO_EXCEPTIONS
throw std::bad_alloc();


Index: test/support/count_new.hpp
===
--- test/support/count_new.hpp
+++ test/support/count_new.hpp
@@ -24,6 +24,9 @@
 
 namespace detail
 {
+#if TEST_STD_VER >= 11
+   [[noreturn]]
+#endif
inline void throw_bad_alloc_helper() {
 #ifndef TEST_HAS_NO_EXCEPTIONS
throw std::bad_alloc();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21504: [X86] add _mm_loadu_si64

2016-06-22 Thread Simon Pilgrim via cfe-commits
RKSimon added inline comments.


Comment at: tools/clang/test/CodeGen/sse2-builtins.c:1526
@@ +1525,3 @@
+  // CHECK-LABEL: test_mm_loadu_si64
+  // CHECK: load i64, i64* %__u
+  // CHECK: insertelement <2 x i64> undef, i64 %{{.*}}, i32 0

Please can add the alignment operand to the CHECK (it should be align 1)?


Repository:
  rL LLVM

http://reviews.llvm.org/D21504



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


Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-22 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Thanks David,

Let's wait for Alexey to see if he has any concerns related to this patch.

Thanks again,
Samuel


http://reviews.llvm.org/D21617



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


Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-22 Thread Kelvin Li via cfe-commits
kkwli0 added a comment.

The changes look fine to me.  Thanks.


http://reviews.llvm.org/D21617



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


Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-22 Thread David S via cfe-commits
davidsh updated this revision to Diff 61612.

http://reviews.llvm.org/D21617

Files:
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nesting_of_regions.cpp

Index: test/OpenMP/nesting_of_regions.cpp
===
--- test/OpenMP/nesting_of_regions.cpp
+++ test/OpenMP/nesting_of_regions.cpp
@@ -2867,6 +2867,12 @@
 #pragma omp teams  // expected-note {{nested teams construct here}}
 ++a;
   }
+#pragma omp target // expected-error {{target construct with nested teams 
region contains statements outside of the teams construct}}
+  {
+while (0)  // expected-note {{statement outside teams construct here}}
+#pragma omp teams  // expected-note {{nested teams construct here}}
+++a;
+  }
 #pragma omp target
   {
 #pragma omp taskloop
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,10 @@
   }
   assert(I != CS->body_end() && "Not found statement");
   S = *I;
+} else {
+  auto *OED = dyn_cast(S);
+  if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()))
+OMPTeamsFound = false;
 }
 if (!OMPTeamsFound) {
   Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);


Index: test/OpenMP/nesting_of_regions.cpp
===
--- test/OpenMP/nesting_of_regions.cpp
+++ test/OpenMP/nesting_of_regions.cpp
@@ -2867,6 +2867,12 @@
 #pragma omp teams  // expected-note {{nested teams construct here}}
 ++a;
   }
+#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
+  {
+while (0)  // expected-note {{statement outside teams construct here}}
+#pragma omp teams  // expected-note {{nested teams construct here}}
+++a;
+  }
 #pragma omp target
   {
 #pragma omp taskloop
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,10 @@
   }
   assert(I != CS->body_end() && "Not found statement");
   S = *I;
+} else {
+  auto *OED = dyn_cast(S);
+  if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()))
+OMPTeamsFound = false;
 }
 if (!OMPTeamsFound) {
   Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-22 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi David,

This fix looks good but you have to add a regression test for it.

Thanks,
Samuel


http://reviews.llvm.org/D21617



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


Re: [PATCH] D21611: Fix small structures calling convention issue for some big endian architectures

2016-06-22 Thread John McCall via cfe-commits
rjmccall added a comment.

Oh, floats are promoted to doubles in varargs, of course, which neatly makes 
that an impossible situation.

My inclination is that the right condition here is that only integer types 
should be right-justified in their slot, but I'll admit to not having an easy 
example of a type for which your condition doesn't work.


http://reviews.llvm.org/D21611



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


r273471 - [driver] Remove one more bunch of empty 'test inputs' folders. NFC

2016-06-22 Thread Simon Atanasyan via cfe-commits
Author: atanasyan
Date: Wed Jun 22 15:30:26 2016
New Revision: 273471

URL: http://llvm.org/viewvc/llvm-project?rev=273471=rev
Log:
[driver] Remove one more bunch of empty 'test inputs' folders. NFC

Removed:
cfe/trunk/test/Driver/Inputs/basic_nacl_tree/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/micromips/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/micromips/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips16/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips16/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/mips16/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/mips16/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/64/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/64/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/micromips/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/micromips/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips16/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips16/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips32/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips32/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/64/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/fp64/
cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/el/fp64/
cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/micromips/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/micromips/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips16/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips16/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/mips16/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/mips16/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips64/64/el/fp64/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips64/64/fp64/


r273468 - [driver] Remove empty folders from the Inputs folder for the driver's tests. NFC

2016-06-22 Thread Simon Atanasyan via cfe-commits
Author: atanasyan
Date: Wed Jun 22 15:20:51 2016
New Revision: 273468

URL: http://llvm.org/viewvc/llvm-project?rev=273468=rev
Log:
[driver] Remove empty folders from the Inputs folder for the driver's tests. NFC

Removed:
cfe/trunk/test/Driver/Inputs/android_triple_version/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/micromips/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/micromips/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips16/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips16/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/mips16/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips32/mips16/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/64/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/64/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/64/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/64/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/lib/gcc/mips-mti-linux-gnu/4.9.0/mips64r2/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/micromips/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/micromips/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips16/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips16/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips32/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips32/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/64/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/64/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/el/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/fp64/bits/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/micromips/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/micromips/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips16/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips16/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/el/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/fp64/nan2008/

cfe/trunk/test/Driver/Inputs/mips_fsf_tree/mips-mti-linux-gnu/lib/mips32/mips16/el/fp64/nan2008/

[PATCH] D21619: [Sema] Implement C++14's DR1579: Prefer moving id-expression out of functions

2016-06-22 Thread Erik Pilkington via cfe-commits
erik.pilkington created this revision.
erik.pilkington added reviewers: rsmith, faisalv.
erik.pilkington added a subscriber: cfe-commits.

DR1579 says that when returning a id-expression from a function, we should 
attempt to return said expression by move first, then fallback to copy.

This patch does this by generalizing `PerformMoveOrCopyElision`, which 
previously did this when returning a id-expression that was a parameter.

This patch allows the following code to compile, for example:
```
struct Base {};
struct Derived : public Base {};
std::unique_ptr f() {
  std::unique_ptr d;
  return d;
}
```
The DR in question: 
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579
Pointed out by PR27785.

Thanks!

http://reviews.llvm.org/D21619

Files:
  include/clang/Sema/Initialization.h
  include/clang/Sema/Sema.h
  lib/Sema/SemaStmt.cpp
  test/SemaCXX/rval-references.cpp

Index: test/SemaCXX/rval-references.cpp
===
--- test/SemaCXX/rval-references.cpp
+++ test/SemaCXX/rval-references.cpp
@@ -72,23 +72,71 @@
 // Test the return dance. This also tests IsReturnCopyElidable.
 struct MoveOnly {
   MoveOnly();
-  MoveOnly(const MoveOnly&) = delete;	// expected-note {{candidate constructor}} \
-  // expected-note 3{{explicitly marked deleted here}}
-  MoveOnly(MoveOnly&&);	// expected-note {{candidate constructor}}
-  MoveOnly(int&&);	// expected-note {{candidate constructor}}
+  MoveOnly(const MoveOnly&) = delete;	// expected-note 3{{explicitly marked deleted here}}
 };
 
 MoveOnly gmo;
 MoveOnly returningNonEligible() {
-  int i;
   static MoveOnly mo;
   MoveOnly  = mo;
   if (0) // Copy from global can't be elided
 return gmo; // expected-error {{call to deleted constructor}}
   else if (0) // Copy from local static can't be elided
 return mo; // expected-error {{call to deleted constructor}}
-  else if (0) // Copy from reference can't be elided
+  else // Copy from reference can't be elided
 return r; // expected-error {{call to deleted constructor}}
-  else // Construction from different type can't be elided
-return i; // expected-error {{no viable conversion from returned value of type 'int' to function return type 'MoveOnly'}}
 }
+
+template
+struct GenericMoveOnly {
+  GenericMoveOnly();
+  template GenericMoveOnly(const GenericMoveOnly &) = delete; // expected-note 5 {{marked deleted here}}
+  GenericMoveOnly(const int &) = delete; // expected-note 2 {{marked deleted here}}
+  template GenericMoveOnly(GenericMoveOnly &&);
+  GenericMoveOnly(int &&);
+};
+
+GenericMoveOnly CWG1579_Eligible(GenericMoveOnly CharMO) {
+  int i;
+  GenericMoveOnly GMO;
+
+  if (0)
+return i;
+  else if (0)
+return GMO;
+  else if (0)
+return ((GMO));
+  else
+return CharMO;
+}
+
+GenericMoveOnly GlobalMO;
+
+GenericMoveOnly CWG1579_Ineligible(int ,
+  GenericMoveOnly ) {
+  static GenericMoveOnly StaticMove;
+  extern GenericMoveOnly ExternMove;
+
+  if (0)
+return AnInt; // expected-error{{invokes a deleted function}}
+  else if (0)
+return GlobalMO; // expected-error{{invokes a deleted function}}
+  else if (0)
+return StaticMove; // expected-error{{invokes a deleted function}}
+  else if (0)
+return ExternMove; // expected-error{{invokes a deleted function}}
+  else if (0)
+return AnInt; // expected-error{{invokes a deleted function}}
+  else
+return CharMO; // expected-error{{invokes a deleted function}}
+}
+
+auto CWG1579_lambda_valid = [](GenericMoveOnly mo) ->
+  GenericMoveOnly {
+  return mo;
+};
+
+auto CWG1579_lambda_invalid = []() -> GenericMoveOnly {
+  static GenericMoveOnly mo;
+  return mo; // expected-error{{invokes a deleted function}}
+};
Index: lib/Sema/SemaStmt.cpp
===
--- lib/Sema/SemaStmt.cpp
+++ lib/Sema/SemaStmt.cpp
@@ -2717,16 +2717,16 @@
 /// \param E The expression being returned from the function or block, or
 /// being thrown.
 ///
-/// \param AllowFunctionParameter Whether we allow function parameters to
-/// be considered NRVO candidates. C++ prohibits this for NRVO itself, but
-/// we re-use this logic to determine whether we should try to move as part of
-/// a return or throw (which does allow function parameters).
+/// \param AllowParamOrMoveConstructable Whether we allow function parameters or
+/// id-expressions that could be moved out of the function to be considered NRVO
+/// candidates. C++ prohibits these for NRVO itself, but we re-use this logic to
+/// determine whether we should try to move as part of a return or throw (which
+/// does allow function parameters).
 ///
 /// \returns The NRVO candidate variable, if the return statement may use the
 /// NRVO, or NULL if there is no such candidate.
-VarDecl *Sema::getCopyElisionCandidate(QualType ReturnType,
-   Expr *E,
-   bool 

Re: [PATCH] D21111: Avoid accessing an invalid PresumedLoc

2016-06-22 Thread Jordan Rose via cfe-commits
jordan_rose added a comment.

*ping*

I'm happy to have someone else review this (or "LGTM" this), but it's so small 
that I'm not sure who else to ask. I'd rather not just commit it cause it's 
been a while since I've touched Clang.


Repository:
  rL LLVM

http://reviews.llvm.org/D2



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


r273465 - [driver][mips] Factor out findMIPSMultilibs code into separate functions. NFC

2016-06-22 Thread Simon Atanasyan via cfe-commits
Author: atanasyan
Date: Wed Jun 22 15:00:50 2016
New Revision: 273465

URL: http://llvm.org/viewvc/llvm-project?rev=273465=rev
Log:
[driver][mips] Factor out findMIPSMultilibs code into separate functions. NFC

The findMIPSMultilibs is too long. One more reason for splitting is to
escape redundant calls of MultilibSet::FilterOut method which lead to
disk access.

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

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=273465=273464=273465=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jun 22 15:00:50 2016
@@ -1846,37 +1846,150 @@ static Multilib makeMultilib(StringRef c
   return Multilib(commonSuffix, commonSuffix, commonSuffix);
 }
 
-static bool findMIPSMultilibs(const Driver , const llvm::Triple 
,
-  StringRef Path, const ArgList ,
-  DetectedMultilibs ) {
-  // Some MIPS toolchains put libraries and object files compiled
-  // using different options in to the sub-directoris which names
-  // reflects the flags used for compilation. For example sysroot
-  // directory might looks like the following examples:
-  //
-  // /usr
-  //   /lib  <= crt*.o files compiled with '-mips32'
-  // /mips16
-  //   /usr
-  // /lib<= crt*.o files compiled with '-mips16'
-  //   /el
-  // /usr
-  //   /lib  <= crt*.o files compiled with '-mips16 -EL'
-  //
-  // or
-  //
-  // /usr
-  //   /lib  <= crt*.o files compiled with '-mips32r2'
-  // /mips16
-  //   /usr
-  // /lib<= crt*.o files compiled with '-mips32r2 -mips16'
-  // /mips32
-  // /usr
-  //   /lib  <= crt*.o files compiled with '-mips32'
+static bool findMipsCsMultilibs(const Multilib::flags_list ,
+FilterNonExistent ,
+DetectedMultilibs ) {
+  // Check for Code Sourcery toolchain multilibs
+  MultilibSet CSMipsMultilibs;
+  {
+auto MArchMips16 = makeMultilib("/mips16").flag("+m32").flag("+mips16");
 
-  FilterNonExistent NonExistent(Path, "/crtbegin.o", D.getVFS());
+auto MArchMicroMips =
+makeMultilib("/micromips").flag("+m32").flag("+mmicromips");
+
+auto MArchDefault = makeMultilib("").flag("-mips16").flag("-mmicromips");
+
+auto UCLibc = makeMultilib("/uclibc").flag("+muclibc");
+
+auto SoftFloat = makeMultilib("/soft-float").flag("+msoft-float");
+
+auto Nan2008 = makeMultilib("/nan2008").flag("+mnan=2008");
+
+auto DefaultFloat =
+makeMultilib("").flag("-msoft-float").flag("-mnan=2008");
+
+auto BigEndian = makeMultilib("").flag("+EB").flag("-EL");
+
+auto LittleEndian = makeMultilib("/el").flag("+EL").flag("-EB");
+
+// Note that this one's osSuffix is ""
+auto MAbi64 = makeMultilib("")
+  .gccSuffix("/64")
+  .includeSuffix("/64")
+  .flag("+mabi=n64")
+  .flag("-mabi=n32")
+  .flag("-m32");
+
+CSMipsMultilibs =
+MultilibSet()
+.Either(MArchMips16, MArchMicroMips, MArchDefault)
+.Maybe(UCLibc)
+.Either(SoftFloat, Nan2008, DefaultFloat)
+.FilterOut("/micromips/nan2008")
+.FilterOut("/mips16/nan2008")
+.Either(BigEndian, LittleEndian)
+.Maybe(MAbi64)
+.FilterOut("/mips16.*/64")
+.FilterOut("/micromips.*/64")
+.FilterOut(NonExistent)
+.setIncludeDirsCallback([](const Multilib ) {
+  std::vector Dirs({"/include"});
+  if (StringRef(M.includeSuffix()).startswith("/uclibc"))
+Dirs.push_back(
+"/../../../../mips-linux-gnu/libc/uclibc/usr/include");
+  else
+Dirs.push_back("/../../../../mips-linux-gnu/libc/usr/include");
+  return Dirs;
+});
+  }
+
+  MultilibSet DebianMipsMultilibs;
+  {
+Multilib MAbiN32 =
+Multilib().gccSuffix("/n32").includeSuffix("/n32").flag("+mabi=n32");
+
+Multilib M64 = Multilib()
+   .gccSuffix("/64")
+   .includeSuffix("/64")
+   .flag("+m64")
+   .flag("-m32")
+   .flag("-mabi=n32");
 
-  // Check for CodeScape MTI toolchain v1.2 and early.
+Multilib M32 = Multilib().flag("-m64").flag("+m32").flag("-mabi=n32");
+
+DebianMipsMultilibs =
+MultilibSet().Either(M32, M64, MAbiN32).FilterOut(NonExistent);
+  }
+
+  // Sort candidates. Toolchain that best meets the directories tree goes 
first.
+  // Then select the first toolchains matches command line flags.
+  MultilibSet *Candidates[] = {, };
+  if (CSMipsMultilibs.size() < DebianMipsMultilibs.size())
+std::iter_swap(Candidates, 

Re: [PATCH] D20880: [Coverage] Push a region and propagate counts through try blocks

2016-06-22 Thread Vedant Kumar via cfe-commits
vsk abandoned this revision.
vsk added a comment.

This change is probably too minor for pre-commit review. I rebased the patch 
and committed r273463: I'd be happy to make any changes to it if requested.


http://reviews.llvm.org/D20880



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


r273463 - [Coverage] Push a new region when handling CXXTryStmts

2016-06-22 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun 22 14:57:58 2016
New Revision: 273463

URL: http://llvm.org/viewvc/llvm-project?rev=273463=rev
Log:
[Coverage] Push a new region when handling CXXTryStmts

Push a new region for the try block and propagate execution counts
through it. This ensures that catch statements get a region counter
distinct from the try block's counter.

Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/test/CoverageMapping/trycatch.cpp
cfe/trunk/test/CoverageMapping/trymacro.cpp

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=273463=273462=273463=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Jun 22 14:57:58 2016
@@ -867,7 +867,12 @@ struct CounterCoverageMappingBuilder
 
   void VisitCXXTryStmt(const CXXTryStmt *S) {
 extendRegion(S);
-Visit(S->getTryBlock());
+// Handle macros that generate the "try" but not the rest.
+extendRegion(S->getTryBlock());
+
+Counter ParentCount = getRegion().getCounter();
+propagateCounts(ParentCount, S->getTryBlock());
+
 for (unsigned I = 0, E = S->getNumHandlers(); I < E; ++I)
   Visit(S->getHandler(I));
 

Modified: cfe/trunk/test/CoverageMapping/trycatch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/trycatch.cpp?rev=273463=273462=273463=diff
==
--- cfe/trunk/test/CoverageMapping/trycatch.cpp (original)
+++ cfe/trunk/test/CoverageMapping/trycatch.cpp Wed Jun 22 14:57:58 2016
@@ -23,7 +23,7 @@ void func(int i) {//
   // CHECK-NEXT: main
 int main() {  // CHECK-NEXT: File 0, [[@LINE]]:12 -> 
[[@LINE+13]]:2 = #0
   int j = 1;
-  try {
+  try {   // CHECK-NEXT: File 0, [[@LINE]]:7 -> 
[[@LINE+2]]:4 = #0
 func(j);
   } catch(const Error ) {   // CHECK-NEXT: File 0, [[@LINE]]:27 -> 
[[@LINE+2]]:4 = #2
 j = 1;

Modified: cfe/trunk/test/CoverageMapping/trymacro.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/trymacro.cpp?rev=273463=273462=273463=diff
==
--- cfe/trunk/test/CoverageMapping/trymacro.cpp (original)
+++ cfe/trunk/test/CoverageMapping/trymacro.cpp Wed Jun 22 14:57:58 2016
@@ -17,8 +17,27 @@ catch(...) {}   // CHECK: [[
 void fn3() TRY { return; } // CHECK: [[@LINE]]:15 -> [[@LINE+1]]:14 = #1
 CATCH(...) {}  // CHECK: [[@LINE]]:12 -> [[@LINE]]:14 = #2
 
+// CHECK: Z3fn4v:
+#define TRY2 try { // CHECK-DAG: File 1, [[@LINE]]:18 -> [[@LINE]]:19 = #1
+void fn4() TRY2 // CHECK-DAG: Expansion,File 0, [[@LINE]]:12 -> [[@LINE]]:16 = 
#1 (Expanded file = 1)
+  for (;;)
+return;
+}
+catch (...) {}
+
+// CHECK: Z3fn5v:
+#define TRY3 try { return; } catch (...) // CHECK-DAG: File 2, [[@LINE]]:18 -> 
[[@LINE]]:29 = #1
+#define TRY4 try { TRY3 { return; } } catch (...) // CHECK-DAG: Expansion,File 
1, [[@LINE]]:20 -> [[@LINE]]:24 = #1 (Expanded file = 2)
+void fn5() {
+  for (;;) {
+TRY4 { return; } // CHECK-DAG: Expansion,File 0, [[@LINE]]:5 -> 
[[@LINE]]:9 = #1 (Expanded file = 1)
+  }  // CHECK-DAG: File 0, [[@LINE-1]]:10 -> [[@LINE-1]]:21 = 
#5
+}
+
 int main() {
   fn1();
   fn2();
   fn3();
+  fn4();
+  fn5();
 }


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


[PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-22 Thread David S via cfe-commits
davidsh created this revision.
davidsh added reviewers: kkwli0, hubert.reinterpretcast.
davidsh added a subscriber: cfe-commits.

Clang fails to diagnose cases such as 
#pragma omp target
  while(0) {
#pragma omp teams
{}
  }


http://reviews.llvm.org/D21617

Files:
  lib/Sema/SemaOpenMP.cpp

Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,10 @@
   }
   assert(I != CS->body_end() && "Not found statement");
   S = *I;
+} else {
+  auto *OED = dyn_cast(S);
+  if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()))
+OMPTeamsFound = false;
 }
 if (!OMPTeamsFound) {
   Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);


Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,10 @@
   }
   assert(I != CS->body_end() && "Not found statement");
   S = *I;
+} else {
+  auto *OED = dyn_cast(S);
+  if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()))
+OMPTeamsFound = false;
 }
 if (!OMPTeamsFound) {
   Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273454 - [codeview] Set the new IntroducedVirtual debug info flag

2016-06-22 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Jun 22 13:34:45 2016
New Revision: 273454

URL: http://llvm.org/viewvc/llvm-project?rev=273454=rev
Log:
[codeview] Set the new IntroducedVirtual debug info flag

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=273454=273453=273454=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jun 22 13:34:45 2016
@@ -1195,6 +1195,15 @@ llvm::DISubprogram *CGDebugInfo::CreateC
   MicrosoftVTableContext::MethodVFTableLocation ML =
   CGM.getMicrosoftVTableContext().getMethodVFTableLocation(GD);
   VIndex = ML.Index;
+
+  // CodeView only records the vftable offset in the class that introduces
+  // the virtual method. This is possible because, unlike Itanium, the MS
+  // C++ ABI does not include all virtual methods from non-primary bases in
+  // the vtable for the most derived class. For example, if C inherits from
+  // A and B, C's primary vftable will not include B's virtual methods.
+  if (Method->begin_overridden_methods() == 
Method->end_overridden_methods())
+Flags |= llvm::DINode::FlagIntroducedVirtual;
+
   // FIXME: Pass down ML.VFPtrOffset and ML.VBTableIndex. The debugger 
needs
   // these to synthesize a call to a virtual method in a complex 
inheritance
   // hierarchy.

Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=273454=273453=273454=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Wed Jun 22 13:34:45 2016
@@ -10,10 +10,21 @@ struct Foo {
 };
 Foo f;
 Foo::Nested n;
+
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: 
DW_TAG_structure_type, name: "Foo",
 // CHECK-SAME: identifier: ".?AUFoo@@"
-// CHECK: !DISubprogram(name: "f", {{.*}} containingType: ![[Foo]], 
virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, {{.*}})
-// CHECK: !DISubprogram(name: "g", {{.*}} containingType: ![[Foo]], 
virtuality: DW_VIRTUALITY_virtual, virtualIndex: 1, {{.*}})
-// CHECK: !DISubprogram(name: "h", {{.*}} containingType: ![[Foo]], 
virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2, {{.*}})
+
+// CHECK: !DISubprogram(name: "f",
+// CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, 
virtualIndex: 0,
+// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
+
+// CHECK: !DISubprogram(name: "g",
+// CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, 
virtualIndex: 1,
+// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
+
+// CHECK: !DISubprogram(name: "h",
+// CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, 
virtualIndex: 2,
+// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
+
 // CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
 // CHECK-SAME: identifier: ".?AUNested@Foo@@"


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


Re: [PATCH] D21611: Fix small structures calling convention issue for some big endian architectures

2016-06-22 Thread John McCall via cfe-commits
rjmccall added a comment.

Hmm.  On MIPS64, a slot is 64 bits, right?  How is a float passed?


http://reviews.llvm.org/D21611



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


r273450 - Make this test a bit more strict and fix it.

2016-06-22 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Wed Jun 22 13:04:52 2016
New Revision: 273450

URL: http://llvm.org/viewvc/llvm-project?rev=273450=rev
Log:
Make this test a bit more strict and fix it.

We do pass -pic-level to cc1 when targeting darwin. Given that codegen
itself doesn't use it, the only difference is whether __PIE__ and
__pie__ are defined.

Modified:
cfe/trunk/test/Driver/pic.c

Modified: cfe/trunk/test/Driver/pic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/pic.c?rev=273450=273449=273450=diff
==
--- cfe/trunk/test/Driver/pic.c (original)
+++ cfe/trunk/test/Driver/pic.c Wed Jun 22 13:04:52 2016
@@ -7,9 +7,11 @@
 //
 // CHECK-PIC1: "-mrelocation-model" "pic"
 // CHECK-PIC1: "-pic-level" "1"
+// CHECK-PIC1-NOT: "-pie-level"
 //
 // CHECK-PIC2: "-mrelocation-model" "pic"
 // CHECK-PIC2: "-pic-level" "2"
+// CHECK-PIC2-NOT: "-pie-level"
 //
 // CHECK-STATIC: "-static"
 // CHECK-NO-STATIC-NOT: "-static"
@@ -151,10 +153,9 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIE
 //
 // Darwin is a beautiful and unique snowflake when it comes to these flags.
-// When targeting a 32-bit darwin system, the -fno-* flag variants work and
-// disable PIC, but any other flag enables PIC (*not* PIE) even if the flag
-// specifies PIE. On 64-bit targets, there is simply nothing you can do, there
-// is no PIE, there is only PIC when it comes to compilation.
+// When targeting a 32-bit darwin system, only level 2 is supported. On 64-bit
+// targets, there is simply nothing you can do, there is no PIE, there is only
+// PIC when it comes to compilation.
 // RUN: %clang -c %s -target i386-apple-darwin -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 // RUN: %clang -c %s -target i386-apple-darwin -fpic -### 2>&1 \
@@ -162,9 +163,9 @@
 // RUN: %clang -c %s -target i386-apple-darwin -fPIC -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 // RUN: %clang -c %s -target i386-apple-darwin -fpie -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
 // RUN: %clang -c %s -target i386-apple-darwin -fPIE -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIE -### 2>&1 \
@@ -172,7 +173,7 @@
 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -fpic -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -fPIE -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
 // RUN: %clang -c %s -target x86_64-apple-darwin -fno-PIC -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
 // RUN: %clang -c %s -target x86_64-apple-darwin -fno-PIE -### 2>&1 \


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


Re: [PATCH] D21507: Changes after running check modernize-use-emplace (D20964)

2016-06-22 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk.
vsk added a comment.

Neat! It would help to upload a git-clang-format'd. Fwiw I only managed to look 
over the changes in lib/{ARCMigrate,AST,Analysis}.

Have you run check-all and the full test-suite?


Repository:
  rL LLVM

http://reviews.llvm.org/D21507



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


Re: [PATCH] D21031: [OpenCL] Allow -cl-std and other standard -cl- options in driver

2016-06-22 Thread Aaron En Ye Shi via cfe-commits
ashi1 updated this revision to Diff 61574.
ashi1 marked 4 inline comments as done.
ashi1 added a comment.

Revised to Anastasia's comments.


http://reviews.llvm.org/D21031

Files:
  include/clang/Basic/DiagnosticFrontendKinds.td
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/opencl.cl

Index: test/Driver/opencl.cl
===
--- test/Driver/opencl.cl
+++ test/Driver/opencl.cl
@@ -1,15 +1,39 @@
-// RUN: %clang -fsyntax-only %s
-// RUN: %clang -fsyntax-only -std=cl %s
-// RUN: %clang -fsyntax-only -std=cl1.1 %s
-// RUN: %clang -fsyntax-only -std=cl1.2 %s
-// RUN: %clang -fsyntax-only -std=cl2.0 %s
-// RUN: %clang -fsyntax-only -std=CL %s
-// RUN: %clang -fsyntax-only -std=CL1.1 %s
-// RUN: %clang -fsyntax-only -std=CL1.2 %s
-// RUN: %clang -fsyntax-only -std=CL2.0 %s
-// RUN: not %clang_cc1 -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
-// RUN: not %clang_cc1 -std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
-// CHECK-C99: error: invalid argument '-std=c99' not allowed with 'OpenCL'
-// CHECK-INVALID: error: invalid value 'invalid' in '-std=invalid'
+// RUN: %clang -S -### -cl-std=CL %s | FileCheck --check-prefix=CHECK-CL %s
+// RUN: %clang -S -### -cl-std=CL1.1 %s | FileCheck --check-prefix=CHECK-CL11 %s
+// RUN: %clang -S -### -cl-std=CL1.2 %s | FileCheck --check-prefix=CHECK-CL12 %s
+// RUN: %clang -S -### -cl-std=CL2.0 %s | FileCheck --check-prefix=CHECK-CL20 %s
+// RUN: %clang -S -### -cl-opt-disable %s | FileCheck --check-prefix=CHECK-OPT-DISABLE %s
+// RUN: %clang -S -### -cl-strict-aliasing %s | FileCheck --check-prefix=CHECK-STRICT-ALIASING %s
+// RUN: %clang -S -### -cl-std=CL1.1 -cl-strict-aliasing %s | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION11 %s
+// RUN: %clang -S -### -cl-std=CL1.2 -cl-strict-aliasing %s | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION12 %s
+// RUN: %clang -S -### -cl-std=CL2.0 -cl-strict-aliasing %s | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION20 %s
+// RUN: %clang -S -### -cl-single-precision-constant %s | FileCheck --check-prefix=CHECK-SINGLE-PRECISION-CONST %s
+// RUN: %clang -S -### -cl-finite-math-only %s | FileCheck --check-prefix=CHECK-FINITE-MATH-ONLY %s
+// RUN: %clang -S -### -cl-kernel-arg-info %s | FileCheck --check-prefix=CHECK-KERNEL-ARG-INFO %s
+// RUN: %clang -S -### -cl-unsafe-math-optimizations %s | FileCheck --check-prefix=CHECK-UNSAFE-MATH-OPT %s
+// RUN: %clang -S -### -cl-fast-relaxed-math %s | FileCheck --check-prefix=CHECK-FAST-RELAXED-MATH %s
+// RUN: %clang -S -### -cl-mad-enable %s | FileCheck --check-prefix=CHECK-MAD-ENABLE %s
+// RUN: %clang -S -### -cl-denorms-are-zero %s | FileCheck --check-prefix=CHECK-DENORMS-ARE-ZERO %s
+// RUN: not %clang_cc1 -cl-std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: not %clang_cc1 -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
 
+// CHECK-CL: .*clang.* "-cc1" .* "-cl-std=CL"
+// CHECK-CL11: .*clang.* "-cc1" .* "-cl-std=CL1.1"
+// CHECK-CL12: .*clang.* "-cc1" .* "-cl-std=CL1.2"
+// CHECK-CL20: .*clang.* "-cc1" .* "-cl-std=CL2.0"
+// CHECK-OPT-DISABLE: .*clang.* "-cc1" .* "-cl-opt-disable"
+// CHECK-STRICT-ALIASING: .*clang.* "-cc1" .* "-cl-strict-aliasing"
+// CHECK-INVALID-OPENCL-VERSION11: OpenCL version 1.1 does not support the option 'cl-strict-aliasing'
+// CHECK-INVALID-OPENCL-VERSION12: OpenCL version 1.2 does not support the option 'cl-strict-aliasing'
+// CHECK-INVALID-OPENCL-VERSION20: OpenCL version 2.0 does not support the option 'cl-strict-aliasing'
+// CHECK-SINGLE-PRECISION-CONST: .*clang.* "-cc1" .* "-cl-single-precision-constant"
+// CHECK-FINITE-MATH-ONLY: .*clang.* "-cc1" .* "-cl-finite-math-only"
+// CHECK-KERNEL-ARG-INFO: .*clang.* "-cc1" .* "-cl-kernel-arg-info"
+// CHECK-UNSAFE-MATH-OPT: .*clang.* "-cc1" .* "-cl-unsafe-math-optimizations"
+// CHECK-FAST-RELAXED-MATH: .*clang.* "-cc1" .* "-cl-fast-relaxed-math"
+// CHECK-MAD-ENABLE: .*clang.* "-cc1" .* "-cl-mad-enable"
+// CHECK-DENORMS-ARE-ZERO: .*clang.* "-cc1" .* "-cl-denorms-are-zero"
+// CHECK-C99: error: invalid argument '-cl-std=c99' not allowed with 'OpenCL'
+// CHECK-INVALID: error: invalid value 'invalid' in '-cl-std=invalid'
+
 kernel void func(void);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -41,6 +41,7 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Target/TargetOptions.h"
+#include "llvm/Support/ScopedPrinter.h"
 #include 
 #include 
 #include 
@@ -1666,6 +1667,18 @@
   LangStd = OpenCLLangStd;
   }
 
+  // -cl-strict-aliasing needs to emit diagnostic in the case where CL > 1.0.
+  // This option should be deprecated for CL > 1.0 because
+  // this option 

Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Ismail Donmez via cfe-commits
Hi,

On Wed, Jun 22, 2016 at 7:55 PM, Liu, Yaxun (Sam)  wrote:
> The cmake of Cygwin itself does not support llvm. Which cmake did you use on 
> Cygwin? Thanks.

I use native windows cmake and this is the only test that ever failed
with this setup. chmod is from native cygwin which seems to be the
problem.

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


Re: [PATCH] D20352: Add XRay flags to Clang

2016-06-22 Thread Dean Michael Berris via cfe-commits
dberris updated this revision to Diff 61567.
dberris added a comment.

- Merge branch 'master' of http://llvm.org/git/clang into xray
- Merge branch 'master' of http://llvm.org/git/clang into xray
- Add runtime support for XRay


http://reviews.llvm.org/D20352

Files:
  include/clang/Basic/Attr.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/Sema/xray-always-instrument-attr.c
  test/Sema/xray-always-instrument-attr.cpp

Index: test/Sema/xray-always-instrument-attr.cpp
===
--- /dev/null
+++ test/Sema/xray-always-instrument-attr.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c++11 -x c++
+void foo [[clang::xray_always_instrument]] ();
+
+struct [[clang::xray_always_instrument]] a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}}
+
+class b {
+ void c [[clang::xray_always_instrument]] ();
+};
Index: test/Sema/xray-always-instrument-attr.c
===
--- /dev/null
+++ test/Sema/xray-always-instrument-attr.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11
+void foo() __attribute__((xray_always_instrument));
+
+struct __attribute__((xray_always_instrument)) a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5913,10 +5913,16 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
-
   case AttributeList::AT_RenderScriptKernel:
 handleSimpleAttribute(S, D, Attr);
 break;
+  // XRay attributes.
+  case AttributeList::AT_XRayAlwaysInstrument:
+handleSimpleAttribute(S, D, Attr);
+break;
+  case AttributeList::AT_XRayNeverInstrument:
+handleSimpleAttribute(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -680,6 +680,9 @@
   }
 
   Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
+  Opts.XRayInstrumentFunctions = Args.hasArg(OPT_fxray_instrument);
+  Opts.XRayInstructionThreshold =
+  getLastArgIntValue(Args, OPT_fxray_instruction_threshold_, 200, Diags);
   Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
   Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
   Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3159,6 +3159,28 @@
   return !StaticRuntimes.empty();
 }
 
+static bool addXRayRuntime(const ToolChain , const ArgList ,
+   ArgStringList ) {
+  if (Args.hasArg(options::OPT_fxray_instrument,
+  options::OPT_fnoxray_instrument, false)) {
+CmdArgs.push_back("-whole-archive");
+CmdArgs.push_back(TC.getCompilerRTArgString(Args, "xray", false));
+CmdArgs.push_back("-no-whole-archive");
+return true;
+  }
+  return false;
+}
+
+static void linkXRayRuntimeDeps(const ToolChain , ArgStringList ) {
+  CmdArgs.push_back("--no-as-needed");
+  CmdArgs.push_back("-lpthread");
+  CmdArgs.push_back("-lrt");
+  CmdArgs.push_back("-lm");
+  CmdArgs.push_back("-latomic");
+  if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)
+CmdArgs.push_back("-ldl");
+}
+
 static bool areOptimizationsEnabled(const ArgList ) {
   // Find the last -O arg and see if it is non-zero.
   if (Arg *A = Args.getLastArg(options::OPT_O_Group))
@@ -4557,6 +4579,16 @@
 
   Args.AddAllArgs(CmdArgs, options::OPT_finstrument_functions);
 
+  if (Args.hasArg(options::OPT_fxray_instrument,
+  options::OPT_fnoxray_instrument, false)) {
+CmdArgs.push_back("-fxray-instrument");
+if (Arg *A = Args.getLastArg(options::OPT_fxray_instruction_threshold_,
+ options::OPT_fxray_instruction_threshold_EQ)) {
+  CmdArgs.push_back("-fxray-instruction-threshold");
+  CmdArgs.push_back(A->getValue());
+}
+  }
+
   addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs);
 
   // Add runtime flag for PS4 when PGO or Coverage are enabled.
@@ -9290,6 +9322,7 @@
 CmdArgs.push_back("--no-demangle");
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+  bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
   // The profile runtime also needs access to system libraries.
   

r273441 - [analyzer] Teach ObjCDeallocChecker about XCTestCase

2016-06-22 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Wed Jun 22 12:03:10 2016
New Revision: 273441

URL: http://llvm.org/viewvc/llvm-project?rev=273441=rev
Log:
[analyzer] Teach ObjCDeallocChecker about XCTestCase

Like with SenTestCase, subclasses of XCTestCase follow a "tear down" idiom to
release instance variables and so typically do not release ivars in -dealloc.
This commit applies the existing special casing for SenTestCase to XCTestCase
as well.

rdar://problem/25884696

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/test/Analysis/DeallocMissingRelease.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=273441=273440=273441=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Wed Jun 22 
12:03:10 2016
@@ -98,8 +98,9 @@ class ObjCDeallocChecker
  check::PointerEscape,
  check::PreStmt> {
 
-  mutable IdentifierInfo *NSObjectII, *SenTestCaseII, *Block_releaseII,
- *CIFilterII;
+  mutable IdentifierInfo *NSObjectII, *SenTestCaseII, *XCTestCaseII,
+  *Block_releaseII, *CIFilterII;
+
   mutable Selector DeallocSel, ReleaseSel;
 
   std::unique_ptr MissingReleaseBugType;
@@ -760,9 +761,9 @@ bool ObjCDeallocChecker::diagnoseMistake
   return true;
 }
 
-ObjCDeallocChecker::
-ObjCDeallocChecker()
-: NSObjectII(nullptr), SenTestCaseII(nullptr), CIFilterII(nullptr) {
+ObjCDeallocChecker::ObjCDeallocChecker()
+: NSObjectII(nullptr), SenTestCaseII(nullptr), XCTestCaseII(nullptr),
+  CIFilterII(nullptr) {
 
   MissingReleaseBugType.reset(
   new BugType(this, "Missing ivar release (leak)",
@@ -784,6 +785,7 @@ void ObjCDeallocChecker::initIdentifierI
 
   NSObjectII = ("NSObject");
   SenTestCaseII = ("SenTestCase");
+  XCTestCaseII = ("XCTestCase");
   Block_releaseII = ("_Block_release");
   CIFilterII = ("CIFilter");
 
@@ -1023,11 +1025,11 @@ bool ObjCDeallocChecker::classHasSeparat
 if (II == NSObjectII)
   return false;
 
-// FIXME: For now, ignore classes that subclass SenTestCase, as these don't
-// need to implement -dealloc.  They implement tear down in another way,
-// which we should try and catch later.
+// FIXME: For now, ignore classes that subclass SenTestCase and XCTestCase,
+// as these don't need to implement -dealloc.  They implement tear down in
+// another way, which we should try and catch later.
 //  http://llvm.org/bugs/show_bug.cgi?id=3187
-if (II == SenTestCaseII)
+if (II == XCTestCaseII || II == SenTestCaseII)
   return true;
   }
 

Modified: cfe/trunk/test/Analysis/DeallocMissingRelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/DeallocMissingRelease.m?rev=273441=273440=273441=diff
==
--- cfe/trunk/test/Analysis/DeallocMissingRelease.m (original)
+++ cfe/trunk/test/Analysis/DeallocMissingRelease.m Wed Jun 22 12:03:10 2016
@@ -723,6 +723,28 @@ struct SomeStruct {
 }
 @end
 
+@interface XCTestCase : NSObject {}
+@end
+
+@interface MyClassXCTest : XCTestCase
+@property (retain) NSObject *ivar;
+@end
+
+@implementation MyClassXCTest
+-(void)tearDown {
+#if NON_ARC
+  [_ivar release];
+#endif
+}
+
+-(void)dealloc; {
+#if NON_ARC
+  [super dealloc]; // no-warning
+#endif
+}
+@end
+
+
 __attribute__((objc_root_class))
 @interface NonNSObjectMissingDealloc
 @property (retain) NSObject *ivar;


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


r273440 - Add support for /Ob1 and -finline-hint-functions flags

2016-06-22 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Jun 22 11:56:16 2016
New Revision: 273440

URL: http://llvm.org/viewvc/llvm-project?rev=273440=rev
Log:
Add support for /Ob1 and -finline-hint-functions flags

Add support for /Ob1 (and equivalent -finline-hint-functions), which enable
inlining only for functions marked inline, either explicitly (via inline
keyword, for example), or implicitly (function definition in class body,
for example).

This works by enabling inlining pass, and adding noinline attribute to
every function not marked inline.

Patch by Rudy Pons !

Differential Revision: http://reviews.llvm.org/D20647

Added:
cfe/trunk/test/CodeGenCXX/inline-hint.cpp
Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/inline-optim.c
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=273440=273439=273440=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Wed Jun 22 11:56:16 2016
@@ -291,7 +291,6 @@ def _SLASH_FS : CLIgnoredFlag<"FS">, Hel
 def _SLASH_GF : CLIgnoredFlag<"GF">;
 def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">;
 def _SLASH_nologo : CLIgnoredFlag<"nologo">;
-def _SLASH_Ob1 : CLIgnoredFlag<"Ob1">;
 def _SLASH_Og : CLIgnoredFlag<"Og">;
 def _SLASH_openmp_ : CLIgnoredFlag<"openmp-">;
 def _SLASH_RTC : CLIgnoredJoined<"RTC">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=273440=273439=273440=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Jun 22 11:56:16 2016
@@ -746,7 +746,10 @@ def fgnu_runtime : Flag<["-"], "fgnu-run
 def fheinous_gnu_extensions : Flag<["-"], "fheinous-gnu-extensions">, 
Flags<[CC1Option]>;
 def filelist : Separate<["-"], "filelist">, Flags<[LinkerInput]>;
 def : Flag<["-"], "findirect-virtual-calls">, Alias;
-def finline_functions : Flag<["-"], "finline-functions">, 
Group, Flags<[CC1Option]>;
+def finline_functions : Flag<["-"], "finline-functions">, 
Group, Flags<[CC1Option]>,
+  HelpText<"Inline suitable functions">;
+def finline_hint_functions: Flag<["-"], "finline-hint-functions">, 
Group, Flags<[CC1Option]>,
+  HelpText<"Inline functions wich are (explicitly or implicitly) marked 
inline">;
 def finline : Flag<["-"], "finline">, Group;
 def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group;
 def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group;

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=273440=273439=273440=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Wed Jun 22 11:56:16 2016
@@ -46,6 +46,7 @@ public:
   enum InliningMethod {
 NoInlining, // Perform no inlining whatsoever.
 NormalInlining, // Use the standard function inlining pass.
+OnlyHintInlining,   // Inline only (implicitly) hinted functions.
 OnlyAlwaysInlining  // Only run the always inlining pass.
   };
 

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=273440=273439=273440=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Jun 22 11:56:16 2016
@@ -328,7 +328,8 @@ void EmitAssemblyHelper::CreatePasses(Mo
   switch (Inlining) {
   case CodeGenOptions::NoInlining:
 break;
-  case CodeGenOptions::NormalInlining: {
+  case CodeGenOptions::NormalInlining:
+  case CodeGenOptions::OnlyHintInlining: {
 PMBuilder.Inliner =
 createFunctionInliningPass(OptLevel, CodeGenOpts.OptimizeSize);
 break;

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=273440=273439=273440=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Jun 22 11:56:16 2016
@@ -686,14 +686,20 @@ void 

Re: [PATCH] D20647: Add support for /Ob1 and -finline-hint-functions flags

2016-06-22 Thread Hans Wennborg via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273440: Add support for /Ob1 and -finline-hint-functions 
flags (authored by hans).

Changed prior to commit:
  http://reviews.llvm.org/D20647?vs=61418=61565#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20647

Files:
  cfe/trunk/include/clang/Driver/CLCompatOptions.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
  cfe/trunk/lib/Driver/MSVCToolChain.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/inline-optim.c
  cfe/trunk/test/CodeGenCXX/inline-hint.cpp
  cfe/trunk/test/Driver/cl-options.c

Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h
@@ -46,6 +46,7 @@
   enum InliningMethod {
 NoInlining, // Perform no inlining whatsoever.
 NormalInlining, // Use the standard function inlining pass.
+OnlyHintInlining,   // Inline only (implicitly) hinted functions.
 OnlyAlwaysInlining  // Only run the always inlining pass.
   };
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -746,7 +746,10 @@
 def fheinous_gnu_extensions : Flag<["-"], "fheinous-gnu-extensions">, Flags<[CC1Option]>;
 def filelist : Separate<["-"], "filelist">, Flags<[LinkerInput]>;
 def : Flag<["-"], "findirect-virtual-calls">, Alias;
-def finline_functions : Flag<["-"], "finline-functions">, Group, Flags<[CC1Option]>;
+def finline_functions : Flag<["-"], "finline-functions">, Group, Flags<[CC1Option]>,
+  HelpText<"Inline suitable functions">;
+def finline_hint_functions: Flag<["-"], "finline-hint-functions">, Group, Flags<[CC1Option]>,
+  HelpText<"Inline functions wich are (explicitly or implicitly) marked inline">;
 def finline : Flag<["-"], "finline">, Group;
 def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group;
 def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group;
Index: cfe/trunk/include/clang/Driver/CLCompatOptions.td
===
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td
@@ -291,7 +291,6 @@
 def _SLASH_GF : CLIgnoredFlag<"GF">;
 def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">;
 def _SLASH_nologo : CLIgnoredFlag<"nologo">;
-def _SLASH_Ob1 : CLIgnoredFlag<"Ob1">;
 def _SLASH_Og : CLIgnoredFlag<"Og">;
 def _SLASH_openmp_ : CLIgnoredFlag<"openmp-">;
 def _SLASH_RTC : CLIgnoredJoined<"RTC">;
Index: cfe/trunk/test/CodeGen/inline-optim.c
===
--- cfe/trunk/test/CodeGen/inline-optim.c
+++ cfe/trunk/test/CodeGen/inline-optim.c
@@ -2,6 +2,7 @@
 
 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+// RUN: %clang_cc1 -triple i686-pc-win32 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
 // RUN: %clang_cc1 -triple i686-pc-win32 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
 
 inline int inline_hint(int a, int b) { return(a+b); }
@@ -13,14 +14,18 @@
 volatile int *pa = (int*) 0x1000;
 void foo() {
 // NOINLINE-LABEL: @foo
+// HINT-LABEL: @foo
 // INLINE-LABEL: @foo
 // NOINLINE: call i32 @inline_hint
+// HINT-NOT: call i32 @inline_hint
 // INLINE-NOT: call i32 @inline_hint
 pa[0] = inline_hint(pa[1],pa[2]);
 // NOINLINE-NOT: call i32 @inline_always
+// HINT-NOT: call i32 @inline_always
 // INLINE-NOT: call i32 @inline_always
 pa[3] = inline_always(pa[4],pa[5]);
 // NOINLINE: call i32 @inline_no_hint
+// HINT: call i32 @inline_no_hint
 // INLINE-NOT: call i32 @inline_no_hint
 pa[6] = inline_no_hint(pa[7], pa[8]);
 }
Index: cfe/trunk/test/Driver/cl-options.c
===
--- cfe/trunk/test/Driver/cl-options.c
+++ cfe/trunk/test/Driver/cl-options.c
@@ -113,6 +113,10 @@
 // Ob2-NOT: warning: argument unused during compilation: '/O2'
 // Ob2: -finline-functions
 
+// RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
+// RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
+// Ob1: -finline-hint-functions
+
 // RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
 // Od: -O0
 
@@ -280,7 +284,6 @@
 // RUN:/GS- \
 // RUN:/kernel- \
 // RUN:/nologo \
-// RUN:/Ob1 \
 // RUN:/openmp- \
 // RUN:/RTC1 \
 // RUN:/sdl \
Index: 

RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Liu, Yaxun (Sam) via cfe-commits
The cmake of Cygwin itself does not support llvm. Which cmake did you use on 
Cygwin? Thanks.

Sam

-Original Message-
From: Ismail Donmez [mailto:ism...@i10z.com] 
Sent: Wednesday, June 22, 2016 12:37 PM
To: Liu, Yaxun (Sam) 
Cc: cfe-commits 
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

On Wed, Jun 22, 2016 at 5:45 PM, Liu, Yaxun (Sam)  wrote:
> $ "chmod" "u-w"
> "C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
> # command stderr:
> r.cl.tmp/*: invalid mode: 'mp/*'
>
> the error msg is strange. On my Cygwin I got different error:
> chmod: cannot access 
> 'C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output
> \opencl-c-header.cl.tmp/*': No such file or directory
>
> This is because * is not expanded when quoted.

Actually I added the quotes to test if it fixes the issue. Since you have 
cygwin can you reproduce the error?

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


Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-22 Thread Vedant Kumar via cfe-commits
vsk abandoned this revision.
vsk added a comment.

Thanks for the valuable feedback! I'll keep all of it in mind when writing 
checks in the future.

I'm closing this revision since http://reviews.llvm.org/D20964 is in.


http://reviews.llvm.org/D21185



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


Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Ismail Donmez via cfe-commits
On Wed, Jun 22, 2016 at 5:45 PM, Liu, Yaxun (Sam)  wrote:
> $ "chmod" "u-w"
> "C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
> # command stderr:
> r.cl.tmp/*: invalid mode: 'mp/*'
>
> the error msg is strange. On my Cygwin I got different error:
> chmod: cannot access 
> 'C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*':
>  No such file or directory
>
> This is because * is not expanded when quoted.

Actually I added the quotes to test if it fixes the issue. Since you
have cygwin can you reproduce the error?

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


[PATCH] D21611: Fix small structures calling convention issue for some big endian architectures

2016-06-22 Thread Strahinja Petrovic via cfe-commits
spetrovic created this revision.
spetrovic added reviewers: rjmccall, john.brawn, dsanders, petarj.
spetrovic added subscribers: cfe-commits, rankov, ivanbaev.
Herald added a reviewer: vkalintiris.
Herald added a subscriber: aemerson.

This patch fixes problem with passing structures and unions smaller than 
register as argument in variadic functions
on big endian architectures. 
For example passing 3 chars in a structure as argument of variadic function 
LLVM is passing those chars 
left-adjusted in register and trying to read them like they are right-adjusted, 
and that makes the problem.
I have changed reading of those arguments. Now LLVM reads them properly 
(left-adjusted). I detected
this problem on ARM32 big endian, MIPS32 big endian and MIPS64 big endian.

http://reviews.llvm.org/D21611

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/struct-union-BE.c

Index: test/CodeGen/struct-union-BE.c
===
--- test/CodeGen/struct-union-BE.c
+++ test/CodeGen/struct-union-BE.c
@@ -0,0 +1,48 @@
+// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS
+// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS64
+// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S 
-emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+
+#include 
+#include 
+
+struct tiny {
+  char c;
+};
+
+union data {
+  char c;
+};
+
+void fstr(int n, ...) {
+  struct tiny x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, struct tiny);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void funi(int n, ...) {
+  union data x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, union data);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void foo() {
+  struct tiny x[3];
+  union data y;
+  x[0].c = 10;
+  fstr(1, x[0]);
+  funi(1, y);
+}
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -272,7 +272,8 @@
 
   // If the argument is smaller than a slot, and this is a big-endian
   // target, the argument will be right-adjusted in its slot.
-  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian()) {
+  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
+  !DirectTy->isStructTy()) {
 Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
   }
 


Index: test/CodeGen/struct-union-BE.c
===
--- test/CodeGen/struct-union-BE.c
+++ test/CodeGen/struct-union-BE.c
@@ -0,0 +1,48 @@
+// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS
+// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS64
+// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S -emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+
+#include 
+#include 
+
+struct tiny {
+  char c;
+};
+
+union data {
+  char c;
+};
+
+void fstr(int n, ...) {
+  struct tiny x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, struct tiny);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void funi(int n, ...) {
+  union data x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, union data);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void foo() {
+  struct tiny x[3];
+  union data y;
+  x[0].c = 10;
+  fstr(1, x[0]);
+  funi(1, y);
+}
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -272,7 +272,8 @@
 
   // If the argument is smaller than a slot, and this is a big-endian
   // target, the argument will be right-adjusted in its slot.
-  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian()) {
+  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
+  !DirectTy->isStructTy()) {
 Addr = 

Re: [PATCH] D21566: Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

2016-06-22 Thread Hans Wennborg via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273434: Widen EHScope::ClenupBitFields::FixupDepth to avoid 
overflowing it (PR23490) (authored by hans).

Changed prior to commit:
  http://reviews.llvm.org/D21566?vs=61560=61563#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21566

Files:
  cfe/trunk/lib/CodeGen/CGCleanup.h
  cfe/trunk/test/CodeGen/fixup-depth-overflow.c

Index: cfe/trunk/test/CodeGen/fixup-depth-overflow.c
===
--- cfe/trunk/test/CodeGen/fixup-depth-overflow.c
+++ cfe/trunk/test/CodeGen/fixup-depth-overflow.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -O1 -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s
+
+#define M if (x) goto L1;
+#define M10 M M M M M M M M M M
+#define M100 M10 M10 M10 M10 M10 M10 M10 M10 M10 M10
+#define M1000 M100 M100 M100 M100 M100 M100 M100 M100 M100 M100
+
+void f(int x) {
+  int h;
+
+  // Many gotos to not-yet-emitted labels would cause EHScope's FixupDepth
+  // to overflow (PR23490).
+  M1000 M1000 M1000
+
+  if (x == 5) {
+// This will cause us to emit a clean-up of the stack variable. If the
+// FixupDepths are broken, fixups will erroneously get threaded through it.
+int i;
+  }
+
+L1:
+  return;
+}
+
+// CHECK-LABEL: define void @f
+// CHECK-NOT: cleanup
Index: cfe/trunk/lib/CodeGen/CGCleanup.h
===
--- cfe/trunk/lib/CodeGen/CGCleanup.h
+++ cfe/trunk/lib/CodeGen/CGCleanup.h
@@ -86,11 +86,6 @@
 /// The amount of extra storage needed by the Cleanup.
 /// Always a multiple of the scope-stack alignment.
 unsigned CleanupSize : 12;
-
-/// The number of fixups required by enclosing scopes (not including
-/// this one).  If this is the top cleanup scope, all the fixups
-/// from this index onwards belong to this scope.
-unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 12
   };
 
   class FilterBitFields {
@@ -188,6 +183,7 @@
EHScopeStack::stable_iterator enclosingEHScope)
 : EHScope(Catch, enclosingEHScope) {
 CatchBits.NumHandlers = numHandlers;
+assert(CatchBits.NumHandlers == numHandlers && "NumHandlers overflow?");
   }
 
   unsigned getNumHandlers() const {
@@ -263,6 +259,11 @@
   };
   mutable struct ExtInfo *ExtInfo;
 
+  /// The number of fixups required by enclosing scopes (not including
+  /// this one).  If this is the top cleanup scope, all the fixups
+  /// from this index onwards belong to this scope.
+  unsigned FixupDepth;
+
   struct ExtInfo () {
 if (!ExtInfo) ExtInfo = new struct ExtInfo();
 return *ExtInfo;
@@ -288,16 +289,16 @@
  unsigned cleanupSize, unsigned fixupDepth,
  EHScopeStack::stable_iterator enclosingNormal,
  EHScopeStack::stable_iterator enclosingEH)
-: EHScope(EHScope::Cleanup, enclosingEH), EnclosingNormal(enclosingNormal),
-  NormalBlock(nullptr), ActiveFlag(nullptr), ExtInfo(nullptr) {
+  : EHScope(EHScope::Cleanup, enclosingEH),
+EnclosingNormal(enclosingNormal), NormalBlock(nullptr),
+ActiveFlag(nullptr), ExtInfo(nullptr), FixupDepth(fixupDepth) {
 CleanupBits.IsNormalCleanup = isNormal;
 CleanupBits.IsEHCleanup = isEH;
 CleanupBits.IsActive = isActive;
 CleanupBits.IsLifetimeMarker = false;
 CleanupBits.TestFlagInNormalCleanup = false;
 CleanupBits.TestFlagInEHCleanup = false;
 CleanupBits.CleanupSize = cleanupSize;
-CleanupBits.FixupDepth = fixupDepth;
 
 assert(CleanupBits.CleanupSize == cleanupSize && "cleanup size overflow");
   }
@@ -343,7 +344,7 @@
 return CleanupBits.TestFlagInEHCleanup;
   }
 
-  unsigned getFixupDepth() const { return CleanupBits.FixupDepth; }
+  unsigned getFixupDepth() const { return FixupDepth; }
   EHScopeStack::stable_iterator getEnclosingNormalCleanup() const {
 return EnclosingNormal;
   }
@@ -451,6 +452,7 @@
   EHFilterScope(unsigned numFilters)
 : EHScope(Filter, EHScopeStack::stable_end()) {
 FilterBits.NumFilters = numFilters;
+assert(FilterBits.NumFilters == numFilters && "NumFilters overflow");
   }
 
   static size_t getSizeForNumFilters(unsigned numFilters) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273434 - Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

2016-06-22 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Jun 22 11:21:14 2016
New Revision: 273434

URL: http://llvm.org/viewvc/llvm-project?rev=273434=rev
Log:
Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

It currently only takes 2048 gotos to overflow the FixupDepth bitfield,
causing silent miscompilation. Apparently some parser generators run into
this (see PR).

I don't know that that data structure is terribly size sensitive anyway,
and since there's no room to widen the bitfield, let's just use a separate
word in EHCatchScope for it.

Differential Revision: http://reviews.llvm.org/D21566

Added:
cfe/trunk/test/CodeGen/fixup-depth-overflow.c
Modified:
cfe/trunk/lib/CodeGen/CGCleanup.h

Modified: cfe/trunk/lib/CodeGen/CGCleanup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.h?rev=273434=273433=273434=diff
==
--- cfe/trunk/lib/CodeGen/CGCleanup.h (original)
+++ cfe/trunk/lib/CodeGen/CGCleanup.h Wed Jun 22 11:21:14 2016
@@ -86,11 +86,6 @@ protected:
 /// The amount of extra storage needed by the Cleanup.
 /// Always a multiple of the scope-stack alignment.
 unsigned CleanupSize : 12;
-
-/// The number of fixups required by enclosing scopes (not including
-/// this one).  If this is the top cleanup scope, all the fixups
-/// from this index onwards belong to this scope.
-unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 12
   };
 
   class FilterBitFields {
@@ -188,6 +183,7 @@ public:
EHScopeStack::stable_iterator enclosingEHScope)
 : EHScope(Catch, enclosingEHScope) {
 CatchBits.NumHandlers = numHandlers;
+assert(CatchBits.NumHandlers == numHandlers && "NumHandlers overflow?");
   }
 
   unsigned getNumHandlers() const {
@@ -263,6 +259,11 @@ class LLVM_ALIGNAS(/*alignof(uint64_t)*/
   };
   mutable struct ExtInfo *ExtInfo;
 
+  /// The number of fixups required by enclosing scopes (not including
+  /// this one).  If this is the top cleanup scope, all the fixups
+  /// from this index onwards belong to this scope.
+  unsigned FixupDepth;
+
   struct ExtInfo () {
 if (!ExtInfo) ExtInfo = new struct ExtInfo();
 return *ExtInfo;
@@ -288,8 +289,9 @@ public:
  unsigned cleanupSize, unsigned fixupDepth,
  EHScopeStack::stable_iterator enclosingNormal,
  EHScopeStack::stable_iterator enclosingEH)
-: EHScope(EHScope::Cleanup, enclosingEH), EnclosingNormal(enclosingNormal),
-  NormalBlock(nullptr), ActiveFlag(nullptr), ExtInfo(nullptr) {
+  : EHScope(EHScope::Cleanup, enclosingEH),
+EnclosingNormal(enclosingNormal), NormalBlock(nullptr),
+ActiveFlag(nullptr), ExtInfo(nullptr), FixupDepth(fixupDepth) {
 CleanupBits.IsNormalCleanup = isNormal;
 CleanupBits.IsEHCleanup = isEH;
 CleanupBits.IsActive = isActive;
@@ -297,7 +299,6 @@ public:
 CleanupBits.TestFlagInNormalCleanup = false;
 CleanupBits.TestFlagInEHCleanup = false;
 CleanupBits.CleanupSize = cleanupSize;
-CleanupBits.FixupDepth = fixupDepth;
 
 assert(CleanupBits.CleanupSize == cleanupSize && "cleanup size overflow");
   }
@@ -343,7 +344,7 @@ public:
 return CleanupBits.TestFlagInEHCleanup;
   }
 
-  unsigned getFixupDepth() const { return CleanupBits.FixupDepth; }
+  unsigned getFixupDepth() const { return FixupDepth; }
   EHScopeStack::stable_iterator getEnclosingNormalCleanup() const {
 return EnclosingNormal;
   }
@@ -451,6 +452,7 @@ public:
   EHFilterScope(unsigned numFilters)
 : EHScope(Filter, EHScopeStack::stable_end()) {
 FilterBits.NumFilters = numFilters;
+assert(FilterBits.NumFilters == numFilters && "NumFilters overflow");
   }
 
   static size_t getSizeForNumFilters(unsigned numFilters) {

Added: cfe/trunk/test/CodeGen/fixup-depth-overflow.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/fixup-depth-overflow.c?rev=273434=auto
==
--- cfe/trunk/test/CodeGen/fixup-depth-overflow.c (added)
+++ cfe/trunk/test/CodeGen/fixup-depth-overflow.c Wed Jun 22 11:21:14 2016
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -O1 -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s
+
+#define M if (x) goto L1;
+#define M10 M M M M M M M M M M
+#define M100 M10 M10 M10 M10 M10 M10 M10 M10 M10 M10
+#define M1000 M100 M100 M100 M100 M100 M100 M100 M100 M100 M100
+
+void f(int x) {
+  int h;
+
+  // Many gotos to not-yet-emitted labels would cause EHScope's FixupDepth
+  // to overflow (PR23490).
+  M1000 M1000 M1000
+
+  if (x == 5) {
+// This will cause us to emit a clean-up of the stack variable. If the
+// FixupDepths are broken, fixups will erroneously get threaded through it.
+int i;
+  }
+
+L1:
+  return;
+}
+
+// CHECK-LABEL: define void @f
+// CHECK-NOT: cleanup


___
cfe-commits mailing list

Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-22 Thread Piotr Padlewski via cfe-commits
Prazek added a subscriber: Prazek.
Prazek added a comment.

In http://reviews.llvm.org/D21185#464517, @Eugene.Zelenko wrote:

> Since http://reviews.llvm.org/D20964 was committed, I think we should close 
> this.


Yep, I think the best idea is to take all the goodies from this check and add 
it to modernize-use-emplace


http://reviews.llvm.org/D21185



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


Re: [PATCH] D21566: Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

2016-06-22 Thread John McCall via cfe-commits
rjmccall added a comment.

That looks great, thanks.


http://reviews.llvm.org/D21566



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


Re: [PATCH] D21566: Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

2016-06-22 Thread Hans Wennborg via cfe-commits
hans added a comment.

Thanks for the review! Please take another look.



Comment at: lib/CodeGen/CGCleanup.h:93
@@ -92,3 +92,3 @@
 /// from this index onwards belong to this scope.
-unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 12
+unsigned FixupDepth;
   };

rjmccall wrote:
> This should just be pulled out of the BitFields structure and into the 
> EHCleanup class.
That's probably a better way to do it. Thanks.


http://reviews.llvm.org/D21566



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


Re: [PATCH] D21566: Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

2016-06-22 Thread Hans Wennborg via cfe-commits
hans updated this revision to Diff 61560.
hans marked 3 inline comments as done.
hans added a comment.

Addressing comments.


http://reviews.llvm.org/D21566

Files:
  lib/CodeGen/CGCleanup.h
  test/CodeGen/fixup-depth-overflow.c

Index: test/CodeGen/fixup-depth-overflow.c
===
--- /dev/null
+++ test/CodeGen/fixup-depth-overflow.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -O1 -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s
+
+#define M if (x) goto L1;
+#define M10 M M M M M M M M M M
+#define M100 M10 M10 M10 M10 M10 M10 M10 M10 M10 M10
+#define M1000 M100 M100 M100 M100 M100 M100 M100 M100 M100 M100
+
+void f(int x) {
+  int h;
+
+  // Many gotos to not-yet-emitted labels would cause EHScope's FixupDepth
+  // to overflow (PR23490).
+  M1000 M1000 M1000
+
+  if (x == 5) {
+// This will cause us to emit a clean-up of the stack variable. If the
+// FixupDepths are broken, fixups will erroneously get threaded through it.
+int i;
+  }
+
+L1:
+  return;
+}
+
+// CHECK-LABEL: define void @f
+// CHECK-NOT: cleanup
Index: lib/CodeGen/CGCleanup.h
===
--- lib/CodeGen/CGCleanup.h
+++ lib/CodeGen/CGCleanup.h
@@ -86,11 +86,6 @@
 /// The amount of extra storage needed by the Cleanup.
 /// Always a multiple of the scope-stack alignment.
 unsigned CleanupSize : 12;
-
-/// The number of fixups required by enclosing scopes (not including
-/// this one).  If this is the top cleanup scope, all the fixups
-/// from this index onwards belong to this scope.
-unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 12
   };
 
   class FilterBitFields {
@@ -188,6 +183,7 @@
EHScopeStack::stable_iterator enclosingEHScope)
 : EHScope(Catch, enclosingEHScope) {
 CatchBits.NumHandlers = numHandlers;
+assert(CatchBits.NumHandlers == numHandlers && "NumHandlers overflow?");
   }
 
   unsigned getNumHandlers() const {
@@ -263,6 +259,11 @@
   };
   mutable struct ExtInfo *ExtInfo;
 
+  /// The number of fixups required by enclosing scopes (not including
+  /// this one).  If this is the top cleanup scope, all the fixups
+  /// from this index onwards belong to this scope.
+  unsigned FixupDepth;
+
   struct ExtInfo () {
 if (!ExtInfo) ExtInfo = new struct ExtInfo();
 return *ExtInfo;
@@ -288,16 +289,16 @@
  unsigned cleanupSize, unsigned fixupDepth,
  EHScopeStack::stable_iterator enclosingNormal,
  EHScopeStack::stable_iterator enclosingEH)
-: EHScope(EHScope::Cleanup, enclosingEH), EnclosingNormal(enclosingNormal),
-  NormalBlock(nullptr), ActiveFlag(nullptr), ExtInfo(nullptr) {
+  : EHScope(EHScope::Cleanup, enclosingEH),
+EnclosingNormal(enclosingNormal), NormalBlock(nullptr),
+ActiveFlag(nullptr), ExtInfo(nullptr), FixupDepth(fixupDepth) {
 CleanupBits.IsNormalCleanup = isNormal;
 CleanupBits.IsEHCleanup = isEH;
 CleanupBits.IsActive = isActive;
 CleanupBits.IsLifetimeMarker = false;
 CleanupBits.TestFlagInNormalCleanup = false;
 CleanupBits.TestFlagInEHCleanup = false;
 CleanupBits.CleanupSize = cleanupSize;
-CleanupBits.FixupDepth = fixupDepth;
 
 assert(CleanupBits.CleanupSize == cleanupSize && "cleanup size overflow");
   }
@@ -343,7 +344,7 @@
 return CleanupBits.TestFlagInEHCleanup;
   }
 
-  unsigned getFixupDepth() const { return CleanupBits.FixupDepth; }
+  unsigned getFixupDepth() const { return FixupDepth; }
   EHScopeStack::stable_iterator getEnclosingNormalCleanup() const {
 return EnclosingNormal;
   }
@@ -451,6 +452,7 @@
   EHFilterScope(unsigned numFilters)
 : EHScope(Filter, EHScopeStack::stable_end()) {
 FilterBits.NumFilters = numFilters;
+assert(FilterBits.NumFilters == numFilters && "NumFilters overflow");
   }
 
   static size_t getSizeForNumFilters(unsigned numFilters) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21566: Widen EHScope::ClenupBitFields::FixupDepth to avoid overflowing it (PR23490)

2016-06-22 Thread John McCall via cfe-commits
rjmccall added a comment.

Yeah, 2048 is clearly too few.  The other changes aren't necessary; if we're 
going to try to be that generous, there's a lot of places in the AST that need 
to be updated.



Comment at: lib/CodeGen/CGCleanup.h:61
@@ -60,3 +60,3 @@
 
-unsigned NumHandlers : 32 - NumCommonBits;
+unsigned NumHandlers;
   };

This one seems unnecessary.  29 bits is fine.


Comment at: lib/CodeGen/CGCleanup.h:93
@@ -92,3 +92,3 @@
 /// from this index onwards belong to this scope.
-unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 12
+unsigned FixupDepth;
   };

This should just be pulled out of the BitFields structure and into the 
EHCleanup class.


Comment at: lib/CodeGen/CGCleanup.h:100
@@ -99,3 +99,3 @@
 
-unsigned NumFilters : 32 - NumCommonBits;
+unsigned NumFilters;
   };

This one is also unnecessary.


http://reviews.llvm.org/D21566



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


r273425 - [OpenCL] Use function metadata to represent kernel attributes

2016-06-22 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Wed Jun 22 09:56:35 2016
New Revision: 273425

URL: http://llvm.org/viewvc/llvm-project?rev=273425=rev
Log:
[OpenCL] Use function metadata to represent kernel attributes

This patch uses function metadata to represent reqd_work_group_size, 
work_group_size_hint and vector_type_hint kernel attributes and kernel argument 
info.

Differential Revision: http://reviews.llvm.org/D20979

Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl
cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl
cfe/trunk/test/CodeGenOpenCL/kernel-metadata.cl

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=273425=273424=273425=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Jun 22 09:56:35 2016
@@ -435,7 +435,6 @@ void CodeGenFunction::EmitMCountInstrume
 // includes the argument name, its type, the address and access qualifiers 
used.
 static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
  CodeGenModule , llvm::LLVMContext 
,
- SmallVector 
,
  CGBuilderTy , ASTContext ) {
   // Create MDNodes that represent the kernel arg metadata.
   // Each MDNode is a list in the form of "key", N number of values which is
@@ -445,28 +444,21 @@ static void GenOpenCLArgMetadata(const F
 
   // MDNode for the kernel argument address space qualifiers.
   SmallVector addressQuals;
-  addressQuals.push_back(llvm::MDString::get(Context, 
"kernel_arg_addr_space"));
 
   // MDNode for the kernel argument access qualifiers (images only).
   SmallVector accessQuals;
-  accessQuals.push_back(llvm::MDString::get(Context, 
"kernel_arg_access_qual"));
 
   // MDNode for the kernel argument type names.
   SmallVector argTypeNames;
-  argTypeNames.push_back(llvm::MDString::get(Context, "kernel_arg_type"));
 
   // MDNode for the kernel argument base type names.
   SmallVector argBaseTypeNames;
-  argBaseTypeNames.push_back(
-  llvm::MDString::get(Context, "kernel_arg_base_type"));
 
   // MDNode for the kernel argument type qualifiers.
   SmallVector argTypeQuals;
-  argTypeQuals.push_back(llvm::MDString::get(Context, "kernel_arg_type_qual"));
 
   // MDNode for the kernel argument names.
   SmallVector argNames;
-  argNames.push_back(llvm::MDString::get(Context, "kernel_arg_name"));
 
   for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
 const ParmVarDecl *parm = FD->getParamDecl(i);
@@ -577,13 +569,19 @@ static void GenOpenCLArgMetadata(const F
 argNames.push_back(llvm::MDString::get(Context, parm->getName()));
   }
 
-  kernelMDArgs.push_back(llvm::MDNode::get(Context, addressQuals));
-  kernelMDArgs.push_back(llvm::MDNode::get(Context, accessQuals));
-  kernelMDArgs.push_back(llvm::MDNode::get(Context, argTypeNames));
-  kernelMDArgs.push_back(llvm::MDNode::get(Context, argBaseTypeNames));
-  kernelMDArgs.push_back(llvm::MDNode::get(Context, argTypeQuals));
+  Fn->setMetadata("kernel_arg_addr_space",
+  llvm::MDNode::get(Context, addressQuals));
+  Fn->setMetadata("kernel_arg_access_qual",
+  llvm::MDNode::get(Context, accessQuals));
+  Fn->setMetadata("kernel_arg_type",
+  llvm::MDNode::get(Context, argTypeNames));
+  Fn->setMetadata("kernel_arg_base_type",
+  llvm::MDNode::get(Context, argBaseTypeNames));
+  Fn->setMetadata("kernel_arg_type_qual",
+  llvm::MDNode::get(Context, argTypeQuals));
   if (CGM.getCodeGenOpts().EmitOpenCLArgMetadata)
-kernelMDArgs.push_back(llvm::MDNode::get(Context, argNames));
+Fn->setMetadata("kernel_arg_name",
+llvm::MDNode::get(Context, argNames));
 }
 
 void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,
@@ -594,11 +592,7 @@ void CodeGenFunction::EmitOpenCLKernelMe
 
   llvm::LLVMContext  = getLLVMContext();
 
-  SmallVector kernelMDArgs;
-  kernelMDArgs.push_back(llvm::ConstantAsMetadata::get(Fn));
-
-  GenOpenCLArgMetadata(FD, Fn, CGM, Context, kernelMDArgs, Builder,
-   getContext());
+  GenOpenCLArgMetadata(FD, Fn, CGM, Context, Builder, getContext());
 
   if (const VecTypeHintAttr *A = FD->getAttr()) {
 QualType hintQTy = A->getTypeHint();
@@ -607,37 +601,29 @@ void CodeGenFunction::EmitOpenCLKernelMe
 hintQTy->isSignedIntegerType() ||
 (hintEltQTy && hintEltQTy->getElementType()->isSignedIntegerType());
 llvm::Metadata *attrMDArgs[] = {
-llvm::MDString::get(Context, "vec_type_hint"),
 llvm::ConstantAsMetadata::get(llvm::UndefValue::get(
 CGM.getTypes().ConvertType(A->getTypeHint(,
 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
 

Re: [PATCH] D21510: [libc++] Check hash before calling __hash_table key_eq function

2016-06-22 Thread Kwasi Mensah via cfe-commits
kmensah added a subscriber: kmensah.
kmensah added a comment.

Friendly Ping about this


Repository:
  rL LLVM

http://reviews.llvm.org/D21510



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


Re: [PATCH] D21031: [OpenCL] Allow -cl-std and other standard -cl- options in driver

2016-06-22 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Frontend/CompilerInvocation.cpp:1673
@@ +1672,3 @@
+  // this option was added for compatibility with OpenCL 1.0.
+  if (const Arg *A = Args.getLastArg(OPT_cl_strict_aliasing)) {
+const int OpenCLVer = Opts.OpenCLVersion;

Could you check the OpenCL version here instead?


Comment at: lib/Frontend/CompilerInvocation.cpp:1675
@@ +1674,3 @@
+const int OpenCLVer = Opts.OpenCLVersion;
+std::string VerSpec = llvm::to_string(OpenCLVer / 100) +
+  std::string (".") +

It seems OK to use Opts.OpenCLVersion directly!


Comment at: test/Driver/opencl.cl:1
@@ -1,13 +1,2 @@
-// RUN: %clang -fsyntax-only %s
-// RUN: %clang -fsyntax-only -std=cl %s
-// RUN: %clang -fsyntax-only -std=cl1.1 %s
-// RUN: %clang -fsyntax-only -std=cl1.2 %s
-// RUN: %clang -fsyntax-only -std=cl2.0 %s
-// RUN: %clang -fsyntax-only -std=CL %s
-// RUN: %clang -fsyntax-only -std=CL1.1 %s
-// RUN: %clang -fsyntax-only -std=CL1.2 %s
-// RUN: %clang -fsyntax-only -std=CL2.0 %s
-// RUN: not %clang_cc1 -std=c99 -DOPENCL %s 2>&1 | FileCheck 
--check-prefix=CHECK-C99 %s
-// RUN: not %clang_cc1 -std=invalid -DOPENCL %s 2>&1 | FileCheck 
--check-prefix=CHECK-INVALID %s
-// CHECK-C99: error: invalid argument '-std=c99' not allowed with 'OpenCL'
-// CHECK-INVALID: error: invalid value 'invalid' in '-std=invalid'
+// RUN: %clang -S -### %s
+// RUN: %clang -S -### -cl-std=CL %s | FileCheck --check-prefix=CHECK-CL %s

Since you are not checking anything here, do we even need this RUN line?


Comment at: test/Driver/opencl.cl:20
@@ +19,3 @@
+// RUN: not %clang_cc1 -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck 
--check-prefix=CHECK-INVALID %s
+// CHECK-C99: error: invalid argument '-cl-std=c99' not allowed with 'OpenCL'
+// CHECK-INVALID: error: invalid value 'invalid' in '-cl-std=invalid'

Could you please separate with an empty line here and order the CHECK lines the 
same way as RUN lines if possible. It will make it more readable then.

Thanks!


http://reviews.llvm.org/D21031



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


Re: [PATCH] D20647: Add support for /Ob1 and -finline-hint-functions flags

2016-06-22 Thread Rudy Pons via cfe-commits
Ilod added a comment.

Thanks.
I will let you submit it for me if everything seems ok.


http://reviews.llvm.org/D20647



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


Re: [PATCH] D20979: [OpenCL] Use function metadata to represent kernel attributes

2016-06-22 Thread Yaxun Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273425: [OpenCL] Use function metadata to represent kernel 
attributes (authored by yaxunl).

Changed prior to commit:
  http://reviews.llvm.org/D20979?vs=60545=61555#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20979

Files:
  cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
  cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl
  cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl
  cfe/trunk/test/CodeGenOpenCL/kernel-metadata.cl

Index: cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl
===
--- cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl
+++ cfe/trunk/test/CodeGenOpenCL/kernel-attributes.cl
@@ -3,14 +3,12 @@
 typedef unsigned int uint4 __attribute__((ext_vector_type(4)));
 
 kernel  __attribute__((vec_type_hint(int))) __attribute__((reqd_work_group_size(1,2,4))) void kernel1(int a) {}
+// CHECK: define void @kernel1(i32 %a) {{[^{]+}} !vec_type_hint ![[MD1:[0-9]+]] !reqd_work_group_size ![[MD2:[0-9]+]]
 
 kernel __attribute__((vec_type_hint(uint4))) __attribute__((work_group_size_hint(8,16,32))) void kernel2(int a) {}
+// CHECK: define void @kernel2(i32 %a) {{[^{]+}} !vec_type_hint ![[MD3:[0-9]+]] !work_group_size_hint ![[MD4:[0-9]+]]
 
-// CHECK: opencl.kernels = !{[[MDNODE0:![0-9]+]], [[MDNODE3:![0-9]+]]}
-
-// CHECK: [[MDNODE0]] = !{void (i32)* @kernel1, {{.*}} [[MDNODE1:![0-9]+]], [[MDNODE2:![0-9]+]]}
-// CHECK: [[MDNODE1]] = !{!"vec_type_hint", i32 undef, i32 1}
-// CHECK: [[MDNODE2]] = !{!"reqd_work_group_size", i32 1, i32 2, i32 4}
-// CHECK: [[MDNODE3]] = !{void (i32)* @kernel2, {{.*}} [[MDNODE4:![0-9]+]], [[MDNODE5:![0-9]+]]}
-// CHECK: [[MDNODE4]] = !{!"vec_type_hint", <4 x i32> undef, i32 0}
-// CHECK: [[MDNODE5]] = !{!"work_group_size_hint", i32 8, i32 16, i32 32}
+// CHECK: [[MD1]] = !{i32 undef, i32 1}
+// CHECK: [[MD2]] = !{i32 1, i32 2, i32 4}
+// CHECK: [[MD3]] = !{<4 x i32> undef, i32 0}
+// CHECK: [[MD4]] = !{i32 8, i32 16, i32 32}
Index: cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl
===
--- cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl
+++ cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl
@@ -1,55 +1,88 @@
-// RUN: %clang_cc1 %s -cl-kernel-arg-info -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s -check-prefix ARGINFO
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s -check-prefix NO-ARGINFO
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
 
 kernel void foo(__global int * restrict X, const int Y, 
 volatile int anotherArg, __constant float * restrict Z) {
   *X = Y + anotherArg;
 }
-
-// CHECK:  !{!"kernel_arg_addr_space", i32 1, i32 0, i32 0, i32 2}
-// CHECK:  !{!"kernel_arg_access_qual", !"none", !"none", !"none", !"none"}
-// CHECK:  !{!"kernel_arg_type", !"int*", !"int", !"int", !"float*"}
-// CHECK:  !{!"kernel_arg_base_type", !"int*", !"int", !"int", !"float*"}
-// CHECK:  !{!"kernel_arg_type_qual", !"restrict", !"const", !"volatile", !"restrict const"}
-// ARGINFO: !{!"kernel_arg_name", !"X", !"Y", !"anotherArg", !"Z"}
-// NO-ARGINFO-NOT: !{!"kernel_arg_name", !"X", !"Y", !"anotherArg", !"Z"}
+// CHECK: define spir_kernel void @foo{{[^!]+}}
+// CHECK: !kernel_arg_addr_space ![[MD11:[0-9]+]]
+// CHECK: !kernel_arg_access_qual ![[MD12:[0-9]+]]
+// CHECK: !kernel_arg_type ![[MD13:[0-9]+]]
+// CHECK: !kernel_arg_base_type ![[MD13]]
+// CHECK: !kernel_arg_type_qual ![[MD14:[0-9]+]]
+// CHECK-NOT: !kernel_arg_name
+// ARGINFO: !kernel_arg_name ![[MD15:[0-9]+]]
 
 kernel void foo2(read_only image1d_t img1, image2d_t img2, write_only image2d_array_t img3) {
 }
-// CHECK:  !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1}
-// CHECK:  !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"write_only"}
-// CHECK:  !{!"kernel_arg_type", !"image1d_t", !"image2d_t", !"image2d_array_t"}
-// CHECK:  !{!"kernel_arg_base_type", !"image1d_t", !"image2d_t", !"image2d_array_t"}
-// CHECK:  !{!"kernel_arg_type_qual", !"", !"", !""}
-// ARGINFO: !{!"kernel_arg_name", !"img1", !"img2", !"img3"}
-// NO-ARGINFO-NOT: !{!"kernel_arg_name", !"img1", !"img2", !"img3"}
+// CHECK: define spir_kernel void @foo2{{[^!]+}}
+// CHECK: !kernel_arg_addr_space ![[MD21:[0-9]+]]
+// CHECK: !kernel_arg_access_qual ![[MD22:[0-9]+]]
+// CHECK: !kernel_arg_type ![[MD23:[0-9]+]]
+// CHECK: !kernel_arg_base_type ![[MD23]]
+// CHECK: !kernel_arg_type_qual ![[MD24:[0-9]+]]
+// CHECK-NOT: !kernel_arg_name
+// ARGINFO: !kernel_arg_name ![[MD25:[0-9]+]]
 
 kernel void foo3(__global half * X) {
 }
-// CHECK:  !{!"kernel_arg_addr_space", i32 1}
-// CHECK:  !{!"kernel_arg_access_qual", !"none"}
-// CHECK:  !{!"kernel_arg_type", !"half*"}
-// CHECK:  !{!"kernel_arg_base_type", !"half*"}
-// 

Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-22 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

Alexey, do you have any additional comments?


http://reviews.llvm.org/D20249



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


RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Liu, Yaxun (Sam) via cfe-commits
$ "chmod" "u-w"
"C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
# command stderr:
r.cl.tmp/*: invalid mode: 'mp/*'

the error msg is strange. On my Cygwin I got different error:
chmod: cannot access 
'C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*':
 No such file or directory

This is because * is not expanded when quoted.

Sam

-Original Message-
From: Ismail Donmez [mailto:ism...@i10z.com] 
Sent: Wednesday, June 22, 2016 3:11 AM
To: Liu, Yaxun (Sam) 
Cc: cfe-commits 
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

On Mon, Jun 20, 2016 at 10:26 PM, Yaxun Liu via cfe-commits 
 wrote:
> Author: yaxunl
> Date: Mon Jun 20 14:26:00 2016
> New Revision: 273191
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
> Log:
> [OpenCL] Include opencl-c.h by default as a clang module
>
> Include opencl-c.h by default as a module to utilize the automatic AST 
> caching mechanism of clang modules.
>
> Add an option -finclude-default-header to enable default header for OpenCL, 
> which is off by default.
>
> Differential Revision: http://reviews.llvm.org/D20444
>
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Headers/module.modulemap
> cfe/trunk/test/Headers/opencl-c-header.cl

chmod lines doesn't seem to work on Cygwin:

$ "chmod" "u-w"
"C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
# command stderr:
r.cl.tmp/*: invalid mode: 'mp/*'
Try 'r.cl.tmp/* --help' for more information.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21564: [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

2016-06-22 Thread Carlo Bertolli via cfe-commits
carlo.bertolli marked 2 inline comments as done.
carlo.bertolli added a comment.

Thanks very much for the quick review. I am about to update the patch 
reflecting your comments and to the latest trunk.



Comment at: include/clang/AST/StmtOpenMP.h:2884-2896
@@ +2883,15 @@
+
+  /// Increment expression for distribute loop (OMPLoopDirective contains
+  /// increment expression for #for loop)
+  Expr *DistIncExpr;
+
+  /// \brief EnsureUpperBound for #pragma omp for: expression LB = PrevUB;
+  Expr *PrevEUBExpr;
+
+  Expr *getDistInc() const { return DistIncExpr; }
+  Expr *getPrevEnsureUpperBound() const { return PrevEUBExpr; }
+
+protected:
+  void setDistInc(Expr *DistInc) { DistIncExpr = DistInc; }
+  void setPrevEnsureUpperBound(Expr *PrevEUB) { PrevEUBExpr = PrevEUB; }
+};

ABataev wrote:
> Don't like the idea of public fields with protected setters. If these fields 
> are required, they must be the part of the base OMPLoopDirective and reuse 
> the logic for other helper expressions.
> 
> Also, I believe, these fields are required for codegen. If so, it is better 
> to add them in codegen patch
I removed the field and will add new fields to OMPLoopDirective later on when I 
produce a code gen patch.


http://reviews.llvm.org/D21564



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


Re: [PATCH] D21597: clang-format: [JS] recognize more type locations.

2016-06-22 Thread Martin Probst via cfe-commits
mprobst added inline comments.


Comment at: lib/Format/TokenAnnotator.cpp:480
@@ -471,1 +479,3 @@
 
+  void parseJSTypeDefinition() {
+// `type Name = Type Expression;`

djasper wrote:
> Why is this necessary?
It is not, actually. I was chasing a wrong path here before understanding it 
was because of the assignment. Removed.


http://reviews.llvm.org/D21597



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


r273422 - clang-format: [JS] Do not break before 'as'.

2016-06-22 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Wed Jun 22 09:35:14 2016
New Revision: 273422

URL: http://llvm.org/viewvc/llvm-project?rev=273422=rev
Log:
clang-format: [JS] Do not break before 'as'.

Summary:
'as' is a pseudo operator, so automatic semicolon insertion kicks in and the
code fails to part.

Reviewers: djasper

Subscribers: klimek

Differential Revision: http://reviews.llvm.org/D21576

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=273422=273421=273422=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Wed Jun 22 09:35:14 2016
@@ -2373,6 +2373,8 @@ bool TokenAnnotator::canBreakBefore(cons
   return Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None;
 if (Right.is(Keywords.kw_in))
   return Style.BreakBeforeBinaryOperators != FormatStyle::BOS_None;
+if (Right.is(Keywords.kw_as))
+  return false; // must not break before as in 'x as type' casts
   }
 
   if (Left.is(tok::at))

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=273422=273421=273422=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Wed Jun 22 09:35:14 2016
@@ -1051,8 +1051,8 @@ TEST_F(FormatTestJS, Modules) {
   // ... but not if from is just an identifier.
   verifyFormat("export {\n"
"  from as from,\n"
-   "  someSurprisinglyLongVariable\n"
-   "  as from\n"
+   "  someSurprisinglyLongVariable as\n"
+   "  from\n"
"};",
getGoogleJSStyleWithColumns(20));
   verifyFormat("export class C {\n"
@@ -1205,6 +1205,9 @@ TEST_F(FormatTestJS, TemplateStrings) {
 TEST_F(FormatTestJS, CastSyntax) {
   verifyFormat("var x = foo;");
   verifyFormat("var x = foo as type;");
+  verifyFormat("let x = (a + b) as\n"
+   "LongTypeIsLong;",
+   getGoogleJSStyleWithColumns(20));
   verifyFormat("foo = [\n"
"  1,  //\n"
"  2\n"


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


Re: [PATCH] D21597: clang-format: [JS] recognize more type locations.

2016-06-22 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 61548.
mprobst added a comment.

- Remove parseJSTypeDefinition


http://reviews.llvm.org/D21597

Files:
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -914,6 +914,12 @@
   verifyFormat("function(x: A|B = A | B): C {}");
   verifyFormat("function x(path: number|string) {}");
   verifyFormat("function x(): string|number {}");
+  verifyFormat("type Foo = Bar|Baz;");
+  verifyFormat("type Foo = Bar|Baz;");
+  verifyFormat("type Foo = (Bar|Baz);");
+  verifyFormat("let x: Bar|Baz;");
+  verifyFormat("let x: Bar|Baz;");
+  verifyFormat("let x: (Foo|Bar)[];");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -134,6 +134,10 @@
 
 if (Left->is(TT_OverloadedOperatorLParen)) {
   Contexts.back().IsExpression = false;
+} else if (Style.Language == FormatStyle::LK_JavaScript &&
+   Line.First->is(Keywords.kw_type)) {
+  // type X = (...);
+  Contexts.back().IsExpression = false;
 } else if (Left->Previous &&
 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_decltype,
  tok::kw_if, tok::kw_while, tok::l_paren,
@@ -147,6 +151,10 @@
   Keywords.kw_function {
   // function(...) or function f(...)
   Contexts.back().IsExpression = false;
+} else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous 
&&
+   Left->Previous->is(TT_JsTypeColon)) {
+  // let x: (SomeType);
+  Contexts.back().IsExpression = false;
 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&
Left->Previous->MatchingParen->is(TT_LambdaLSquare)) {
@@ -653,6 +661,7 @@
 default:
   break;
 }
+
 return true;
   }
 
@@ -913,6 +922,9 @@
   void modifyContext(const FormatToken ) {
 if (Current.getPrecedence() == prec::Assignment &&
 !Line.First->isOneOf(tok::kw_template, tok::kw_using, tok::kw_return) 
&&
+// Type aliases use `type X = ...;` in TypeScript.
+!(Style.Language == FormatStyle::LK_JavaScript &&
+  Line.First->is(Keywords.kw_type)) &&
 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) {
   Contexts.back().IsExpression = true;
   if (!Line.startsWith(TT_UnaryOperator)) {
Index: lib/Format/FormatToken.h
===
--- lib/Format/FormatToken.h
+++ lib/Format/FormatToken.h
@@ -586,6 +586,7 @@
 kw_import = ("import");
 kw_is = ("is");
 kw_let = ("let");
+kw_type = ("type");
 kw_var = ("var");
 kw_yield = ("yield");
 
@@ -637,6 +638,7 @@
   IdentifierInfo *kw_import;
   IdentifierInfo *kw_is;
   IdentifierInfo *kw_let;
+  IdentifierInfo *kw_type;
   IdentifierInfo *kw_var;
   IdentifierInfo *kw_yield;
 


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -914,6 +914,12 @@
   verifyFormat("function(x: A|B = A | B): C {}");
   verifyFormat("function x(path: number|string) {}");
   verifyFormat("function x(): string|number {}");
+  verifyFormat("type Foo = Bar|Baz;");
+  verifyFormat("type Foo = Bar|Baz;");
+  verifyFormat("type Foo = (Bar|Baz);");
+  verifyFormat("let x: Bar|Baz;");
+  verifyFormat("let x: Bar|Baz;");
+  verifyFormat("let x: (Foo|Bar)[];");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -134,6 +134,10 @@
 
 if (Left->is(TT_OverloadedOperatorLParen)) {
   Contexts.back().IsExpression = false;
+} else if (Style.Language == FormatStyle::LK_JavaScript &&
+   Line.First->is(Keywords.kw_type)) {
+  // type X = (...);
+  Contexts.back().IsExpression = false;
 } else if (Left->Previous &&
 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_decltype,
  tok::kw_if, tok::kw_while, tok::l_paren,
@@ -147,6 +151,10 @@
   Keywords.kw_function {
   // function(...) or function f(...)
   Contexts.back().IsExpression = false;
+} else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous &&
+   Left->Previous->is(TT_JsTypeColon)) {
+  // let x: (SomeType);
+  Contexts.back().IsExpression = false;
 } else if 

Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-22 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

I think this LGTM (with the const overload), but you should poke Richard to see 
what his thoughts are before committing.



Comment at: include/llvm/Support/TrailingObjects.h:353
@@ +352,3 @@
+  ///
+  /// \code{.cpp}
+  ///

hubert.reinterpretcast wrote:
> aaron.ballman wrote:
> > That's novel (we use it in two other places from what I can tell).
> This is a documented Doxygen command:
> https://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdcode
> 
> The presence of the file extension in the existing use is mostly harmless to 
> older versions of Doxygen:
> http://www.llvm.org/docs/doxygen/html/classllvm_1_1TypeBuilder.html#details
> 
> Since this is present in a .h header, I am not sure we will get C++ (as 
> opposed to C) syntax coloring reliably otherwise.
> 
Huh, interesting. I'm not opposed to it, though I prefer consistency. I say 
leave it, though.


Comment at: include/llvm/Support/TrailingObjects.h:378
@@ +377,3 @@
+
+BaseTy *get() { return p; }
+

hubert.reinterpretcast wrote:
> aaron.ballman wrote:
> > Should we have a const overload for this?
> I can add one. It will return a pointer-to-const since the semantics of this 
> class is that it owns the memory.
> 
That's what I was expecting, so it sounds good to me.


http://reviews.llvm.org/D19770



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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-22 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: include/llvm/Support/TrailingObjects.h:353
@@ +352,3 @@
+  ///
+  /// \code{.cpp}
+  ///

aaron.ballman wrote:
> That's novel (we use it in two other places from what I can tell).
This is a documented Doxygen command:
https://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdcode

The presence of the file extension in the existing use is mostly harmless to 
older versions of Doxygen:
http://www.llvm.org/docs/doxygen/html/classllvm_1_1TypeBuilder.html#details

Since this is present in a .h header, I am not sure we will get C++ (as opposed 
to C) syntax coloring reliably otherwise.



Comment at: include/llvm/Support/TrailingObjects.h:378
@@ +377,3 @@
+
+BaseTy *get() { return p; }
+

aaron.ballman wrote:
> Should we have a const overload for this?
I can add one. It will return a pointer-to-const since the semantics of this 
class is that it owns the memory.



http://reviews.llvm.org/D19770



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


Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-22 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

Since http://reviews.llvm.org/D20964 was committed, I think we should close 
this.


http://reviews.llvm.org/D21185



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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-22 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: include/llvm/Support/TrailingObjects.h:353
@@ +352,3 @@
+  ///
+  /// \code{.cpp}
+  ///

That's novel (we use it in two other places from what I can tell).


Comment at: include/llvm/Support/TrailingObjects.h:378
@@ +377,3 @@
+
+BaseTy *get() { return p; }
+

Should we have a const overload for this?


http://reviews.llvm.org/D19770



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


Re: [PATCH] Restructure the propagation of -fPIC/-fPIE.

2016-06-22 Thread Joerg Sonnenberger via cfe-commits
On Wed, Jun 22, 2016 at 08:06:06AM -0400, Rafael Espíndola wrote:
> On 21 June 2016 at 19:04, Joerg Sonnenberger via cfe-commits
>  wrote:
> > On Tue, Jun 21, 2016 at 06:53:03PM -0400, Rafael Espíndola via cfe-commits 
> > wrote:
> >> diff --git a/lib/Frontend/InitPreprocessor.cpp 
> >> b/lib/Frontend/InitPreprocessor.cpp
> >> index 27ef59a..6b93c69 100644
> >> --- a/lib/Frontend/InitPreprocessor.cpp
> >> +++ b/lib/Frontend/InitPreprocessor.cpp
> >> @@ -873,10 +873,10 @@ static void InitializePredefinedMacros(const 
> >> TargetInfo ,
> >>if (unsigned PICLevel = LangOpts.PICLevel) {
> >>  Builder.defineMacro("__PIC__", Twine(PICLevel));
> >>  Builder.defineMacro("__pic__", Twine(PICLevel));
> >> -  }
> >> -  if (unsigned PIELevel = LangOpts.PIELevel) {
> >> -Builder.defineMacro("__PIE__", Twine(PIELevel));
> >> -Builder.defineMacro("__pie__", Twine(PIELevel));
> >> +if (LangOpts.PIE) {
> >> +  Builder.defineMacro("__PIE__", Twine(PICLevel));
> >> +  Builder.defineMacro("__pie__", Twine(PICLevel));
> >> +}
> >>}
> >>
> >>// Macros to control C99 numerics and 
> >
> > This is the only part that I am somewhat nervous about, since it changes
> > behavior in an externally visible way. I'm not sure what the code
> > expectations are in the wild world right now.
> 
> I should not, or there is a bug.
> 
> It changes the driver to cc1 interface, but given driver invocation we
> should be creating identical defines.

OK, I retract that. I thought only one set of defines were ever present,
but guess it was the old behavior as well to have both for PIE.

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


Re: [PATCH] D21303: [clang-tidy] Adds performance-returning-type check.

2016-06-22 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:53
@@ +52,3 @@
+/// matches the given matcher.
+AST_MATCHER_P(QualType, ignoringRefsAndConsts,
+  ast_matchers::internal::Matcher, InnerMatcher) {

Prazek wrote:
> This one is usefull AF. Can you put into Traversal AST Matchers?
> 
> 
> {meme, src=brilliant}
> 
> 
I don't think this is a good candidate for a public AST matcher -- it does too 
many disparate things.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:64
@@ +63,3 @@
+/// \brief Matches ParmVarDecls which have default arguments.
+AST_MATCHER(ParmVarDecl, hasDefaultArgument) { return Node.hasDefaultArg(); }
+

With proper documentation and tests, this would be a good candidate to move 
into ASTMatchers.h though. However, it should be called `hasDefaultArg()` 
instead.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:69
@@ +68,3 @@
+AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher,
+ hasOneActiveArgument) {
+  return anyOf(parameterCountIs(1),

Arguments are what the caller provides. Parameters are what the function 
accepts. Also "active" is a bit of a strange term for here, so I think this 
should be renamed to something like `hasOneNonDefaultedParam()` or something 
similar.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:77
@@ +76,3 @@
+/// matcher.
+AST_MATCHER_P(TemplateTypeParmDecl, hasTemplateType,
+  ast_matchers::internal::Matcher, InnerMatcher) {

I think we should make `hasType()` work for `TemplateTypeParmDecl` instead of 
doing it this way (as part of the public AST matcher interface), assuming it 
doesn't currently work.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:86
@@ +85,3 @@
+/// to move-construct from any type.
+AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher,
+ moveConstructorFromAnyType) {

I think this might actually be better expressed as a local variable in 
`registerMatchers()` instead of a matcher like this.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:88
@@ +87,3 @@
+ moveConstructorFromAnyType) {
+  // Potentially danger: this matcher binds a name, with probably
+  // mean that you cant use it twice in your check!

s/danger/dangerous
s/with/which


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:89
@@ +88,3 @@
+  // Potentially danger: this matcher binds a name, with probably
+  // mean that you cant use it twice in your check!
+  const char TemplateArgument[] = "templateArgument";

s/mean/means
s/cant/can't


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:111-112
@@ +110,4 @@
+
+/// \brief Matches to qual types which has constructors from type that matches
+/// the given matcher.
+AST_MATCHER_FUNCTION_P(ast_matchers::internal::Matcher,

Can you fix the grammatical issues with the comment? I'm not quite certain what 
it should say, but I think it's something like:

Matches a QualType whose declaration has a converting constructor accepting an 
argument of the type from the given inner matcher.


Comment at: clang-tidy/performance/ReturnValueCopyCheck.cpp:130-131
@@ +129,4 @@
+
+  // Matches to type with after ignoring refs and consts is the same as
+  // "constructedType"
+  auto HasTypeSameAsConstructed = hasType(hasCanonicalType(

Also ungrammatical (and missing a period at the end of the sentence).


Comment at: clang-tidy/performance/ReturnValueCopyCheck.h:20
@@ +19,3 @@
+
+/// This check finds places where we are returning object of a different type 
than
+/// the function return type. In such places, we should use std::move, 
otherwise

an object of a different type.


http://reviews.llvm.org/D21303



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


[libcxx] r273409 - Creating release candidate final from release_381 branch

2016-06-22 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Wed Jun 22 08:22:18 2016
New Revision: 273409

URL: http://llvm.org/viewvc/llvm-project?rev=273409=rev
Log:
Creating release candidate final from release_381 branch

Added:
libcxx/tags/RELEASE_381/final/   (props changed)
  - copied from r273408, libcxx/branches/release_38/

Propchange: libcxx/tags/RELEASE_381/final/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Jun 22 08:22:18 2016
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:257682,257696,257702,258107,258403,259682


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


[libcxxabi] r273410 - Creating release candidate final from release_381 branch

2016-06-22 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Wed Jun 22 08:22:19 2016
New Revision: 273410

URL: http://llvm.org/viewvc/llvm-project?rev=273410=rev
Log:
Creating release candidate final from release_381 branch

Added:
libcxxabi/tags/RELEASE_381/final/   (props changed)
  - copied from r273409, libcxxabi/branches/release_38/

Propchange: libcxxabi/tags/RELEASE_381/final/
--
svn:mergeinfo = /libcxxabi/trunk:257896


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


[libunwind] r273416 - Creating release candidate final from release_381 branch

2016-06-22 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Wed Jun 22 08:22:30 2016
New Revision: 273416

URL: http://llvm.org/viewvc/llvm-project?rev=273416=rev
Log:
Creating release candidate final from release_381 branch

Added:
libunwind/tags/RELEASE_381/final/
  - copied from r273415, libunwind/branches/release_38/

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


Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-22 Thread pierre gousseau via cfe-commits
pgousseau added a comment.

Ping!


http://reviews.llvm.org/D20867



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


Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-22 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/performance/EmplaceCheck.cpp:26
@@ +25,3 @@
+  on(expr(hasType(cxxRecordDecl(hasName("std::vector"),
+  callee(functionDecl(hasName("push_back"))),
+  hasArgument(0, cxxConstructExpr().bind("construct_expr")))

sbenza wrote:
> Just say functionDecl(hasName("std::vector::push_back")) and you can remove 
> the type check.
Should use "::std::vector::push_back" just to be sure it doesn't explode when 
evil people have:
```
namespace frobble {
namespace std {
template 
class vector {
  void push_back(const T&);
};
}
}
```


Comment at: clang-tidy/performance/EmplaceCheck.cpp:38
@@ +37,3 @@
+  if (SR.isInvalid())
+return {};
+  return Lexer::getSourceText(Lexer::getAsCharRange(SR, SM, LO), SM, LO);

I think this goes against our coding standards and should be `return 
StringRef();`.


http://reviews.llvm.org/D21185



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


Re: [PATCH] D21392: [clang-tidy] Enhance redundant-expression check

2016-06-22 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:27
@@ -25,1 +26,3 @@
 
+static bool incrementWithoutOverflow(const llvm::APSInt ,
+ llvm::APSInt ) {

I think this could be implemented using APInt overflow checks, no? 
`APInt::sadd_ov()`?


Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:138
@@ +137,3 @@
+  incrementWithoutOverflow(ValueLHS, ValueLHS_plus1) &&
+  llvm::APSInt::compareValues(ValueLHS_plus1, ValueRHS) == 0)
+return true;

Ah, this may be confusion on my part. I was thinking "equivalent ranges" 
meaning "does one range cover another range", e.g., `x < 12` is also covered by 
`x < 4` in an expression like `if (x < 4 && x < 12)`.

I think this code is fine as-is.


Comment at: clang-tidy/misc/RedundantExpressionCheck.cpp:274
@@ +273,3 @@
+Value = -Value;
+  }
+}

> In this case -128 (8-bits) will give -128.

So negating -128 doesn't yield 128, it yields -128? That seems weird.

> The APSInt is behaving the same way than a real value of the same width and 
> signedness.

A real value of the same width and signedness has UB with that case, which is 
why I was asking. The range of an 8-bit signed int is -128 to 127, so negating 
-128 yields an out-of-range value. I want to make sure we aren't butchering 
that by canonicalizing the negate expression.


Comment at: clang-tidy/misc/RedundantExpressionCheck.h:31
@@ +30,3 @@
+private:
+  void checkArithmeticExpr(const ast_matchers::MatchFinder::MatchResult );
+  void checkBitwiseExpr(const ast_matchers::MatchFinder::MatchResult );

Hmmm, good point. Drat!


http://reviews.llvm.org/D21392



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


Re: [PATCH] D21373: [Clang][bmi][intrinsics] Adding _mm_tzcnt_64 _mm_tzcnt_32 intrinsics to clang.

2016-06-22 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273401: [Clang][bmi][intrinsics] Adding _mm_tzcnt_64 
_mm_tzcnt_32 intrinsics to clang. (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21373?vs=61351=61536#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21373

Files:
  cfe/trunk/lib/Headers/bmiintrin.h
  cfe/trunk/test/CodeGen/bmi-builtins.c

Index: cfe/trunk/test/CodeGen/bmi-builtins.c
===
--- cfe/trunk/test/CodeGen/bmi-builtins.c
+++ cfe/trunk/test/CodeGen/bmi-builtins.c
@@ -64,6 +64,13 @@
   return __tzcnt_u32(__X);
 }
 
+int test_mm_tzcnt_32(unsigned int __X) {
+  // CHECK-LABEL: test_mm_tzcnt_32
+  // CHECK: icmp ne i32 %{{.*}}, 0
+  // CHECK: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true)
+  return _mm_tzcnt_32(__X);
+}
+
 unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
   // CHECK-LABEL: test__andn_u64
   // CHECK: xor i64 %{{.*}}, -1
@@ -105,6 +112,13 @@
   return __tzcnt_u64(__X);
 }
 
+long long test_mm_tzcnt_64(unsigned long long __X) {
+  // CHECK-LABEL: test_mm_tzcnt_64
+  // CHECK: icmp ne i64 %{{.*}}, 0
+  // CHECK: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 true)
+  return _mm_tzcnt_64(__X);
+}
+
 // Intel intrinsics
 
 unsigned short test_tzcnt_u16(unsigned short __X) {
Index: cfe/trunk/lib/Headers/bmiintrin.h
===
--- cfe/trunk/lib/Headers/bmiintrin.h
+++ cfe/trunk/lib/Headers/bmiintrin.h
@@ -287,6 +287,22 @@
   return __X ? __builtin_ctz(__X) : 32;
 }
 
+/// \brief Counts the number of trailing zero bits in the operand.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c TZCNT instruction.
+///
+/// \param __X
+///An unsigned 32-bit integer whose trailing zeros are to be counted.
+/// \returns An 32-bit integer containing the number of trailing zero
+///bits in the operand.
+static __inline__ int __RELAXED_FN_ATTRS
+_mm_tzcnt_32(unsigned int __X)
+{
+  return __X ? __builtin_ctz(__X) : 32;
+}
+
 #ifdef __x86_64__
 
 /// \brief Performs a bitwise AND of the second operand with the one's
@@ -508,6 +524,22 @@
   return __X ? __builtin_ctzll(__X) : 64;
 }
 
+/// \brief Counts the number of trailing zero bits in the operand.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c TZCNT instruction.
+///
+/// \param __X
+///An unsigned 64-bit integer whose trailing zeros are to be counted.
+/// \returns An 64-bit integer containing the number of trailing zero
+///bits in the operand.
+static __inline__ long long __RELAXED_FN_ATTRS
+_mm_tzcnt_64(unsigned long long __X)
+{
+  return __X ? __builtin_ctzll(__X) : 64;
+}
+
 #endif /* __x86_64__ */
 
 #undef __DEFAULT_FN_ATTRS


Index: cfe/trunk/test/CodeGen/bmi-builtins.c
===
--- cfe/trunk/test/CodeGen/bmi-builtins.c
+++ cfe/trunk/test/CodeGen/bmi-builtins.c
@@ -64,6 +64,13 @@
   return __tzcnt_u32(__X);
 }
 
+int test_mm_tzcnt_32(unsigned int __X) {
+  // CHECK-LABEL: test_mm_tzcnt_32
+  // CHECK: icmp ne i32 %{{.*}}, 0
+  // CHECK: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true)
+  return _mm_tzcnt_32(__X);
+}
+
 unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
   // CHECK-LABEL: test__andn_u64
   // CHECK: xor i64 %{{.*}}, -1
@@ -105,6 +112,13 @@
   return __tzcnt_u64(__X);
 }
 
+long long test_mm_tzcnt_64(unsigned long long __X) {
+  // CHECK-LABEL: test_mm_tzcnt_64
+  // CHECK: icmp ne i64 %{{.*}}, 0
+  // CHECK: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 true)
+  return _mm_tzcnt_64(__X);
+}
+
 // Intel intrinsics
 
 unsigned short test_tzcnt_u16(unsigned short __X) {
Index: cfe/trunk/lib/Headers/bmiintrin.h
===
--- cfe/trunk/lib/Headers/bmiintrin.h
+++ cfe/trunk/lib/Headers/bmiintrin.h
@@ -287,6 +287,22 @@
   return __X ? __builtin_ctz(__X) : 32;
 }
 
+/// \brief Counts the number of trailing zero bits in the operand.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c TZCNT instruction.
+///
+/// \param __X
+///An unsigned 32-bit integer whose trailing zeros are to be counted.
+/// \returns An 32-bit integer containing the number of trailing zero
+///bits in the operand.
+static __inline__ int __RELAXED_FN_ATTRS
+_mm_tzcnt_32(unsigned int __X)
+{
+  return __X ? __builtin_ctz(__X) : 32;
+}
+
 #ifdef __x86_64__
 
 /// \brief Performs a bitwise AND of the second operand with the one's
@@ -508,6 +524,22 @@
   return __X ? __builtin_ctzll(__X) : 64;
 }
 
+/// \brief Counts the number of trailing zero bits in the operand.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c TZCNT instruction.
+///
+/// \param __X
+///An unsigned 64-bit integer whose trailing zeros are to be counted.
+/// \returns An 64-bit integer containing the number of trailing zero
+///bits in the operand.
+static __inline__ 

r273401 - [Clang][bmi][intrinsics] Adding _mm_tzcnt_64 _mm_tzcnt_32 intrinsics to clang.

2016-06-22 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Wed Jun 22 07:32:43 2016
New Revision: 273401

URL: http://llvm.org/viewvc/llvm-project?rev=273401=rev
Log:
[Clang][bmi][intrinsics] Adding _mm_tzcnt_64 _mm_tzcnt_32 intrinsics to clang.

Differential Revision: http://reviews.llvm.org/D21373

Modified:
cfe/trunk/lib/Headers/bmiintrin.h
cfe/trunk/test/CodeGen/bmi-builtins.c

Modified: cfe/trunk/lib/Headers/bmiintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/bmiintrin.h?rev=273401=273400=273401=diff
==
--- cfe/trunk/lib/Headers/bmiintrin.h (original)
+++ cfe/trunk/lib/Headers/bmiintrin.h Wed Jun 22 07:32:43 2016
@@ -287,6 +287,22 @@ __tzcnt_u32(unsigned int __X)
   return __X ? __builtin_ctz(__X) : 32;
 }
 
+/// \brief Counts the number of trailing zero bits in the operand.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c TZCNT instruction.
+///
+/// \param __X
+///An unsigned 32-bit integer whose trailing zeros are to be counted.
+/// \returns An 32-bit integer containing the number of trailing zero
+///bits in the operand.
+static __inline__ int __RELAXED_FN_ATTRS
+_mm_tzcnt_32(unsigned int __X)
+{
+  return __X ? __builtin_ctz(__X) : 32;
+}
+
 #ifdef __x86_64__
 
 /// \brief Performs a bitwise AND of the second operand with the one's
@@ -507,6 +523,22 @@ __tzcnt_u64(unsigned long long __X)
 {
   return __X ? __builtin_ctzll(__X) : 64;
 }
+
+/// \brief Counts the number of trailing zero bits in the operand.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c TZCNT instruction.
+///
+/// \param __X
+///An unsigned 64-bit integer whose trailing zeros are to be counted.
+/// \returns An 64-bit integer containing the number of trailing zero
+///bits in the operand.
+static __inline__ long long __RELAXED_FN_ATTRS
+_mm_tzcnt_64(unsigned long long __X)
+{
+  return __X ? __builtin_ctzll(__X) : 64;
+}
 
 #endif /* __x86_64__ */
 

Modified: cfe/trunk/test/CodeGen/bmi-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/bmi-builtins.c?rev=273401=273400=273401=diff
==
--- cfe/trunk/test/CodeGen/bmi-builtins.c (original)
+++ cfe/trunk/test/CodeGen/bmi-builtins.c Wed Jun 22 07:32:43 2016
@@ -64,6 +64,13 @@ unsigned int test__tzcnt_u32(unsigned in
   return __tzcnt_u32(__X);
 }
 
+int test_mm_tzcnt_32(unsigned int __X) {
+  // CHECK-LABEL: test_mm_tzcnt_32
+  // CHECK: icmp ne i32 %{{.*}}, 0
+  // CHECK: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true)
+  return _mm_tzcnt_32(__X);
+}
+
 unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
   // CHECK-LABEL: test__andn_u64
   // CHECK: xor i64 %{{.*}}, -1
@@ -105,6 +112,13 @@ unsigned long long test__tzcnt_u64(unsig
   return __tzcnt_u64(__X);
 }
 
+long long test_mm_tzcnt_64(unsigned long long __X) {
+  // CHECK-LABEL: test_mm_tzcnt_64
+  // CHECK: icmp ne i64 %{{.*}}, 0
+  // CHECK: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 true)
+  return _mm_tzcnt_64(__X);
+}
+
 // Intel intrinsics
 
 unsigned short test_tzcnt_u16(unsigned short __X) {


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


Re: [PATCH] Restructure the propagation of -fPIC/-fPIE.

2016-06-22 Thread Rafael Espíndola via cfe-commits
On 21 June 2016 at 19:04, Joerg Sonnenberger via cfe-commits
 wrote:
> On Tue, Jun 21, 2016 at 06:53:03PM -0400, Rafael Espíndola via cfe-commits 
> wrote:
>> diff --git a/lib/Frontend/InitPreprocessor.cpp 
>> b/lib/Frontend/InitPreprocessor.cpp
>> index 27ef59a..6b93c69 100644
>> --- a/lib/Frontend/InitPreprocessor.cpp
>> +++ b/lib/Frontend/InitPreprocessor.cpp
>> @@ -873,10 +873,10 @@ static void InitializePredefinedMacros(const 
>> TargetInfo ,
>>if (unsigned PICLevel = LangOpts.PICLevel) {
>>  Builder.defineMacro("__PIC__", Twine(PICLevel));
>>  Builder.defineMacro("__pic__", Twine(PICLevel));
>> -  }
>> -  if (unsigned PIELevel = LangOpts.PIELevel) {
>> -Builder.defineMacro("__PIE__", Twine(PIELevel));
>> -Builder.defineMacro("__pie__", Twine(PIELevel));
>> +if (LangOpts.PIE) {
>> +  Builder.defineMacro("__PIE__", Twine(PICLevel));
>> +  Builder.defineMacro("__pie__", Twine(PICLevel));
>> +}
>>}
>>
>>// Macros to control C99 numerics and 
>
> This is the only part that I am somewhat nervous about, since it changes
> behavior in an externally visible way. I'm not sure what the code
> expectations are in the wild world right now.

I should not, or there is a bug.

It changes the driver to cc1 interface, but given driver invocation we
should be creating identical defines.

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


Re: [PATCH] D21603: [include-fixer] Fix namespace after inserting a missing header.

2016-06-22 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 61524.
hokein added a comment.

Fix a typo.


http://reviews.llvm.org/D21603

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixerContext.h
  include-fixer/SymbolIndexManager.cpp
  include-fixer/SymbolIndexManager.h
  include-fixer/find-all-symbols/SymbolInfo.cpp
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -50,7 +50,7 @@
 }
 
 static std::string runIncludeFixer(
-StringRef Code,
+StringRef Code, bool FixNamespace = false,
 const std::vector  = std::vector()) {
   std::vector Symbols = {
   SymbolInfo("string", SymbolInfo::SymbolKind::Class, "", 1,
@@ -82,14 +82,21 @@
   IncludeFixerContext FixerContext;
   IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm");
 
-  runOnCode(, Code, "input.cc", ExtraArgs);
-  if (FixerContext.Headers.empty())
+  std::string FakeFileName = "input.cc";
+  runOnCode(, Code, FakeFileName, ExtraArgs);
+  if (FixerContext.getMatchedSymbols().empty())
 return Code;
   tooling::Replacements Replacements =
   clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front());
+  Code, FakeFileName, FixerContext.getHeaders().front());
   clang::RewriterTestContext Context;
-  clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
+  clang::FileID ID = Context.createInMemoryFile(FakeFileName, Code);
+  if (FixNamespace && FixerContext.getSymbolRange().getLength() > 0) {
+Replacements.emplace(
+FakeFileName, FixerContext.getSymbolRange().getOffset(),
+FixerContext.getSymbolRange().getLength(),
+FixerContext.getMatchedSymbols().front().getFullyQualifiedName());
+  }
   clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
@@ -136,20 +143,24 @@
 
 TEST(IncludeFixer, MinimizeInclude) {
   std::vector IncludePath = {"-Idir/"};
-  EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \"otherdir/qux.h\"\na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 
   IncludePath = {"-isystemdir"};
-  EXPECT_EQ("#include \na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 
   IncludePath = {"-iquotedir"};
-  EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \"otherdir/qux.h\"\na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 
   IncludePath = {"-Idir", "-Idir/otherdir"};
-  EXPECT_EQ("#include \"qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \"qux.h\"\na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 }
 
 TEST(IncludeFixer, NestedName) {
@@ -221,6 +232,31 @@
 runIncludeFixer("a::Vector v;"));
 }
 
+TEST(IncludeFixer, FixNamespace) {
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("b::bar b;\n", /*FixNamespace=*/true));
+
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("a::b::bar b;\n", /*FixNamespace=*/true));
+
+  EXPECT_EQ(
+  "c::b::bar b;\n",
+  runIncludeFixer("c::b::bar b;\n", /*FixNamespace=*/true));
+
+  EXPECT_EQ("#include \"color.h\"\nint test = a::b::Green;\n",
+runIncludeFixer("int test = Green;\n", /*FixNamespace=*/true));
+
+  // FIXME: Fix-namespace should not fix the global qualified identifier.
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("::a::b::bar b;\n", /*FixNamespace=*/true));
+
+  // FIXME: Fix-namespace should not add the missing namespace prefix to the
+  // unidentified symbol which is already in that namespace.
+  EXPECT_EQ(
+  "#include \"bar.h\"\nnamespace a {\na::b::bar b;\n}\n",
+  runIncludeFixer("namespace a {\nb::bar b;\n}\n", /*FixNamespace==*/true));
+}
+
 } // namespace
 } // namespace include_fixer
 } // namespace clang
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -16,6 +16,7 @@
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/Tooling/CommonOptionsParser.h"

[PATCH] D21603: [include-fixer] Fix namespace after inserting a missing header.

2016-06-22 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a subscriber: cfe-commits.

This is an initial version of fixing namespace issues by adding a missing
namespace prefix to an unidentified symbol.

This version only fixes the first discovered unidentified symbol
In the long run, include-fixer should fix all unidentfied symbols
with a same name at one run.

Currently, it works on command-line tool. The vim integration is not
implemented yet.

http://reviews.llvm.org/D21603

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixerContext.h
  include-fixer/SymbolIndexManager.cpp
  include-fixer/SymbolIndexManager.h
  include-fixer/find-all-symbols/SymbolInfo.cpp
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -50,7 +50,7 @@
 }
 
 static std::string runIncludeFixer(
-StringRef Code,
+StringRef Code, bool FixNamespace = false,
 const std::vector  = std::vector()) {
   std::vector Symbols = {
   SymbolInfo("string", SymbolInfo::SymbolKind::Class, "", 1,
@@ -82,14 +82,21 @@
   IncludeFixerContext FixerContext;
   IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm");
 
-  runOnCode(, Code, "input.cc", ExtraArgs);
-  if (FixerContext.Headers.empty())
+  std::string FakeFileName = "input.cc";
+  runOnCode(, Code, FakeFileName, ExtraArgs);
+  if (FixerContext.getMatchedSymbols().empty())
 return Code;
   tooling::Replacements Replacements =
   clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front());
+  Code, FakeFileName, FixerContext.getHeaders().front());
   clang::RewriterTestContext Context;
-  clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
+  clang::FileID ID = Context.createInMemoryFile(FakeFileName, Code);
+  if (FixNamespace && FixerContext.getSymbolRange().getLength() > 0) {
+Replacements.emplace(
+FakeFileName, FixerContext.getSymbolRange().getOffset(),
+FixerContext.getSymbolRange().getLength(),
+FixerContext.getMatchedSymbols().front().getFullyQualifiedName());
+  }
   clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
@@ -136,20 +143,24 @@
 
 TEST(IncludeFixer, MinimizeInclude) {
   std::vector IncludePath = {"-Idir/"};
-  EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \"otherdir/qux.h\"\na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 
   IncludePath = {"-isystemdir"};
-  EXPECT_EQ("#include \na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 
   IncludePath = {"-iquotedir"};
-  EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \"otherdir/qux.h\"\na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 
   IncludePath = {"-Idir", "-Idir/otherdir"};
-  EXPECT_EQ("#include \"qux.h\"\na::b::foo bar;\n",
-runIncludeFixer("a::b::foo bar;\n", IncludePath));
+  EXPECT_EQ(
+  "#include \"qux.h\"\na::b::foo bar;\n",
+  runIncludeFixer("a::b::foo bar;\n", /*FixNamespace=*/false, IncludePath));
 }
 
 TEST(IncludeFixer, NestedName) {
@@ -221,6 +232,31 @@
 runIncludeFixer("a::Vector v;"));
 }
 
+TEST(IncludeFixer, FixNamespace) {
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("b::bar b;\n", /*FixNamespace=*/true));
+
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("a::b::bar b;\n", /*FixNamespace=*/true));
+
+  EXPECT_EQ(
+  "c::b::bar b;\n",
+  runIncludeFixer("c::b::bar b;\n", /*FixNamespace=*/true));
+
+  EXPECT_EQ("#include \"color.h\"\nint test = a::b::Green;\n",
+runIncludeFixer("int test = Green;\n", /*FixNamespace=*/true));
+
+  // FIXME: Fix-namespace should not fix the global qualified identifier.
+  EXPECT_EQ("#include \"bar.h\"\na::b::bar b;\n",
+runIncludeFixer("::a::b::bar b;\n", /*FixNamespace=*/true));
+
+  // FIXME: Fix-namespace should not add the missing namespace prefix to the
+  // unidentified symbol which is already in that namespace.
+  EXPECT_EQ(
+  "#include \"bar.h\"\nnamespace a {\na::b::bar b;\n}\n",
+  runIncludeFixer("namespace a {\nb::bar b;\n}\n", /*FixNamespace==*/true));
+}
+
 } // namespace
 } // namespace include_fixer
 } // namespace clang
Index: 

[PATCH] D21602: Changes related to tooling::applyAllReplacements interface change in D21601.

2016-06-22 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added reviewers: klimek, djasper.
ioeric added a subscriber: cfe-commits.

this patch contains changes related to the interface change from
http://reviews.llvm.org/D21601. Only submit this patch after D21601 is
submitted.

http://reviews.llvm.org/D21602

Files:
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/clang-tidy/ClangTidyTest.h

Index: unittests/clang-tidy/ClangTidyTest.h
===
--- unittests/clang-tidy/ClangTidyTest.h
+++ unittests/clang-tidy/ClangTidyTest.h
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/Optional.h"
 #include 
 #include 
 
@@ -121,7 +122,12 @@
 Fixes.insert(Error.Fix.begin(), Error.Fix.end());
   if (Errors)
 *Errors = Context.getErrors();
-  return tooling::applyAllReplacements(Code, Fixes);
+  auto Result = tooling::applyAllReplacements(Code, Fixes);
+  if (!Result) {
+// FIXME: propogate the error.
+return "";
+  }
+  return *Result;
 }
 
 #define EXPECT_NO_CHANGES(Check, Code) 
\
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -211,9 +211,13 @@
 tooling::Replacements Replacements =
 clang::include_fixer::createInsertHeaderReplacements(
 Code->getBuffer(), FilePath, Context.Headers[0], InsertStyle);
-std::string ChangedCode =
+auto ChangedCode =
 tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
@@ -265,9 +269,13 @@
   Diagnostics.setClient(, false);
 
   if (STDINMode) {
-std::string ChangedCode =
+auto ChangedCode =
 tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 


Index: unittests/clang-tidy/ClangTidyTest.h
===
--- unittests/clang-tidy/ClangTidyTest.h
+++ unittests/clang-tidy/ClangTidyTest.h
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/Optional.h"
 #include 
 #include 
 
@@ -121,7 +122,12 @@
 Fixes.insert(Error.Fix.begin(), Error.Fix.end());
   if (Errors)
 *Errors = Context.getErrors();
-  return tooling::applyAllReplacements(Code, Fixes);
+  auto Result = tooling::applyAllReplacements(Code, Fixes);
+  if (!Result) {
+// FIXME: propogate the error.
+return "";
+  }
+  return *Result;
 }
 
 #define EXPECT_NO_CHANGES(Check, Code) \
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -211,9 +211,13 @@
 tooling::Replacements Replacements =
 clang::include_fixer::createInsertHeaderReplacements(
 Code->getBuffer(), FilePath, Context.Headers[0], InsertStyle);
-std::string ChangedCode =
+auto ChangedCode =
 tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
@@ -265,9 +269,13 @@
   Diagnostics.setClient(, false);
 
   if (STDINMode) {
-std::string ChangedCode =
+auto ChangedCode =
 tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-22 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added reviewers: klimek, djasper.
ioeric added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

return llvm::Expected<> to carry error status and error information.
This is the first step towards introducing "Error" into tooling::Replacements.

http://reviews.llvm.org/D21601

Files:
  include/clang/Tooling/Core/Replacement.h
  lib/Format/Format.cpp
  lib/Tooling/Core/Replacement.cpp
  tools/clang-format/ClangFormat.cpp
  unittests/Format/CleanupTest.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestJS.cpp
  unittests/Format/FormatTestJava.cpp
  unittests/Format/FormatTestProto.cpp
  unittests/Format/FormatTestSelective.cpp
  unittests/Format/SortImportsTestJS.cpp
  unittests/Format/SortIncludesTest.cpp
  unittests/Tooling/RefactoringTest.cpp
  unittests/Tooling/RewriterTest.cpp

Index: unittests/Tooling/RewriterTest.cpp
===
--- unittests/Tooling/RewriterTest.cpp
+++ unittests/Tooling/RewriterTest.cpp
@@ -41,8 +41,9 @@
   Replacements Replaces;
   Replaces.insert(Replacement("", 6, 6, ""));
   Replaces.insert(Replacement("", 6, 0, "replaced\n"));
-  EXPECT_EQ("line1\nreplaced\nline3\nline4",
-applyAllReplacements("line1\nline2\nline3\nline4", Replaces));
+  auto Rewritten = applyAllReplacements("line1\nline2\nline3\nline4", Replaces);
+  EXPECT_TRUE((bool)Rewritten);
+  EXPECT_EQ("line1\nreplaced\nline3\nline4", *Rewritten);
 }
 
 } // end namespace
Index: unittests/Tooling/RefactoringTest.cpp
===
--- unittests/Tooling/RefactoringTest.cpp
+++ unittests/Tooling/RefactoringTest.cpp
@@ -640,27 +640,32 @@
StringRef Result, const Replacements ,
const Replacements ) {
 // These are mainly to verify the test itself and make it easier to read.
-std::string AfterFirst = applyAllReplacements(Code, First);
-std::string InSequenceRewrite = applyAllReplacements(AfterFirst, Second);
-EXPECT_EQ(Intermediate, AfterFirst);
-EXPECT_EQ(Result, InSequenceRewrite);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE((bool)AfterFirst);
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
+EXPECT_TRUE((bool)InSequenceRewrite);
+EXPECT_EQ(Intermediate, *AfterFirst);
+EXPECT_EQ(Result, *InSequenceRewrite);
 
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE((bool)MergedRewrite);
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
   }
   void mergeAndTestRewrite(StringRef Code, const Replacements ,
const Replacements ) {
-std::string InSequenceRewrite =
-applyAllReplacements(applyAllReplacements(Code, First), Second);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE((bool)AfterFirst);
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE((bool)MergedRewrite);
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -26,10 +26,13 @@
 
   std::string sort(StringRef Code, StringRef FileName = "input.cpp") {
 auto Ranges = GetCodeRange(Code);
-std::string Sorted =
+auto Sorted =
 applyAllReplacements(Code, sortIncludes(Style, Code, Ranges, FileName));
-return applyAllReplacements(Sorted,
-reformat(Style, Sorted, Ranges, FileName));
+EXPECT_TRUE((bool)Sorted);
+auto Result = applyAllReplacements(
+*Sorted, reformat(Style, *Sorted, Ranges, FileName));
+EXPECT_TRUE((bool)Result);
+return *Result;
   }
 
   unsigned newCursor(llvm::StringRef Code, unsigned Cursor) {
Index: unittests/Format/SortImportsTestJS.cpp

[libcxx] r273395 - Run list debug copy test in C++03.

2016-06-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun 22 03:57:33 2016
New Revision: 273395

URL: http://llvm.org/viewvc/llvm-project?rev=273395=rev
Log:
Run list debug copy test in C++03.

Modified:

libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp?rev=273395=273394=273395=diff
==
--- 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp 
(original)
+++ 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp 
Wed Jun 22 03:57:33 2016
@@ -7,8 +7,6 @@
 //
 
//===--===//
 
-// UNSUPPORTED: c++98, c++03
-
 // 
 
 // list(list&& c);
@@ -22,7 +20,8 @@
 
 int main()
 {
-std::list l1 = {1, 2, 3};
+std::list l1;
+l1.push_back(1); l1.push_back(2); l1.push_back(3);
 std::list::iterator i = l1.begin();
 std::list l2 = l1;
 l2.erase(i);


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


[PATCH] D21599: [Libcxx][MIPS] Use LLVM CheckAtomic.cmake module to figure out whether we need to link with libatomic.

2016-06-22 Thread Nitesh Jain via cfe-commits
nitesh.jain created this revision.
nitesh.jain added reviewers: dsanders, vkalintiris, joerg, jroelofs, EricWF, 
mclow.lists.
nitesh.jain added subscribers: jaydeep, bhushan, slthakur, mohit.bhakkad, 
zturner, cfe-commits.
nitesh.jain set the repository for this revision to rL LLVM.

The patch http://reviews.llvm.org/D20896 add check for 64 bit atomic operations 
in LLVM CheckAtomic.cmake module. We can than used this module to figure out 
whether we need to link with libatomic.

Repository:
  rL LLVM

http://reviews.llvm.org/D21599

Files:
  cmake/Modules/CheckLibcxxAtomic.cmake
  cmake/config-ix.cmake
  lib/CMakeLists.txt
  test/CMakeLists.txt
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -22,7 +22,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
-config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
+config.use_libatomic= "@HAVE_CXX_LIBATOMICS64@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 
 # Let the main config do the real work.
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -18,7 +18,7 @@
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_ENABLE_SHARED)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
+pythonize_bool(HAVE_CXX_LIBATOMICS64)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -79,7 +79,7 @@
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
-add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
+add_library_flags_if(HAVE_CXX_LIBATOMICS64 atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)
Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,6 +1,5 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
-include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- cmake/Modules/CheckLibcxxAtomic.cmake
+++ /dev/null
@@ -1,41 +0,0 @@
-INCLUDE(CheckCXXSourceCompiles)
-
-# Sometimes linking against libatomic is required for atomic ops, if
-# the platform doesn't support lock-free atomics.
-#
-# We could modify LLVM's CheckAtomic module and have it check for 64-bit
-# atomics instead. However, we would like to avoid careless uses of 64-bit
-# atomics inside LLVM over time on 32-bit platforms.
-
-function(check_cxx_atomics varname)
-  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-std=c++11 -nostdinc++ -isystem 
${LIBCXX_SOURCE_DIR}/include")
-  if (${LIBCXX_GCC_TOOLCHAIN})
-set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
-  endif()
-  check_cxx_source_compiles("
-#include 
-#include 
-std::atomic x;
-std::atomic y;
-int main() {
-  return x + y;
-}
-" ${varname})
-  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
-endfunction(check_cxx_atomics)
-
-check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
-# If not, check if the library exists, and atomics work with it.
-if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
-  check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
-  if(LIBCXX_HAS_ATOMIC_LIB)
-list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
-check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
-if (NOT LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
-  message(WARNING "Host compiler must support std::atomic!")
-endif()
-  else()
-message(WARNING "Host compiler appears to require libatomic, but cannot 
find it.")
-  endif()
-endif()


Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -22,7 +22,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
-config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
+config.use_libatomic= "@HAVE_CXX_LIBATOMICS64@"
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
 
 # Let the main config do the real work.
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -18,7 +18,7 @@
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 

Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-22 Thread Peter Smith via cfe-commits
Hello Lei,

Thanks for all the updates. That looks good to me from an ARM perspective.

Peter

On 22 June 2016 at 09:03, Lei Zhang  wrote:
> 2016-06-21 23:07 GMT+08:00 Peter Smith :
>> Hello Lei,
>>
>> The changes to llvm and clang look ok to me. I've got some suggestions
>> for testing.
>>
>> For the clang patch, it looks like there isn't a test to check that
>> musleabihf implies hard floating point. It looks like
>> Driver/arm-mfpu.c CHECK-HF might be a good candidate to add a test.
>>
>> For the llvm patch
>>
>> I think you should be able to find a test that checks the behaviour of
>> GNUEABI and GNUEABIHF for each of the properties that you've added
>> Subtarget->isTargetMuslAEABI() to or equivalent. It would be useful to
>> add a test case for MUSLEABI and/or MUSLEABIHF. For example in the
>> RTLIB case there are a large number of tests that check whether the
>> correct __aeabi_ function is called.
>>
>> Some files I came across (there are many more) that might be a good
>> place to check that musleabi and musleabihf behaves like gnueabi and
>> gnueabihf:
>> CodeGen/ARM/memfunc.ll
>> CodeGen/Thumb2/float-ops.ll
>> CodeGen/ARM/divmod-eabi.ll
>> CodeGen/ARM/fp16.ll (hard-float for HF)
>> MC/ARM/eh-directives-personalityindex.s
>
> Thanks for the pointers! Please see the refined (again) patches.
>
> As a side note, there's no "gnueabi" in float-ops.ll or
> eh-directive-personalityindex.s, so I skipped them. In addition, I
> found a few other relevant test files to patch thanks to your advice.
>
>
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r273394 - Finish converting list _LIBCPP_DEBUG tests.

2016-06-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun 22 03:47:43 2016
New Revision: 273394

URL: http://llvm.org/viewvc/llvm-project?rev=273394=rev
Log:
Finish converting list _LIBCPP_DEBUG tests.

Added:
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/

libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/

libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp
Modified:

libcxx/trunk/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.cons/move.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.ops/splice_pos_list.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.ops/splice_pos_list_iter.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.ops/splice_pos_list_iter_iter.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/list.special/swap.pass.cpp

Added: 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp?rev=273394=auto
==
--- 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp 
(added)
+++ 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp 
Wed Jun 22 03:47:43 2016
@@ -0,0 +1,30 @@
+//===--===//
+//
+// 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
+
+// 
+
+// list(list&& c);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include 
+#include 
+#include 
+
+int main()
+{
+std::list l1 = {1, 2, 3};
+std::list::iterator i = l1.begin();
+std::list l2 = l1;
+l2.erase(i);
+assert(false);
+}

Added: 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp?rev=273394=auto
==
--- 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp 
(added)
+++ 
libcxx/trunk/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp 
Wed Jun 22 03:47:43 2016
@@ -0,0 +1,32 @@
+//===--===//
+//
+// 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
+
+// 
+
+// list(list&& c);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(1))
+
+#include 
+#include 
+#include 
+#include "MoveOnly.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+std::list l1 = {1, 2, 3};
+std::list::iterator i = l1.begin();
+std::list l2 = std::move(l1);
+assert(*l2.erase(i) == 2);
+}

Added: 
libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp?rev=273394=auto
==
--- 
libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
 (added)
+++ 
libcxx/trunk/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp
 Wed Jun 22 03:47:43 2016
@@ -0,0 +1,29 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// void splice(const_iterator position, list& x);
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+

Re: [libcxx] r273392 - Cleanup filesystem::permissions ever more.

2016-06-22 Thread Eric Fiselier via cfe-commits
*even more. Not "ever more".

On Wed, Jun 22, 2016 at 1:57 AM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Wed Jun 22 02:57:38 2016
> New Revision: 273392
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273392=rev
> Log:
> Cleanup filesystem::permissions ever more.
>
> Modified:
> libcxx/trunk/src/experimental/filesystem/operations.cpp
>
> Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=273392=273391=273392=diff
>
> ==
> --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
> +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Wed Jun 22
> 02:57:38 2016
> @@ -597,30 +597,25 @@ void __permissions(const path& p, perms
>  const bool resolve_symlinks = !bool(perms::symlink_nofollow & prms);
>  const bool add_perms = bool(perms::add_perms & prms);
>  const bool remove_perms = bool(perms::remove_perms & prms);
> -
>  _LIBCPP_ASSERT(!(add_perms && remove_perms),
> "Both add_perms and remove_perms are set");
>
> -std::error_code m_ec;
> -file_status st = resolve_symlinks ? detail::posix_stat(p, _ec)
> -  : detail::posix_lstat(p, _ec);
> -if (m_ec) return set_or_throw(m_ec, ec, "permissions", p);
> -
> -// AT_SYMLINK_NOFOLLOW can only be used on symlinks, using it on a
> regular
> -// file will cause fchmodat to report an error on some systems.
> -const bool set_sym_perms = is_symlink(st) && !resolve_symlinks;
> -
> -if ((resolve_symlinks && is_symlink(st)) && (add_perms ||
> remove_perms)) {
> -st = detail::posix_stat(p, _ec);
> +bool set_sym_perms = false;
> +prms &= perms::mask;
> +if (!resolve_symlinks || (add_perms || remove_perms)) {
> +std::error_code m_ec;
> +file_status st = resolve_symlinks ? detail::posix_stat(p, _ec)
> +  : detail::posix_lstat(p, _ec);
> +set_sym_perms = is_symlink(st);
>  if (m_ec) return set_or_throw(m_ec, ec, "permissions", p);
> +_LIBCPP_ASSERT(st.permissions() != perms::unknown,
> +   "Permissions unexpectedly unknown");
> +if (add_perms)
> +prms |= st.permissions();
> +else if (remove_perms)
> +   prms = st.permissions() & ~prms;
>  }
> -
> -prms = prms & perms::mask;
> -if (add_perms)
> -prms |= st.permissions();
> -else if (remove_perms)
> -prms = st.permissions() & ~prms;
> -auto real_perms = detail::posix_convert_perms(prms);
> +const auto real_perms = detail::posix_convert_perms(prms);
>
>  # if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_FDCWD)
>  const int flags = set_sym_perms ? AT_SYMLINK_NOFOLLOW : 0;
>
>
> ___
> 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


[libcxx] r273393 - Cleanup _LIBCPP_DEBUG tests in std::list. More to come.

2016-06-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun 22 03:01:27 2016
New Revision: 273393

URL: http://llvm.org/viewvc/llvm-project?rev=273393=rev
Log:
Cleanup _LIBCPP_DEBUG tests in std::list. More to come.

Added:
libcxx/trunk/test/libcxx/containers/sequences/list/db_back.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_cback.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_cfront.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_front.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp
libcxx/trunk/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp

libcxx/trunk/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp
Removed:
libcxx/trunk/test/std/containers/sequences/list/db_back.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_cback.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_cfront.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_front.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_iterators_6.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_iterators_7.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_iterators_8.pass.cpp
libcxx/trunk/test/std/containers/sequences/list/db_iterators_9.pass.cpp
Modified:

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp

Added: libcxx/trunk/test/libcxx/containers/sequences/list/db_back.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/db_back.pass.cpp?rev=273393=auto
==
--- libcxx/trunk/test/libcxx/containers/sequences/list/db_back.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/containers/sequences/list/db_back.pass.cpp Wed Jun 
22 03:01:27 2016
@@ -0,0 +1,32 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// Call back() on empty container.
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main()
+{
+typedef int T;
+typedef std::list C;
+C c(1);
+assert(c.back() == 0);
+c.clear();
+assert(c.back() == 0);
+assert(false);
+}

Added: libcxx/trunk/test/libcxx/containers/sequences/list/db_cback.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/db_cback.pass.cpp?rev=273393=auto
==
--- libcxx/trunk/test/libcxx/containers/sequences/list/db_cback.pass.cpp (added)
+++ libcxx/trunk/test/libcxx/containers/sequences/list/db_cback.pass.cpp Wed 
Jun 22 03:01:27 2016
@@ -0,0 +1,30 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// Call back() on empty const container.
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main()
+{
+typedef int T;
+typedef std::list C;
+const C c;
+assert(c.back() == 0);
+assert(false);
+}

Added: libcxx/trunk/test/libcxx/containers/sequences/list/db_cfront.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/list/db_cfront.pass.cpp?rev=273393=auto
==
--- libcxx/trunk/test/libcxx/containers/sequences/list/db_cfront.pass.cpp 
(added)
+++ libcxx/trunk/test/libcxx/containers/sequences/list/db_cfront.pass.cpp Wed 
Jun 22 03:01:27 2016
@@ -0,0 +1,30 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under 

[libcxx] r273392 - Cleanup filesystem::permissions ever more.

2016-06-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun 22 02:57:38 2016
New Revision: 273392

URL: http://llvm.org/viewvc/llvm-project?rev=273392=rev
Log:
Cleanup filesystem::permissions ever more.

Modified:
libcxx/trunk/src/experimental/filesystem/operations.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=273392=273391=273392=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Wed Jun 22 02:57:38 
2016
@@ -597,30 +597,25 @@ void __permissions(const path& p, perms
 const bool resolve_symlinks = !bool(perms::symlink_nofollow & prms);
 const bool add_perms = bool(perms::add_perms & prms);
 const bool remove_perms = bool(perms::remove_perms & prms);
-
 _LIBCPP_ASSERT(!(add_perms && remove_perms),
"Both add_perms and remove_perms are set");
 
-std::error_code m_ec;
-file_status st = resolve_symlinks ? detail::posix_stat(p, _ec)
-  : detail::posix_lstat(p, _ec);
-if (m_ec) return set_or_throw(m_ec, ec, "permissions", p);
-
-// AT_SYMLINK_NOFOLLOW can only be used on symlinks, using it on a regular
-// file will cause fchmodat to report an error on some systems.
-const bool set_sym_perms = is_symlink(st) && !resolve_symlinks;
-
-if ((resolve_symlinks && is_symlink(st)) && (add_perms || remove_perms)) {
-st = detail::posix_stat(p, _ec);
+bool set_sym_perms = false;
+prms &= perms::mask;
+if (!resolve_symlinks || (add_perms || remove_perms)) {
+std::error_code m_ec;
+file_status st = resolve_symlinks ? detail::posix_stat(p, _ec)
+  : detail::posix_lstat(p, _ec);
+set_sym_perms = is_symlink(st);
 if (m_ec) return set_or_throw(m_ec, ec, "permissions", p);
+_LIBCPP_ASSERT(st.permissions() != perms::unknown,
+   "Permissions unexpectedly unknown");
+if (add_perms)
+prms |= st.permissions();
+else if (remove_perms)
+   prms = st.permissions() & ~prms;
 }
-
-prms = prms & perms::mask;
-if (add_perms)
-prms |= st.permissions();
-else if (remove_perms)
-prms = st.permissions() & ~prms;
-auto real_perms = detail::posix_convert_perms(prms);
+const auto real_perms = detail::posix_convert_perms(prms);
 
 # if defined(AT_SYMLINK_NOFOLLOW) && defined(AT_FDCWD)
 const int flags = set_sym_perms ? AT_SYMLINK_NOFOLLOW : 0;


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


Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-22 Thread Lei Zhang via cfe-commits
2016-06-21 23:07 GMT+08:00 Peter Smith :
> Hello Lei,
>
> The changes to llvm and clang look ok to me. I've got some suggestions
> for testing.
>
> For the clang patch, it looks like there isn't a test to check that
> musleabihf implies hard floating point. It looks like
> Driver/arm-mfpu.c CHECK-HF might be a good candidate to add a test.
>
> For the llvm patch
>
> I think you should be able to find a test that checks the behaviour of
> GNUEABI and GNUEABIHF for each of the properties that you've added
> Subtarget->isTargetMuslAEABI() to or equivalent. It would be useful to
> add a test case for MUSLEABI and/or MUSLEABIHF. For example in the
> RTLIB case there are a large number of tests that check whether the
> correct __aeabi_ function is called.
>
> Some files I came across (there are many more) that might be a good
> place to check that musleabi and musleabihf behaves like gnueabi and
> gnueabihf:
> CodeGen/ARM/memfunc.ll
> CodeGen/Thumb2/float-ops.ll
> CodeGen/ARM/divmod-eabi.ll
> CodeGen/ARM/fp16.ll (hard-float for HF)
> MC/ARM/eh-directives-personalityindex.s

Thanks for the pointers! Please see the refined (again) patches.

As a side note, there's no "gnueabi" in float-ops.ll or
eh-directive-personalityindex.s, so I skipped them. In addition, I
found a few other relevant test files to patch thanks to your advice.


Lei


llvm-musl-arm-v3.patch
Description: Binary data


clang-musl-arm-v3.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21597: clang-format: [JS] recognize more type locations.

2016-06-22 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: lib/Format/TokenAnnotator.cpp:480
@@ -471,1 +479,3 @@
 
+  void parseJSTypeDefinition() {
+// `type Name = Type Expression;`

Why is this necessary?


http://reviews.llvm.org/D21597



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


[libcxx] r273391 - Avoid unnecessary stat call in filesystem::permissions implementation.

2016-06-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun 22 02:24:00 2016
New Revision: 273391

URL: http://llvm.org/viewvc/llvm-project?rev=273391=rev
Log:
Avoid unnecessary stat call in filesystem::permissions implementation.

Modified:
libcxx/trunk/src/experimental/filesystem/operations.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=273391=273390=273391=diff
==
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Wed Jun 22 02:24:00 
2016
@@ -602,7 +602,8 @@ void __permissions(const path& p, perms
"Both add_perms and remove_perms are set");
 
 std::error_code m_ec;
-file_status st = detail::posix_lstat(p, _ec);
+file_status st = resolve_symlinks ? detail::posix_stat(p, _ec)
+  : detail::posix_lstat(p, _ec);
 if (m_ec) return set_or_throw(m_ec, ec, "permissions", p);
 
 // AT_SYMLINK_NOFOLLOW can only be used on symlinks, using it on a regular


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


[libcxx] r273390 - Disable ccache usage for .fail.cpp tests. It causes bugs.

2016-06-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Jun 22 02:09:59 2016
New Revision: 273390

URL: http://llvm.org/viewvc/llvm-project?rev=273390=rev
Log:
Disable ccache usage for .fail.cpp tests. It causes bugs.

Modified:
libcxx/trunk/test/libcxx/compiler.py
libcxx/trunk/test/libcxx/test/format.py

Modified: libcxx/trunk/test/libcxx/compiler.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/compiler.py?rev=273390=273389=273390=diff
==
--- libcxx/trunk/test/libcxx/compiler.py (original)
+++ libcxx/trunk/test/libcxx/compiler.py Wed Jun 22 02:09:59 2016
@@ -47,9 +47,10 @@ class CXXCompiler(object):
 self.type = compiler_type
 self.version = (major_ver, minor_ver, patchlevel)
 
-def _basicCmd(self, source_files, out, is_link=False, input_is_cxx=False):
+def _basicCmd(self, source_files, out, is_link=False, input_is_cxx=False,
+  disable_ccache=False):
 cmd = []
-if self.use_ccache and not is_link:
+if self.use_ccache and not disable_ccache and not is_link:
 cmd += ['ccache']
 cmd += [self.path]
 if out is not None:
@@ -65,12 +66,15 @@ class CXXCompiler(object):
 return cmd
 
 def preprocessCmd(self, source_files, out=None, flags=[]):
-cmd = self._basicCmd(source_files, out, input_is_cxx=True) + ['-E']
+cmd = self._basicCmd(source_files, out, input_is_cxx=True,
+ disable_ccache=True) + ['-E']
 cmd += self.flags + self.compile_flags + flags
 return cmd
 
-def compileCmd(self, source_files, out=None, flags=[]):
-cmd = self._basicCmd(source_files, out, input_is_cxx=True) + ['-c']
+def compileCmd(self, source_files, out=None, flags=[],
+   disable_ccache=False):
+cmd = self._basicCmd(source_files, out, input_is_cxx=True,
+ disable_ccache=disable_ccache) + ['-c']
 cmd += self.flags + self.compile_flags + flags
 return cmd
 
@@ -89,8 +93,10 @@ class CXXCompiler(object):
 out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
 return cmd, out, err, rc
 
-def compile(self, source_files, out=None, flags=[], env=None, cwd=None):
-cmd = self.compileCmd(source_files, out, flags)
+def compile(self, source_files, out=None, flags=[], env=None, cwd=None,
+disable_ccache=False):
+cmd = self.compileCmd(source_files, out, flags,
+  disable_ccache=disable_ccache)
 out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
 return cmd, out, err, rc
 
@@ -106,7 +112,8 @@ class CXXCompiler(object):
 return cmd, out, err, rc
 
 def compileLinkTwoSteps(self, source_file, out=None, object_file=None,
-flags=[], env=None, cwd=None):
+flags=[], env=None, cwd=None,
+disable_ccache=False):
 if not isinstance(source_file, str):
 raise TypeError('This function only accepts a single input file')
 if object_file is None:
@@ -117,7 +124,8 @@ class CXXCompiler(object):
 with_fn = lambda: libcxx.util.nullContext(object_file)
 with with_fn() as object_file:
 cc_cmd, cc_stdout, cc_stderr, rc = self.compile(
-source_file, object_file, flags=flags, env=env, cwd=cwd)
+source_file, object_file, flags=flags, env=env, cwd=cwd,
+disable_ccache=disable_ccache)
 if rc != 0:
 return cc_cmd, cc_stdout, cc_stderr, rc
 

Modified: libcxx/trunk/test/libcxx/test/format.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=273390=273389=273390=diff
==
--- libcxx/trunk/test/libcxx/test/format.py (original)
+++ libcxx/trunk/test/libcxx/test/format.py Wed Jun 22 02:09:59 2016
@@ -172,7 +172,8 @@ class LibcxxTestFormat(object):
 extra_flags += ['-Xclang', '-verify',
 '-Xclang', '-verify-ignore-unexpected=note']
 cmd, out, err, rc = self.cxx.compile(source_path, out=os.devnull,
- flags=extra_flags)
+ flags=extra_flags,
+ disable_ccache=True)
 expected_rc = 0 if use_verify else 1
 if rc == expected_rc:
 return lit.Test.PASS, ''


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


Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-06-22 Thread Ismail Donmez via cfe-commits
Hi,

On Mon, Jun 20, 2016 at 10:26 PM, Yaxun Liu via cfe-commits
 wrote:
> Author: yaxunl
> Date: Mon Jun 20 14:26:00 2016
> New Revision: 273191
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273191=rev
> Log:
> [OpenCL] Include opencl-c.h by default as a clang module
>
> Include opencl-c.h by default as a module to utilize the automatic AST 
> caching mechanism of clang modules.
>
> Add an option -finclude-default-header to enable default header for OpenCL, 
> which is off by default.
>
> Differential Revision: http://reviews.llvm.org/D20444
>
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Headers/module.modulemap
> cfe/trunk/test/Headers/opencl-c-header.cl

chmod lines doesn't seem to work on Cygwin:

$ "chmod" "u-w"
"C:\cygwin64\home\ismail\src\llvm\dist\tools\clang\test\Headers\Output\opencl-c-header.cl.tmp/*"
# command stderr:
r.cl.tmp/*: invalid mode: 'mp/*'
Try 'r.cl.tmp/* --help' for more information.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273388 - [AVX512] Fix _mm_setzero_di to not require avx512vl since its used by the avx512dqintrin.h. Also update the avx512dq test to not enable avx512vl feature so we can ensure correct dependencies

2016-06-22 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Jun 22 01:36:21 2016
New Revision: 273388

URL: http://llvm.org/viewvc/llvm-project?rev=273388=rev
Log:
[AVX512] Fix _mm_setzero_di to not require avx512vl since its used by the 
avx512dqintrin.h. Also update the avx512dq test to not enable avx512vl feature 
so we can ensure correct dependencies.

Modified:
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512dq-builtins.c

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=273388=273387=273388=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Wed Jun 22 01:36:21 2016
@@ -30,9 +30,10 @@
 
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("avx512vl")))
 
-static  __inline __v2di __DEFAULT_FN_ATTRS
+/* Doesn't require avx512vl, used in avx512dqintrin.h */
+static  __inline __m128i __attribute__((__always_inline__, __nodebug__, 
__target__("avx512f")))
 _mm_setzero_di(void) {
-  return (__v2di){ 0, 0};
+  return (__m128i)(__v2di){ 0LL, 0LL};
 }
 
 /* Integer compare */

Modified: cfe/trunk/test/CodeGen/avx512dq-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512dq-builtins.c?rev=273388=273387=273388=diff
==
--- cfe/trunk/test/CodeGen/avx512dq-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512dq-builtins.c Wed Jun 22 01:36:21 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx512dq 
-target-feature +avx512vl -emit-llvm -o - -Werror | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx512dq 
-emit-llvm -o - -Werror | FileCheck %s
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H


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


r273386 - [AVX512] Add missing typecasts to intrinsics.

2016-06-22 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Jun 22 01:36:16 2016
New Revision: 273386

URL: http://llvm.org/viewvc/llvm-project?rev=273386=rev
Log:
[AVX512] Add missing typecasts to intrinsics.

Modified:
cfe/trunk/lib/Headers/avx512vlbwintrin.h

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=273386=273385=273386=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Wed Jun 22 01:36:16 2016
@@ -2408,22 +2408,22 @@ _mm256_maskz_cvtepu8_epi16 (__mmask16 __
 
 #define _mm_mask_shufflehi_epi16(W, U, A, imm) __extension__ ({ \
   (__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
-  _mm_shufflehi_epi16((A), (imm)), \
+  (__v8hi)_mm_shufflehi_epi16((A), (imm)), 
\
   (__v8hi)(__m128i)(W)); })
 
 #define _mm_maskz_shufflehi_epi16(U, A, imm) __extension__ ({ \
   (__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
-  _mm_shufflehi_epi16((A), (imm)), \
+  (__v8hi)_mm_shufflehi_epi16((A), (imm)), 
\
   (__v8hi)_mm_setzero_hi()); })
 
 #define _mm256_mask_shufflehi_epi16(W, U, A, imm) __extension__ ({ \
   (__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
-  _mm256_shufflehi_epi16((A), (imm)), \
+  (__v16hi)_mm256_shufflehi_epi16((A), 
(imm)), \
   (__v16hi)(__m256i)(W)); })
 
 #define _mm256_maskz_shufflehi_epi16(U, A, imm) __extension__ ({ \
   (__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
-  _mm256_shufflehi_epi16((A), (imm)), \
+  (__v16hi)_mm256_shufflehi_epi16((A), 
(imm)), \
   (__v16hi)_mm256_setzero_si256()); })
 
 #define _mm_mask_shufflelo_epi16(W, U, A, imm) __extension__ ({ \


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


r273387 - [AVX512] __builtin_ia32_reducesd_mask and __builtin_ia32_reducess_mask should not require avx512vl.

2016-06-22 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Jun 22 01:36:18 2016
New Revision: 273387

URL: http://llvm.org/viewvc/llvm-project?rev=273387=rev
Log:
[AVX512] __builtin_ia32_reducesd_mask and __builtin_ia32_reducess_mask should 
not require avx512vl.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=273387=273386=273387=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jun 22 01:36:18 2016
@@ -1507,8 +1507,8 @@ TARGET_BUILTIN(__builtin_ia32_reducepd12
 TARGET_BUILTIN(__builtin_ia32_reducepd256_mask, "V4dV4dIiV4dUc", "", 
"avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps128_mask, "V4fV4fIiV4fUc", "", 
"avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps256_mask, "V8fV8fIiV8fUc", "", 
"avx512vl,avx512dq")
-TARGET_BUILTIN(__builtin_ia32_reducesd_mask, "V2dV2dV2dV2dUcIiIi", "", 
"avx512vl,avx512dq")
-TARGET_BUILTIN(__builtin_ia32_reducess_mask, "V4fV4fV4fV4fUcIiIi", "", 
"avx512vl,avx512dq")
+TARGET_BUILTIN(__builtin_ia32_reducesd_mask, "V2dV2dV2dV2dUcIiIi", "", 
"avx512dq")
+TARGET_BUILTIN(__builtin_ia32_reducess_mask, "V4fV4fV4fV4fUcIiIi", "", 
"avx512dq")
 TARGET_BUILTIN(__builtin_ia32_pmaddubsw128_mask, "V8sV16cV16cV8sUc", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaddubsw256_mask, "V16sV32cV32cV16sUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaddwd128_mask, "V4iV8sV8sV4iUc", "", 
"avx512vl,avx512bw")


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


r273389 - [AVX512] Use a __v8hi vector inside of _mm_setzero_hi to match its name. Probably no real functional change.

2016-06-22 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Jun 22 01:36:23 2016
New Revision: 273389

URL: http://llvm.org/viewvc/llvm-project?rev=273389=rev
Log:
[AVX512] Use a __v8hi vector inside of _mm_setzero_hi to match its name. 
Probably no real functional change.

Modified:
cfe/trunk/lib/Headers/avx512vlbwintrin.h

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=273389=273388=273389=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Wed Jun 22 01:36:23 2016
@@ -33,7 +33,7 @@
 
 static  __inline __m128i __DEFAULT_FN_ATTRS
 _mm_setzero_hi(void){
-return (__m128i){ 0LL, 0LL };
+return (__m128i)(__v8hi){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
 /* Integer compare */


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


Re: [clang-tools-extra] r273304 - clang-rename: add a -old-name option

2016-06-22 Thread Miklos Vajna via cfe-commits
Hi Galina,

On Tue, Jun 21, 2016 at 06:17:52PM -0700, Galina Kistanova 
 wrote:
> This revision broke one of builders:
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7435

Yes, sorry. Should be fixed by r273314.

Regards,

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


Re: [PATCH] D21597: clang-format: [JS] recognize more type locations.

2016-06-22 Thread Martin Probst via cfe-commits
mprobst added a comment.

This seems to be getting a bit tricky with the declaration contexts. If you 
have a better suggestion, please come forward.


http://reviews.llvm.org/D21597



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