Re: [PATCH] D20798: clang-format: [JS] Sort imported symbols.

2016-05-31 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
This revision is now accepted and ready to land.


Comment at: lib/Format/SortJavaScriptImports.cpp:248
@@ +247,3 @@
+// ... then the references in order ...
+for (JsImportedSymbol *I = Symbols.begin(), *E = Symbols.end(); I != E;) {
+  Buffer += getSourceText(I->Range);

It's an implementation detail that the iterator of a SmallVector is a 
JsImportedSymbol*. Use auto. Also, I find this more readable:

  for (auto I = Symbols.begin(), E = Symbols.end(); I != E; ++I) {
if (I != Symbols.begin())
  Buffer += ",";
Buffer += getSourceText(I->Range);
  }


http://reviews.llvm.org/D20798



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


Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-31 Thread Felix Berger via cfe-commits
flx updated this revision to Diff 59167.

http://reviews.llvm.org/D20277

Files:
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.h
  clang-tidy/utils/DeclRefExprUtils.cpp
  clang-tidy/utils/DeclRefExprUtils.h
  clang-tidy/utils/Matchers.h
  clang-tidy/utils/TypeTraits.cpp
  clang-tidy/utils/TypeTraits.h
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  test/clang-tidy/performance-unnecessary-value-param.cpp

Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,5 +1,7 @@
 // RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
 
+// CHECK-FIXES: #include 
+
 struct ExpensiveToCopyType {
   const ExpensiveToCopyType & constReference() const {
 return *this;
@@ -30,6 +32,15 @@
   void constMethod() const;
 };
 
+struct ExpensiveMovableType {
+  ExpensiveMovableType();
+  ExpensiveMovableType(ExpensiveMovableType &&);
+  ExpensiveMovableType(const ExpensiveMovableType &) = default;
+  ExpensiveMovableType =(const ExpensiveMovableType &) = default;
+  ExpensiveMovableType =(ExpensiveMovableType &&);
+  ~ExpensiveMovableType();
+};
+
 void positiveExpensiveConstValue(const ExpensiveToCopyType Obj);
 // CHECK-FIXES: void positiveExpensiveConstValue(const ExpensiveToCopyType& Obj);
 void positiveExpensiveConstValue(const ExpensiveToCopyType Obj) {
@@ -180,3 +191,36 @@
 void NegativeMoveOnlyTypePassedByValue(MoveOnlyType M) {
   M.constMethod();
 }
+
+void PositiveMoveOnCopyConstruction(ExpensiveMovableType E) {
+  auto F = E;
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: parameter 'E' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
+  // CHECK-FIXES: auto F = std::move(E);
+}
+
+void PositiveConstRefNotMoveSinceReferencedMultipleTimes(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:79: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveConstRefNotMoveSinceReferencedMultipleTimes(const ExpensiveMovableType& E) {
+  auto F = E;
+  auto G = E;
+}
+
+void PositiveMoveOnCopyAssignment(ExpensiveMovableType E) {
+  ExpensiveMovableType F;
+  F = E;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: parameter 'E' is passed by value
+  // CHECK-FIXES: F = std::move(E);
+}
+
+void PositiveConstRefNotMoveConstructible(ExpensiveToCopyType T) {
+  // CHECK-MESSAGES: [[@LINE-1]]:63: warning: the parameter 'T' is copied
+  // CHECK-FIXES: void PositiveConstRefNotMoveConstructible(const ExpensiveToCopyType& T) {
+  auto U = T;
+}
+
+void PositiveConstRefNotMoveAssignable(ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the parameter 'A' is copied
+  // CHECK-FIXES: void PositiveConstRefNotMoveAssignable(const ExpensiveToCopyType& A) {
+  ExpensiveToCopyType B;
+  B = A;
+}
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -10,7 +10,7 @@
 which means they are not trivially copyable or have a non-trivial copy
 constructor or destructor.
 
-To ensure that it is safe to replace the value paramater with a const reference
+To ensure that it is safe to replace the value parameter with a const reference
 the following heuristic is employed:
 
 1. the parameter is const qualified;
@@ -31,3 +31,25 @@
 Value.ConstMethd();
 ExpensiveToCopy Copy(Value);
   }
+
+If the parameter is not const, only copied or assigned once and has a
+non-trivial move-constructor or move-assignment operator respectively the check
+will suggest to move it.
+
+Example:
+
+.. code-block:: c++
+
+  void setValue(string Value) {
+Field = Value;
+  }
+
+Will become:
+
+.. code-block:: c++
+
+  #include 
+
+  void setValue(string Value) {
+Field = std::move(Value);
+  }
Index: clang-tidy/utils/TypeTraits.h
===
--- clang-tidy/utils/TypeTraits.h
+++ clang-tidy/utils/TypeTraits.h
@@ -29,6 +29,12 @@
 bool recordIsTriviallyDefaultConstructible(const RecordDecl ,
const ASTContext );
 
+// Returns true if Type has a non-trivial move constructor.
+bool hasNonTrivialMoveConstructor(QualType Type);
+
+// Return true if Type has a non-trivial move assignment operator.
+bool hasNonTrivialMoveAssignment(QualType Type);
+
 } // type_traits
 } // namespace utils
 } // namespace tidy
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -124,6 +124,20 @@
   return false;
 }
 
+bool 

Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

2016-05-31 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

In http://reviews.llvm.org/D20714#444802, @Eugene.Zelenko wrote:

> Point of Include What You Use suggestions to rely on explicit dependencies, 
> not implicit ones.


It's true most of the time.
In some case,  splitting the header file is for maintainability and including 
the root is still the right coding-style to use.

I can't tell about what clang/llvm community will prefer. Both approaches make 
sense and it's matter of choice.

As an example, look to "ast.h"... there is no needs at all for the existence of 
that file if you only rely on your current rules.

  14 #ifndef LLVM_CLANG_AST_AST_H
  15 #define LLVM_CLANG_AST_AST_H
  16 
  17 // This header exports all AST interfaces.
  18 #include "clang/AST/ASTContext.h"
  19 #include "clang/AST/Decl.h"
  20 #include "clang/AST/DeclCXX.h"
  21 #include "clang/AST/DeclObjC.h"
  22 #include "clang/AST/DeclTemplate.h"
  23 #include "clang/AST/Expr.h"
  24 #include "clang/AST/ExprObjC.h"
  25 #include "clang/AST/StmtVisitor.h"
  26 #include "clang/AST/Type.h"
  27 
  28 #endif

On my side, having the include statement for every AST file is over-kill.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714



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


Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-31 Thread Felix Berger via cfe-commits
flx updated this revision to Diff 59157.
flx marked 2 inline comments as done.

http://reviews.llvm.org/D20277

Files:
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.h
  clang-tidy/utils/DeclRefExprUtils.cpp
  clang-tidy/utils/DeclRefExprUtils.h
  clang-tidy/utils/Matchers.h
  clang-tidy/utils/TypeTraits.cpp
  clang-tidy/utils/TypeTraits.h
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  test/clang-tidy/performance-unnecessary-value-param.cpp

Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,5 +1,7 @@
 // RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
 
+// CHECK-FIXES: #include 
+
 struct ExpensiveToCopyType {
   const ExpensiveToCopyType & constReference() const {
 return *this;
@@ -30,6 +32,15 @@
   void constMethod() const;
 };
 
+struct ExpensiveMovableType {
+  ExpensiveMovableType();
+  ExpensiveMovableType(ExpensiveMovableType &&);
+  ExpensiveMovableType(const ExpensiveMovableType &) = default;
+  ExpensiveMovableType =(const ExpensiveMovableType &) = default;
+  ExpensiveMovableType =(ExpensiveMovableType &&);
+  ~ExpensiveMovableType();
+};
+
 void positiveExpensiveConstValue(const ExpensiveToCopyType Obj);
 // CHECK-FIXES: void positiveExpensiveConstValue(const ExpensiveToCopyType& Obj);
 void positiveExpensiveConstValue(const ExpensiveToCopyType Obj) {
@@ -180,3 +191,36 @@
 void NegativeMoveOnlyTypePassedByValue(MoveOnlyType M) {
   M.constMethod();
 }
+
+void PositiveMoveOnCopyConstruction(ExpensiveMovableType E) {
+  auto F = E;
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: parameter 'E' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
+  // CHECK-FIXES: auto F = std::move(E);
+}
+
+void PositiveConstRefNotMoveSinceReferencedMultipleTimes(ExpensiveMovableType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:79: warning: the parameter 'E' is copied
+  // CHECK-FIXES: void PositiveConstRefNotMoveSinceReferencedMultipleTimes(const ExpensiveMovableType& E) {
+  auto F = E;
+  auto G = E;
+}
+
+void PositiveMoveOnCopyAssignment(ExpensiveMovableType E) {
+  ExpensiveMovableType F;
+  F = E;
+  // CHECK-MESSAGES: [[@LINE-1]]:7: warning: parameter 'E' is passed by value
+  // CHECK-FIXES: F = std::move(E);
+}
+
+void PositiveConstRefNotMoveConstructible(ExpensiveToCopyType T) {
+  // CHECK-MESSAGES: [[@LINE-1]]:63: warning: the parameter 'T' is copied
+  // CHECK-FIXES: void PositiveConstRefNotMoveConstructible(const ExpensiveToCopyType& T) {
+  auto U = T;
+}
+
+void PositiveConstRefNotMoveAssignable(ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the parameter 'A' is copied
+  // CHECK-FIXES: void PositiveConstRefNotMoveAssignable(const ExpensiveToCopyType& A) {
+  ExpensiveToCopyType B;
+  B = A;
+}
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -10,7 +10,7 @@
 which means they are not trivially copyable or have a non-trivial copy
 constructor or destructor.
 
-To ensure that it is safe to replace the value paramater with a const reference
+To ensure that it is safe to replace the value parameter with a const reference
 the following heuristic is employed:
 
 1. the parameter is const qualified;
@@ -31,3 +31,25 @@
 Value.ConstMethd();
 ExpensiveToCopy Copy(Value);
   }
+
+If the parameter is not const, only copied or assigned once and has a
+non-trivial move-constructor or move-assignment operator respectively the check
+will suggest to move it.
+
+Example:
+
+.. code-block:: c++
+
+  void setValue(string Value) {
+Field = Value;
+  }
+
+Will become:
+
+.. code-block:: c++
+
+  #include 
+
+  void setValue(string Value) {
+Field = std::move(Value);
+  }
Index: clang-tidy/utils/TypeTraits.h
===
--- clang-tidy/utils/TypeTraits.h
+++ clang-tidy/utils/TypeTraits.h
@@ -29,6 +29,12 @@
 bool recordIsTriviallyDefaultConstructible(const RecordDecl ,
const ASTContext );
 
+// Returns true if Type has a non-deleted move constructor.
+bool hasMoveConstructor(QualType Type);
+
+// Return true if Type has a non-deleted move assignment operator.
+bool hasMoveAssignmentOperator(QualType Type);
+
 } // type_traits
 } // namespace utils
 } // namespace tidy
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -124,6 +124,20 @@
   return false;
 }
 

Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-31 Thread Felix Berger via cfe-commits
flx added inline comments.


Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:34
@@ -29,1 +33,3 @@
 
+template  bool isSetDifferenceEmpty(const S , const S ) {
+  for (const auto  : S1)

sbenza wrote:
> isSubset?
In the caller code it seems to me more intuitive to say we're checking whether 
the set difference is empty. But no particularly strong feelings if you think 
isSubset is more clear.


http://reviews.llvm.org/D20277



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


[PATCH] D20844: FixIt: correctly set DeclSpec's range end for a type name annotation.

2016-05-31 Thread Manman Ren via cfe-commits
manmanren created this revision.
manmanren added a reviewer: rjmccall.
manmanren added a subscriber: cfe-commits.

Before this fix, both the start and the end point to the same location, and we 
will add the FixIt before the type name:
^(NSView view) to ^(*NSView view)

After this commit, fixit will change it to ^(NSView *view).



http://reviews.llvm.org/D20844

Files:
  lib/Parse/ParseDecl.cpp
  test/FixIt/fixit-interface-as-param.m

Index: test/FixIt/fixit-interface-as-param.m
===
--- test/FixIt/fixit-interface-as-param.m
+++ test/FixIt/fixit-interface-as-param.m
@@ -5,7 +5,16 @@
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:22-8:22}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:12-16:12}:"*"
Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -2935,8 +2935,8 @@
   if (isInvalid)
 break;
 
-  DS.SetRangeEnd(Tok.getAnnotationEndLoc());
   ConsumeToken(); // The typename
+  DS.SetRangeEnd(Tok.getLocation());
 
   continue;
 }


Index: test/FixIt/fixit-interface-as-param.m
===
--- test/FixIt/fixit-interface-as-param.m
+++ test/FixIt/fixit-interface-as-param.m
@@ -5,7 +5,16 @@
 
 @interface INTF
 - (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
 @end
 
 // CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:22-8:22}:"*"
+@implementation INTF
+-(void)foo {
+  ^(NSView view) {
+  };
+}
+@end
+// CHECK: {16:12-16:12}:"*"
Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -2935,8 +2935,8 @@
   if (isInvalid)
 break;
 
-  DS.SetRangeEnd(Tok.getAnnotationEndLoc());
   ConsumeToken(); // The typename
+  DS.SetRangeEnd(Tok.getLocation());
 
   continue;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20843: ObjC lifetime: pull sugar off when the qualifiers conflict.

2016-05-31 Thread Manman Ren via cfe-commits
manmanren created this revision.
manmanren added a reviewer: rjmccall.
manmanren added a subscriber: cfe-commits.

It's possible to have multiple local ObjCLifetime qualifiers. When there is
a conflict, we can't stop after we reach a type that is directly qualified.
We need to keep pulling sugar off and removing the ObjCLifetime qualifers.

One example:
@implementation A
- init {
  __attribute__((objc_ownership(strong))) __typeof__(self) self_strong;
  __attribute__((objc_ownership(weak))) __typeof__(self_strong) self_weak;
}
@end



http://reviews.llvm.org/D20843

Files:
  lib/Sema/SemaType.cpp
  test/SemaObjC/arc-objc-lifetime-conflict.m

Index: test/SemaObjC/arc-objc-lifetime-conflict.m
===
--- test/SemaObjC/arc-objc-lifetime-conflict.m
+++ test/SemaObjC/arc-objc-lifetime-conflict.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-arc 
-fobjc-runtime-has-weak %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: bitcast {{.*}} %self_weak_s_w_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong_w_s
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s3
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong3
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong2
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong
+// CHECK-NEXT: objc_storeStrong
+@interface NSObject
+@end
+@interface A : NSObject
+@end
+@implementation A
+- (void)test {
+  __attribute__((objc_ownership(strong))) __typeof__(self) self_strong;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong) self_strong2;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong2) 
self_strong3;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong3) self_weak_s3;
+ 
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong) self_weak_s;
+  __attribute__((objc_ownership(strong))) __typeof__(self_weak_s) 
self_strong_w_s;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong_w_s) 
self_weak_s_w_s;
+}
+@end
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -5415,11 +5415,13 @@
 }
 
 // Otherwise, if the qualifiers actually conflict, pull sugar off
-// until we reach a type that is directly qualified.
+// and remove the ObjCLifetime qualifiers.
 if (previousLifetime != lifetime) {
-  // This should always terminate: the canonical type is
-  // qualified, so some bit of sugar must be hiding it.
-  while (!underlyingType.Quals.hasObjCLifetime()) {
+  // It's possible to have multiple local ObjCLifetime qualifiers. We
+  // can't stop after we reach a type that is directly qualified.
+  const Type *prevTy = nullptr;
+  while (!prevTy || prevTy != underlyingType.Ty) {
+prevTy = underlyingType.Ty;
 underlyingType = underlyingType.getSingleStepDesugaredType();
   }
   underlyingType.Quals.removeObjCLifetime();


Index: test/SemaObjC/arc-objc-lifetime-conflict.m
===
--- test/SemaObjC/arc-objc-lifetime-conflict.m
+++ test/SemaObjC/arc-objc-lifetime-conflict.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-arc -fobjc-runtime-has-weak %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: bitcast {{.*}} %self_weak_s_w_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong_w_s
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_weak_s3
+// CHECK-NEXT: objc_destroyWeak
+// CHECK-NEXT: bitcast {{.*}} %self_strong3
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong2
+// CHECK-NEXT: objc_storeStrong
+// CHECK-NEXT: bitcast {{.*}} %self_strong
+// CHECK-NEXT: objc_storeStrong
+@interface NSObject
+@end
+@interface A : NSObject
+@end
+@implementation A
+- (void)test {
+  __attribute__((objc_ownership(strong))) __typeof__(self) self_strong;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong) self_strong2;
+  __attribute__((objc_ownership(strong))) __typeof__(self_strong2) self_strong3;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong3) self_weak_s3;
+ 
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong) self_weak_s;
+  __attribute__((objc_ownership(strong))) __typeof__(self_weak_s) self_strong_w_s;
+  __attribute__((objc_ownership(weak))) __typeof__(self_strong_w_s) self_weak_s_w_s;
+}
+@end
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -5415,11 +5415,13 @@
 }
 
 // Otherwise, if the qualifiers actually 

Buildbot numbers for the last week of 5/22/2016 - 5/28/2016

2016-05-31 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 5/22/2016 - 5/28/2016.

Thanks

Galina


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

 buildername| builds |
changes | status change ratio
++-+-
 perf-x86_64-penryn-O3-polly| 54 |
24 |44.4
 clang-cmake-armv7-a15-selfhost-neon| 23
|   8 |34.8
 clang-ppc64le-linux-lnt|214 |
70 |32.7
 lldb-x86_64-darwin-13.4|141 |
44 |31.2
 clang-ppc64le-linux-multistage |106 |
28 |26.4
 lldb-windows7-android  |137 |
36 |26.3
 clang-ppc64be-linux-multistage | 97 |
24 |24.7
 clang-cmake-mipsel | 21
|   5 |23.8
 clang-cmake-armv7-a15-selfhost | 30
|   7 |23.3
 clang-cmake-thumbv7-a15-full-sh| 26
|   6 |23.1
 sanitizer-x86_64-linux-bootstrap   | 46
|   9 |19.6
 clang-cmake-armv7-a15-full | 99 |
17 |17.2
 clang-x86-win2008-selfhost | 94 |
16 |17.0
 libcxx-sphinx-docs | 12
|   2 |16.7
 clang-cmake-aarch64-full   | 54
|   8 |14.8
 llvm-mips-linux| 62
|   9 |14.5
 sanitizer-ppc64le-linux| 60
|   8 |13.3
 clang-native-aarch64-full  | 15
|   2 |13.3
 lldb-x86_64-ubuntu-14.04-android   |137 |
18 |13.1
 clang-atom-d525-fedora-rel | 77 |
10 |13.0
 sanitizer-ppc64be-linux| 98 |
12 |12.2
 clang-cmake-thumbv7-a15|180 |
21 |11.7
 clang-cmake-armv7-a15  |148 |
17 |11.5
 clang-ppc64be-linux-lnt|262 |
30 |11.5
 sanitizer-x86_64-linux-fast|202 |
23 |11.4
 clang-cmake-aarch64-quick  |178 |
20 |11.2
 clang-ppc64le-linux|243 |
26 |10.7
 clang-cmake-aarch64-42vma  |113 |
12 |10.6
 llvm-clang-lld-x86_64-debian-fast  |172 |
18 |10.5
 clang-x86_64-debian-fast   |138 |
14 |10.1
 lldb-x86-windows-msvc2015  |271 |
27 |10.0
 clang-ppc64be-linux|346 |
34 | 9.8
 clang-cmake-mips   |108 |
10 | 9.3
 lldb-x86_64-ubuntu-14.04-cmake |248 |
22 | 8.9
 clang-s390x-linux  |378 |
32 | 8.5
 clang-x86_64-linux-selfhost-modules|247 |
20 | 8.1
 clang-hexagon-elf  |354 |
28 | 7.9
 clang-bpf-build|394 |
30 | 7.6
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast |469 |
34 | 7.2
 perf-x86_64-penryn-O3-polly-fast   | 30
|   2 | 6.7
 llvm-hexagon-elf   |274 |
18 | 6.6
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   |467 |
28 | 6.0
 clang-x64-ninja-win7   |154
|   9 | 5.8
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable |275 |
16 | 5.8
 sanitizer-x86_64-linux | 74
|   4 | 5.4
 lldb-amd64-ninja-netbsd7   |167
|   8 | 4.8
 lld-x86_64-freebsd |

LLVM buildmaster will be restarted tonight

2016-05-31 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted after 6 PM Pacific time today.
Thank you for understanding.

Thanks

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


r271351 - Indexer: add CXObjCPropertyAttr_class for class properties.

2016-05-31 Thread Manman Ren via cfe-commits
Author: mren
Date: Tue May 31 18:22:04 2016
New Revision: 271351

URL: http://llvm.org/viewvc/llvm-project?rev=271351=rev
Log:
Indexer: add CXObjCPropertyAttr_class for class properties.

rdar://25963227

Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/c-index-api-loadTU-test.m
cfe/trunk/test/Index/print-type.m
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=271351=271350=271351=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue May 31 18:22:04 2016
@@ -3911,7 +3911,8 @@ typedef enum {
   CXObjCPropertyAttr_atomic= 0x100,
   CXObjCPropertyAttr_weak  = 0x200,
   CXObjCPropertyAttr_strong= 0x400,
-  CXObjCPropertyAttr_unsafe_unretained = 0x800
+  CXObjCPropertyAttr_unsafe_unretained = 0x800,
+  CXObjCPropertyAttr_class = 0x4000
 } CXObjCPropertyAttrKind;
 
 /**

Modified: cfe/trunk/test/Index/c-index-api-loadTU-test.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/c-index-api-loadTU-test.m?rev=271351=271350=271351=diff
==
--- cfe/trunk/test/Index/c-index-api-loadTU-test.m (original)
+++ cfe/trunk/test/Index/c-index-api-loadTU-test.m Tue May 31 18:22:04 2016
@@ -73,6 +73,7 @@ struct X0  {};
 @interface TestAttributes()
 // 
 @property (retain) IBOutlet id anotherOutlet;
+@property (class) int cProp;
 @end
 
 // CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 
Extent=[4:1 - 12:5]
@@ -167,7 +168,7 @@ struct X0  {};
 // CHECK: c-index-api-loadTU-test.m:69:16: TypeRef=struct X0:71:8 
Extent=[69:16 - 69:18]
 // CHECK: c-index-api-loadTU-test.m:70:8: StructDecl=X0:70:8 Extent=[70:1 - 
70:10]
 // CHECK: c-index-api-loadTU-test.m:71:8: StructDecl=X0:71:8 (Definition) 
Extent=[71:1 - 71:14]
-// CHECK: c-index-api-loadTU-test.m:73:12: ObjCCategoryDecl=:73:12 
Extent=[73:1 - 76:5]
+// CHECK: c-index-api-loadTU-test.m:73:12: ObjCCategoryDecl=:73:12 
Extent=[73:1 - 77:5]
 // CHECK: c-index-api-loadTU-test.m:73:12: ObjCClassRef=TestAttributes:62:12 
Extent=[73:12 - 73:26]
 // CHECK: c-index-api-loadTU-test.m:75:32: 
ObjCPropertyDecl=anotherOutlet:75:32 [retain,] Extent=[75:1 - 75:45]
 // CHECK: c-index-api-loadTU-test.m:75:20: attribute(iboutlet)= Extent=[75:20 
- 75:28]
@@ -175,3 +176,7 @@ struct X0  {};
 // CHECK: c-index-api-loadTU-test.m:75:32: 
ObjCInstanceMethodDecl=anotherOutlet:75:32 Extent=[75:32 - 75:45]
 // CHECK: c-index-api-loadTU-test.m:75:32: 
ObjCInstanceMethodDecl=setAnotherOutlet::75:32 Extent=[75:32 - 75:45]
 // CHECK: c-index-api-loadTU-test.m:75:32: ParmDecl=anotherOutlet:75:32 
(Definition) Extent=[75:32 - 75:45]
+// CHECK: c-index-api-loadTU-test.m:76:23: ObjCPropertyDecl=cProp:76:23 
[class,] Extent=[76:1 - 76:28]
+// CHECK: c-index-api-loadTU-test.m:76:23: ObjCClassMethodDecl=cProp:76:23 
Extent=[76:23 - 76:28]
+// CHECK: c-index-api-loadTU-test.m:76:23: ObjCClassMethodDecl=setCProp::76:23 
Extent=[76:23 - 76:28]
+// CHECK: c-index-api-loadTU-test.m:76:23: ParmDecl=cProp:76:23 (Definition) 
Extent=[76:23 - 76:28]

Modified: cfe/trunk/test/Index/print-type.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-type.m?rev=271351=271350=271351=diff
==
--- cfe/trunk/test/Index/print-type.m (original)
+++ cfe/trunk/test/Index/print-type.m Tue May 31 18:22:04 2016
@@ -4,6 +4,7 @@
 -(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
 -(bycopy)methodIn:(in int)i andOut:(out short *)j , ...;
 -(void)kindof_meth:(__kindof Foo *)p;
+@property (class) int classProp;
 @end
 
 // RUN: c-index-test -test-print-type %s | FileCheck %s
@@ -15,3 +16,4 @@
 // CHECK: ParmDecl=i:5:27 (Definition) [In,] [type=int] [typekind=Int] 
[isPOD=1]
 // CHECK: ParmDecl=j:5:49 (Definition) [Out,] [type=short *] 
[typekind=Pointer] [isPOD=1] [pointeetype=short] [pointeekind=Short]
 // CHECK: ParmDecl=p:6:36 (Definition) [type=__kindof Foo *] 
[typekind=ObjCObjectPointer] [canonicaltype=__kindof Foo *] 
[canonicaltypekind=ObjCObjectPointer] [isPOD=1] [pointeetype=Foo] 
[pointeekind=ObjCInterface]
+// CHECK: ObjCPropertyDecl=classProp:7:23 [class,] [type=int] [typekind=Int] 
[isPOD=1]

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=271351=271350=271351=diff
==
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Tue May 31 18:22:04 2016
@@ -937,6 +937,7 @@ static void PrintCursor(CXCursor Cursor,
 PRINT_PROP_ATTR(weak);
 PRINT_PROP_ATTR(strong);
 

Re: [PATCH] D20757: Add "REQUIRES-ANY" feature test

2016-05-31 Thread Daniel Dunbar via cfe-commits
I believe you are thinking of: http://reviews.llvm.org/D18185


On Tue, May 31, 2016 at 2:32 PM, Paul Robinson 
wrote:

> probinson added a subscriber: probinson.
> probinson added a comment.
>
> Do I remember that somebody was working on a more generic expression-like
> syntax for REQUIRES?  If that's been abandoned, then Never Mind.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D20757
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-05-31 Thread Akira Hatanaka via cfe-commits
ahatanak added a subscriber: ahatanak.


Comment at: test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp:57
@@ -56,3 +56,3 @@
 struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
-#if !defined(__cpp_noexcept_function_type)
+#if !defined(__cpp_noexcept_function_type) && 0
 {

Can you explain why this change was needed? I'm trying to figure out why the 
two static_asserts in the #else part fail.


http://reviews.llvm.org/D16948



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


Re: [PATCH] D20640: [AMDGPU] Set default dwarf version to 2

2016-05-31 Thread Konstantin Zhuravlyov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271347: [AMDGPU] Set default dwarf version to 2 (authored by 
kzhuravl).

Changed prior to commit:
  http://reviews.llvm.org/D20640?vs=58481=59144#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20640

Files:
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/test/Driver/amdgpu-toolchain.c

Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -943,6 +943,7 @@
 public:
   AMDGPUToolChain(const Driver , const llvm::Triple ,
 const llvm::opt::ArgList );
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
 };
 
Index: cfe/trunk/test/Driver/amdgpu-toolchain.c
===
--- cfe/trunk/test/Driver/amdgpu-toolchain.c
+++ cfe/trunk/test/Driver/amdgpu-toolchain.c
@@ -1,3 +1,6 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}} "-cc1as"
 // AS_LINK: ld.lld{{.*}} "-shared"
+
+// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck 
-check-prefix=DWARF_VER %s
+// DWARF_VER: "-dwarf-version=2"


Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -943,6 +943,7 @@
 public:
   AMDGPUToolChain(const Driver , const llvm::Triple ,
 const llvm::opt::ArgList );
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
 };
 
Index: cfe/trunk/test/Driver/amdgpu-toolchain.c
===
--- cfe/trunk/test/Driver/amdgpu-toolchain.c
+++ cfe/trunk/test/Driver/amdgpu-toolchain.c
@@ -1,3 +1,6 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}} "-cc1as"
 // AS_LINK: ld.lld{{.*}} "-shared"
+
+// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
+// DWARF_VER: "-dwarf-version=2"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271347 - [AMDGPU] Set default dwarf version to 2

2016-05-31 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Tue May 31 17:47:11 2016
New Revision: 271347

URL: http://llvm.org/viewvc/llvm-project?rev=271347=rev
Log:
[AMDGPU] Set default dwarf version to 2

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

Modified:
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/amdgpu-toolchain.c

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=271347=271346=271347=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue May 31 17:47:11 2016
@@ -943,6 +943,7 @@ protected:
 public:
   AMDGPUToolChain(const Driver , const llvm::Triple ,
 const llvm::opt::ArgList );
+  unsigned GetDefaultDwarfVersion() const override { return 2; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
 };
 

Modified: cfe/trunk/test/Driver/amdgpu-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-toolchain.c?rev=271347=271346=271347=diff
==
--- cfe/trunk/test/Driver/amdgpu-toolchain.c (original)
+++ cfe/trunk/test/Driver/amdgpu-toolchain.c Tue May 31 17:47:11 2016
@@ -1,3 +1,6 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}} "-cc1as"
 // AS_LINK: ld.lld{{.*}} "-shared"
+
+// RUN: %clang -### -g -target amdgcn--amdhsa -mcpu=kaveri %s 2>&1 | FileCheck 
-check-prefix=DWARF_VER %s
+// DWARF_VER: "-dwarf-version=2"


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


Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-31 Thread Jeroen Ketema via cfe-commits
Hi Sam,

> This commit does not change the initial state of the extensions. An extension 
> is supported is not the same as enabled. At the beginning all extensions are 
> disabled.

I do not see this reflected in the code at all. Could you please:

a. Point me to the location where this distinction is made.

b. Convince me that I cannot enable an extension for a target if that target 
does not support the extension?

Jeroen

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


RE: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-31 Thread Liu, Yaxun (Sam) via cfe-commits
Hi Jeroen,

I added all extensions since it may be useful for users to know that certain 
extensions are supported by a platform. The spec does not specify those options 
which do not affect language semantics should or should not be defined. I am 
considering removing them since they may encourage users to depend on a feature 
not supported by other OpenCL compiler.

This commit does not change the initial state of the extensions. An extension 
is supported is not the same as enabled. At the beginning all extensions are 
disabled.

Each target has its own supported extensions except SPIR. Since it is a generic 
target which is supposed to run on different platforms supporting it. It is 
assumed that all extensions are supported. For some targets the supported 
extensions may not be accurate currently, but should be updated to reflect 
their real situation.

Sam

-Original Message-
From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
Sent: Tuesday, May 31, 2016 5:36 PM
To: Liu, Yaxun (Sam) 
Cc: Anastasia Stulova ; Clang Commits 
; nd 
Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.


By the way, are you accidentally violating:


The initial state of the compiler is as if the directive #pragma OPENCL 
EXTENSION all : disable was issued, telling the compiler that all error and 
warning reporting must be done according to this specification, ignoring any 
extensions.


That from just before the text quoted below.

Jeroen

> On 31 May 2016, at 22:30, Jeroen Ketema  wrote:
> 
> 
> Hi Sam,
> 
> Fair enough. However, if I read your quote correctly, then there is 
> absolutely no need to define a cl_khr_icd, pragma, as ICD in no way affects 
> the language. Why do you define one anyway?
> 
> The following also hasn’t been cleared up yet:
> 
> 
> * If I understand the patch correctly, it allows me to enable extensions for 
> targets that do not support it. There does not seem a check against the 
> initially enabled extensions, just a check for what is or isn't supported in 
> a particular version of OpenCL. This means I can now, e.g., enable sharing 
> with Direct3D 11 for the nvptx target even though this target does not 
> support this functionality.
> 
> 
> Could you please clarify?
> 
> Thanks,
> 
> Jeroen
> 
>> On 31 May 2016, at 21:29, Liu, Yaxun (Sam)  wrote:
>> 
>> Hi Jeroen,
>> 
>> OpenCL spec v1.1 s9.1 says
>> 
>> Every extension which affects the OpenCL language semantics, syntax 
>> or adds built-in functions to the language must create a preprocessor 
>> #define that matches the extension name string.
>> This #define would be available in the language if and only if the 
>> extension is supported on a given implementation.
>> 
>> The spec does not say pragma enabling/disabling an extension will 
>> define/undefined the macro.
>> 
>> Also before this commit, Clang did not define/undefine the macro based on 
>> pragma either.
>> 
>> You could define/undefined your own macro to indicate an extension is 
>> enabled/disabled then use it to condition your code.
>> 
>> Thanks.
>> 
>> Sam
>> 
>> -Original Message-
>> From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk]
>> Sent: Monday, May 30, 2016 10:08 AM
>> To: Anastasia Stulova 
>> Cc: Liu, Yaxun (Sam) ; Clang Commits 
>> ; nd 
>> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>> info.
>> 
>> 
>> Hi Anastasia,
>> 
>> My apologies for my slow reply. My main issue was that the defaults have 
>> changed, which is somewhat annoying. However, digging deeper into this I'm 
>> noticing two serious problems:
>> 
>> * When I do:
>> 
>> #pragma OPENCL EXTENSION cl_khr_fp16 : disable
>> 
>> the cl_khr_fp16 macro stays defined in code I compile down to the SPIR 
>> target, which means I cannot do conditional compilation based on which 
>> extensions are enabled/disabled. This means I now need to start pulling 
>> additional manual tricks to do conditional compilation of half precision 
>> code.
>> 
>> [Sam] Before this change, clang did not define/undefine cl_khr_fp16 based on 
>> pragma. How could your code work?
>> 
>> * If I understand the patch correctly, it allows me to enable extensions for 
>> targets that do not support it. There does not seem a check against the 
>> initially enabled extensions, just a check for what is or isn't supported in 
>> a particular version of OpenCL. This means I can now, e.g., enable sharing 
>> with Direct3D 11 for the nvptx target even though this target does not 
>> support this functionality.
>> 
>> On top of the above, I do not understand why this patch introduces code for 
>> extensions like ICD, which is an OpenCL API concept and not a OpenCL C 
>> concept.
>> [Sam] The spec requires
>> 
>> Jeroen
>> 
>>> On 20 May 2016, at 21:01, 

Re: [PATCH] D20836: [CUDA] Conservatively mark inline asm as convergent.

2016-05-31 Thread Artem Belevich via cfe-commits
tra added a comment.

I guess we would not be able to remove convergent from inline asm 
automatically. Do we need a way to explicitly remove convergent from inline asm?


http://reviews.llvm.org/D20836



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


Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-31 Thread Jeroen Ketema via cfe-commits

By the way, are you accidentally violating:


The initial state of the compiler is as if the directive
#pragma OPENCL EXTENSION all : disable
was issued, telling the compiler that all error and warning reporting must be 
done according to this specification, ignoring any extensions.


That from just before the text quoted below.

Jeroen

> On 31 May 2016, at 22:30, Jeroen Ketema  wrote:
> 
> 
> Hi Sam,
> 
> Fair enough. However, if I read your quote correctly, then there is 
> absolutely no need to define a cl_khr_icd, pragma, as ICD in no way affects 
> the language. Why do you define one anyway?
> 
> The following also hasn’t been cleared up yet:
> 
> 
> * If I understand the patch correctly, it allows me to enable extensions for 
> targets that do not support it. There does not seem a check against the 
> initially enabled extensions, just a check for what is or isn't supported in 
> a particular version of OpenCL. This means I can now, e.g., enable sharing 
> with Direct3D 11 for the nvptx target even though this target does not 
> support this functionality.
> 
> 
> Could you please clarify?
> 
> Thanks,
> 
> Jeroen
> 
>> On 31 May 2016, at 21:29, Liu, Yaxun (Sam)  wrote:
>> 
>> Hi Jeroen,
>> 
>> OpenCL spec v1.1 s9.1 says
>> 
>> Every extension which affects the OpenCL language semantics, syntax or adds 
>> built-in functions
>> to the language must create a preprocessor #define that matches the 
>> extension name string.
>> This #define would be available in the language if and only if the extension 
>> is supported on a
>> given implementation.
>> 
>> The spec does not say pragma enabling/disabling an extension will 
>> define/undefined the macro.
>> 
>> Also before this commit, Clang did not define/undefine the macro based on 
>> pragma either.
>> 
>> You could define/undefined your own macro to indicate an extension is 
>> enabled/disabled then use it to condition your code.
>> 
>> Thanks.
>> 
>> Sam
>> 
>> -Original Message-
>> From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
>> Sent: Monday, May 30, 2016 10:08 AM
>> To: Anastasia Stulova 
>> Cc: Liu, Yaxun (Sam) ; Clang Commits 
>> ; nd 
>> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>> info.
>> 
>> 
>> Hi Anastasia,
>> 
>> My apologies for my slow reply. My main issue was that the defaults have 
>> changed, which is somewhat annoying. However, digging deeper into this I'm 
>> noticing two serious problems:
>> 
>> * When I do:
>> 
>> #pragma OPENCL EXTENSION cl_khr_fp16 : disable
>> 
>> the cl_khr_fp16 macro stays defined in code I compile down to the SPIR 
>> target, which means I cannot do conditional compilation based on which 
>> extensions are enabled/disabled. This means I now need to start pulling 
>> additional manual tricks to do conditional compilation of half precision 
>> code.
>> 
>> [Sam] Before this change, clang did not define/undefine cl_khr_fp16 based on 
>> pragma. How could your code work?
>> 
>> * If I understand the patch correctly, it allows me to enable extensions for 
>> targets that do not support it. There does not seem a check against the 
>> initially enabled extensions, just a check for what is or isn't supported in 
>> a particular version of OpenCL. This means I can now, e.g., enable sharing 
>> with Direct3D 11 for the nvptx target even though this target does not 
>> support this functionality.
>> 
>> On top of the above, I do not understand why this patch introduces code for 
>> extensions like ICD, which is an OpenCL API concept and not a OpenCL C 
>> concept.
>> [Sam] The spec requires 
>> 
>> Jeroen
>> 
>>> On 20 May 2016, at 21:01, Anastasia Stulova  
>>> wrote:
>>> 
>>> Thanks Sam!
>>> 
>>> @Jeroen, could you give us more details about your problem.
>>> 
>>> Anastasia
>>> 
>>> -Original Message-
>>> From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com]
>>> Sent: 20 May 2016 20:52
>>> To: Anastasia Stulova; Jeroen Ketema
>>> Cc: Clang Commits; nd
>>> Subject: RE: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>>> info.
>>> 
>>> I think this feature can be implemented by keeping a record of enabled 
>>> OpenCL extensions by user's program.
>>> 
>>> For optional core feature cl_khr_fp64, we just need to detect if double 
>>> type is used by user's program.
>>> 
>>> Sam
>>> 
>>> -Original Message-
>>> From: Liu, Yaxun (Sam)
>>> Sent: Friday, May 20, 2016 3:45 PM
>>> To: 'Anastasia Stulova' ; Jeroen Ketema 
>>> 
>>> Cc: Clang Commits ; nd 
>>> Subject: RE: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>>> info.
>>> 
>>> Currently Clang does not emit opencl.used.extensions metadata, so the issue 
>>> mentioned does not exist.
>>> 
>>> Also extensions supported by a target and 

Re: [PATCH] D20836: [CUDA] Conservatively mark inline asm as convergent.

2016-05-31 Thread Justin Lebar via cfe-commits
jlebar added a comment.

In http://reviews.llvm.org/D20836#444911, @tra wrote:

> I guess we would not be able to remove convergent from inline asm 
> automatically. Do we need a way to explicitly remove convergent from inline 
> asm?


We can think about it.  I'm not sure it will make a big difference, frankly.  
Like, if this encourages people to write less inline asm, I'm onboard with 
that.  :)


Repository:
  rL LLVM

http://reviews.llvm.org/D20836



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


Re: [PATCH] D20836: [CUDA] Conservatively mark inline asm as convergent.

2016-05-31 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271336: [CUDA] Conservatively mark inline asm as convergent. 
(authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D20836?vs=59130=59133#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20836

Files:
  cfe/trunk/lib/CodeGen/CGStmt.cpp
  cfe/trunk/test/CodeGenCUDA/convergent.cu

Index: cfe/trunk/test/CodeGenCUDA/convergent.cu
===
--- cfe/trunk/test/CodeGenCUDA/convergent.cu
+++ cfe/trunk/test/CodeGenCUDA/convergent.cu
@@ -25,13 +25,19 @@
 __host__ __device__ void bar() {
   // DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
   baz();
+  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
+  int x;
+  asm ("trap;" : "=l"(x));
+  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
+  asm volatile ("trap;");
 }
 
 // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // DEVICE: attributes [[BAZ_ATTR]] = {
 // DEVICE-SAME: convergent
 // DEVICE-SAME: }
 // DEVICE: attributes [[CALL_ATTR]] = { convergent }
+// DEVICE: attributes [[ASM_ATTR]] = { convergent
 
 // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // HOST: attributes [[BAZ_ATTR]] = {
Index: cfe/trunk/lib/CodeGen/CGStmt.cpp
===
--- cfe/trunk/lib/CodeGen/CGStmt.cpp
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp
@@ -2054,6 +2054,14 @@
   llvm::ConstantAsMetadata::get(Loc)));
   }
 
+  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
+// Conservatively, mark all inline asm blocks in CUDA as convergent
+// (meaning, they may call an intrinsically convergent op, such as 
bar.sync,
+// and so can't have certain optimizations applied around them).
+Result->addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::Convergent);
+  }
+
   // Extract all of the register value results from the asm.
   std::vector RegResults;
   if (ResultRegTypes.size() == 1) {


Index: cfe/trunk/test/CodeGenCUDA/convergent.cu
===
--- cfe/trunk/test/CodeGenCUDA/convergent.cu
+++ cfe/trunk/test/CodeGenCUDA/convergent.cu
@@ -25,13 +25,19 @@
 __host__ __device__ void bar() {
   // DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
   baz();
+  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
+  int x;
+  asm ("trap;" : "=l"(x));
+  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
+  asm volatile ("trap;");
 }
 
 // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // DEVICE: attributes [[BAZ_ATTR]] = {
 // DEVICE-SAME: convergent
 // DEVICE-SAME: }
 // DEVICE: attributes [[CALL_ATTR]] = { convergent }
+// DEVICE: attributes [[ASM_ATTR]] = { convergent
 
 // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // HOST: attributes [[BAZ_ATTR]] = {
Index: cfe/trunk/lib/CodeGen/CGStmt.cpp
===
--- cfe/trunk/lib/CodeGen/CGStmt.cpp
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp
@@ -2054,6 +2054,14 @@
   llvm::ConstantAsMetadata::get(Loc)));
   }
 
+  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
+// Conservatively, mark all inline asm blocks in CUDA as convergent
+// (meaning, they may call an intrinsically convergent op, such as bar.sync,
+// and so can't have certain optimizations applied around them).
+Result->addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::Convergent);
+  }
+
   // Extract all of the register value results from the asm.
   std::vector RegResults;
   if (ResultRegTypes.size() == 1) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271336 - [CUDA] Conservatively mark inline asm as convergent.

2016-05-31 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Tue May 31 16:27:13 2016
New Revision: 271336

URL: http://llvm.org/viewvc/llvm-project?rev=271336=rev
Log:
[CUDA] Conservatively mark inline asm as convergent.

Summary:
This is particularly important because a some convergent CUDA intrinsics
(e.g.  __shfl_down) are implemented in terms of inline asm.

Reviewers: tra

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGenCUDA/convergent.cu

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=271336=271335=271336=diff
==
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue May 31 16:27:13 2016
@@ -2054,6 +2054,14 @@ void CodeGenFunction::EmitAsmStmt(const
   llvm::ConstantAsMetadata::get(Loc)));
   }
 
+  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
+// Conservatively, mark all inline asm blocks in CUDA as convergent
+// (meaning, they may call an intrinsically convergent op, such as 
bar.sync,
+// and so can't have certain optimizations applied around them).
+Result->addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::Convergent);
+  }
+
   // Extract all of the register value results from the asm.
   std::vector RegResults;
   if (ResultRegTypes.size() == 1) {

Modified: cfe/trunk/test/CodeGenCUDA/convergent.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCUDA/convergent.cu?rev=271336=271335=271336=diff
==
--- cfe/trunk/test/CodeGenCUDA/convergent.cu (original)
+++ cfe/trunk/test/CodeGenCUDA/convergent.cu Tue May 31 16:27:13 2016
@@ -25,6 +25,11 @@ __host__ __device__ void baz();
 __host__ __device__ void bar() {
   // DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
   baz();
+  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
+  int x;
+  asm ("trap;" : "=l"(x));
+  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
+  asm volatile ("trap;");
 }
 
 // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
@@ -32,6 +37,7 @@ __host__ __device__ void bar() {
 // DEVICE-SAME: convergent
 // DEVICE-SAME: }
 // DEVICE: attributes [[CALL_ATTR]] = { convergent }
+// DEVICE: attributes [[ASM_ATTR]] = { convergent
 
 // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // HOST: attributes [[BAZ_ATTR]] = {


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


Re: [PATCH] D20757: Add "REQUIRES-ANY" feature test

2016-05-31 Thread Paul Robinson via cfe-commits
probinson added a subscriber: probinson.
probinson added a comment.

Do I remember that somebody was working on a more generic expression-like 
syntax for REQUIRES?  If that's been abandoned, then Never Mind.


Repository:
  rL LLVM

http://reviews.llvm.org/D20757



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


Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-31 Thread Jeroen Ketema via cfe-commits

Hi Sam,

Fair enough. However, if I read your quote correctly, then there is absolutely 
no need to define a cl_khr_icd, pragma, as ICD in no way affects the language. 
Why do you define one anyway?

The following also hasn’t been cleared up yet:


* If I understand the patch correctly, it allows me to enable extensions for 
targets that do not support it. There does not seem a check against the 
initially enabled extensions, just a check for what is or isn't supported in a 
particular version of OpenCL. This means I can now, e.g., enable sharing with 
Direct3D 11 for the nvptx target even though this target does not support this 
functionality.


Could you please clarify?

Thanks,

 Jeroen

> On 31 May 2016, at 21:29, Liu, Yaxun (Sam)  wrote:
> 
> Hi Jeroen,
> 
> OpenCL spec v1.1 s9.1 says
> 
> Every extension which affects the OpenCL language semantics, syntax or adds 
> built-in functions
> to the language must create a preprocessor #define that matches the extension 
> name string.
> This #define would be available in the language if and only if the extension 
> is supported on a
> given implementation.
> 
> The spec does not say pragma enabling/disabling an extension will 
> define/undefined the macro.
> 
> Also before this commit, Clang did not define/undefine the macro based on 
> pragma either.
> 
> You could define/undefined your own macro to indicate an extension is 
> enabled/disabled then use it to condition your code.
> 
> Thanks.
> 
> Sam
> 
> -Original Message-
> From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
> Sent: Monday, May 30, 2016 10:08 AM
> To: Anastasia Stulova 
> Cc: Liu, Yaxun (Sam) ; Clang Commits 
> ; nd 
> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> 
> Hi Anastasia,
> 
> My apologies for my slow reply. My main issue was that the defaults have 
> changed, which is somewhat annoying. However, digging deeper into this I'm 
> noticing two serious problems:
> 
> * When I do:
> 
> #pragma OPENCL EXTENSION cl_khr_fp16 : disable
> 
> the cl_khr_fp16 macro stays defined in code I compile down to the SPIR 
> target, which means I cannot do conditional compilation based on which 
> extensions are enabled/disabled. This means I now need to start pulling 
> additional manual tricks to do conditional compilation of half precision code.
> 
> [Sam] Before this change, clang did not define/undefine cl_khr_fp16 based on 
> pragma. How could your code work?
> 
> * If I understand the patch correctly, it allows me to enable extensions for 
> targets that do not support it. There does not seem a check against the 
> initially enabled extensions, just a check for what is or isn't supported in 
> a particular version of OpenCL. This means I can now, e.g., enable sharing 
> with Direct3D 11 for the nvptx target even though this target does not 
> support this functionality.
> 
> On top of the above, I do not understand why this patch introduces code for 
> extensions like ICD, which is an OpenCL API concept and not a OpenCL C 
> concept.
> [Sam] The spec requires 
> 
> Jeroen
> 
>> On 20 May 2016, at 21:01, Anastasia Stulova  
>> wrote:
>> 
>> Thanks Sam!
>> 
>> @Jeroen, could you give us more details about your problem.
>> 
>> Anastasia
>> 
>> -Original Message-
>> From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com]
>> Sent: 20 May 2016 20:52
>> To: Anastasia Stulova; Jeroen Ketema
>> Cc: Clang Commits; nd
>> Subject: RE: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>> info.
>> 
>> I think this feature can be implemented by keeping a record of enabled 
>> OpenCL extensions by user's program.
>> 
>> For optional core feature cl_khr_fp64, we just need to detect if double type 
>> is used by user's program.
>> 
>> Sam
>> 
>> -Original Message-
>> From: Liu, Yaxun (Sam)
>> Sent: Friday, May 20, 2016 3:45 PM
>> To: 'Anastasia Stulova' ; Jeroen Ketema 
>> 
>> Cc: Clang Commits ; nd 
>> Subject: RE: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>> info.
>> 
>> Currently Clang does not emit opencl.used.extensions metadata, so the issue 
>> mentioned does not exist.
>> 
>> Also extensions supported by a target and extensions used by an OpenCL 
>> program is different concept.
>> 
>> I'd say Clang currently miss a feature to detect used extensions and emit 
>> the metadata.
>> 
>> Sam
>> 
>> -Original Message-
>> From: Anastasia Stulova [mailto:anastasia.stul...@arm.com]
>> Sent: Friday, May 20, 2016 3:23 PM
>> To: Liu, Yaxun (Sam) ; Jeroen Ketema 
>> 
>> Cc: Clang Commits ; nd 
>> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
>> info.
>> 
>> Hi Sam,
>> 
>> 

Re: [PATCH] D20709: Support ARM subtarget feature +long64

2016-05-31 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a comment.

I looked at how LangOpts and TargetInfo are handled and found a way we can 
achieve 64-bit longs without a Target feature (and restrict it just to 
RenderScript!).  This would be via TargetInfo::adjust().  I'll abandon the 
sibling patch to LLVM as we should be able to do this just in Clang.


http://reviews.llvm.org/D20709



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


[PATCH] D20836: [CUDA] Conservatively mark inline asm as convergent.

2016-05-31 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: tra.
jlebar added a subscriber: cfe-commits.

This is particularly important because a some convergent CUDA intrinsics
(e.g.  __shfl_down) are implemented in terms of inline asm.

http://reviews.llvm.org/D20836

Files:
  lib/CodeGen/CGStmt.cpp
  test/CodeGenCUDA/convergent.cu

Index: test/CodeGenCUDA/convergent.cu
===
--- test/CodeGenCUDA/convergent.cu
+++ test/CodeGenCUDA/convergent.cu
@@ -25,13 +25,19 @@
 __host__ __device__ void bar() {
   // DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
   baz();
+  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
+  int x;
+  asm ("trap;" : "=l"(x));
+  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
+  asm volatile ("trap;");
 }
 
 // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // DEVICE: attributes [[BAZ_ATTR]] = {
 // DEVICE-SAME: convergent
 // DEVICE-SAME: }
 // DEVICE: attributes [[CALL_ATTR]] = { convergent }
+// DEVICE: attributes [[ASM_ATTR]] = { convergent
 
 // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // HOST: attributes [[BAZ_ATTR]] = {
Index: lib/CodeGen/CGStmt.cpp
===
--- lib/CodeGen/CGStmt.cpp
+++ lib/CodeGen/CGStmt.cpp
@@ -2054,6 +2054,14 @@
   llvm::ConstantAsMetadata::get(Loc)));
   }
 
+  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
+// Conservatively, mark all inline asm blocks in CUDA as convergent
+// (meaning, they may call an intrinsically convergent op, such as 
bar.sync,
+// and so can't have certain optimizations applied around them).
+Result->addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::Convergent);
+  }
+
   // Extract all of the register value results from the asm.
   std::vector RegResults;
   if (ResultRegTypes.size() == 1) {


Index: test/CodeGenCUDA/convergent.cu
===
--- test/CodeGenCUDA/convergent.cu
+++ test/CodeGenCUDA/convergent.cu
@@ -25,13 +25,19 @@
 __host__ __device__ void bar() {
   // DEVICE: call void @_Z3bazv() [[CALL_ATTR:#[0-9]+]]
   baz();
+  // DEVICE: call i32 asm "trap;", "=l"() [[ASM_ATTR:#[0-9]+]]
+  int x;
+  asm ("trap;" : "=l"(x));
+  // DEVICE: call void asm sideeffect "trap;", ""() [[ASM_ATTR:#[0-9]+]]
+  asm volatile ("trap;");
 }
 
 // DEVICE: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // DEVICE: attributes [[BAZ_ATTR]] = {
 // DEVICE-SAME: convergent
 // DEVICE-SAME: }
 // DEVICE: attributes [[CALL_ATTR]] = { convergent }
+// DEVICE: attributes [[ASM_ATTR]] = { convergent
 
 // HOST: declare void @_Z3bazv() [[BAZ_ATTR:#[0-9]+]]
 // HOST: attributes [[BAZ_ATTR]] = {
Index: lib/CodeGen/CGStmt.cpp
===
--- lib/CodeGen/CGStmt.cpp
+++ lib/CodeGen/CGStmt.cpp
@@ -2054,6 +2054,14 @@
   llvm::ConstantAsMetadata::get(Loc)));
   }
 
+  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
+// Conservatively, mark all inline asm blocks in CUDA as convergent
+// (meaning, they may call an intrinsically convergent op, such as bar.sync,
+// and so can't have certain optimizations applied around them).
+Result->addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::Convergent);
+  }
+
   // Extract all of the register value results from the asm.
   std::vector RegResults;
   if (ResultRegTypes.size() == 1) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16545: [libcxxabi] Enable testing for static libc++abi

2016-05-31 Thread Ben Craig via cfe-commits
bcraig added a comment.

In http://reviews.llvm.org/D16545#444854, @rmaprath wrote:

> Hmmm, it looks like part of this patch didn't go in? I cannot see the changes 
> in the `libcxxabi/CMakeLists.txt` file in the repo.
>
> I was hoping this would enable me to run the `libc++abi` tests on in-tree 
> static builds, but I still can't.
>
> Perhaps you forgot to commit that file?


Hrm, you're right, it didn't go in.  I'll get it in tomorrow morning.


http://reviews.llvm.org/D16545



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


Re: [PATCH] D16545: [libcxxabi] Enable testing for static libc++abi

2016-05-31 Thread Asiri Rathnayake via cfe-commits
rmaprath added a subscriber: rmaprath.
rmaprath added a comment.

Hmmm, it looks like part of this patch didn't go in? I cannot see the changes 
in the `libcxxab/CMakeLists.txt` file in the repo.

I was hoping this would enable me to run the `libc++abi` tests on in-tree 
static builds, but I still can't.

Perhaps you forgot to commit that file?


http://reviews.llvm.org/D16545



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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-05-31 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Sema/SemaExpr.cpp:10527
@@ +10526,3 @@
+if (RD->hasAttr() ||
+ME->getMemberDecl()->hasAttr()) {
+  Diag(OpLoc, diag::warn_taking_address_of_packed_member)

rogfer01 wrote:
> aaron.ballman wrote:
> > Ah, I forgot that the attribute also affected the alignment of the struct 
> > itself. Amending my false-positive idea, the following should be fine, 
> > shouldn't it?:
> > ```
> > struct __attribute__((packed)) S {
> >   char c;
> >   int i;
> >   char c2;
> > };
> > 
> > void f(S s) {
> >   char *cp = 
> >   char *cp2 = 
> > }
> > ```
> > I think perhaps we should not diagnose if the member's type also has a 
> > one-byte alignment (or, for instance, uses alignas(1) to achieve that). 
> > What do you think?
> Yes. I like the idea since the packed attribute has no effect on already 
> 1-aligned data (like char). But note that C++11 does not allow reducing the 
> alignment through `alignas`.
Hmm, okay, I was not remembering properly; I thought one of `alignas`, 
`__declspec(align)`, or `__attribute__((aligned))` allowed for decreasing the 
alignment, but documentation implies otherwise.


http://reviews.llvm.org/D20561



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


Re: [PATCH] D20757: Add "REQUIRES-ANY" feature test

2016-05-31 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rL LLVM

http://reviews.llvm.org/D20757



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


r271331 - [Coverage] Remove redundant handleFileExit() call (NFC)

2016-05-31 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Tue May 31 15:35:12 2016
New Revision: 271331

URL: http://llvm.org/viewvc/llvm-project?rev=271331=rev
Log:
[Coverage] Remove redundant handleFileExit() call (NFC)

I added this call in r271308. It's redundant because it's dominated by a
call to extendRegion().

Thanks to Justin Bogner for pointing this out!

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

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=271331=271330=271331=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Tue May 31 15:35:12 2016
@@ -783,10 +783,8 @@ struct CounterCoverageMappingBuilder
   Visit(Child);
 popRegions(Index);
   }
-} else {
-  handleFileExit(getStart(Body));
+} else
   propagateCounts(Counter::getZero(), Body);
-}
 BreakContinue BC = BreakContinueStack.pop_back_val();
 
 if (!BreakContinueStack.empty())


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


Re: [PATCH] D20828: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271329: [CMake] Update to requiring CMake 3.4.3 (authored by 
cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D20828?vs=59099=59125#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20828

Files:
  libcxx/trunk/CMakeLists.txt

Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -3,7 +3,7 @@
 
#===
 # Setup Project
 
#===
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -3,7 +3,7 @@
 #===
 # Setup Project
 #===
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20829: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271330: [CMake] Update to requiring CMake 3.4.3 (authored by 
cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D20829?vs=59101=59126#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20829

Files:
  libcxxabi/trunk/CMakeLists.txt

Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -2,7 +2,7 @@
 # Setup Project
 
#===
 
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -2,7 +2,7 @@
 # Setup Project
 #===
 
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-31 Thread Liu, Yaxun (Sam) via cfe-commits
Hi Jeroen,

OpenCL spec v1.1 s9.1 says

Every extension which affects the OpenCL language semantics, syntax or adds 
built-in functions
to the language must create a preprocessor #define that matches the extension 
name string.
This #define would be available in the language if and only if the extension is 
supported on a
given implementation.

The spec does not say pragma enabling/disabling an extension will 
define/undefined the macro.

Also before this commit, Clang did not define/undefine the macro based on 
pragma either.

You could define/undefined your own macro to indicate an extension is 
enabled/disabled then use it to condition your code.

Thanks.

Sam

-Original Message-
From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
Sent: Monday, May 30, 2016 10:08 AM
To: Anastasia Stulova 
Cc: Liu, Yaxun (Sam) ; Clang Commits 
; nd 
Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.


Hi Anastasia,

My apologies for my slow reply. My main issue was that the defaults have 
changed, which is somewhat annoying. However, digging deeper into this I'm 
noticing two serious problems:

* When I do:

#pragma OPENCL EXTENSION cl_khr_fp16 : disable

the cl_khr_fp16 macro stays defined in code I compile down to the SPIR target, 
which means I cannot do conditional compilation based on which extensions are 
enabled/disabled. This means I now need to start pulling additional manual 
tricks to do conditional compilation of half precision code.

[Sam] Before this change, clang did not define/undefine cl_khr_fp16 based on 
pragma. How could your code work?

* If I understand the patch correctly, it allows me to enable extensions for 
targets that do not support it. There does not seem a check against the 
initially enabled extensions, just a check for what is or isn't supported in a 
particular version of OpenCL. This means I can now, e.g., enable sharing with 
Direct3D 11 for the nvptx target even though this target does not support this 
functionality.

On top of the above, I do not understand why this patch introduces code for 
extensions like ICD, which is an OpenCL API concept and not a OpenCL C concept.
[Sam] The spec requires 

Jeroen

> On 20 May 2016, at 21:01, Anastasia Stulova  wrote:
> 
> Thanks Sam!
> 
> @Jeroen, could you give us more details about your problem.
> 
> Anastasia
> 
> -Original Message-
> From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com]
> Sent: 20 May 2016 20:52
> To: Anastasia Stulova; Jeroen Ketema
> Cc: Clang Commits; nd
> Subject: RE: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> I think this feature can be implemented by keeping a record of enabled OpenCL 
> extensions by user's program.
> 
> For optional core feature cl_khr_fp64, we just need to detect if double type 
> is used by user's program.
> 
> Sam
> 
> -Original Message-
> From: Liu, Yaxun (Sam)
> Sent: Friday, May 20, 2016 3:45 PM
> To: 'Anastasia Stulova' ; Jeroen Ketema 
> 
> Cc: Clang Commits ; nd 
> Subject: RE: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Currently Clang does not emit opencl.used.extensions metadata, so the issue 
> mentioned does not exist.
> 
> Also extensions supported by a target and extensions used by an OpenCL 
> program is different concept.
> 
> I'd say Clang currently miss a feature to detect used extensions and emit the 
> metadata.
> 
> Sam
> 
> -Original Message-
> From: Anastasia Stulova [mailto:anastasia.stul...@arm.com]
> Sent: Friday, May 20, 2016 3:23 PM
> To: Liu, Yaxun (Sam) ; Jeroen Ketema 
> 
> Cc: Clang Commits ; nd 
> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Hi Sam,
> 
> Has this been addressed?
> 
> @Jeroen, as far as I am aware adding supported extensions is completely new 
> to Clang and shouldn't be braking any existing functionality that are related 
> to that. Could you elaborate on the problem. Would creating new Clang target 
> help? Otherwise, do you have any other proposal for the solution?
> 
> Thanks,
> Anastasia
> 
> 
> 
> From: cfe-commits  on behalf of 
> Jeroen Ketema via cfe-commits 
> Sent: 17 May 2016 12:49
> To: Yaxun Liu via cfe-commits
> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Hi,
> 
> The below commit enables all OpenCL extensions for the SPIR target by 
> default. This incorrect, as SPIR allows you to specify which extensions are 
> enabled/disabled its metadata. This means that any SPIR generated by Clang 
> may now be rejected by specific OpenCL 

Re: [PATCH] D20823: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271326: [CMake] Update to requiring CMake 3.4.3 (authored by 
cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D20823?vs=59094=59122#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20823

Files:
  cfe/trunk/CMakeLists.txt
  cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt

Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 # FIXME: It may be removed when we use 2.8.12.
 if(CMAKE_VERSION VERSION_LESS 2.8.12)
Index: cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
===
--- cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
+++ cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
@@ -1,6 +1,6 @@
 project(exec C)
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 include(CheckCCompilerFlag)
 check_c_compiler_flag("-std=c99" C99_SUPPORTED)


Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 # FIXME: It may be removed when we use 2.8.12.
 if(CMAKE_VERSION VERSION_LESS 2.8.12)
Index: cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
===
--- cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
+++ cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
@@ -1,6 +1,6 @@
 project(exec C)
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 include(CheckCCompilerFlag)
 check_c_compiler_flag("-std=c99" C99_SUPPORTED)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r271330 - [CMake] Update to requiring CMake 3.4.3

2016-05-31 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue May 31 15:21:53 2016
New Revision: 271330

URL: http://llvm.org/viewvc/llvm-project?rev=271330=rev
Log:
[CMake] Update to requiring CMake 3.4.3

Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: cfe-commits

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

Modified:
libcxxabi/trunk/CMakeLists.txt

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=271330=271329=271330=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Tue May 31 15:21:53 2016
@@ -2,7 +2,7 @@
 # Setup Project
 
#===
 
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


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


r271326 - [CMake] Update to requiring CMake 3.4.3

2016-05-31 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue May 31 15:21:38 2016
New Revision: 271326

URL: http://llvm.org/viewvc/llvm-project?rev=271326=rev
Log:
[CMake] Update to requiring CMake 3.4.3

Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: cfe-commits

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

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=271326=271325=271326=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Tue May 31 15:21:38 2016
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 # FIXME: It may be removed when we use 2.8.12.
 if(CMAKE_VERSION VERSION_LESS 2.8.12)

Modified: cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt?rev=271326=271325=271326=diff
==
--- cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt 
(original)
+++ cfe/trunk/tools/scan-build-py/tests/functional/exec/CMakeLists.txt Tue May 
31 15:21:38 2016
@@ -1,6 +1,6 @@
 project(exec C)
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 include(CheckCCompilerFlag)
 check_c_compiler_flag("-std=c99" C99_SUPPORTED)


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


[libcxx] r271329 - [CMake] Update to requiring CMake 3.4.3

2016-05-31 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue May 31 15:21:52 2016
New Revision: 271329

URL: http://llvm.org/viewvc/llvm-project?rev=271329=rev
Log:
[CMake] Update to requiring CMake 3.4.3

Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=271329=271328=271329=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Tue May 31 15:21:52 2016
@@ -3,7 +3,7 @@
 
#===
 # Setup Project
 
#===
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


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


Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

2016-05-31 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

Point of Include What You Use suggestions to rely on explicit dependencies, not 
implicit ones.



Comment at: clang-tidy/utils/OptionsUtils.cpp:1
@@ -1,2 +1,2 @@
 //===--- DanglingHandleCheck.cpp - 
clang-tidy--===//
 //

etienneb wrote:
> Could you fix this 'DanglingHandleCheck.cpp' -> 'OptionsUtils.cpp'
> 
Will fix on commit.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714



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


[clang-tools-extra] r271321 - [include-fixer] disable path cleaning test for windows and mingw.

2016-05-31 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue May 31 14:22:01 2016
New Revision: 271321

URL: http://llvm.org/viewvc/llvm-project?rev=271321=rev
Log:
[include-fixer] disable path cleaning test for windows and mingw.

Modified:

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp?rev=271321=271320=271321=diff
==
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 (original)
+++ 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 Tue May 31 14:22:01 2016
@@ -90,8 +90,13 @@ public:
 InMemoryFileSystem->addFile(HeaderName, 0,
 llvm::MemoryBuffer::getMemBuffer(Code));
 
+std::string Content = "#include\"" + std::string(HeaderName) +
+  "\"\n"
+  "#include \"internal/internal.h\"";
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
 const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+Content += "\n#include \"" + DirtyHeader + "\"";
 const std::string CleanHeader = "internal/a/b.h";
 const std::string DirtyHeaderContent =
 "#define INTERNAL 1\nclass ExtraInternal {};";
@@ -101,17 +106,15 @@ public:
   CleanHeader, 1, {});
 SymbolInfo DirtySymbol("ExtraInternal", SymbolInfo::SymbolKind::Class,
CleanHeader, 2, {});
-
-std::string Content = "#include\"" + std::string(HeaderName) +
-  "\"\n"
-  "#include \"internal/internal.h\"\n"
-  "#include \"" + DirtyHeader + "\"";
+#endif // _MSC_VER && __MINGW32__
 InMemoryFileSystem->addFile(FileName, 0,
 llvm::MemoryBuffer::getMemBuffer(Content));
 Invocation.run();
 EXPECT_TRUE(hasSymbol(InternalSymbol));
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
 EXPECT_TRUE(hasSymbol(DirtySymbol));
 EXPECT_TRUE(hasSymbol(DirtyMacro));
+#endif  // _MSC_VER && __MINGW32__
 return true;
   }
 


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


Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics

2016-05-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno closed this revision.
bruno added a comment.

Committed in r271042


http://reviews.llvm.org/D20404



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


Re: [PATCH] D20266: [Modules] Use vfs for (recursive) directory iteration

2016-05-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno closed this revision.
bruno added a comment.

Committed in r269661


http://reviews.llvm.org/D20266



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


Re: [PATCH] D18585: [CrashReproducer] Add a module map callback for added headers

2016-05-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno closed this revision.
bruno added a comment.

Committed in r264971


http://reviews.llvm.org/D18585



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


Re: [PATCH] D20451: [Parser] Fix look ahead after EOF while parsing objc message and lambdas

2016-05-31 Thread Bruno Cardoso Lopes via cfe-commits
bruno closed this revision.
bruno added a comment.

Thanks Doug!

Committed r271314


http://reviews.llvm.org/D20451



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


r271314 - [Parser] Fix look ahead after EOF while parsing objc message and lambdas

2016-05-31 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Tue May 31 13:46:31 2016
New Revision: 271314

URL: http://llvm.org/viewvc/llvm-project?rev=271314=rev
Log:
[Parser] Fix look ahead after EOF while parsing objc message and lambdas

If a closing ')' isn't found for a macro instantiation inside a '[',
the next token is EOF, this leads to crashes if we try to look ahead of
that. This could be triggered whenever trying to parse lambdas or objs
message expressions.

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

rdar://problem/25662647

Added:
cfe/trunk/test/Parser/objcxx11-messaging-and-lambda.mm
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=271314=271313=271314=diff
==
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Tue May 31 13:46:31 2016
@@ -739,8 +739,11 @@ ExprResult Parser::TryParseLambdaExpress
  && Tok.is(tok::l_square)
  && "Not at the start of a possible lambda expression.");
 
-  const Token Next = NextToken(), After = GetLookAheadToken(2);
+  const Token Next = NextToken();
+  if (Next.is(tok::eof)) // Nothing else to lookup here...
+return ExprEmpty();
 
+  const Token After = GetLookAheadToken(2);
   // If lookahead indicates this is a lambda...
   if (Next.is(tok::r_square) || // []
   Next.is(tok::equal) ||// [=

Added: cfe/trunk/test/Parser/objcxx11-messaging-and-lambda.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objcxx11-messaging-and-lambda.mm?rev=271314=auto
==
--- cfe/trunk/test/Parser/objcxx11-messaging-and-lambda.mm (added)
+++ cfe/trunk/test/Parser/objcxx11-messaging-and-lambda.mm Tue May 31 13:46:31 
2016
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+#define OBJCLASS(name) // expected-note {{macro 'OBJCLASS' defined here}}
+
+class NSMutableData;
+
+NSMutableData *test() { // expected-note {{to match this '{'}}
+  NSMutableData *data = [[[OBJCLASS(NSMutableDataOBJCLASS( alloc] init] 
autorelease]; // expected-error {{unterminated function-like macro invocation}} 
\
+  // expected-error {{expected ';' at end of declaration}}
+  return data;
+} // expected-error {{expected expression}} expected-error {{expected '}'}}


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


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-31 Thread Jan Vesely via cfe-commits
jvesely added inline comments.


Comment at: lib/Basic/Targets.cpp:2024-2025
@@ -2023,2 +2023,4 @@
   Builder.defineMacro("__HAS_LDEXPF__");
+if (hasFP64)
+  Builder.defineMacro("__HAS_FP64__");
   }

arsenm wrote:
> I don't think we need this. I want device macros for other tuning and 
> intrinsic availability reasons. Right now there are builtins that only work 
> on some subtargets but no way to test for that
Why not have macro per feature that determines intrinsic/optimization 
availability?
it was preferred last year [0]
at least on r600 it works nicer than separating 
EG/EG+FP64/NI_but_eg_isa/NI+FP64+CM_ISA
and the feature selection is done in two places (llvm+clang) instead of every 
piece of compiled code.

[0]http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150420/127643.html


Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


Re: [PATCH] D20415: Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

2016-05-31 Thread Adrian Prantl via cfe-commits
aprantl added inline comments.


Comment at: lib/CodeGen/CGDebugInfo.cpp:3427
@@ -3425,3 +3426,3 @@
 DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, 
Unit),
-Var->hasInternalLinkage(), Var,
+Var->hasInternalLinkage(), nullptr,
 getOrCreateStaticDataMemberDeclarationOrNull(D));

aprantl wrote:
> I think it would be more readable to pass an empty DIExpression() here.
/* expression=*/ is good enough.


Comment at: lib/CodeGen/CGDebugInfo.cpp:3474
@@ -3472,1 +3473,3 @@
 return;
+  llvm::DIExpression *InitExpr = nullptr;
+  if (Init.isInt())

aprantl wrote:
> Shouldn't the default constructor of DIExpression() wrap an MDNode nullptr?
Sorry, that was a couple of IR evolution steps ago. DIExpression now inserts 
from MDNode.


http://reviews.llvm.org/D20415



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


Re: [PATCH] D20828: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis.
thakis accepted this revision.
thakis added a reviewer: thakis.
thakis added a comment.
This revision is now accepted and ready to land.

s/retiring/requiring/, right?


http://reviews.llvm.org/D20828



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


Re: [PATCH] D20383: PCH + Module: make sure we write out macros associated with builtin identifiers

2016-05-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271310: PCH + module: make sure we write out macros 
associated with builtin identifiers. (authored by mren).

Changed prior to commit:
  http://reviews.llvm.org/D20383?vs=57673=59103#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20383

Files:
  cfe/trunk/lib/Serialization/ASTWriter.cpp
  cfe/trunk/test/Modules/Inputs/MacroFabs1.h
  cfe/trunk/test/Modules/Inputs/module.map
  cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch
  cfe/trunk/test/Modules/pch-module-macro.m

Index: cfe/trunk/test/Modules/Inputs/module.map
===
--- cfe/trunk/test/Modules/Inputs/module.map
+++ cfe/trunk/test/Modules/Inputs/module.map
@@ -414,3 +414,7 @@
 }
 
 module Empty {}
+
+module MacroFabs1 {
+  header "MacroFabs1.h"
+}
Index: cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch
===
--- cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch
+++ cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch
@@ -0,0 +1,3 @@
+
+@import MacroFabs1;
+
Index: cfe/trunk/test/Modules/Inputs/MacroFabs1.h
===
--- cfe/trunk/test/Modules/Inputs/MacroFabs1.h
+++ cfe/trunk/test/Modules/Inputs/MacroFabs1.h
@@ -0,0 +1,6 @@
+
+#undef fabs
+#define fabs(x) (x)
+
+#undef my_fabs
+#define my_fabs(x) (x)
Index: cfe/trunk/test/Modules/pch-module-macro.m
===
--- cfe/trunk/test/Modules/pch-module-macro.m
+++ cfe/trunk/test/Modules/pch-module-macro.m
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -o %t.pch -I %S/Inputs -x objective-c-header %S/Inputs/pch-import-module-with-macro.pch
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fsyntax-only -I %S/Inputs -include-pch %t.pch %s -verify
+// expected-no-diagnostics
+
+int test(int x) {
+  return my_fabs(x) + fabs(x);
+}
+
Index: cfe/trunk/lib/Serialization/ASTWriter.cpp
===
--- cfe/trunk/lib/Serialization/ASTWriter.cpp
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp
@@ -2187,30 +2187,29 @@
 
 // Write out any exported module macros.
 bool EmittedModuleMacros = false;
-if (IsModule) {
-  auto Leafs = PP.getLeafModuleMacros(Name);
-  SmallVector Worklist(Leafs.begin(), Leafs.end());
-  llvm::DenseMap Visits;
-  while (!Worklist.empty()) {
-auto *Macro = Worklist.pop_back_val();
-
-// Emit a record indicating this submodule exports this macro.
-ModuleMacroRecord.push_back(
-getSubmoduleID(Macro->getOwningModule()));
-ModuleMacroRecord.push_back(getMacroRef(Macro->getMacroInfo(), Name));
-for (auto *M : Macro->overrides())
-  ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
-
-Stream.EmitRecord(PP_MODULE_MACRO, ModuleMacroRecord);
-ModuleMacroRecord.clear();
-
-// Enqueue overridden macros once we've visited all their ancestors.
-for (auto *M : Macro->overrides())
-  if (++Visits[M] == M->getNumOverridingMacros())
-Worklist.push_back(M);
+// We write out exported module macros for PCH as well.
+auto Leafs = PP.getLeafModuleMacros(Name);
+SmallVector Worklist(Leafs.begin(), Leafs.end());
+llvm::DenseMap Visits;
+while (!Worklist.empty()) {
+  auto *Macro = Worklist.pop_back_val();
+
+  // Emit a record indicating this submodule exports this macro.
+  ModuleMacroRecord.push_back(
+  getSubmoduleID(Macro->getOwningModule()));
+  ModuleMacroRecord.push_back(getMacroRef(Macro->getMacroInfo(), Name));
+  for (auto *M : Macro->overrides())
+ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
+
+  Stream.EmitRecord(PP_MODULE_MACRO, ModuleMacroRecord);
+  ModuleMacroRecord.clear();
+
+  // Enqueue overridden macros once we've visited all their ancestors.
+  for (auto *M : Macro->overrides())
+if (++Visits[M] == M->getNumOverridingMacros())
+  Worklist.push_back(M);
 
-EmittedModuleMacros = true;
-  }
+  EmittedModuleMacros = true;
 }
 
 if (Record.empty() && !EmittedModuleMacros)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271310 - PCH + module: make sure we write out macros associated with builtin identifiers.

2016-05-31 Thread Manman Ren via cfe-commits
Author: mren
Date: Tue May 31 13:19:32 2016
New Revision: 271310

URL: http://llvm.org/viewvc/llvm-project?rev=271310=rev
Log:
PCH + module: make sure we write out macros associated with builtin identifiers.

When we import a module that defines a builtin identifier from prefix header and
precompile the prefix header, the macro information related to the identifier
is lost.

If we don't precompile the prefix header, the source file can still see the
macro information. The reason is that we write out the identifier in the pch
but not the macro information since the macro is not defined locally.

This is related to r251565. In that commit, if we read a builtin identifier from
a module that wasn't "interesting" to that module, we will still write it out to
a PCH that imports that module.

The fix is to write exported module macros for PCH as well.

rdar://2430

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

Added:
cfe/trunk/test/Modules/Inputs/MacroFabs1.h
cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch
cfe/trunk/test/Modules/pch-module-macro.m
Modified:
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/Modules/Inputs/module.map

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=271310=271309=271310=diff
==
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Tue May 31 13:19:32 2016
@@ -2187,30 +2187,29 @@ void ASTWriter::WritePreprocessor(const
 
 // Write out any exported module macros.
 bool EmittedModuleMacros = false;
-if (IsModule) {
-  auto Leafs = PP.getLeafModuleMacros(Name);
-  SmallVector Worklist(Leafs.begin(), Leafs.end());
-  llvm::DenseMap Visits;
-  while (!Worklist.empty()) {
-auto *Macro = Worklist.pop_back_val();
-
-// Emit a record indicating this submodule exports this macro.
-ModuleMacroRecord.push_back(
-getSubmoduleID(Macro->getOwningModule()));
-ModuleMacroRecord.push_back(getMacroRef(Macro->getMacroInfo(), Name));
-for (auto *M : Macro->overrides())
-  ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
-
-Stream.EmitRecord(PP_MODULE_MACRO, ModuleMacroRecord);
-ModuleMacroRecord.clear();
-
-// Enqueue overridden macros once we've visited all their ancestors.
-for (auto *M : Macro->overrides())
-  if (++Visits[M] == M->getNumOverridingMacros())
-Worklist.push_back(M);
+// We write out exported module macros for PCH as well.
+auto Leafs = PP.getLeafModuleMacros(Name);
+SmallVector Worklist(Leafs.begin(), Leafs.end());
+llvm::DenseMap Visits;
+while (!Worklist.empty()) {
+  auto *Macro = Worklist.pop_back_val();
+
+  // Emit a record indicating this submodule exports this macro.
+  ModuleMacroRecord.push_back(
+  getSubmoduleID(Macro->getOwningModule()));
+  ModuleMacroRecord.push_back(getMacroRef(Macro->getMacroInfo(), Name));
+  for (auto *M : Macro->overrides())
+ModuleMacroRecord.push_back(getSubmoduleID(M->getOwningModule()));
+
+  Stream.EmitRecord(PP_MODULE_MACRO, ModuleMacroRecord);
+  ModuleMacroRecord.clear();
+
+  // Enqueue overridden macros once we've visited all their ancestors.
+  for (auto *M : Macro->overrides())
+if (++Visits[M] == M->getNumOverridingMacros())
+  Worklist.push_back(M);
 
-EmittedModuleMacros = true;
-  }
+  EmittedModuleMacros = true;
 }
 
 if (Record.empty() && !EmittedModuleMacros)

Added: cfe/trunk/test/Modules/Inputs/MacroFabs1.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/MacroFabs1.h?rev=271310=auto
==
--- cfe/trunk/test/Modules/Inputs/MacroFabs1.h (added)
+++ cfe/trunk/test/Modules/Inputs/MacroFabs1.h Tue May 31 13:19:32 2016
@@ -0,0 +1,6 @@
+
+#undef fabs
+#define fabs(x) (x)
+
+#undef my_fabs
+#define my_fabs(x) (x)

Modified: cfe/trunk/test/Modules/Inputs/module.map
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=271310=271309=271310=diff
==
--- cfe/trunk/test/Modules/Inputs/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/module.map Tue May 31 13:19:32 2016
@@ -414,3 +414,7 @@ module MethodPoolString2 {
 }
 
 module Empty {}
+
+module MacroFabs1 {
+  header "MacroFabs1.h"
+}

Added: cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/pch-import-module-with-macro.pch?rev=271310=auto

[PATCH] D20829: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Chris Bieneman via cfe-commits
beanz created this revision.
beanz added a subscriber: cfe-commits.

This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

http://reviews.llvm.org/D20829

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -2,7 +2,7 @@
 # Setup Project
 
#===
 
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -2,7 +2,7 @@
 # Setup Project
 #===
 
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20827: [include-fixer] Use YAML format in -output-headers and -insert-header mode.

2016-05-31 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 59100.
hokein added a comment.

Remove unused code.


http://reviews.llvm.org/D20827

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixerContext.h
  include-fixer/tool/ClangIncludeFixer.cpp
  include-fixer/tool/clang-include-fixer.py
  test/include-fixer/commandline_options.cpp
  test/include-fixer/ranking.cpp

Index: test/include-fixer/ranking.cpp
===
--- test/include-fixer/ranking.cpp
+++ test/include-fixer/ranking.cpp
@@ -1,6 +1,5 @@
-// RUN: clang-include-fixer -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s -implicit-check-not=.h
+// RUN: clang-include-fixer -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s
 
-// CHECK: "../include/bar.h"
-// CHECK-NEXT: "../include/zbar.h"
+// CHECK: Headers: [ '"../include/bar.h"', '"../include/zbar.h"' ]
 
 bar b;
Index: test/include-fixer/commandline_options.cpp
===
--- test/include-fixer/commandline_options.cpp
+++ test/include-fixer/commandline_options.cpp
@@ -1,7 +1,7 @@
 // REQUIRES: shell
 // RUN: sed -e 's#//.*$##' %s > %t.cpp
 // RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -output-headers %t.cpp -- | FileCheck %s -check-prefix=CHECK-HEADERS
-// RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='"foo.h"' %t.cpp | FileCheck %s -check-prefix=CHECK
+// RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='{SymbolIdentifier: foo, Headers: ["\"foo.h\""]}' %t.cpp | FileCheck %s -check-prefix=CHECK
 //
 // CHECK-HEADERS: "foo.h"
 // CHECK-HEADERS: "bar.h"
Index: include-fixer/tool/clang-include-fixer.py
===
--- include-fixer/tool/clang-include-fixer.py
+++ include-fixer/tool/clang-include-fixer.py
@@ -19,6 +19,7 @@
 import difflib
 import subprocess
 import vim
+import yaml
 
 # set g:clang_include_fixer_path to the path to clang-include-fixer if it is not
 # on the path.
@@ -49,7 +50,7 @@
 
 
 def InsertHeaderToVimBuffer(header, text):
-  command = [binary, "-stdin", "-insert-header="+header,
+  command = [binary, "-stdin", "-insert-header="+yaml.dump(header),
  vim.current.buffer.name]
   stdout, stderr = execute(command, text)
   if stdout:
@@ -77,30 +78,38 @@
   command = [binary, "-stdin", "-output-headers", "-db="+args.db,
  "-input="+args.input, vim.current.buffer.name]
   stdout, stderr = execute(command, text)
-  lines = stdout.splitlines()
-  if len(lines) < 2:
-print "No header is included.\n"
+  include_fixer_context = yaml.load(stdout)
+  symbol = include_fixer_context["SymbolIdentifier"]
+  headers = include_fixer_context["Headers"]
+
+  if not symbol:
+print "The file is fine, no need to add a header.\n"
+return;
+
+  if not headers:
+print "Couldn't find a header for {0}.\n".format(symbol)
 return
 
   # The first line is the symbol name.
-  symbol = lines[0]
   # If there is only one suggested header, insert it directly.
-  if len(lines) == 2 or maximum_suggested_headers == 1:
-InsertHeaderToVimBuffer(lines[1], text)
-print "Added #include {0} for {1}.\n".format(lines[1], symbol)
+  if len(headers) == 1 or maximum_suggested_headers == 1:
+InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+ "Headers":[headers[0]]}, text)
+print "Added #include {0} for {1}.\n".format(headers[0], symbol)
 return
 
   choices_message = ""
   index = 1;
-  for header in lines[1:1+maximum_suggested_headers]:
+  for header in headers[0:maximum_suggested_headers]:
 choices_message += "&{0} {1}\n".format(index, header)
 index += 1
 
   select = ShowDialog("choose a header file for {0}.".format(symbol),
   choices_message)
   # Insert a selected header.
-  InsertHeaderToVimBuffer(lines[select], text)
-  print "Added #include {0} for {1}.\n".format(lines[select], symbol)
+  InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+   "Headers":[headers[select-1]]}, text)
+  print "Added #include {0} for {1}.\n".format(headers[select-1], symbol)
   return;
 
 
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -18,9 +18,25 @@
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/YAMLTraits.h"
 
 using namespace clang;
 using namespace llvm;
+using clang::include_fixer::IncludeFixerContext;
+
+LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(IncludeFixerContext)
+LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string)
+
+namespace llvm {
+namespace yaml {
+template <> struct MappingTraits {
+  static void mapping(IO , IncludeFixerContext ) {
+

[PATCH] D20828: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Chris Bieneman via cfe-commits
beanz created this revision.
beanz added a subscriber: cfe-commits.

This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

http://reviews.llvm.org/D20828

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -3,7 +3,7 @@
 
#===
 # Setup Project
 
#===
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -3,7 +3,7 @@
 #===
 # Setup Project
 #===
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 if(POLICY CMP0042)
   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20415: Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

2016-05-31 Thread Adrian Prantl via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

LGTM with small changes.



Comment at: lib/CodeGen/CGDebugInfo.cpp:3427
@@ -3425,3 +3426,3 @@
 DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, 
Unit),
-Var->hasInternalLinkage(), Var,
+Var->hasInternalLinkage(), nullptr,
 getOrCreateStaticDataMemberDeclarationOrNull(D));

I think it would be more readable to pass an empty DIExpression() here.


Comment at: lib/CodeGen/CGDebugInfo.cpp:3474
@@ -3472,1 +3473,3 @@
 return;
+  llvm::DIExpression *InitExpr = nullptr;
+  if (Init.isInt())

Shouldn't the default constructor of DIExpression() wrap an MDNode nullptr?


Comment at: lib/CodeGen/CGDebugInfo.h:348
@@ -347,2 +347,3 @@
 
   /// Emit global variable's debug info.
+  void EmitGlobalVariable(const ValueDecl *VD, const APValue );

While we're here: Emit *a* global variable's debug info?


http://reviews.llvm.org/D20415



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-31 Thread Eric Niebler via cfe-commits
eric_niebler updated this revision to Diff 59098.
eric_niebler added a comment.

Remove stale comment, tweak for diagnostic wording.


http://reviews.llvm.org/D19843

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticLexKinds.td
  include/clang/Basic/FileManager.h
  include/clang/Basic/VirtualFileSystem.h
  include/clang/Lex/DirectoryLookup.h
  include/clang/Lex/HeaderSearch.h
  lib/Basic/FileManager.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPDirectives.cpp
  test/Lexer/Inputs/case-insensitive-include.h
  test/Lexer/case-insensitive-include-ms.c
  test/Lexer/case-insensitive-include.c
  test/PCH/case-insensitive-include.c

Index: test/PCH/case-insensitive-include.c
===
--- test/PCH/case-insensitive-include.c
+++ test/PCH/case-insensitive-include.c
@@ -2,7 +2,7 @@
 
 // Test this without pch.
 // RUN: cp %S/Inputs/case-insensitive-include.h %T
-// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %T -verify
 
 // Test with pch.
 // RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T
Index: test/Lexer/case-insensitive-include.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include.c
@@ -0,0 +1,27 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s
+
+#include "case-insensitive-include.h"
+#include "Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:38}:"\"case-insensitive-include.h\""
+
+#include "../Output/./case-insensitive-include.h"
+#include "../Output/./Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\""
+#include "../output/./case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\""
+
+#include "apath/.././case-insensitive-include.h"
+#include "apath/.././Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath/.././case-insensitive-include.h\""
+#include "APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+
+#include "../Output/./apath/.././case-insensitive-include.h"
+#include "../Output/./APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+#include "../output/./apath/.././case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:61}:"\"../Output/./apath/.././case-insensitive-include.h\""
Index: test/Lexer/case-insensitive-include-ms.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include-ms.c
@@ -0,0 +1,18 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %T -verify
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s
+
+#include "..\Output\.\case-insensitive-include.h"
+#include "..\Output\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\""
+#include "..\output\.\case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\""
+
+#include "apath\..\.\case-insensitive-include.h"
+#include "apath\..\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath\\..\\.\\case-insensitive-include.h\""
+#include "APath\..\.\case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
Index: test/Lexer/Inputs/case-insensitive-include.h
===
--- /dev/null
+++ test/Lexer/Inputs/case-insensitive-include.h
@@ -0,0 +1,5 @@
+#pragma once
+
+struct S {
+  int x;
+};
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -24,6 +24,9 @@
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/Pragma.h"
 #include "llvm/ADT/APInt.h"

[PATCH] D20827: [include-fixer] Use YAML format in -output-headers and -insert-header mode.

2016-05-31 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.

And some improvements:
* Show better error messages on unfound symbols.
* Fix a typo.

http://reviews.llvm.org/D20827

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixerContext.h
  include-fixer/tool/ClangIncludeFixer.cpp
  include-fixer/tool/clang-include-fixer.py
  test/include-fixer/commandline_options.cpp
  test/include-fixer/ranking.cpp

Index: test/include-fixer/ranking.cpp
===
--- test/include-fixer/ranking.cpp
+++ test/include-fixer/ranking.cpp
@@ -1,6 +1,5 @@
-// RUN: clang-include-fixer -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s -implicit-check-not=.h
+// RUN: clang-include-fixer -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s
 
-// CHECK: "../include/bar.h"
-// CHECK-NEXT: "../include/zbar.h"
+// CHECK: Headers: [ '"../include/bar.h"', '"../include/zbar.h"' ]
 
 bar b;
Index: test/include-fixer/commandline_options.cpp
===
--- test/include-fixer/commandline_options.cpp
+++ test/include-fixer/commandline_options.cpp
@@ -1,7 +1,7 @@
 // REQUIRES: shell
 // RUN: sed -e 's#//.*$##' %s > %t.cpp
 // RUN: clang-include-fixer -db=fixed -input='foo= "foo.h","bar.h"' -output-headers %t.cpp -- | FileCheck %s -check-prefix=CHECK-HEADERS
-// RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='"foo.h"' %t.cpp | FileCheck %s -check-prefix=CHECK
+// RUN: cat %t.cpp | clang-include-fixer -stdin -insert-header='{SymbolIdentifier: foo, Headers: ["\"foo.h\""]}' %t.cpp | FileCheck %s -check-prefix=CHECK
 //
 // CHECK-HEADERS: "foo.h"
 // CHECK-HEADERS: "bar.h"
Index: include-fixer/tool/clang-include-fixer.py
===
--- include-fixer/tool/clang-include-fixer.py
+++ include-fixer/tool/clang-include-fixer.py
@@ -19,6 +19,7 @@
 import difflib
 import subprocess
 import vim
+import yaml
 
 # set g:clang_include_fixer_path to the path to clang-include-fixer if it is not
 # on the path.
@@ -49,7 +50,7 @@
 
 
 def InsertHeaderToVimBuffer(header, text):
-  command = [binary, "-stdin", "-insert-header="+header,
+  command = [binary, "-stdin", "-insert-header="+yaml.dump(header),
  vim.current.buffer.name]
   stdout, stderr = execute(command, text)
   if stdout:
@@ -77,30 +78,41 @@
   command = [binary, "-stdin", "-output-headers", "-db="+args.db,
  "-input="+args.input, vim.current.buffer.name]
   stdout, stderr = execute(command, text)
+  include_fixer_context = yaml.load(stdout)
+
   lines = stdout.splitlines()
-  if len(lines) < 2:
-print "No header is included.\n"
+
+  symbol = include_fixer_context["SymbolIdentifier"]
+  headers = include_fixer_context["Headers"]
+
+  if not symbol:
+print "The file is fine, no need to add a header.\n"
+return;
+
+  if not headers:
+print "Couldn't find a header for {0}.\n".format(symbol)
 return
 
   # The first line is the symbol name.
-  symbol = lines[0]
   # If there is only one suggested header, insert it directly.
-  if len(lines) == 2 or maximum_suggested_headers == 1:
-InsertHeaderToVimBuffer(lines[1], text)
-print "Added #include {0} for {1}.\n".format(lines[1], symbol)
+  if len(headers) == 1 or maximum_suggested_headers == 1:
+InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+ "Headers":[headers[0]]}, text)
+print "Added #include {0} for {1}.\n".format(header[0], symbol)
 return
 
   choices_message = ""
   index = 1;
-  for header in lines[1:1+maximum_suggested_headers]:
+  for header in headers[0:maximum_suggested_headers]:
 choices_message += "&{0} {1}\n".format(index, header)
 index += 1
 
   select = ShowDialog("choose a header file for {0}.".format(symbol),
   choices_message)
   # Insert a selected header.
-  InsertHeaderToVimBuffer(lines[select], text)
-  print "Added #include {0} for {1}.\n".format(lines[select], symbol)
+  InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+   "Headers":[headers[select-1]]}, text)
+  print "Added #include {0} for {1}.\n".format(headers[select-1], symbol)
   return;
 
 
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -18,9 +18,25 @@
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/YAMLTraits.h"
 
 using namespace clang;
 using namespace llvm;
+using clang::include_fixer::IncludeFixerContext;
+
+LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(IncludeFixerContext)
+LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string)
+
+namespace llvm {
+namespace yaml {
+template <> 

r271308 - [Coverage] Fix crash on a switch partially covered by a macro (PR27948)

2016-05-31 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Tue May 31 13:06:19 2016
New Revision: 271308

URL: http://llvm.org/viewvc/llvm-project?rev=271308=rev
Log:
[Coverage] Fix crash on a switch partially covered by a macro (PR27948)

We have to handle file exits before and after visiting regions in the
switch body. Fixes PR27948.

Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/test/CoverageMapping/switchmacro.c

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=271308=271307=271308=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Tue May 31 13:06:19 2016
@@ -783,8 +783,10 @@ struct CounterCoverageMappingBuilder
   Visit(Child);
 popRegions(Index);
   }
-} else
+} else {
+  handleFileExit(getStart(Body));
   propagateCounts(Counter::getZero(), Body);
+}
 BreakContinue BC = BreakContinueStack.pop_back_val();
 
 if (!BreakContinueStack.empty())
@@ -792,7 +794,9 @@ struct CounterCoverageMappingBuilder
   BreakContinueStack.back().ContinueCount, BC.ContinueCount);
 
 Counter ExitCount = getRegionCounter(S);
-pushRegion(ExitCount, getStart(S), getEnd(S));
+SourceLocation ExitLoc = getEnd(S);
+pushRegion(ExitCount, getStart(S), ExitLoc);
+handleFileExit(ExitLoc);
   }
 
   void VisitSwitchCase(const SwitchCase *S) {

Modified: cfe/trunk/test/CoverageMapping/switchmacro.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switchmacro.c?rev=271308=271307=271308=diff
==
--- cfe/trunk/test/CoverageMapping/switchmacro.c (original)
+++ cfe/trunk/test/CoverageMapping/switchmacro.c Tue May 31 13:06:19 2016
@@ -32,6 +32,14 @@ default: ;
   END
 }
 
+// PR27948 - Crash when handling a switch partially covered by a macro
+// CHECK: baz
+#define START2 switch (0) default:
+void baz() {
+  for (;;)
+START2 return; // CHECK: Expansion,File 0, [[@LINE]]:5 -> [[@LINE]]:11 = 
#1 (Expanded file = 1)
+}
+
 int main(int argc, const char *argv[]) {
   foo(3);
   return 0;


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


[PATCH] D20823: [CMake] Update to retiring CMake 3.4.3

2016-05-31 Thread Chris Bieneman via cfe-commits
beanz created this revision.
beanz added a subscriber: cfe-commits.

This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

http://reviews.llvm.org/D20823

Files:
  CMakeLists.txt
  tools/scan-build-py/tests/functional/exec/CMakeLists.txt

Index: tools/scan-build-py/tests/functional/exec/CMakeLists.txt
===
--- tools/scan-build-py/tests/functional/exec/CMakeLists.txt
+++ tools/scan-build-py/tests/functional/exec/CMakeLists.txt
@@ -1,6 +1,6 @@
 project(exec C)
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 include(CheckCCompilerFlag)
 check_c_compiler_flag("-std=c99" C99_SUPPORTED)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 # FIXME: It may be removed when we use 2.8.12.
 if(CMAKE_VERSION VERSION_LESS 2.8.12)


Index: tools/scan-build-py/tests/functional/exec/CMakeLists.txt
===
--- tools/scan-build-py/tests/functional/exec/CMakeLists.txt
+++ tools/scan-build-py/tests/functional/exec/CMakeLists.txt
@@ -1,6 +1,6 @@
 project(exec C)
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 include(CheckCCompilerFlag)
 check_c_compiler_flag("-std=c99" C99_SUPPORTED)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 3.4.3)
 
 # FIXME: It may be removed when we use 2.8.12.
 if(CMAKE_VERSION VERSION_LESS 2.8.12)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20383: PCH + Module: make sure we write out macros associated with builtin identifiers

2016-05-31 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.

Looks good to me, too.


http://reviews.llvm.org/D20383



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


Re: [PATCH] D20383: PCH + Module: make sure we write out macros associated with builtin identifiers

2016-05-31 Thread Doug Gregor via cfe-commits
doug.gregor accepted this revision.
doug.gregor added a comment.
This revision is now accepted and ready to land.

Yes, that's a LGTM, sorry for being unclear.


http://reviews.llvm.org/D20383



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


Re: [PATCH] D20383: PCH + Module: make sure we write out macros associated with builtin identifiers

2016-05-31 Thread Manman Ren via cfe-commits
manmanren added a comment.

In http://reviews.llvm.org/D20383#443613, @doug.gregor wrote:

> Yeah, this looks like the right approach. PCH follows the same rules as 
> modules when it comes to newer information shadowing imported information.


Hi Doug,

Thanks for reviewing the patch! Can I take that as a "LGTM"? I will clean up 
the source change.

Manman


http://reviews.llvm.org/D20383



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


r271305 - Work around MinGW's macro definition of 'interface' to 'struct'

2016-05-31 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue May 31 12:42:56 2016
New Revision: 271305

URL: http://llvm.org/viewvc/llvm-project?rev=271305=rev
Log:
Work around MinGW's macro definition of 'interface' to 'struct'

Previous attempts to rename the IBOutletCollection argument to something
other than "Interface" were undone (r127127 and r139620).  Instead of
renaming it, work around this in tablegen, so the public facing getter
can have the usual name of 'getInterface'.

Fixes PR26682

Modified:
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=271305=271304=271305=diff
==
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue May 31 12:42:56 2016
@@ -194,6 +194,11 @@ namespace {
 lowerName[0] = std::tolower(lowerName[0]);
 upperName[0] = std::toupper(upperName[0]);
   }
+  // Work around MinGW's macro definition of 'interface' to 'struct'. We
+  // have an attribute argument called 'Interface', so only the lower case
+  // name conflicts with the macro definition.
+  if (lowerName == "interface")
+lowerName = "interface_";
 }
 virtual ~Argument() = default;
 


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


Re: [PATCH] D20819: [find-all-symbols] remove dots in SymbolInfo file paths.

2016-05-31 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271302: [find-all-symbols] remove dots in SymbolInfo file 
paths. (authored by ioeric).

Changed prior to commit:
  http://reviews.llvm.org/D20819?vs=59075=59091#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20819

Files:
  clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllMacros.cpp
  clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
  
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -90,13 +90,28 @@
 InMemoryFileSystem->addFile(HeaderName, 0,
 llvm::MemoryBuffer::getMemBuffer(Code));
 
+// Test path cleaning for both decls and macros.
+const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string CleanHeader = "internal/a/b.h";
+const std::string DirtyHeaderContent =
+"#define INTERNAL 1\nclass ExtraInternal {};";
+InMemoryFileSystem->addFile(
+DirtyHeader, 0, llvm::MemoryBuffer::getMemBuffer(DirtyHeaderContent));
+SymbolInfo DirtyMacro("INTERNAL", SymbolInfo::SymbolKind::Macro,
+  CleanHeader, 1, {});
+SymbolInfo DirtySymbol("ExtraInternal", SymbolInfo::SymbolKind::Class,
+   CleanHeader, 2, {});
+
 std::string Content = "#include\"" + std::string(HeaderName) +
   "\"\n"
-  "#include \"internal/internal.h\"";
+  "#include \"internal/internal.h\"\n"
+  "#include \"" + DirtyHeader + "\"";
 InMemoryFileSystem->addFile(FileName, 0,
 llvm::MemoryBuffer::getMemBuffer(Content));
 Invocation.run();
 EXPECT_TRUE(hasSymbol(InternalSymbol));
+EXPECT_TRUE(hasSymbol(DirtySymbol));
+EXPECT_TRUE(hasSymbol(DirtyMacro));
 return true;
   }
 
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
@@ -99,7 +99,10 @@
   // If Collector is not nullptr, check pragma remapping header.
   FilePath = Collector ? Collector->getMappedHeader(FilePath) : FilePath;
 
-  return SymbolInfo(ND->getNameAsString(), Type, FilePath.str(),
+  SmallString<256> CleanedFilePath = FilePath;
+  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
+
+  return SymbolInfo(ND->getNameAsString(), Type, CleanedFilePath,
 SM.getExpansionLineNumber(Loc), GetContexts(ND));
 }
 
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllMacros.cpp
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllMacros.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllMacros.cpp
@@ -13,6 +13,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/Token.h"
+#include "llvm/Support/Path.h"
 
 namespace clang {
 namespace find_all_symbols {
@@ -30,8 +31,11 @@
   // If Collector is not nullptr, check pragma remapping header.
   FilePath = Collector ? Collector->getMappedHeader(FilePath) : FilePath;
 
+  SmallString<256> CleanedFilePath = FilePath;
+  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
+
   SymbolInfo Symbol(MacroNameTok.getIdentifierInfo()->getName(),
-SymbolInfo::SymbolKind::Macro, FilePath.str(),
+SymbolInfo::SymbolKind::Macro, CleanedFilePath,
 SM->getSpellingLineNumber(Loc), {});
 
   Reporter->reportSymbol(SM->getFileEntryForID(SM->getMainFileID())->getName(),


Index: clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -90,13 +90,28 @@
 InMemoryFileSystem->addFile(HeaderName, 0,
 llvm::MemoryBuffer::getMemBuffer(Code));
 
+// Test path cleaning for both decls and macros.
+const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string CleanHeader = "internal/a/b.h";
+const std::string DirtyHeaderContent =
+"#define INTERNAL 1\nclass 

Re: [PATCH] D20821: Fix a few issues while skipping function bodies

2016-05-31 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Parse/ParseStmt.cpp:1989
@@ +1988,3 @@
+if (Tok.is(tok::colon)) {
+  // skip constructor initializer list
+  SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch);

Comments should start with a capital letter and end with a period.


Comment at: lib/Parse/ParseStmt.cpp:1990
@@ +1989,3 @@
+  // skip constructor initializer list
+  SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch);
+}

This is not correct. Skipping constructor initializer lists correctly is hard 
(which is probably why we used to parse the initializer list rather than 
skipping it). You can use `Parser::ConsumeAndStoreFunctionPrologue` to get this 
(approximately) correct.


http://reviews.llvm.org/D20821



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


Re: [PATCH] D20415: Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

2016-05-31 Thread Peter Collingbourne via cfe-commits
pcc added a comment.

Ping.


http://reviews.llvm.org/D20415



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


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-31 Thread Matt Arsenault via cfe-commits
arsenm added inline comments.


Comment at: lib/Basic/Targets.cpp:2024-2025
@@ -2023,2 +2023,4 @@
   Builder.defineMacro("__HAS_LDEXPF__");
+if (hasFP64)
+  Builder.defineMacro("__HAS_FP64__");
   }

I don't think we need this. I want device macros for other tuning and intrinsic 
availability reasons. Right now there are builtins that only work on some 
subtargets but no way to test for that


Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


r271297 - AMDGPU: Update datalayout string

2016-05-31 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Tue May 31 11:58:18 2016
New Revision: 271297

URL: http://llvm.org/viewvc/llvm-project?rev=271297=rev
Log:
AMDGPU: Update datalayout string

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/target-data.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=271297=271296=271297=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue May 31 11:58:18 2016
@@ -1921,7 +1921,7 @@ static const char *const DataLayoutStrin
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
 
 static const char *const DataLayoutStringSI =
-  "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64"
+  "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"
   "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
   "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
 

Modified: cfe/trunk/test/CodeGen/target-data.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=271297=271296=271297=diff
==
--- cfe/trunk/test/CodeGen/target-data.c (original)
+++ cfe/trunk/test/CodeGen/target-data.c Tue May 31 11:58:18 2016
@@ -132,12 +132,12 @@
 
 // RUN: %clang_cc1 -triple amdgcn-unknown -target-cpu hawaii -o - -emit-llvm 
%s \
 // RUN: | FileCheck %s -check-prefix=R600SI
-// R600SI: target datalayout = 
"e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
+// R600SI: target datalayout = 
"e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
 
 // Test default -target-cpu
 // RUN: %clang_cc1 -triple amdgcn-unknown -o - -emit-llvm %s \
 // RUN: | FileCheck %s -check-prefix=R600SIDefault
-// R600SIDefault: target datalayout = 
"e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
+// R600SIDefault: target datalayout = 
"e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
 
 // RUN: %clang_cc1 -triple arm64-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=AARCH64


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


[PATCH] D20821: Fix a few issues while skipping function bodies

2016-05-31 Thread Olivier Goffart via cfe-commits
ogoffart created this revision.
ogoffart added reviewers: cfe-commits, rsmith, akyrtzi.
Herald added a subscriber: klimek.

Fix a few issues while skipping function bodies

 - In functions with try { } catch { }, only the try block would be
   skipped, not the catch blocks

 - The template functions would still be parsed.

 - The initializers within a constructor would still be parsed.

 - The inline functions within class would still be stored, only to be
   discared later.

 - Invalid code with try would assert (as in "int foo() try assert_here")
   
This attempt to do even less while skipping function bodies. 


http://reviews.llvm.org/D20821

Files:
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/SemaDecl.cpp
  unittests/Tooling/ToolingTest.cpp

Index: unittests/Tooling/ToolingTest.cpp
===
--- unittests/Tooling/ToolingTest.cpp
+++ unittests/Tooling/ToolingTest.cpp
@@ -241,7 +241,7 @@
 struct SkipBodyConsumer : public clang::ASTConsumer {
   /// Skip the 'skipMe' function.
   bool shouldSkipFunctionBody(Decl *D) override {
-FunctionDecl *F = dyn_cast(D);
+NamedDecl *F = dyn_cast(D);
 return F && F->getNameAsString() == "skipMe";
   }
 };
@@ -259,6 +259,36 @@
 "int skipMe() { an_error_here }"));
   EXPECT_FALSE(runToolOnCode(new SkipBodyAction,
  "int skipMeNot() { an_error_here }"));
+
+  // Test constructors with initializers
+  EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
+"struct skipMe { skipMe() : an_error() { more error } };"));
+  EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
+"struct skipMe { skipMe(); };"
+"skipMe::skipMe() : an_error() { more error }"));
+  EXPECT_FALSE(runToolOnCode(new SkipBodyAction,
+"struct skipMeNot { skipMeNot() : an_error() { } };"));
+  EXPECT_FALSE(runToolOnCode(new SkipBodyAction,
+"struct skipMeNot { skipMeNot(); };"
+"skipMeNot::skipMeNot() : an_error() { }"));
+
+  // Try/catch
+  EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
+"void skipMe() try { an_error() } catch(error) { error };"));
+  EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
+"struct S { void skipMe() try { an_error() } catch(error) { error } };"));
+  EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
+"void skipMe() try { an_error() } catch(error) { error; }"
+"catch(error) { error } catch (error) { }"));
+  EXPECT_FALSE(runToolOnCode(new SkipBodyAction,
+"void skipMe() try something;")); // don't crash while parsing
+
+  // Template
+  EXPECT_TRUE(runToolOnCode(new SkipBodyAction,
+"template int skipMe() { an_error_here }"
+"int x = skipMe();"));
+  EXPECT_FALSE(runToolOnCode(new SkipBodyAction,
+"template int skipMeNot() { an_error_here }"));
 }
 
 TEST(runToolOnCodeWithArgs, TestNoDepFile) {
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11378,7 +11378,7 @@
 FD->setHasSkippedBody();
   else if (ObjCMethodDecl *MD = dyn_cast_or_null(Decl))
 MD->setHasSkippedBody();
-  return ActOnFinishFunctionBody(Decl, nullptr);
+  return Decl;
 }
 
 Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) {
Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -1044,6 +1044,12 @@
 D.complete(DP);
 D.getMutableDeclSpec().abort();
 
+if (SkipFunctionBodies && (!DP || Actions.canSkipFunctionBody(DP)) &&
+trySkippingFunctionBody()) {
+  BodyScope.Exit();
+  return Actions.ActOnSkippedFunctionBody(DP);
+}
+
 CachedTokens Toks;
 LexTemplateFunctionForLateParsing(Toks);
 
@@ -1136,6 +1142,13 @@
 return Res;
   }
 
+  if (SkipFunctionBodies && (!Res || Actions.canSkipFunctionBody(Res)) &&
+  trySkippingFunctionBody()) {
+BodyScope.Exit();
+Actions.ActOnSkippedFunctionBody(Res);
+return Actions.ActOnFinishFunctionBody(Res, nullptr, false);
+  }
+
   if (Tok.is(tok::kw_try))
 return ParseFunctionTryBlock(Res, BodyScope);
 
Index: lib/Parse/ParseStmt.cpp
===
--- lib/Parse/ParseStmt.cpp
+++ lib/Parse/ParseStmt.cpp
@@ -1916,12 +1916,6 @@
   assert(Tok.is(tok::l_brace));
   SourceLocation LBraceLoc = Tok.getLocation();
 
-  if (SkipFunctionBodies && (!Decl || Actions.canSkipFunctionBody(Decl)) &&
-  trySkippingFunctionBody()) {
-BodyScope.Exit();
-return Actions.ActOnSkippedFunctionBody(Decl);
-  }
-
   PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, LBraceLoc,
   "parsing function body");
 
@@ -1964,12 +1958,6 @@
   else
 Actions.ActOnDefaultCtorInitializers(Decl);
 
-  if (SkipFunctionBodies && Actions.canSkipFunctionBody(Decl) &&
-  

Re: [clang-tools-extra] r271295 - IncludeFixerTests: Update libdeps.

2016-05-31 Thread Eric Liu via cfe-commits
Thanks for the patch!

On Tue, May 31, 2016 at 6:48 PM NAKAMURA Takumi via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: chapuni
> Date: Tue May 31 11:41:39 2016
> New Revision: 271295
>
> URL: http://llvm.org/viewvc/llvm-project?rev=271295=rev
> Log:
> IncludeFixerTests: Update libdeps.
>
> Modified:
> clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
>
> Modified: clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt?rev=271295=271294=271295=diff
>
> ==
> --- clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
> (original)
> +++ clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt Tue May
> 31 11:41:39 2016
> @@ -17,6 +17,7 @@ add_extra_unittest(IncludeFixerTests
>
>  target_link_libraries(IncludeFixerTests
>clangBasic
> +  clangFormat
>clangFrontend
>clangIncludeFixer
>clangRewrite
>
>
> ___
> 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


[clang-tools-extra] r271295 - IncludeFixerTests: Update libdeps.

2016-05-31 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Tue May 31 11:41:39 2016
New Revision: 271295

URL: http://llvm.org/viewvc/llvm-project?rev=271295=rev
Log:
IncludeFixerTests: Update libdeps.

Modified:
clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt

Modified: clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt?rev=271295=271294=271295=diff
==
--- clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt Tue May 31 
11:41:39 2016
@@ -17,6 +17,7 @@ add_extra_unittest(IncludeFixerTests
 
 target_link_libraries(IncludeFixerTests
   clangBasic
+  clangFormat
   clangFrontend
   clangIncludeFixer
   clangRewrite


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


Re: [PATCH] D20423: [Clang][LLVMGold] Passing LLVM arguments to gold plugin

2016-05-31 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

In http://reviews.llvm.org/D20423#440539, @bunty2020 wrote:

> Clang's help shows the following description:
>  **-mllvm   Additional arguments to forward to LLVM's option 
> processing**
>
> If -mllvm  sets some internal option for cc1 then its strange 
> for front-end parser using some option which is supposed to be LLVM's option.


cc1 is not just the front-end, it is the front-end, the optimizer, and the 
codegen (unless emitting bitcode).


http://reviews.llvm.org/D20423



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


Re: [PATCH] Fix stack overflow in MSVC unqualified type lookup logic

2016-05-31 Thread Reid Kleckner via cfe-commits
Thanks for the patch and report!

Can this check be defeated with mutually recursive class template
inheritance? I was thinking something like this:

...
template 
struct FooWrapper : FooTemplated { };

// Full template spec
template 
class FooTemplated : public FooWrapper {
...

Maybe we should use a set of visited RDs?

On Fri, May 27, 2016 at 9:56 PM, Will Wilson  wrote:

> Hi Alexey,
>
> A customer encountered a stack overflow in the code from r229817. I've
> created a small repro for testing the issue and a fix. The fix should also
> better deal with lookup into partially specialized base templates.
>
> Test case included and tested against latest trunk.
>
> Let me know if it looks acceptable!
>
> Cheers,
> Will.
>
> --
> *Indefiant *: http://www.indefiant.com
> Home of Recode : Runtime C++ Editing for VS
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20819: [find-all-symbols] remove dots in SymbolInfo file paths.

2016-05-31 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

I think this is ok, mainly because the clean paths are explicitly for user 
code, where users usually like to have, well, clean paths.


http://reviews.llvm.org/D20819



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


[clang-tools-extra] r271294 - [include-fixer] removed unused forward declaration.

2016-05-31 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue May 31 11:03:09 2016
New Revision: 271294

URL: http://llvm.org/viewvc/llvm-project?rev=271294=rev
Log:
[include-fixer] removed unused forward declaration.

Modified:
clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=271294=271293=271294=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Tue May 31 11:03:09 
2016
@@ -26,8 +26,6 @@ namespace clang {
 namespace include_fixer {
 namespace {
 
-class Action;
-
 /// Manages the parse, gathers include suggestions.
 class Action : public clang::ASTFrontendAction,
public clang::ExternalSemaSource {


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


Re: [PATCH] D20819: [find-all-symbols] remove dots in SymbolInfo file paths.

2016-05-31 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

Adding Manuel as a second opinion. I think this is fine but paths are a messy 
problem, in particular removing .. can break symlinked directories.


http://reviews.llvm.org/D20819



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


Re: r271288 - [ASTMatchers] Breaking change of `has` matcher

2016-05-31 Thread Piotr Padlewski via cfe-commits
Already commited. It should work right now.

2016-05-31 18:00 GMT+02:00 Rafael Espíndola :

> I think is just the usual "llvm.org is crazy slow". I am trying to commit.
>
> Cheers,
> Rafael
>
>
> On 31 May 2016 at 08:54, Piotr Padlewski 
> wrote:
> > dunno why but I can't fetch from upstream
> >
> > Can you push this change?
> >
> > - include/clang/CMakeLists.txt
> > -
> > index 96905c9..feb81f0 100644
> > @@ -5,4 +5,3 @@ add_subdirectory(Parse)
> >  add_subdirectory(Sema)
> >  add_subdirectory(Serialization)
> >  add_subdirectory(StaticAnalyzer/Checkers)
> > -add_subdirectory(ASTMatchers)
> >
> > 2016-05-31 17:48 GMT+02:00 Piotr Padlewski :
> >>
> >> Yep, sending fix
> >>
> >> 2016-05-31 17:45 GMT+02:00 Rafael Espíndola  >:
> >>>
> >>> This broke the build:
> >>>
> >>>
> http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/36968/steps/cmake-configure/logs/stdio
> >>>
> >>> On 31 May 2016 at 08:25, Piotr Padlewski via cfe-commits
> >>>  wrote:
> >>> > Author: prazek
> >>> > Date: Tue May 31 10:25:05 2016
> >>> > New Revision: 271288
> >>> >
> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=271288=rev
> >>> > Log:
> >>> > [ASTMatchers] Breaking change of `has` matcher
> >>> >
> >>> > has matcher can now match to implicit and paren casts
> >>> >
> >>> > http://reviews.llvm.org/D20801
> >>> >
> >>> > Modified:
> >>> > cfe/trunk/docs/ReleaseNotes.rst
> >>> > cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> >>> > cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> >>> > cfe/trunk/include/clang/CMakeLists.txt
> >>> > cfe/trunk/unittests/AST/ASTImporterTest.cpp
> >>> > cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
> >>> >
> >>> > Modified: cfe/trunk/docs/ReleaseNotes.rst
> >>> > URL:
> >>> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=271288=271287=271288=diff
> >>> >
> >>> >
> ==
> >>> > --- cfe/trunk/docs/ReleaseNotes.rst (original)
> >>> > +++ cfe/trunk/docs/ReleaseNotes.rst Tue May 31 10:25:05 2016
> >>> > @@ -185,11 +185,13 @@ this section should help get you past th
> >>> >  AST Matchers
> >>> >  
> >>> >
> >>> > -- hasAnyArgument: Matcher no longer ignores parentheses and implicit
> >>> > casts on
> >>> > -  the argument before applying the inner matcher. The fix was done
> to
> >>> > allow for
> >>> > -  greater control by the user. In all existing checkers that use
> this
> >>> > matcher
> >>> > -  all instances of code ``hasAnyArgument()`` must be
> >>> > changed to
> >>> > -  ``hasAnyArgument(ignoringParenImpCasts())``.
> >>> > +- has and hasAnyArgument: Matchers no longer ignores parentheses and
> >>> > implicit
> >>> > +  casts on the argument before applying the inner matcher. The fix
> was
> >>> > done to
> >>> > +  allow for greater control by the user. In all existing checkers
> that
> >>> > use this
> >>> > +  matcher all instances of code ``hasAnyArgument()``
> or
> >>> > +  ``has()`` must be changed to
> >>> > +  ``hasAnyArgument(ignoringParenImpCasts())`` or
> >>> > +  ``has(ignoringParenImpCasts())``.
> >>> >
> >>> >  ...
> >>> >
> >>> >
> >>> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> >>> > URL:
> >>> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=271288=271287=271288=diff
> >>> >
> >>> >
> ==
> >>> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
> >>> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue May 31
> >>> > 10:25:05 2016
> >>> > @@ -2169,6 +2169,10 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
> >>> >  /// ChildT must be an AST base type.
> >>> >  ///
> >>> >  /// Usable as: Any Matcher
> >>> > +/// Note that has is direct matcher, so it also matches things like
> >>> > implicit
> >>> > +/// casts and paren casts. If you are matching with expr then you
> >>> > should
> >>> > +/// probably consider using ignoringParenImpCasts like:
> >>> > +/// has(ignoringParenImpCasts(expr())).
> >>> >  const internal::ArgumentAdaptingMatcherFunc
> >>> >  LLVM_ATTRIBUTE_UNUSED has = {};
> >>> >
> >>> >
> >>> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> >>> > URL:
> >>> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=271288=271287=271288=diff
> >>> >
> >>> >
> ==
> >>> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> >>> > (original)
> >>> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue May
> >>> > 31 10:25:05 2016
> >>> > @@ -1165,8 +1165,6 @@ public:
> >>> >  /// ChildT must 

Re: [PATCH] D20715: [docs] Document the source-based code coverage feature

2016-05-31 Thread Vedant Kumar via cfe-commits
vsk updated this revision to Diff 59078.
vsk marked an inline comment as done.
vsk added a comment.

- Actually link in the new document into Index.rst.


http://reviews.llvm.org/D20715

Files:
  docs/SourceBasedCodeCoverage.rst
  docs/index.rst

Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -33,6 +33,7 @@
ControlFlowIntegrity
LTOVisibility
SafeStack
+   SourceBasedCodeCoverage
Modules
MSVCCompatibility
CommandGuide/index
Index: docs/SourceBasedCodeCoverage.rst
===
--- /dev/null
+++ docs/SourceBasedCodeCoverage.rst
@@ -0,0 +1,187 @@
+==
+Source-based Code Coverage
+==
+
+.. contents::
+   :local:
+
+Introduction
+
+
+This document explains how to use clang's source-based code coverage feature.
+It's called "source-based" because it operates on AST and preprocessor
+information directly. This allows it to generate very precise coverage data.
+
+Clang ships two other code coverage implementations:
+
+* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
+  various sanitizers. It can provide up to edge-level coverage.
+
+* gcov - A GCC-compatible coverage implementation which operates on DebugInfo.
+
+From this point onwards "code coverage" will refer to the source-based kind.
+
+The code coverage workflow
+==
+
+The code coverage workflow consists of three main steps:
+
+1. Compiling with coverage enabled.
+
+2. Running the instrumented program.
+
+3. Creating coverage reports.
+
+The next few sections work through a complete, copy-'n-paste friendly example
+based on this program:
+
+.. code-block:: console
+
+% cat < foo.cc
+#define BAR(x) ((x) || (x))
+template  void foo(T x) {
+  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+}
+int main() {
+  foo(0);
+  foo(0);
+  return 0;
+}
+EOF
+
+Compiling with coverage enabled
+===
+
+To compile code with coverage enabled pass ``-fprofile-instr-generate
+-fcoverage-mapping`` to the compiler:
+
+.. code-block:: console
+
+# Step 1: Compile with coverage enabled.
+% clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
+
+Note that linking together code with and without coverage instrumentation is
+supported: any uninstrumented code simply won't be accounted for.
+
+Running the instrumented program
+
+
+The next step is to run the instrumented program. When the program exits it
+will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE``
+environment variable. If that variable does not exist the profile is written to
+``./default.profraw``.
+
+If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the
+missing directory structure will be created.  Additionally, the following
+special **pattern strings** are replaced:
+
+* "%p" expands out to the PID.
+
+* "%h" expands out to the hostname of the machine running the program.
+
+.. code-block:: console
+
+# Step 2: Run the program.
+% LLVM_PROFILE_FILE="foo.profraw" ./foo
+
+Creating coverage reports
+=
+
+Raw profiles have to be **indexed** before they can be used to generated
+coverage reports:
+
+.. code-block:: console
+
+# Step 3(a): Index the raw profile.
+% llvm-profdata merge -sparse foo.profraw -o foo.profdata
+
+You may be wondering why raw profiles aren't indexed automatically. In
+real-world projects multiple profiles have to be merged together before a
+report can be generated. This merge step is inevitable, so it makes sense to
+handle the compute-intensive indexing process at that point. A separate
+indexing step has the added benefit of keeping the compiler runtime small and
+simple.
+
+There are multiple different ways to render coverage reports. One option is to
+generate a line-oriented report:
+
+.. code-block:: console
+
+# Step 3(b): Create a line-oriented coverage report.
+% llvm-cov show ./foo -instr-profile=foo.profdata
+
+This report includes a summary view as well as dedicated sub-views for
+templated functions and their instantiations. For our example program, we get
+distinct views for ``foo(...)`` and ``foo(...)``.  If
+``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays sub-line
+region counts (even in macro expansions):
+
+.. code-block:: console
+
+   20|1|#define BAR(x) ((x) || (x))
+   ^20 ^2
+2|2|template  void foo(T x) {
+   22|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+   ^22 ^20  ^20^20
+2|4|}
+--
+| _Z3fooIiEvT_:
+|  1|2|template  void foo(T x) {
+| 11|3|  for (unsigned I = 0; I < 10; ++I) { BAR(I); }
+|

r271293 - Fixed bug

2016-05-31 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Tue May 31 10:56:26 2016
New Revision: 271293

URL: http://llvm.org/viewvc/llvm-project?rev=271293=rev
Log:
Fixed bug

Modified:
cfe/trunk/include/clang/CMakeLists.txt

Modified: cfe/trunk/include/clang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CMakeLists.txt?rev=271293=271292=271293=diff
==
--- cfe/trunk/include/clang/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/CMakeLists.txt Tue May 31 10:56:26 2016
@@ -5,4 +5,3 @@ add_subdirectory(Parse)
 add_subdirectory(Sema)
 add_subdirectory(Serialization)
 add_subdirectory(StaticAnalyzer/Checkers)
-add_subdirectory(ASTMatchers)


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


Re: r253909 - Make clang_Cursor_getMangling not mangle if the declaration isn't mangled

2016-05-31 Thread Ehsan Akhgari via cfe-commits
Of course, apologies for this.  Reverted in r271291 and recommitted in
r271292.

On Tue, May 31, 2016 at 10:18 AM, David Blaikie  wrote:

> Burt Wesarg points out on cfe-dev that this commit message doesn't match
> the patch (nor the description provided in the code review thread that lead
> to this commit) - this one might be worth reverting and recommitting with a
> more accurate commit message (I don't usually suggest this for most commits
> that are missing a commit message, but this one is actively misleading so
> might be trickier when people are doing archaeology)?
>
> On Mon, Nov 23, 2015 at 11:56 AM, Ehsan Akhgari via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ehsan
>> Date: Mon Nov 23 13:56:46 2015
>> New Revision: 253909
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253909=rev
>> Log:
>> Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
>>
>> Right now clang_Cursor_getMangling will attempt to mangle any
>> declaration, even if the declaration isn't mangled (extern C).  This
>> results in a partially mangled name which isn't useful for much. This
>> patch makes clang_Cursor_getMangling return an empty string if the
>> declaration isn't mangled.
>>
>> Patch by Michael Wu .
>>
>> Added:
>> cfe/trunk/test/Index/symbol-visibility.c
>> Modified:
>> cfe/trunk/include/clang-c/Index.h
>> cfe/trunk/tools/c-index-test/c-index-test.c
>> cfe/trunk/tools/libclang/CIndex.cpp
>> cfe/trunk/tools/libclang/libclang.exports
>>
>> Modified: cfe/trunk/include/clang-c/Index.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253909=253908=253909=diff
>>
>> ==
>> --- cfe/trunk/include/clang-c/Index.h (original)
>> +++ cfe/trunk/include/clang-c/Index.h Mon Nov 23 13:56:46 2015
>> @@ -2461,6 +2461,32 @@ enum CXLinkageKind {
>>  CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor
>> cursor);
>>
>>  /**
>> + * \brief Describe the visibility of the entity referred to by a cursor.
>> + *
>> + * This returns the default visibility if not explicitly specified by
>> + * a visibility attribute. The default visibility may be changed by
>> + * commandline arguments.
>> + *
>> + * \param cursor The cursor to query.
>> + *
>> + * \returns The visibility of the cursor.
>> + */
>> +enum CXVisibilityKind {
>> +  /** \brief This value indicates that no visibility information is
>> available
>> +   * for a provided CXCursor. */
>> +  CXVisibility_Invalid,
>> +
>> +  /** \brief Symbol not seen by the linker. */
>> +  CXVisibility_Hidden,
>> +  /** \brief Symbol seen by the linker but resolves to a symbol inside
>> this object. */
>> +  CXVisibility_Protected,
>> +  /** \brief Symbol seen by the linker and acts like a normal symbol. */
>> +  CXVisibility_Default,
>> +};
>> +
>> +CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor
>> cursor);
>> +
>> +/**
>>   * \brief Determine the availability of the entity that this cursor
>> refers to,
>>   * taking the current target platform into account.
>>   *
>>
>> Added: cfe/trunk/test/Index/symbol-visibility.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/symbol-visibility.c?rev=253909=auto
>>
>> ==
>> --- cfe/trunk/test/Index/symbol-visibility.c (added)
>> +++ cfe/trunk/test/Index/symbol-visibility.c Mon Nov 23 13:56:46 2015
>> @@ -0,0 +1,7 @@
>> +// RUN: c-index-test -test-print-visibility %s | FileCheck %s
>> +
>> +__attribute__ ((visibility ("default"))) void foo1();
>> +__attribute__ ((visibility ("hidden"))) void foo2();
>> +
>> +// CHECK: FunctionDecl=foo1:3:47visibility=Default
>> +// CHECK: FunctionDecl=foo2:4:46visibility=Hidden
>>
>> Modified: cfe/trunk/tools/c-index-test/c-index-test.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=253909=253908=253909=diff
>>
>> ==
>> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
>> +++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 23 13:56:46 2015
>> @@ -1248,6 +1248,32 @@ static enum CXChildVisitResult PrintLink
>>  }
>>
>>
>>  
>> /**/
>> +/* Visibility testing.
>>   */
>>
>> +/**/
>> +
>> +static enum CXChildVisitResult PrintVisibility(CXCursor cursor, CXCursor
>> p,
>> +   CXClientData d) {
>> +  const char *visibility = 0;
>> +
>> +  if (clang_isInvalid(clang_getCursorKind(cursor)))
>> +return CXChildVisit_Recurse;
>> +
>> +  switch (clang_getCursorVisibility(cursor)) {
>> +case CXVisibility_Invalid: break;
>> +case CXVisibility_Hidden: visibility = 

r271292 - clang-c: Add the clang_getCursorVisibility() API

2016-05-31 Thread Ehsan Akhgari via cfe-commits
Author: ehsan
Date: Tue May 31 10:55:51 2016
New Revision: 271292

URL: http://llvm.org/viewvc/llvm-project?rev=271292=rev
Log:
clang-c: Add the clang_getCursorVisibility() API

This patch adds an API for querying the visibility of the entity
referred to by a cursor.

Patch by Michael Wu .

Added:
cfe/trunk/test/Index/symbol-visibility.c
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/libclang.exports

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=271292=271291=271292=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue May 31 10:55:51 2016
@@ -2516,6 +2516,32 @@ enum CXLinkageKind {
  */
 CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
 
+enum CXVisibilityKind {
+  /** \brief This value indicates that no visibility information is available
+   * for a provided CXCursor. */
+  CXVisibility_Invalid,
+
+  /** \brief Symbol not seen by the linker. */
+  CXVisibility_Hidden,
+  /** \brief Symbol seen by the linker but resolves to a symbol inside this 
object. */
+  CXVisibility_Protected,
+  /** \brief Symbol seen by the linker and acts like a normal symbol. */
+  CXVisibility_Default
+};
+
+/**
+ * \brief Describe the visibility of the entity referred to by a cursor.
+ *
+ * This returns the default visibility if not explicitly specified by
+ * a visibility attribute. The default visibility may be changed by
+ * commandline arguments.
+ *
+ * \param cursor The cursor to query.
+ *
+ * \returns The visibility of the cursor.
+ */
+CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor 
cursor);
+
 /**
  * \brief Determine the availability of the entity that this cursor refers to,
  * taking the current target platform into account.

Added: cfe/trunk/test/Index/symbol-visibility.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/symbol-visibility.c?rev=271292=auto
==
--- cfe/trunk/test/Index/symbol-visibility.c (added)
+++ cfe/trunk/test/Index/symbol-visibility.c Tue May 31 10:55:51 2016
@@ -0,0 +1,7 @@
+// RUN: c-index-test -test-print-visibility %s | FileCheck %s
+
+__attribute__ ((visibility ("default"))) void foo1();
+__attribute__ ((visibility ("hidden"))) void foo2();
+
+// CHECK: FunctionDecl=foo1:3:47visibility=Default
+// CHECK: FunctionDecl=foo2:4:46visibility=Hidden

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=271292=271291=271292=diff
==
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Tue May 31 10:55:51 2016
@@ -1265,6 +1265,32 @@ static enum CXChildVisitResult PrintLink
 }
 
 
/**/
+/* Visibility testing.
*/
+/**/
+
+static enum CXChildVisitResult PrintVisibility(CXCursor cursor, CXCursor p,
+   CXClientData d) {
+  const char *visibility = 0;
+
+  if (clang_isInvalid(clang_getCursorKind(cursor)))
+return CXChildVisit_Recurse;
+
+  switch (clang_getCursorVisibility(cursor)) {
+case CXVisibility_Invalid: break;
+case CXVisibility_Hidden: visibility = "Hidden"; break;
+case CXVisibility_Protected: visibility = "Protected"; break;
+case CXVisibility_Default: visibility = "Default"; break;
+  }
+
+  if (visibility) {
+PrintCursor(cursor, NULL);
+printf("visibility=%s\n", visibility);
+  }
+
+  return CXChildVisit_Recurse;
+}
+
+/**/
 /* Typekind testing.  
*/
 
/**/
 
@@ -4240,6 +4266,7 @@ static void print_usage(void) {
 "   c-index-test -test-inclusion-stack-tu \n");
   fprintf(stderr,
 "   c-index-test -test-print-linkage-source {}*\n"
+"   c-index-test -test-print-visibility {}*\n"
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
@@ -4334,6 +4361,9 @@ int cindextest_main(int argc, const char
   else if (argc > 2 && strcmp(argv[1], "-test-print-linkage-source") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all", PrintLinkage,
 NULL);
+  else 

Re: r271288 - [ASTMatchers] Breaking change of `has` matcher

2016-05-31 Thread Rafael Espíndola via cfe-commits
I think is just the usual "llvm.org is crazy slow". I am trying to commit.

Cheers,
Rafael


On 31 May 2016 at 08:54, Piotr Padlewski  wrote:
> dunno why but I can't fetch from upstream
>
> Can you push this change?
>
> - include/clang/CMakeLists.txt
> -
> index 96905c9..feb81f0 100644
> @@ -5,4 +5,3 @@ add_subdirectory(Parse)
>  add_subdirectory(Sema)
>  add_subdirectory(Serialization)
>  add_subdirectory(StaticAnalyzer/Checkers)
> -add_subdirectory(ASTMatchers)
>
> 2016-05-31 17:48 GMT+02:00 Piotr Padlewski :
>>
>> Yep, sending fix
>>
>> 2016-05-31 17:45 GMT+02:00 Rafael Espíndola :
>>>
>>> This broke the build:
>>>
>>> http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/36968/steps/cmake-configure/logs/stdio
>>>
>>> On 31 May 2016 at 08:25, Piotr Padlewski via cfe-commits
>>>  wrote:
>>> > Author: prazek
>>> > Date: Tue May 31 10:25:05 2016
>>> > New Revision: 271288
>>> >
>>> > URL: http://llvm.org/viewvc/llvm-project?rev=271288=rev
>>> > Log:
>>> > [ASTMatchers] Breaking change of `has` matcher
>>> >
>>> > has matcher can now match to implicit and paren casts
>>> >
>>> > http://reviews.llvm.org/D20801
>>> >
>>> > Modified:
>>> > cfe/trunk/docs/ReleaseNotes.rst
>>> > cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>>> > cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>>> > cfe/trunk/include/clang/CMakeLists.txt
>>> > cfe/trunk/unittests/AST/ASTImporterTest.cpp
>>> > cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
>>> >
>>> > Modified: cfe/trunk/docs/ReleaseNotes.rst
>>> > URL:
>>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=271288=271287=271288=diff
>>> >
>>> > ==
>>> > --- cfe/trunk/docs/ReleaseNotes.rst (original)
>>> > +++ cfe/trunk/docs/ReleaseNotes.rst Tue May 31 10:25:05 2016
>>> > @@ -185,11 +185,13 @@ this section should help get you past th
>>> >  AST Matchers
>>> >  
>>> >
>>> > -- hasAnyArgument: Matcher no longer ignores parentheses and implicit
>>> > casts on
>>> > -  the argument before applying the inner matcher. The fix was done to
>>> > allow for
>>> > -  greater control by the user. In all existing checkers that use this
>>> > matcher
>>> > -  all instances of code ``hasAnyArgument()`` must be
>>> > changed to
>>> > -  ``hasAnyArgument(ignoringParenImpCasts())``.
>>> > +- has and hasAnyArgument: Matchers no longer ignores parentheses and
>>> > implicit
>>> > +  casts on the argument before applying the inner matcher. The fix was
>>> > done to
>>> > +  allow for greater control by the user. In all existing checkers that
>>> > use this
>>> > +  matcher all instances of code ``hasAnyArgument()`` or
>>> > +  ``has()`` must be changed to
>>> > +  ``hasAnyArgument(ignoringParenImpCasts())`` or
>>> > +  ``has(ignoringParenImpCasts())``.
>>> >
>>> >  ...
>>> >
>>> >
>>> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>>> > URL:
>>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=271288=271287=271288=diff
>>> >
>>> > ==
>>> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
>>> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue May 31
>>> > 10:25:05 2016
>>> > @@ -2169,6 +2169,10 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
>>> >  /// ChildT must be an AST base type.
>>> >  ///
>>> >  /// Usable as: Any Matcher
>>> > +/// Note that has is direct matcher, so it also matches things like
>>> > implicit
>>> > +/// casts and paren casts. If you are matching with expr then you
>>> > should
>>> > +/// probably consider using ignoringParenImpCasts like:
>>> > +/// has(ignoringParenImpCasts(expr())).
>>> >  const internal::ArgumentAdaptingMatcherFunc
>>> >  LLVM_ATTRIBUTE_UNUSED has = {};
>>> >
>>> >
>>> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>>> > URL:
>>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=271288=271287=271288=diff
>>> >
>>> > ==
>>> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>>> > (original)
>>> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue May
>>> > 31 10:25:05 2016
>>> > @@ -1165,8 +1165,6 @@ public:
>>> >  /// ChildT must be an AST base type.
>>> >  template 
>>> >  class HasMatcher : public WrapperMatcherInterface {
>>> > -  static_assert(IsBaseType::value,
>>> > -"has only accepts base type matcher");
>>> >
>>> >  public:
>>> >explicit HasMatcher(const Matcher )
>>> > @@ -1174,10 +1172,9 @@ public:
>>> >
>>> >bool matches(const T , ASTMatchFinder *Finder,
>>> > 

Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-31 Thread Jan Vesely via cfe-commits
jvesely marked 2 inline comments as done.
jvesely added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-05-31 Thread Jan Vesely via cfe-commits
jvesely updated the summary for this revision.
jvesely updated this revision to Diff 59080.
jvesely added a comment.

add has_fp64 macro


Repository:
  rL LLVM

http://reviews.llvm.org/D20388

Files:
  lib/Basic/Targets.cpp
  test/Misc/amdgcn.languageOptsOpenCL.cl
  test/Misc/r600.languageOptsOpenCL.cl

Index: test/Misc/r600.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/r600.languageOptsOpenCL.cl
@@ -0,0 +1,51 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu turks
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#if (__OPENCL_C_VERSION__ < 120) && (defined __HAS_FP64__)
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+
+#endif
Index: test/Misc/amdgcn.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -0,0 +1,61 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple amdgcn-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple amdgcn-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
+#endif
+
+#if (__OPENCL_C_VERSION__ < 120)
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
+#endif
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+#endif
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
Index: 

Re: r271288 - [ASTMatchers] Breaking change of `has` matcher

2016-05-31 Thread Piotr Padlewski via cfe-commits
dunno why but I can't fetch from upstream

Can you push this change?

- include/clang/CMakeLists.txt
-
index 96905c9..feb81f0 100644
@@ -5,4 +5,3 @@ add_subdirectory(Parse)
 add_subdirectory(Sema)
 add_subdirectory(Serialization)
 add_subdirectory(StaticAnalyzer/Checkers)
-add_subdirectory(ASTMatchers)

2016-05-31 17:48 GMT+02:00 Piotr Padlewski :

> Yep, sending fix
>
> 2016-05-31 17:45 GMT+02:00 Rafael Espíndola :
>
>> This broke the build:
>>
>> http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/36968/steps/cmake-configure/logs/stdio
>>
>> On 31 May 2016 at 08:25, Piotr Padlewski via cfe-commits
>>  wrote:
>> > Author: prazek
>> > Date: Tue May 31 10:25:05 2016
>> > New Revision: 271288
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=271288=rev
>> > Log:
>> > [ASTMatchers] Breaking change of `has` matcher
>> >
>> > has matcher can now match to implicit and paren casts
>> >
>> > http://reviews.llvm.org/D20801
>> >
>> > Modified:
>> > cfe/trunk/docs/ReleaseNotes.rst
>> > cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>> > cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>> > cfe/trunk/include/clang/CMakeLists.txt
>> > cfe/trunk/unittests/AST/ASTImporterTest.cpp
>> > cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
>> >
>> > Modified: cfe/trunk/docs/ReleaseNotes.rst
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=271288=271287=271288=diff
>> >
>> ==
>> > --- cfe/trunk/docs/ReleaseNotes.rst (original)
>> > +++ cfe/trunk/docs/ReleaseNotes.rst Tue May 31 10:25:05 2016
>> > @@ -185,11 +185,13 @@ this section should help get you past th
>> >  AST Matchers
>> >  
>> >
>> > -- hasAnyArgument: Matcher no longer ignores parentheses and implicit
>> casts on
>> > -  the argument before applying the inner matcher. The fix was done to
>> allow for
>> > -  greater control by the user. In all existing checkers that use this
>> matcher
>> > -  all instances of code ``hasAnyArgument()`` must be
>> changed to
>> > -  ``hasAnyArgument(ignoringParenImpCasts())``.
>> > +- has and hasAnyArgument: Matchers no longer ignores parentheses and
>> implicit
>> > +  casts on the argument before applying the inner matcher. The fix was
>> done to
>> > +  allow for greater control by the user. In all existing checkers that
>> use this
>> > +  matcher all instances of code ``hasAnyArgument()`` or
>> > +  ``has()`` must be changed to
>> > +  ``hasAnyArgument(ignoringParenImpCasts())`` or
>> > +  ``has(ignoringParenImpCasts())``.
>> >
>> >  ...
>> >
>> >
>> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=271288=271287=271288=diff
>> >
>> ==
>> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
>> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue May 31
>> 10:25:05 2016
>> > @@ -2169,6 +2169,10 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
>> >  /// ChildT must be an AST base type.
>> >  ///
>> >  /// Usable as: Any Matcher
>> > +/// Note that has is direct matcher, so it also matches things like
>> implicit
>> > +/// casts and paren casts. If you are matching with expr then you
>> should
>> > +/// probably consider using ignoringParenImpCasts like:
>> > +/// has(ignoringParenImpCasts(expr())).
>> >  const internal::ArgumentAdaptingMatcherFunc
>> >  LLVM_ATTRIBUTE_UNUSED has = {};
>> >
>> >
>> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=271288=271287=271288=diff
>> >
>> ==
>> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
>> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue May
>> 31 10:25:05 2016
>> > @@ -1165,8 +1165,6 @@ public:
>> >  /// ChildT must be an AST base type.
>> >  template 
>> >  class HasMatcher : public WrapperMatcherInterface {
>> > -  static_assert(IsBaseType::value,
>> > -"has only accepts base type matcher");
>> >
>> >  public:
>> >explicit HasMatcher(const Matcher )
>> > @@ -1174,10 +1172,9 @@ public:
>> >
>> >bool matches(const T , ASTMatchFinder *Finder,
>> > BoundNodesTreeBuilder *Builder) const override {
>> > -return Finder->matchesChildOf(
>> > -Node, this->InnerMatcher, Builder,
>> > -ASTMatchFinder::TK_IgnoreImplicitCastsAndParentheses,
>> > -ASTMatchFinder::BK_First);
>> > +return Finder->matchesChildOf(Node, this->InnerMatcher, Builder,
>> > +   

Re: r271288 - [ASTMatchers] Breaking change of `has` matcher

2016-05-31 Thread Piotr Padlewski via cfe-commits
Yep, sending fix

2016-05-31 17:45 GMT+02:00 Rafael Espíndola :

> This broke the build:
>
> http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/36968/steps/cmake-configure/logs/stdio
>
> On 31 May 2016 at 08:25, Piotr Padlewski via cfe-commits
>  wrote:
> > Author: prazek
> > Date: Tue May 31 10:25:05 2016
> > New Revision: 271288
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=271288=rev
> > Log:
> > [ASTMatchers] Breaking change of `has` matcher
> >
> > has matcher can now match to implicit and paren casts
> >
> > http://reviews.llvm.org/D20801
> >
> > Modified:
> > cfe/trunk/docs/ReleaseNotes.rst
> > cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> > cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> > cfe/trunk/include/clang/CMakeLists.txt
> > cfe/trunk/unittests/AST/ASTImporterTest.cpp
> > cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
> >
> > Modified: cfe/trunk/docs/ReleaseNotes.rst
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=271288=271287=271288=diff
> >
> ==
> > --- cfe/trunk/docs/ReleaseNotes.rst (original)
> > +++ cfe/trunk/docs/ReleaseNotes.rst Tue May 31 10:25:05 2016
> > @@ -185,11 +185,13 @@ this section should help get you past th
> >  AST Matchers
> >  
> >
> > -- hasAnyArgument: Matcher no longer ignores parentheses and implicit
> casts on
> > -  the argument before applying the inner matcher. The fix was done to
> allow for
> > -  greater control by the user. In all existing checkers that use this
> matcher
> > -  all instances of code ``hasAnyArgument()`` must be
> changed to
> > -  ``hasAnyArgument(ignoringParenImpCasts())``.
> > +- has and hasAnyArgument: Matchers no longer ignores parentheses and
> implicit
> > +  casts on the argument before applying the inner matcher. The fix was
> done to
> > +  allow for greater control by the user. In all existing checkers that
> use this
> > +  matcher all instances of code ``hasAnyArgument()`` or
> > +  ``has()`` must be changed to
> > +  ``hasAnyArgument(ignoringParenImpCasts())`` or
> > +  ``has(ignoringParenImpCasts())``.
> >
> >  ...
> >
> >
> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=271288=271287=271288=diff
> >
> ==
> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue May 31
> 10:25:05 2016
> > @@ -2169,6 +2169,10 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
> >  /// ChildT must be an AST base type.
> >  ///
> >  /// Usable as: Any Matcher
> > +/// Note that has is direct matcher, so it also matches things like
> implicit
> > +/// casts and paren casts. If you are matching with expr then you should
> > +/// probably consider using ignoringParenImpCasts like:
> > +/// has(ignoringParenImpCasts(expr())).
> >  const internal::ArgumentAdaptingMatcherFunc
> >  LLVM_ATTRIBUTE_UNUSED has = {};
> >
> >
> > Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=271288=271287=271288=diff
> >
> ==
> > --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
> > +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue May 31
> 10:25:05 2016
> > @@ -1165,8 +1165,6 @@ public:
> >  /// ChildT must be an AST base type.
> >  template 
> >  class HasMatcher : public WrapperMatcherInterface {
> > -  static_assert(IsBaseType::value,
> > -"has only accepts base type matcher");
> >
> >  public:
> >explicit HasMatcher(const Matcher )
> > @@ -1174,10 +1172,9 @@ public:
> >
> >bool matches(const T , ASTMatchFinder *Finder,
> > BoundNodesTreeBuilder *Builder) const override {
> > -return Finder->matchesChildOf(
> > -Node, this->InnerMatcher, Builder,
> > -ASTMatchFinder::TK_IgnoreImplicitCastsAndParentheses,
> > -ASTMatchFinder::BK_First);
> > +return Finder->matchesChildOf(Node, this->InnerMatcher, Builder,
> > +  ASTMatchFinder::TK_AsIs,
> > +  ASTMatchFinder::BK_First);
> >}
> >  };
> >
> >
> > Modified: cfe/trunk/include/clang/CMakeLists.txt
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CMakeLists.txt?rev=271288=271287=271288=diff
> >
> ==
> > --- cfe/trunk/include/clang/CMakeLists.txt (original)
> > +++ cfe/trunk/include/clang/CMakeLists.txt Tue May 31 10:25:05 2016
> > @@ -5,3 +5,4 @@ 

Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-05-31 Thread David Majnemer via cfe-commits
majnemer added inline comments.


Comment at: src/experimental/operations.cpp:128-129
@@ +127,4 @@
+bool stat_equivalent(struct ::stat& st1, struct ::stat& st2) {
+return (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
+}
+

It is possible for `st_ino` to wrap around while the machine is still running.
I'd mix `st_gen` into the comparison if we are running under one of the BSDs or 
Darwin.

Linux has a `FS_IOC_GETVERSION` ioctl but it requires a file descriptor.  Maybe 
such heroics are not worth it.


http://reviews.llvm.org/D16948



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


r271291 - Revert r253909 because it was committed with an incorrect message

2016-05-31 Thread Ehsan Akhgari via cfe-commits
Author: ehsan
Date: Tue May 31 10:39:10 2016
New Revision: 271291

URL: http://llvm.org/viewvc/llvm-project?rev=271291=rev
Log:
Revert r253909 because it was committed with an incorrect message

Removed:
cfe/trunk/test/Index/symbol-visibility.c
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/libclang.exports

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=271291=271290=271291=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue May 31 10:39:10 2016
@@ -2516,32 +2516,6 @@ enum CXLinkageKind {
  */
 CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
 
-enum CXVisibilityKind {
-  /** \brief This value indicates that no visibility information is available
-   * for a provided CXCursor. */
-  CXVisibility_Invalid,
-
-  /** \brief Symbol not seen by the linker. */
-  CXVisibility_Hidden,
-  /** \brief Symbol seen by the linker but resolves to a symbol inside this 
object. */
-  CXVisibility_Protected,
-  /** \brief Symbol seen by the linker and acts like a normal symbol. */
-  CXVisibility_Default
-};
-
-/**
- * \brief Describe the visibility of the entity referred to by a cursor.
- *
- * This returns the default visibility if not explicitly specified by
- * a visibility attribute. The default visibility may be changed by
- * commandline arguments.
- *
- * \param cursor The cursor to query.
- *
- * \returns The visibility of the cursor.
- */
-CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor 
cursor);
-
 /**
  * \brief Determine the availability of the entity that this cursor refers to,
  * taking the current target platform into account.

Removed: cfe/trunk/test/Index/symbol-visibility.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/symbol-visibility.c?rev=271290=auto
==
--- cfe/trunk/test/Index/symbol-visibility.c (original)
+++ cfe/trunk/test/Index/symbol-visibility.c (removed)
@@ -1,7 +0,0 @@
-// RUN: c-index-test -test-print-visibility %s | FileCheck %s
-
-__attribute__ ((visibility ("default"))) void foo1();
-__attribute__ ((visibility ("hidden"))) void foo2();
-
-// CHECK: FunctionDecl=foo1:3:47visibility=Default
-// CHECK: FunctionDecl=foo2:4:46visibility=Hidden

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=271291=271290=271291=diff
==
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Tue May 31 10:39:10 2016
@@ -1265,32 +1265,6 @@ static enum CXChildVisitResult PrintLink
 }
 
 
/**/
-/* Visibility testing.
*/
-/**/
-
-static enum CXChildVisitResult PrintVisibility(CXCursor cursor, CXCursor p,
-   CXClientData d) {
-  const char *visibility = 0;
-
-  if (clang_isInvalid(clang_getCursorKind(cursor)))
-return CXChildVisit_Recurse;
-
-  switch (clang_getCursorVisibility(cursor)) {
-case CXVisibility_Invalid: break;
-case CXVisibility_Hidden: visibility = "Hidden"; break;
-case CXVisibility_Protected: visibility = "Protected"; break;
-case CXVisibility_Default: visibility = "Default"; break;
-  }
-
-  if (visibility) {
-PrintCursor(cursor, NULL);
-printf("visibility=%s\n", visibility);
-  }
-
-  return CXChildVisit_Recurse;
-}
-
-/**/
 /* Typekind testing.  
*/
 
/**/
 
@@ -4266,7 +4240,6 @@ static void print_usage(void) {
 "   c-index-test -test-inclusion-stack-tu \n");
   fprintf(stderr,
 "   c-index-test -test-print-linkage-source {}*\n"
-"   c-index-test -test-print-visibility {}*\n"
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
@@ -4361,9 +4334,6 @@ int cindextest_main(int argc, const char
   else if (argc > 2 && strcmp(argv[1], "-test-print-linkage-source") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all", PrintLinkage,
 NULL);
-  else if (argc > 2 && strcmp(argv[1], "-test-print-visibility") == 0)
-return perform_test_load_source(argc - 2, argv + 2, 

Re: r271288 - [ASTMatchers] Breaking change of `has` matcher

2016-05-31 Thread Rafael Espíndola via cfe-commits
This broke the build:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/36968/steps/cmake-configure/logs/stdio

On 31 May 2016 at 08:25, Piotr Padlewski via cfe-commits
 wrote:
> Author: prazek
> Date: Tue May 31 10:25:05 2016
> New Revision: 271288
>
> URL: http://llvm.org/viewvc/llvm-project?rev=271288=rev
> Log:
> [ASTMatchers] Breaking change of `has` matcher
>
> has matcher can now match to implicit and paren casts
>
> http://reviews.llvm.org/D20801
>
> Modified:
> cfe/trunk/docs/ReleaseNotes.rst
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> cfe/trunk/include/clang/CMakeLists.txt
> cfe/trunk/unittests/AST/ASTImporterTest.cpp
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
>
> Modified: cfe/trunk/docs/ReleaseNotes.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=271288=271287=271288=diff
> ==
> --- cfe/trunk/docs/ReleaseNotes.rst (original)
> +++ cfe/trunk/docs/ReleaseNotes.rst Tue May 31 10:25:05 2016
> @@ -185,11 +185,13 @@ this section should help get you past th
>  AST Matchers
>  
>
> -- hasAnyArgument: Matcher no longer ignores parentheses and implicit casts on
> -  the argument before applying the inner matcher. The fix was done to allow 
> for
> -  greater control by the user. In all existing checkers that use this matcher
> -  all instances of code ``hasAnyArgument()`` must be changed 
> to
> -  ``hasAnyArgument(ignoringParenImpCasts())``.
> +- has and hasAnyArgument: Matchers no longer ignores parentheses and implicit
> +  casts on the argument before applying the inner matcher. The fix was done 
> to
> +  allow for greater control by the user. In all existing checkers that use 
> this
> +  matcher all instances of code ``hasAnyArgument()`` or
> +  ``has()`` must be changed to
> +  ``hasAnyArgument(ignoringParenImpCasts())`` or
> +  ``has(ignoringParenImpCasts())``.
>
>  ...
>
>
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=271288=271287=271288=diff
> ==
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue May 31 10:25:05 2016
> @@ -2169,6 +2169,10 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
>  /// ChildT must be an AST base type.
>  ///
>  /// Usable as: Any Matcher
> +/// Note that has is direct matcher, so it also matches things like implicit
> +/// casts and paren casts. If you are matching with expr then you should
> +/// probably consider using ignoringParenImpCasts like:
> +/// has(ignoringParenImpCasts(expr())).
>  const internal::ArgumentAdaptingMatcherFunc
>  LLVM_ATTRIBUTE_UNUSED has = {};
>
>
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=271288=271287=271288=diff
> ==
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue May 31 
> 10:25:05 2016
> @@ -1165,8 +1165,6 @@ public:
>  /// ChildT must be an AST base type.
>  template 
>  class HasMatcher : public WrapperMatcherInterface {
> -  static_assert(IsBaseType::value,
> -"has only accepts base type matcher");
>
>  public:
>explicit HasMatcher(const Matcher )
> @@ -1174,10 +1172,9 @@ public:
>
>bool matches(const T , ASTMatchFinder *Finder,
> BoundNodesTreeBuilder *Builder) const override {
> -return Finder->matchesChildOf(
> -Node, this->InnerMatcher, Builder,
> -ASTMatchFinder::TK_IgnoreImplicitCastsAndParentheses,
> -ASTMatchFinder::BK_First);
> +return Finder->matchesChildOf(Node, this->InnerMatcher, Builder,
> +  ASTMatchFinder::TK_AsIs,
> +  ASTMatchFinder::BK_First);
>}
>  };
>
>
> Modified: cfe/trunk/include/clang/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CMakeLists.txt?rev=271288=271287=271288=diff
> ==
> --- cfe/trunk/include/clang/CMakeLists.txt (original)
> +++ cfe/trunk/include/clang/CMakeLists.txt Tue May 31 10:25:05 2016
> @@ -5,3 +5,4 @@ add_subdirectory(Parse)
>  add_subdirectory(Sema)
>  add_subdirectory(Serialization)
>  add_subdirectory(StaticAnalyzer/Checkers)
> +add_subdirectory(ASTMatchers)
>
> Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
> URL: 
> 

Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete

2016-05-31 Thread David Majnemer via cfe-commits
majnemer added inline comments.


Comment at: src/experimental/operations.cpp:529
@@ +528,3 @@
+
+if (::utimensat(AT_FDCWD, p.c_str(), tbuf, 0) == -1) {
+m_ec = detail::capture_errno();

SUSv4 says:

> The utime() function is marked obsolescent.

However, `utimes` was made legacy in SUSv3 and removed from legacy in SUSv4
http://pubs.opengroup.org/onlinepubs/9699919799/functions/utimes.html


http://reviews.llvm.org/D16948



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


[clang-tools-extra] r271289 - [ASTMatchers] Added ignoringParenImpCasts to has matchers

2016-05-31 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Tue May 31 10:26:56 2016
New Revision: 271289

URL: http://llvm.org/viewvc/llvm-project?rev=271289=rev
Log:
[ASTMatchers] Added ignoringParenImpCasts to has matchers

has matcher changed behaviour, and now it matches "as is" and
doesn't skip implicit and paren casts

http://reviews.llvm.org/D20801

Modified:
clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp

clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/IncorrectRoundings.cpp
clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MisplacedWideningCastCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SizeofContainerCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SizeofExpressionCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousMissingCommaCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousStringCompareCheck.cpp

clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/ShrinkToFitCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp

clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp?rev=271289=271288=271289=diff
==
--- clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/cert/ThrownExceptionTypeCheck.cpp Tue 
May 31 10:26:56 2016
@@ -23,10 +23,10 @@ void ThrownExceptionTypeCheck::registerM
 return;
 
   Finder->addMatcher(
-  cxxThrowExpr(
-  has(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
-  isCopyConstructor(), unless(isNoThrow()
-  .bind("expr"))),
+  cxxThrowExpr(has(ignoringParenImpCasts(
+  cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
+   isCopyConstructor(), unless(isNoThrow()
+  .bind("expr",
   this);
 }
 

Modified: 
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp?rev=271289=271288=271289=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp 
Tue May 31 10:26:56 2016
@@ -47,15 +47,18 @@ void BoolPointerImplicitConversionCheck:
   auto DeclRef = ignoringParenImpCasts(declRefExpr(to(equalsNode(D;
   if (!match(findAll(
  unaryOperator(hasOperatorName("*"), 
hasUnaryOperand(DeclRef))),
- *If, *Result.Context).empty() ||
+ *If, *Result.Context)
+   .empty() ||
   !match(findAll(arraySubscriptExpr(hasBase(DeclRef))), *If,
- *Result.Context).empty() ||
+ *Result.Context)
+   .empty() ||
   // FIXME: We should still warn if the paremater is implicitly converted 
to
   // bool.
   !match(findAll(callExpr(hasAnyArgument(ignoringParenImpCasts(DeclRef,
  *If, *Result.Context)
.empty() ||
-  !match(findAll(cxxDeleteExpr(has(expr(DeclRef, *If, *Result.Context)
+  !match(findAll(cxxDeleteExpr(has(ignoringParenImpCasts(expr(DeclRef),
+ *If, *Result.Context)
.empty())
 return;
 

Modified: clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp?rev=271289=271288=271289=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp Tue May 31 
10:26:56 2016
@@ -103,15 +103,17 @@ void DanglingHandleCheck::registerMatche
   Finder->addMatcher(

r271288 - [ASTMatchers] Breaking change of `has` matcher

2016-05-31 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Tue May 31 10:25:05 2016
New Revision: 271288

URL: http://llvm.org/viewvc/llvm-project?rev=271288=rev
Log:
[ASTMatchers] Breaking change of `has` matcher

has matcher can now match to implicit and paren casts

http://reviews.llvm.org/D20801

Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
cfe/trunk/include/clang/CMakeLists.txt
cfe/trunk/unittests/AST/ASTImporterTest.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=271288=271287=271288=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Tue May 31 10:25:05 2016
@@ -185,11 +185,13 @@ this section should help get you past th
 AST Matchers
 
 
-- hasAnyArgument: Matcher no longer ignores parentheses and implicit casts on
-  the argument before applying the inner matcher. The fix was done to allow for
-  greater control by the user. In all existing checkers that use this matcher
-  all instances of code ``hasAnyArgument()`` must be changed to
-  ``hasAnyArgument(ignoringParenImpCasts())``.
+- has and hasAnyArgument: Matchers no longer ignores parentheses and implicit
+  casts on the argument before applying the inner matcher. The fix was done to
+  allow for greater control by the user. In all existing checkers that use this
+  matcher all instances of code ``hasAnyArgument()`` or
+  ``has()`` must be changed to
+  ``hasAnyArgument(ignoringParenImpCasts())`` or
+  ``has(ignoringParenImpCasts())``.
 
 ...
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=271288=271287=271288=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue May 31 10:25:05 2016
@@ -2169,6 +2169,10 @@ AST_MATCHER_P(CXXRecordDecl, hasMethod,
 /// ChildT must be an AST base type.
 ///
 /// Usable as: Any Matcher
+/// Note that has is direct matcher, so it also matches things like implicit
+/// casts and paren casts. If you are matching with expr then you should
+/// probably consider using ignoringParenImpCasts like:
+/// has(ignoringParenImpCasts(expr())).
 const internal::ArgumentAdaptingMatcherFunc
 LLVM_ATTRIBUTE_UNUSED has = {};
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=271288=271287=271288=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue May 31 
10:25:05 2016
@@ -1165,8 +1165,6 @@ public:
 /// ChildT must be an AST base type.
 template 
 class HasMatcher : public WrapperMatcherInterface {
-  static_assert(IsBaseType::value,
-"has only accepts base type matcher");
 
 public:
   explicit HasMatcher(const Matcher )
@@ -1174,10 +1172,9 @@ public:
 
   bool matches(const T , ASTMatchFinder *Finder,
BoundNodesTreeBuilder *Builder) const override {
-return Finder->matchesChildOf(
-Node, this->InnerMatcher, Builder,
-ASTMatchFinder::TK_IgnoreImplicitCastsAndParentheses,
-ASTMatchFinder::BK_First);
+return Finder->matchesChildOf(Node, this->InnerMatcher, Builder,
+  ASTMatchFinder::TK_AsIs,
+  ASTMatchFinder::BK_First);
   }
 };
 

Modified: cfe/trunk/include/clang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CMakeLists.txt?rev=271288=271287=271288=diff
==
--- cfe/trunk/include/clang/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/CMakeLists.txt Tue May 31 10:25:05 2016
@@ -5,3 +5,4 @@ add_subdirectory(Parse)
 add_subdirectory(Sema)
 add_subdirectory(Serialization)
 add_subdirectory(StaticAnalyzer/Checkers)
+add_subdirectory(ASTMatchers)

Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=271288=271287=271288=diff
==
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Tue May 31 10:25:05 2016
@@ -225,20 +225,14 @@ TEST(ImportExpr, ImportCXXThisExpr) {
 
 TEST(ImportExpr, ImportAtomicExpr) {
   MatchVerifier Verifier;
-  EXPECT_TRUE(
-testImport(
-  "void 

[PATCH] D20817: clang-format: [JS] no ASI on `import {x as\n y}`.

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

ASI did not handle the ES6 `as` operator correctly.

http://reviews.llvm.org/D20817

Files:
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1010,6 +1010,9 @@
"} from 'some/module.js';");
   verifyFormat("import {X, Y,} from 'some/module.js';");
   verifyFormat("import {X as myLocalX, Y as myLocalY} from 'some/module.js';");
+  // Ensure Automatic Semicolon Insertion does not break on "as\n".
+  verifyFormat("import {X as myX} from 'm';", "import {X as\n"
+  " myX} from 'm';");
   verifyFormat("import * as lib from 'some/module.js';");
   verifyFormat("var x = {import: 1};\nx.import = 2;");
 
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -668,11 +668,11 @@
   // FIXME: This returns true for C/C++ keywords like 'struct'.
   return FormatTok->is(tok::identifier) &&
  (FormatTok->Tok.getIdentifierInfo() == nullptr ||
-  !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, 
Keywords.kw_async,
-  Keywords.kw_await, Keywords.kw_yield,
-  Keywords.kw_finally, Keywords.kw_function,
-  Keywords.kw_import, Keywords.kw_is,
-  Keywords.kw_let, Keywords.kw_var,
+  !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, Keywords.kw_as,
+  Keywords.kw_async, Keywords.kw_await,
+  Keywords.kw_yield, Keywords.kw_finally,
+  Keywords.kw_function, Keywords.kw_import,
+  Keywords.kw_is, Keywords.kw_let, Keywords.kw_var,
   Keywords.kw_abstract, Keywords.kw_extends,
   Keywords.kw_implements, Keywords.kw_instanceof,
   Keywords.kw_interface, Keywords.kw_throws));


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1010,6 +1010,9 @@
"} from 'some/module.js';");
   verifyFormat("import {X, Y,} from 'some/module.js';");
   verifyFormat("import {X as myLocalX, Y as myLocalY} from 'some/module.js';");
+  // Ensure Automatic Semicolon Insertion does not break on "as\n".
+  verifyFormat("import {X as myX} from 'm';", "import {X as\n"
+  " myX} from 'm';");
   verifyFormat("import * as lib from 'some/module.js';");
   verifyFormat("var x = {import: 1};\nx.import = 2;");
 
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -668,11 +668,11 @@
   // FIXME: This returns true for C/C++ keywords like 'struct'.
   return FormatTok->is(tok::identifier) &&
  (FormatTok->Tok.getIdentifierInfo() == nullptr ||
-  !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, Keywords.kw_async,
-  Keywords.kw_await, Keywords.kw_yield,
-  Keywords.kw_finally, Keywords.kw_function,
-  Keywords.kw_import, Keywords.kw_is,
-  Keywords.kw_let, Keywords.kw_var,
+  !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, Keywords.kw_as,
+  Keywords.kw_async, Keywords.kw_await,
+  Keywords.kw_yield, Keywords.kw_finally,
+  Keywords.kw_function, Keywords.kw_import,
+  Keywords.kw_is, Keywords.kw_let, Keywords.kw_var,
   Keywords.kw_abstract, Keywords.kw_extends,
   Keywords.kw_implements, Keywords.kw_instanceof,
   Keywords.kw_interface, Keywords.kw_throws));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14326: ASTImporter: expressions, pt.2

2016-05-31 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

Ping?


http://reviews.llvm.org/D14326



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


Re: [PATCH] D20798: clang-format: [JS] Sort imported symbols.

2016-05-31 Thread Martin Probst via cfe-commits
mprobst added a comment.

Done regarding the tests. We do have an unrelated issue with formatting `import 
{x as foo}`, will send a fix later.


http://reviews.llvm.org/D20798



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


Re: [PATCH] D20798: clang-format: [JS] Sort imported symbols.

2016-05-31 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 59070.
mprobst added a comment.

- multiline tests, review comments


http://reviews.llvm.org/D20798

Files:
  lib/Format/Format.cpp
  lib/Format/SortJavaScriptImports.cpp
  unittests/Format/SortImportsTestJS.cpp

Index: unittests/Format/SortImportsTestJS.cpp
===
--- unittests/Format/SortImportsTestJS.cpp
+++ unittests/Format/SortImportsTestJS.cpp
@@ -67,6 +67,21 @@
  "let x = 1;");
 }
 
+TEST_F(SortImportsTestJS, WrappedImportStatements) {
+  verifySort("import {sym1, sym2} from 'a';\n"
+ "import {sym} from 'b';\n"
+ "\n"
+ "1;",
+ "import\n"
+ "  {sym}\n"
+ "  from 'b';\n"
+ "import {\n"
+ "  sym1,\n"
+ "  sym2\n"
+ "} from 'a';\n"
+ "1;");
+}
+
 TEST_F(SortImportsTestJS, SeparateMainCodeBody) {
   verifySort("import {sym} from 'a';"
  "\n"
@@ -101,6 +116,18 @@
  "import {sym1 as alias1} from 'b';\n");
 }
 
+TEST_F(SortImportsTestJS, SortSymbols) {
+  verifySort("import {sym1, sym2 as a, sym3} from 'b';\n",
+ "import {sym2 as a, sym1, sym3} from 'b';\n");
+  verifySort("import {sym1 /* important! */, /*!*/ sym2 as a} from 'b';\n",
+ "import {/*!*/ sym2 as a, sym1 /* important! */} from 'b';\n");
+  verifySort("import {sym1, sym2} from 'b';\n", "import {\n"
+"  sym2 \n"
+",\n"
+" sym1 \n"
+"} from 'b';\n");
+}
+
 TEST_F(SortImportsTestJS, GroupImports) {
   verifySort("import {a} from 'absolute';\n"
  "\n"
Index: lib/Format/SortJavaScriptImports.cpp
===
--- lib/Format/SortJavaScriptImports.cpp
+++ lib/Format/SortJavaScriptImports.cpp
@@ -25,6 +25,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Debug.h"
+#include 
 #include 
 
 #define DEBUG_TYPE "format-formatter"
@@ -40,6 +41,13 @@
 struct JsImportedSymbol {
   StringRef Symbol;
   StringRef Alias;
+  SourceRange Range;
+
+  bool operator==(const JsImportedSymbol ) const {
+// Ignore Range for comparison, it is only used to stitch code together,
+// but imports at different code locations are still conceptually the same.
+return Symbol == RHS.Symbol && Alias == RHS.Alias;
+  }
 };
 
 // An ES6 module reference.
@@ -139,23 +147,14 @@
  [&](unsigned LHSI, unsigned RHSI) {
return References[LHSI] < References[RHSI];
  });
-// FIXME: Pull this into a common function.
-bool OutOfOrder = false;
-for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
-  if (i != Indices[i]) {
-OutOfOrder = true;
-break;
-  }
-}
-if (!OutOfOrder)
-  return Result;
+bool ReferencesInOrder = std::is_sorted(Indices.begin(), Indices.end());
 
-// Replace all existing import/export statements.
 std::string ReferencesText;
+bool SymbolsInOrder = true;
 for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
   JsModuleReference Reference = References[Indices[i]];
-  StringRef ReferenceStmt = getSourceText(Reference.Range);
-  ReferencesText += ReferenceStmt;
+  if (appendReference(ReferencesText, Reference))
+SymbolsInOrder = false;
   if (i + 1 < e) {
 // Insert breaks between imports and exports.
 ReferencesText += "\n";
@@ -167,6 +166,10 @@
   ReferencesText += "\n";
   }
 }
+
+if (ReferencesInOrder && SymbolsInOrder)
+  return Result;
+
 // Separate references from the main code body of the file.
 if (FirstNonImportLine && FirstNonImportLine->First->NewlinesBefore < 2)
   ReferencesText += "\n";
@@ -211,10 +214,45 @@
   }
 
   StringRef getSourceText(SourceRange Range) {
+return getSourceText(Range.getBegin(), Range.getEnd());
+  }
+
+  StringRef getSourceText(SourceLocation Begin, SourceLocation End) {
 const SourceManager  = Env.getSourceManager();
-return FileContents.substr(SM.getFileOffset(Range.getBegin()),
-   SM.getFileOffset(Range.getEnd()) -
-   SM.getFileOffset(Range.getBegin()));
+return FileContents.substr(SM.getFileOffset(Begin),
+   SM.getFileOffset(End) - SM.getFileOffset(Begin));
+  }
+
+  // Appends ``Reference`` to ``Buffer``, returning true if text within the
+  // ``Reference`` changed (e.g. symbol order).
+  bool appendReference(std::string , JsModuleReference ) {
+// Sort the individual symbols within the import.
+// E.g. `import {b, a} from 'x';` -> `import {a, b} from 'x';`
+SmallVector Symbols = 

Re: [PATCH] D20816: [include-fixer] use clang-format cleaner to insert header.

2016-05-31 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: include-fixer/IncludeFixer.cpp:29
@@ -28,3 +28,3 @@
 
 class Action;
 

The forward declaration can be removed too.


Repository:
  rL LLVM

http://reviews.llvm.org/D20816



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


Re: [PATCH] D20798: clang-format: [JS] Sort imported symbols.

2016-05-31 Thread Martin Probst via cfe-commits
mprobst marked 4 inline comments as done.
mprobst added a comment.

Done regarding the tests. We do have an unrelated issue with formatting `import 
{x as foo}`, will send a fix later.


http://reviews.llvm.org/D20798



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


Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-31 Thread Felix Berger via cfe-commits
flx added a comment.

In http://reviews.llvm.org/D20277#444023, @Prazek wrote:

> In http://reviews.llvm.org/D20277#436725, @flx wrote:
>
> > In http://reviews.llvm.org/D20277#436717, @Prazek wrote:
> >
> > > Cool check! Did you think about sugesting std::move for rvalue references 
> > > if they are used once?
> >
> >
> > Thanks! I'm not sure this fits with what a user would expect from a check 
> > named "unnecessary-value-param" since in this case the parameter is not 
> > passed by value. Would a separate check make sense for this?
>
>
> Consider changing the name :) When I was thinking about the check for rvalue 
> references, I wanted to name it "*-rvalue-ref-one-use". 
>  If it covers values also, maybe "performance-move-single-used-variable" or 
> "performance-variable-one-use", or "performance-disposable-object" (If I 
> translated it correctly).
>
> In my opinion there is no need to have separate check to to this, because the 
> user would like to have both or none.


Renaming the check is a breaking change since it affects user's configurations. 
I'm working in a code base that doesn't allow r-value references outside of 
move constructors and assignment, but if you'd like to add handing the r-value 
reference case, that'd be great! I agree that with this change it make sense to 
handle r-value references here too.


http://reviews.llvm.org/D20277



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


Re: [PATCH] D20816: [include-fixer] use clang-format cleaner to insert header.

2016-05-31 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271287: [include-fixer] use clang-format cleaner to insert 
header. (authored by ioeric).

Changed prior to commit:
  http://reviews.llvm.org/D20816?vs=59067=59069#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20816

Files:
  clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
  clang-tools-extra/trunk/include-fixer/IncludeFixer.h
  clang-tools-extra/trunk/include-fixer/IncludeFixerContext.h
  clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
  clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp

Index: clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
===
--- clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
+++ clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
@@ -78,21 +78,22 @@
 return Code;
   tooling::Replacements Replacements =
   clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front(),
-  FixerContext.FirstIncludeOffset);
+  Code, "input.cc", FixerContext.Headers.front());
   clang::RewriterTestContext Context;
   clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
   clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
 
 TEST(IncludeFixer, Typo) {
-  EXPECT_EQ("#include \n\nstd::string foo;\n",
+  EXPECT_EQ("#include \nstd::string foo;\n",
 runIncludeFixer("std::string foo;\n"));
 
+  // FIXME: the current version of include-fixer does not get this test case
+  // right - header should be inserted before definition.
   EXPECT_EQ(
-  "// comment\n#include \"foo.h\"\n#include \nstd::string foo;\n"
-  "#include \"dir/bar.h\"\n",
+  "// comment\n#include \"foo.h\"\nstd::string foo;\n"
+  "#include \"dir/bar.h\"\n#include \n",
   runIncludeFixer("// comment\n#include \"foo.h\"\nstd::string foo;\n"
   "#include \"dir/bar.h\"\n"));
 
@@ -106,11 +107,11 @@
   // string without "std::" can also be fixed since fixed db results go through
   // SymbolIndexManager, and SymbolIndexManager matches unqualified identifiers
   // too.
-  EXPECT_EQ("#include \n\nstring foo;\n",
+  EXPECT_EQ("#include \nstring foo;\n",
 runIncludeFixer("string foo;\n"));
 
   // Fully qualified name.
-  EXPECT_EQ("#include \n\n::std::string foo;\n",
+  EXPECT_EQ("#include \n::std::string foo;\n",
 runIncludeFixer("::std::string foo;\n"));
   // Should not match std::string.
   EXPECT_EQ("::string foo;\n", runIncludeFixer("::string foo;\n"));
@@ -126,24 +127,24 @@
 
 TEST(IncludeFixer, MinimizeInclude) {
   std::vector IncludePath = {"-Idir/"};
-  EXPECT_EQ("#include \"otherdir/qux.h\"\n\na::b::foo bar;\n",
+  EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
 runIncludeFixer("a::b::foo bar;\n", IncludePath));
 
   IncludePath = {"-isystemdir"};
-  EXPECT_EQ("#include \n\na::b::foo bar;\n",
+  EXPECT_EQ("#include \na::b::foo bar;\n",
 runIncludeFixer("a::b::foo bar;\n", IncludePath));
 
   IncludePath = {"-iquotedir"};
-  EXPECT_EQ("#include \"otherdir/qux.h\"\n\na::b::foo bar;\n",
+  EXPECT_EQ("#include \"otherdir/qux.h\"\na::b::foo bar;\n",
 runIncludeFixer("a::b::foo bar;\n", IncludePath));
 
   IncludePath = {"-Idir", "-Idir/otherdir"};
-  EXPECT_EQ("#include \"qux.h\"\n\na::b::foo bar;\n",
+  EXPECT_EQ("#include \"qux.h\"\na::b::foo bar;\n",
 runIncludeFixer("a::b::foo bar;\n", IncludePath));
 }
 
 TEST(IncludeFixer, NestedName) {
-  EXPECT_EQ("#include \"dir/otherdir/qux.h\"\n\n"
+  EXPECT_EQ("#include \"dir/otherdir/qux.h\"\n"
 "int x = a::b::foo(0);\n",
 runIncludeFixer("int x = a::b::foo(0);\n"));
 
@@ -153,33 +154,35 @@
   EXPECT_EQ("#define FOO(x) a::##x\nint x = FOO(b::foo);\n",
 runIncludeFixer("#define FOO(x) a::##x\nint x = FOO(b::foo);\n"));
 
-  EXPECT_EQ("#include \"dir/otherdir/qux.h\"\n\n"
-"namespace a {}\nint a = a::b::foo(0);\n",
+  // The empty namespace is cleaned up by clang-format after include-fixer
+  // finishes.
+  EXPECT_EQ("#include \"dir/otherdir/qux.h\"\n"
+"\nint a = a::b::foo(0);\n",
 runIncludeFixer("namespace a {}\nint a = a::b::foo(0);\n"));
 }
 
 TEST(IncludeFixer, MultipleMissingSymbols) {
-  EXPECT_EQ("#include \n\nstd::string bar;\nstd::sting foo;\n",
+  EXPECT_EQ("#include \nstd::string bar;\nstd::sting foo;\n",
 runIncludeFixer("std::string bar;\nstd::sting foo;\n"));
 }
 
 TEST(IncludeFixer, ScopedNamespaceSymbols) {
-  EXPECT_EQ("#include \"bar.h\"\n\nnamespace a {\nb::bar b;\n}",
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a {\nb::bar b;\n}",
 runIncludeFixer("namespace a {\nb::bar b;\n}"));
-  EXPECT_EQ("#include \"bar.h\"\n\nnamespace A {\na::b::bar b;\n}",

[clang-tools-extra] r271287 - [include-fixer] use clang-format cleaner to insert header.

2016-05-31 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue May 31 09:48:45 2016
New Revision: 271287

URL: http://llvm.org/viewvc/llvm-project?rev=271287=rev
Log:
[include-fixer] use clang-format cleaner to insert header.

Summary: clang-format's cleanupAroundReplacements() takes care of header 
insertions.

Reviewers: bkramer

Subscribers: cfe-commits, hokein

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

Modified:
clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
clang-tools-extra/trunk/include-fixer/IncludeFixer.h
clang-tools-extra/trunk/include-fixer/IncludeFixerContext.h
clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=271287=271286=271287=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Tue May 31 09:48:45 
2016
@@ -28,33 +28,6 @@ namespace {
 
 class Action;
 
-class PreprocessorHooks : public clang::PPCallbacks {
-public:
-  explicit PreprocessorHooks(Action *EnclosingPass)
-  : EnclosingPass(EnclosingPass), TrackedFile(nullptr) {}
-
-  void FileChanged(clang::SourceLocation loc,
-   clang::PPCallbacks::FileChangeReason reason,
-   clang::SrcMgr::CharacteristicKind file_type,
-   clang::FileID prev_fid) override;
-
-  void InclusionDirective(clang::SourceLocation HashLocation,
-  const clang::Token ,
-  llvm::StringRef FileName, bool IsAngled,
-  clang::CharSourceRange FileNameRange,
-  const clang::FileEntry *IncludeFile,
-  llvm::StringRef SearchPath,
-  llvm::StringRef relative_path,
-  const clang::Module *imported) override;
-
-private:
-  /// The current Action.
-  Action *EnclosingPass;
-
-  /// The current FileEntry.
-  const clang::FileEntry *TrackedFile;
-};
-
 /// Manages the parse, gathers include suggestions.
 class Action : public clang::ASTFrontendAction,
public clang::ExternalSemaSource {
@@ -67,8 +40,6 @@ public:
   CreateASTConsumer(clang::CompilerInstance ,
 StringRef InFile) override {
 Filename = InFile;
-Compiler.getPreprocessor().addPPCallbacks(
-llvm::make_unique(this));
 return llvm::make_unique();
   }
 
@@ -195,22 +166,6 @@ public:
 
   StringRef filename() const { return Filename; }
 
-  /// Called for each include file we discover is in the file.
-  /// \param SourceManager the active SourceManager
-  /// \param canonical_path the canonical path to the include file
-  /// \param uttered_path the path as it appeared in the program
-  /// \param IsAngled whether angle brackets were used
-  /// \param HashLocation the source location of the include's \#
-  /// \param EndLocation the source location following the include
-  void NextInclude(clang::SourceManager *SourceManager,
-   llvm::StringRef canonical_path, llvm::StringRef 
uttered_path,
-   bool IsAngled, clang::SourceLocation HashLocation,
-   clang::SourceLocation EndLocation) {
-unsigned Offset = SourceManager->getFileOffset(HashLocation);
-if (FirstIncludeOffset == -1U)
-  FirstIncludeOffset = Offset;
-  }
-
   /// Get the minimal include for a given path.
   std::string minimizeInclude(StringRef Include,
   const clang::SourceManager ,
@@ -244,7 +199,6 @@ public:
   return FixerContext;
 
 FixerContext.SymbolIdentifer = QuerySymbol;
-FixerContext.FirstIncludeOffset = FirstIncludeOffset;
 for (const auto  : SymbolQueryResults)
   FixerContext.Headers.push_back(
   minimizeInclude(Header, SourceManager, HeaderSearch));
@@ -252,9 +206,6 @@ public:
 return FixerContext;
   }
 
-  /// Sets the location at the very top of the file.
-  void setFileBegin(clang::SourceLocation Location) { FileBegin = Location; }
-
 private:
   /// Query the database for a given identifier.
   bool query(StringRef Query, SourceLocation Loc) {
@@ -280,13 +231,6 @@ private:
   /// The absolute path to the file being processed.
   std::string Filename;
 
-  /// The location of the beginning of the tracked file.
-  clang::SourceLocation FileBegin;
-
-  /// The offset of the last include in the original source file. This will
-  /// be used as the insertion point for new include directives.
-  unsigned FirstIncludeOffset = -1U;
-
   /// The symbol being queried.
   std::string QuerySymbol;
 
@@ -298,44 +242,6 @@ private:
   bool MinimizeIncludePaths = true;
 };
 
-void PreprocessorHooks::FileChanged(clang::SourceLocation Loc,
- 

Re: [PATCH] D20816: [include-fixer] use clang-format cleaner to insert header.

2016-05-31 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Look at all this annoying preprocessor code going away! I love it.


http://reviews.llvm.org/D20816



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


  1   2   >