Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-18 Thread Evgeniy Dushistov via cfe-commits
Dushistov updated this revision to Diff 40485.
Dushistov added a comment.

Replace 'endswith' with 'operator==', also update test to check that all four 
ways to call postEvent not produce warning


http://reviews.llvm.org/D14170

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/Inputs/qt-simulator.h
  test/Analysis/qt_malloc.cpp

Index: test/Analysis/qt_malloc.cpp
===
--- /dev/null
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -analyze 
-analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus
 -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *event = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, 
event);
+  QCoreApplication::instance()->postEvent(obj, event);
+  QCoreApplication::postEvent(obj, event);
+  QApplication::postEvent(obj, event);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- /dev/null
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,11 @@
 return true;
   }
 
+  if (FName == "postEvent" &&
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the


Index: test/Analysis/qt_malloc.cpp
===
--- /dev/null
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *event = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, event);
+  QCoreApplication::instance()->postEvent(obj, event);
+  QCoreApplication::postEvent(obj, event);
+  QApplication::postEvent(obj, event);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- /dev/null
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,11 @@
 return true;
   }
 
+  if (FName == "postEvent" &&
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-18 Thread Evgeniy Dushistov via cfe-commits
Dushistov marked an inline comment as done.
Dushistov added a comment.

http://reviews.llvm.org/D14170



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


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-18 Thread Evgeniy Dushistov via cfe-commits
Dushistov added a comment.

apply all suggestions


http://reviews.llvm.org/D14170



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


Re: [PATCH] D13289: [libc++] Provide additional templates for valarray transcendentals that satisfy the standard synopsis

2015-11-18 Thread Petr Pavlu via cfe-commits
petpav01 updated this revision to Diff 40486.
petpav01 added a comment.

I am not sure if I understand the comment about [17.6.5.4] correctly. It is not 
clear to me how this part of the standard prevents the user from specifying 
explicit template parameters for standard functions. It seems odd that the 
standard would disallow, for example, to use `std::max(1, 2.0)`.

New patch changes the transcendentals that accepted any `Expr` (i.e. `valarray` 
or `__val_expr`) to only accept `__val_expr`. In two cases (`atan2()` and 
`pow()`) the original template had to be split into four functions:

- `func(const __val_expr&, const __val_expr&)`
- `func(const __val_expr&, const valarray&)`
- `func(const valarray&, const __val_expr&)`
- `func(const valarray&, const valarray&)`

`is_same` checks on `value_type` of both operands are also added in these cases.

Missing thing is a better test coverage. The tests currently do not instantiate 
the `__val_expr` templates. I am working on this. Could you please send me an 
example that shows the problem with the ranking in overload resolution so I can 
add a test for it too?


http://reviews.llvm.org/D13289

Files:
  include/valarray
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
  
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp

Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
===
--- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
+++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
@@ -33,19 +33,26 @@
 
 int main()
 {
+typedef double T;
+T a1[] = {-.9, -.5, 0., .5, .75};
+T a3[] = {-7.1629787019902447e-01,
+  -4.6211715726000974e-01,
+   0.e+00,
+   4.6211715726000974e-01,
+   6.3514895238728730e-01};
+const unsigned N = sizeof(a1)/sizeof(a1[0]);
 {
-typedef double T;
-T a1[] = {-.9, -.5, 0., .5, .75};
-T a3[] = {-7.1629787019902447e-01,
-  -4.6211715726000974e-01,
-   0.e+00,
-   4.6211715726000974e-01,
-   6.3514895238728730e-01};
-const unsigned N = sizeof(a1)/sizeof(a1[0]);
 std::valarray v1(a1, N);
 std::valarray v3 = tanh(v1);
 assert(v3.size() == v1.size());
 for (int i = 0; i < v3.size(); ++i)
 assert(is_about(v3[i], a3[i], 10));
 }
+{
+std::valarray v1(a1, N);
+std::valarray v3 = std::tanh(v1);
+assert(v3.size() == v1.size());
+for (int i = 0; i < v3.size(); ++i)
+assert(is_about(v3[i], a3[i], 10));
+}
 }
Index: test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
===
--- test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
+++ test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
@@ -33,19 +33,26 @@
 
 int main()
 {
+typedef double T;
+T a1[] = {-.9, -.5, 0., .5, .

Re: [PATCH] D14760: Resolve build problem on NetBSD

2015-11-18 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

Are you sure your sources are up-to-date? That file is newly generated in LLVM 
and no changes outside should be necessary. Are you using cmake or gmake?


Repository:
  rL LLVM

http://reviews.llvm.org/D14760



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


Re: [PATCH] D14758: Handle ARMv7K as an alias, instead of fake architecture (NFC)

2015-11-18 Thread Renato Golin via cfe-commits
rengolin requested changes to this revision.
This revision now requires changes to proceed.


Comment at: lib/Driver/Tools.cpp:6298
@@ -6297,1 +6297,3 @@
   unsigned ArchKind;
+  if (Arch == "armv7k" || Arch == "thumbv7k")
+return "v7k"; // In other cases, Cortex-A7 should resolve to ARMv7-A

This doesn't fix the "horrible hack".


http://reviews.llvm.org/D14758



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


Re: [PATCH] D14756: Handle ARMv6-J as an alias, instead of fake architecture

2015-11-18 Thread Renato Golin via cfe-commits
rengolin added a comment.

Same comment as http://reviews.llvm.org/D14755. Whenever that's approved, so it 
this.


http://reviews.llvm.org/D14756



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


Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-18 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin updated this revision to Diff 40489.
DmitryPolukhin added a comment.

Added new warning group as suggested.

I see thousands of vector types in headers on GitHub 
https://github.com/search?p=1&q=%22__attribute__+mode+v4sf%22+extension%3Ah&ref=searchresults&type=Code&utf8=%E2%9C%93

liboil from freedesktop.org uses vector types in headers.


http://reviews.llvm.org/D14744

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDeclAttr.cpp
  test/Sema/attr-mode-vector-types.c

Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -3234,38 +3234,31 @@
   return true;
 }
 
-/// handleModeAttr - This attribute modifies the width of a decl with primitive
-/// type.
-///
-/// Despite what would be logical, the mode attribute is a decl attribute, not a
-/// type attribute: 'int ** __attribute((mode(HI))) *G;' tries to make 'G' be
-/// HImode, not an intermediate pointer.
-static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
-  // This attribute isn't documented, but glibc uses it.  It changes
-  // the width of an int or unsigned int to the specified size.
-  if (!Attr.isArgIdent(0)) {
-S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) << Attr.getName()
-  << AANT_ArgumentIdentifier;
-return;
-  }
-  
-  IdentifierInfo *Name = Attr.getArgAsIdent(0)->Ident;
-  StringRef Str = Name->getName();
-
-  normalizeName(Str);
-
-  unsigned DestWidth = 0;
-  bool IntegerMode = true;
-  bool ComplexMode = false;
+/// parseModeAttr - Parses attribute mode string and returns parsed type
+/// attribute.
+static void parseModeAttr(Sema &S, StringRef Str, unsigned &DestWidth,
+  bool &IntegerMode, bool &ComplexMode) {
   switch (Str.size()) {
   case 2:
 switch (Str[0]) {
-case 'Q': DestWidth = 8; break;
-case 'H': DestWidth = 16; break;
-case 'S': DestWidth = 32; break;
-case 'D': DestWidth = 64; break;
-case 'X': DestWidth = 96; break;
-case 'T': DestWidth = 128; break;
+case 'Q':
+  DestWidth = 8;
+  break;
+case 'H':
+  DestWidth = 16;
+  break;
+case 'S':
+  DestWidth = 32;
+  break;
+case 'D':
+  DestWidth = 64;
+  break;
+case 'X':
+  DestWidth = 96;
+  break;
+case 'T':
+  DestWidth = 128;
+  break;
 }
 if (Str[1] == 'F') {
   IntegerMode = false;
@@ -3293,6 +3286,50 @@
   DestWidth = S.Context.getTargetInfo().getUnwindWordWidth();
 break;
   }
+}
+
+/// handleModeAttr - This attribute modifies the width of a decl with primitive
+/// type.
+///
+/// Despite what would be logical, the mode attribute is a decl attribute, not a
+/// type attribute: 'int ** __attribute((mode(HI))) *G;' tries to make 'G' be
+/// HImode, not an intermediate pointer.
+static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  // This attribute isn't documented, but glibc uses it.  It changes
+  // the width of an int or unsigned int to the specified size.
+  if (!Attr.isArgIdent(0)) {
+S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) << Attr.getName()
+  << AANT_ArgumentIdentifier;
+return;
+  }
+
+  IdentifierInfo *Name = Attr.getArgAsIdent(0)->Ident;
+  StringRef Str = Name->getName();
+
+  normalizeName(Str);
+
+  unsigned DestWidth = 0;
+  bool IntegerMode = true;
+  bool ComplexMode = false;
+  llvm::APInt VectorSize(64, 0);
+  if (Str.size() >= 4 && Str[0] == 'V') {
+// Minimal length of vector mode is 4: 'V' + NUMBER(>=1) + TYPE(>=2).
+int VectorStringLength = 0;
+while (isdigit(Str[VectorStringLength + 1]))
+  ++VectorStringLength;
+if (VectorStringLength &&
+!Str.substr(1, VectorStringLength).getAsInteger(10, VectorSize) &&
+VectorSize.isPowerOf2()) {
+  parseModeAttr(S, Str.substr(VectorStringLength + 1), DestWidth,
+IntegerMode, ComplexMode);
+  S.Diag(Attr.getLoc(), diag::warn_vector_mode_deprecated);
+} else {
+  VectorSize = 0;
+}
+  }
+
+  if (!VectorSize)
+parseModeAttr(S, Str, DestWidth, IntegerMode, ComplexMode);
 
   QualType OldTy;
   if (TypedefNameDecl *TD = dyn_cast(D))
@@ -3351,7 +3388,10 @@
   }
 
   QualType NewTy = NewElemTy;
-  if (const VectorType *OldVT = OldTy->getAs()) {
+  if (VectorSize.getBoolValue()) {
+NewTy = S.Context.getVectorType(NewTy, VectorSize.getZExtValue(),
+VectorType::GenericVector);
+  } else if (const VectorType *OldVT = OldTy->getAs()) {
 // Complex machine mode does not support base vector types.
 if (ComplexMode) {
   S.Diag(Attr.getLoc(), diag::err_complex_mode_vector_type);
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/Diagnost

Re: [PATCH] D13383: [clang] Add flag to DeclContext to distinguish between qualified and unqualified name lookups

2015-11-18 Thread Eugene Leviant via cfe-commits
evgeny777 closed this revision.
evgeny777 added a comment.

Deinitializer class was renamed and moved under LookupQualifiedName() function 
scope


http://reviews.llvm.org/D13383



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


Re: [PATCH] D14760: Resolve build problem on NetBSD

2015-11-18 Thread Kamil Rytarowski via cfe-commits
krytarowski added a comment.

In http://reviews.llvm.org/D14760#291616, @joerg wrote:

> Are you sure your sources are up-to-date? That file is newly generated in 
> LLVM and no changes outside should be necessary. Are you using cmake or gmake?


Yes. This is also the reason to kill randomly buildbot building.

CMake + ninja: http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd7


Repository:
  rL LLVM

http://reviews.llvm.org/D14760



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


r253456 - Set flag for lldb when qualified name lookup is being done

2015-11-18 Thread Eugene Leviant via cfe-commits
Author: evgeny777
Date: Wed Nov 18 06:48:05 2015
New Revision: 253456

URL: http://llvm.org/viewvc/llvm-project?rev=253456&view=rev
Log:
Set flag for lldb when qualified name lookup is being done

Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=253456&r1=253455&r2=253456&view=diff
==
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Wed Nov 18 06:48:05 2015
@@ -1142,6 +1142,11 @@ class DeclContext {
   /// that are missing from the lookup table.
   mutable bool HasLazyExternalLexicalLookups : 1;
 
+  /// \brief If \c true, lookups should only return identifier from
+  /// DeclContext scope (for example TranslationUnit). Used in
+  /// LookupQualifiedName()
+  mutable bool UseQualifiedLookup : 1;
+
   /// \brief Pointer to the data structure used to lookup declarations
   /// within this context (or a DependentStoredDeclsMap if this is a
   /// dependent context). We maintain the invariant that, if the map
@@ -1176,6 +1181,7 @@ protected:
 ExternalVisibleStorage(false),
 NeedToReconcileExternalVisibleStorage(false),
 HasLazyLocalLexicalLookups(false), 
HasLazyExternalLexicalLookups(false),
+UseQualifiedLookup(false),
 LookupPtr(nullptr), FirstDecl(nullptr), LastDecl(nullptr) {}
 
 public:
@@ -1756,6 +1762,16 @@ public:
  D == LastDecl);
   }
 
+  bool setUseQualifiedLookup(bool use = true) {
+bool old_value = UseQualifiedLookup;
+UseQualifiedLookup = use;
+return old_value;
+  }
+
+  bool shouldUseQualifiedLookup() const {
+return UseQualifiedLookup;
+  }
+
   static bool classof(const Decl *D);
   static bool classof(const DeclContext *D) { return true; }
 

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=253456&r1=253455&r2=253456&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Nov 18 06:48:05 2015
@@ -1907,7 +1907,18 @@ bool Sema::LookupQualifiedName(LookupRes
   cast(LookupCtx)->isBeingDefined()) &&
  "Declaration context must already be complete!");
 
-  // Perform qualified name lookup into the LookupCtx.
+  struct QualifiedLookupInScope {
+bool oldVal;
+DeclContext *Context;
+// Set flag in DeclContext informing debugger that we're looking for 
qualified name
+QualifiedLookupInScope(DeclContext *ctx) : Context(ctx) { 
+  oldVal = ctx->setUseQualifiedLookup(); 
+}
+~QualifiedLookupInScope() { 
+  Context->setUseQualifiedLookup(oldVal); 
+}
+  } QL(LookupCtx);
+
   if (LookupDirect(*this, R, LookupCtx)) {
 R.resolveKind();
 if (isa(LookupCtx))


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


r253458 - Fix tests in order for them to not fail after r252604.

2015-11-18 Thread Igor Laevsky via cfe-commits
Author: igor.laevsky
Date: Wed Nov 18 08:40:41 2015
New Revision: 253458

URL: http://llvm.org/viewvc/llvm-project?rev=253458&view=rev
Log:
Fix tests in order for them to not fail after r252604.

Some expected attributes appear to be incorrect after 
optimizations are run and llvm will strip them. Use -O0
so that llvm will not have a chance to remove them. 


Modified:
cfe/trunk/test/CodeGenObjC/optimize-ivar-offset-load.m

Modified: cfe/trunk/test/CodeGenObjC/optimize-ivar-offset-load.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/optimize-ivar-offset-load.m?rev=253458&r1=253457&r2=253458&view=diff
==
--- cfe/trunk/test/CodeGenObjC/optimize-ivar-offset-load.m (original)
+++ cfe/trunk/test/CodeGenObjC/optimize-ivar-offset-load.m Wed Nov 18 08:40:41 
2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10  -Os -emit-llvm %s -o -  | 
FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10  -O0 -emit-llvm %s -o -  | 
FileCheck %s
 // rdar://16095748
 
 @interface NSObject 
@@ -31,7 +31,7 @@ extern void foo(int);
 // CHECK: [[ADDPTR:%.*]] = getelementptr inbounds i8, i8* [[THREE]], i64 
[[IVAR]]
 // CHECK: [[FOUR:%.*]] = bitcast i8* [[ADDPTR]] to i32*
 // CHECK: [[FIVE:%.*]] = load i32, i32* [[FOUR]], align 4
-// CHECK:   tail call void @foo(i32 [[FIVE]])
+// CHECK:   call void @foo(i32 [[FIVE]])
 
 @implementation SampleClass
 + (SampleClass*) new { return 0; }


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


[PATCH] D14773: [ARM] Support +feature targeting in -mcpu/-march

2015-11-18 Thread Bradley Smith via cfe-commits
bsmith created this revision.
bsmith added a reviewer: rengolin.
bsmith added a subscriber: cfe-commits.
bsmith set the repository for this revision to rL LLVM.
Herald added subscribers: rengolin, aemerson.

For AArch64 it is possible to specify various optional extensions by using 
options such as '-mcpu=cortex-a53+crc', we would like to add the same support 
to the ARM targeting to allow specifying of extensions in this manner. We use 
TargetParser to do this rather than a StringSwitch to avoid hard-coding 
extension names.

Repository:
  rL LLVM

http://reviews.llvm.org/D14773

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-features.c

Index: test/Driver/arm-features.c
===
--- /dev/null
+++ test/Driver/arm-features.c
@@ -0,0 +1,7 @@
+// RUN: %clang -target arm -mcpu=generic+crc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s
+// RUN: %clang -target arm -mcpu=generic -march=armv8a+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s
+// CHECK-CRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crc"
+
+// RUN: %clang -target arm -mcpu=generic+nocrc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s
+// RUN: %clang -target arm -mcpu=generic -march=armv8a+nocrc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s
+// CHECK-NOCRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crc"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -574,23 +574,47 @@
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
+// Decode ARM features from string like +[no]featureA+[no]featureB+...
+static bool DecodeARMFeatures(const Driver &D, StringRef text,
+  std::vector &Features) {
+  SmallVector Split;
+  text.split(Split, StringRef("+"), -1, false);
+
+  for (StringRef Feature : Split) {
+const char *FeatureName = llvm::ARM::getArchExtFeature(Feature);
+if (FeatureName)
+  Features.push_back(FeatureName);
+else
+  return false;
+  }
+  return true;
+}
+
 // Check if -march is valid by checking if it can be canonicalised and parsed.
 // getARMArch is used here instead of just checking the -march value in order
 // to handle -march=native correctly.
 static void checkARMArchName(const Driver &D, const Arg *A, const ArgList &Args,
  llvm::StringRef ArchName,
+ std::vector &Features,
  const llvm::Triple &Triple) {
+  std::pair Split = ArchName.split("+");
+
   std::string MArch = arm::getARMArch(ArchName, Triple);
-  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID)
+  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID ||
+  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
 // Check -mcpu=. Needs ArchName to handle -mcpu=generic.
 static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
 llvm::StringRef CPUName, llvm::StringRef ArchName,
+std::vector &Features,
 const llvm::Triple &Triple) {
+  std::pair Split = CPUName.split("+");
+
   std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
-  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty())
+  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty() ||
+  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
@@ -756,12 +780,12 @@
   D.Diag(clang::diag::warn_drv_unused_argument)
   << ArchArg->getAsString(Args);
 ArchName = StringRef(WaArch->getValue()).substr(7);
-checkARMArchName(D, WaArch, Args, ArchName, Triple);
+checkARMArchName(D, WaArch, Args, ArchName, Features, Triple);
 // FIXME: Set Arch.
 D.Diag(clang::diag::warn_drv_unused_argument) << WaArch->getAsString(Args);
   } else if (ArchArg) {
 ArchName = ArchArg->getValue();
-checkARMArchName(D, ArchArg, Args, ArchName, Triple);
+checkARMArchName(D, ArchArg, Args, ArchName, Features, Triple);
   }
 
   // Check -mcpu. ClangAs gives preference to -Wa,-mcpu=.
@@ -772,10 +796,10 @@
   D.Diag(clang::diag::warn_drv_unused_argument)
   << CPUArg->getAsString(Args);
 CPUName = StringRef(WaCPU->getValue()).substr(6);
-checkARMCPUName(D, WaCPU, Args, CPUName, ArchName, Triple);
+checkARMCPUName(D, WaCPU, Args, CPUName, ArchName, Features, Triple);
   } else if (CPUArg) {
 CPUName = CPUArg->getValue();
-checkARMCPUName(D, CPUArg, Args, CPUName, ArchName, Triple);
+checkARMCPUName(D, CPUArg, Args, CPUName, ArchName, Features, Triple);
   }
 
   // Add CPU features 

Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-18 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D14744#291663, @DmitryPolukhin wrote:

> Added new warning group as suggested.
>
> I see thousands of vector types in headers on GitHub 
> https://github.com/search?p=1&q=%22__attribute__+mode+v4sf%22+extension%3Ah&ref=searchresults&type=Code&utf8=%E2%9C%93
>
> liboil from freedesktop.org uses vector types in headers.


The vast majority of those headers all appear to be GCC's vector-defs.h, so I'm 
still not convinced this is actually something we need to solve. However, I 
also don't see the harm.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2828
@@ +2827,3 @@
+def warn_vector_mode_deprecated : Warning<
+  "specifying vector types with __attribute__ ((mode)) is deprecated, "
+  "use __attribute__ ((vector_size)) instead">,

Should be reworded slightly to be consistent with other attribute diagnostics:

"specifying vector types with the 'mode' attribute is deprecated; use the 
'vector_size' attribute instead"


Comment at: lib/Sema/SemaDeclAttr.cpp:3239
@@ +3238,3 @@
+/// attribute.
+static void parseModeAttr(Sema &S, StringRef Str, unsigned &DestWidth,
+  bool &IntegerMode, bool &ComplexMode) {

parseModeAttrArg() please.


Comment at: lib/Sema/SemaDeclAttr.cpp:3315
@@ +3314,3 @@
+  llvm::APInt VectorSize(64, 0);
+  if (Str.size() >= 4 && Str[0] == 'V') {
+// Minimal length of vector mode is 4: 'V' + NUMBER(>=1) + TYPE(>=2).

Can you have a vector of vectors with mode? I'm wondering why this isn't part 
of parseModeAttr(), since this is parsing part of the mode attribute.


Comment at: lib/Sema/SemaDeclAttr.cpp:3318
@@ +3317,3 @@
+int VectorStringLength = 0;
+while (isdigit(Str[VectorStringLength + 1]))
+  ++VectorStringLength;

This will cause a buffer overrun on pathological code; should also constrain 
based on the size of Str.


http://reviews.llvm.org/D14744



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


Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-18 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added inline comments.


Comment at: lib/Sema/SemaDeclAttr.cpp:3315
@@ +3314,3 @@
+  llvm::APInt VectorSize(64, 0);
+  if (Str.size() >= 4 && Str[0] == 'V') {
+// Minimal length of vector mode is 4: 'V' + NUMBER(>=1) + TYPE(>=2).

aaron.ballman wrote:
> Can you have a vector of vectors with mode? I'm wondering why this isn't part 
> of parseModeAttr(), since this is parsing part of the mode attribute.
No, it is not possible and more over it is not allowed to combine vector_size 
and vector mode (GCC does the same). Checks below prevent non-primitive types 
as vector elements.


Comment at: lib/Sema/SemaDeclAttr.cpp:3318
@@ +3317,3 @@
+int VectorStringLength = 0;
+while (isdigit(Str[VectorStringLength + 1]))
+  ++VectorStringLength;

aaron.ballman wrote:
> This will cause a buffer overrun on pathological code; should also constrain 
> based on the size of Str.
Thank you for catching this!


http://reviews.llvm.org/D14744



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


Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-18 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin updated this revision to Diff 40506.
DmitryPolukhin marked 3 inline comments as done.

http://reviews.llvm.org/D14744

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDeclAttr.cpp
  test/Sema/attr-mode-vector-types.c

Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -3234,38 +3234,31 @@
   return true;
 }
 
-/// handleModeAttr - This attribute modifies the width of a decl with primitive
-/// type.
-///
-/// Despite what would be logical, the mode attribute is a decl attribute, not a
-/// type attribute: 'int ** __attribute((mode(HI))) *G;' tries to make 'G' be
-/// HImode, not an intermediate pointer.
-static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
-  // This attribute isn't documented, but glibc uses it.  It changes
-  // the width of an int or unsigned int to the specified size.
-  if (!Attr.isArgIdent(0)) {
-S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) << Attr.getName()
-  << AANT_ArgumentIdentifier;
-return;
-  }
-  
-  IdentifierInfo *Name = Attr.getArgAsIdent(0)->Ident;
-  StringRef Str = Name->getName();
-
-  normalizeName(Str);
-
-  unsigned DestWidth = 0;
-  bool IntegerMode = true;
-  bool ComplexMode = false;
+/// parseModeAttrArg - Parses attribute mode string and returns parsed type
+/// attribute.
+static void parseModeAttrArg(Sema &S, StringRef Str, unsigned &DestWidth,
+ bool &IntegerMode, bool &ComplexMode) {
   switch (Str.size()) {
   case 2:
 switch (Str[0]) {
-case 'Q': DestWidth = 8; break;
-case 'H': DestWidth = 16; break;
-case 'S': DestWidth = 32; break;
-case 'D': DestWidth = 64; break;
-case 'X': DestWidth = 96; break;
-case 'T': DestWidth = 128; break;
+case 'Q':
+  DestWidth = 8;
+  break;
+case 'H':
+  DestWidth = 16;
+  break;
+case 'S':
+  DestWidth = 32;
+  break;
+case 'D':
+  DestWidth = 64;
+  break;
+case 'X':
+  DestWidth = 96;
+  break;
+case 'T':
+  DestWidth = 128;
+  break;
 }
 if (Str[1] == 'F') {
   IntegerMode = false;
@@ -3293,6 +3286,52 @@
   DestWidth = S.Context.getTargetInfo().getUnwindWordWidth();
 break;
   }
+}
+
+/// handleModeAttr - This attribute modifies the width of a decl with primitive
+/// type.
+///
+/// Despite what would be logical, the mode attribute is a decl attribute, not a
+/// type attribute: 'int ** __attribute((mode(HI))) *G;' tries to make 'G' be
+/// HImode, not an intermediate pointer.
+static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  // This attribute isn't documented, but glibc uses it.  It changes
+  // the width of an int or unsigned int to the specified size.
+  if (!Attr.isArgIdent(0)) {
+S.Diag(Attr.getLoc(), diag::err_attribute_argument_type) << Attr.getName()
+  << AANT_ArgumentIdentifier;
+return;
+  }
+
+  IdentifierInfo *Name = Attr.getArgAsIdent(0)->Ident;
+  StringRef Str = Name->getName();
+
+  normalizeName(Str);
+
+  unsigned DestWidth = 0;
+  bool IntegerMode = true;
+  bool ComplexMode = false;
+  llvm::APInt VectorSize(64, 0);
+  if (Str.size() >= 4 && Str[0] == 'V') {
+// Minimal length of vector mode is 4: 'V' + NUMBER(>=1) + TYPE(>=2).
+size_t StrSize = Str.size();
+int VectorStringLength = 0;
+while ((VectorStringLength + 1) < StrSize &&
+   isdigit(Str[VectorStringLength + 1]))
+  ++VectorStringLength;
+if (VectorStringLength &&
+!Str.substr(1, VectorStringLength).getAsInteger(10, VectorSize) &&
+VectorSize.isPowerOf2()) {
+  parseModeAttrArg(S, Str.substr(VectorStringLength + 1), DestWidth,
+   IntegerMode, ComplexMode);
+  S.Diag(Attr.getLoc(), diag::warn_vector_mode_deprecated);
+} else {
+  VectorSize = 0;
+}
+  }
+
+  if (!VectorSize)
+parseModeAttrArg(S, Str, DestWidth, IntegerMode, ComplexMode);
 
   QualType OldTy;
   if (TypedefNameDecl *TD = dyn_cast(D))
@@ -3351,7 +3390,10 @@
   }
 
   QualType NewTy = NewElemTy;
-  if (const VectorType *OldVT = OldTy->getAs()) {
+  if (VectorSize.getBoolValue()) {
+NewTy = S.Context.getVectorType(NewTy, VectorSize.getZExtValue(),
+VectorType::GenericVector);
+  } else if (const VectorType *OldVT = OldTy->getAs()) {
 // Complex machine mode does not support base vector types.
 if (ComplexMode) {
   S.Diag(Attr.getLoc(), diag::err_complex_mode_vector_type);
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -2824,6 +2824,10 @@
   "mode attribute only supported for integer and floating-point types">;
 def err_mode_wrong_type : Error<
   "type

Re: [PATCH] D14744: PR10235: support for vector mode attributes + warning

2015-11-18 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Thanks, this LGTM!

~Aaron


http://reviews.llvm.org/D14744



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


Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-11-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 40505.
danielmarjamaki added a comment.

I have problems with the "default" handling of expressions.

I want to warn about loss of precision for such code:

  unsigned int x = 256;
  unsigned char c;
  c = x;

The analyser tells me that the RHS value is 0 instead of 256 in the assignment 
"c = x". Here is the dump of the ProgramState:

Store (direct and default bindings), 0x0 :

Expressions:
 (0x7b9bd30,0x7b458d8) c : &c
 (0x7b9bd30,0x7b45940) x : 0 U8b
Ranges are empty.

This patch is a quick proof-of-concept where I track variable values myself 
using ProgramState. It gives me better results when I scan projects.

I wonder if you think I should continue working on this proof-of-concept 
method. Or if you have some tip how I can see the untruncated rhs value in a 
assignment.


http://reviews.llvm.org/D13126

Files:
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
  test/Analysis/conversion.c

Index: test/Analysis/conversion.c
===
--- test/Analysis/conversion.c
+++ test/Analysis/conversion.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core.Conversion -verify %s
+
+void warn1() {
+  unsigned short s;
+  unsigned int largeValue = 1 << 16;
+  s = largeValue; // expected-warning{{Loss of precision when value is 65536}}
+}
+
+void warn2(int x) {
+  unsigned short s;
+  unsigned int largeValue = 1;
+  if (x)
+largeValue = 1 << 16;
+  s = largeValue; // expected-warning{{Loss of precision when value is 65536}}
+}
+
+void dontwarn1() {
+  unsigned short s;
+  unsigned int largeValue = 1 << 16;
+  s = (unsigned short)largeValue;
+}
Index: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
@@ -0,0 +1,170 @@
+//=== ConversionChecker.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This defines ConversionChecker that warns about dangerous conversions where
+// there is possible loss of sign or loss of precision.
+//
+//===--===//
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/StaticAnalyzer/Core/CheckerManager.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+
+using namespace clang;
+using namespace ento;
+
+namespace {
+class ConversionChecker : public Checker,
+ check::PreStmt,
+ check::PreStmt> {
+  mutable std::unique_ptr BT;
+
+public:
+  void checkPreStmt(const BinaryOperator *B, CheckerContext &C) const {
+if (B->isAssignmentOp()) {
+  //diagnoseLossOfSign(B, C);
+  diagnoseLossOfPrecision(B, C);
+  assign(B, C);
+}
+else if (B->isRelationalOp() || B->isMultiplicativeOp()) {
+  //diagnoseLossOfSign(B, C);
+}
+  }
+
+  void checkPreStmt(const UnaryOperator *U, CheckerContext &C) const {
+UnaryOperator::Opcode Opc = U->getOpcode();
+if (Opc == UO_AddrOf || Opc == UO_PreInc || Opc == UO_PreDec || Opc == UO_PostInc || Opc == UO_PostDec)
+  removeDecl(U->getSubExpr(), C);
+  }
+
+  void checkPreStmt(const DeclStmt *D, CheckerContext &C) const {
+const VarDecl *VD = dyn_cast(D->getSingleDecl());
+if (!VD)
+  return;
+const Expr *Init = VD->getInit();
+if (!Init)
+  return;
+SVal Val = C.getSVal(Init);
+if (Val.isUnknown())
+  return;
+setDeclVal(VD, Val, C);
+  }
+
+
+private:
+  void assign(const BinaryOperator *B, CheckerContext &C) const;
+  void removeDecl(const Expr *E, CheckerContext &C) const;
+  void setDeclVal(const Expr *E, SVal Val, CheckerContext &C) const;
+  void setDeclVal(const ValueDecl *VD, SVal Val, CheckerContext &C) const;
+
+  void diagnoseLossOfPrecision(const BinaryOperator *B, CheckerContext &C) const;
+
+  void reportBug(CheckerContext &C, const char Msg[], SVal Val) const {
+// Generate an error node.
+ExplodedNode *N = C.generateErrorNode(C.getState());
+if (!N)
+  return;
+
+if (!BT)
+  BT.reset(new BuiltinBug(this, "Conversion", "Loss of sign/precision."));
+
+std::string Value;
+Optional V = Val.getAs();
+if (V)
+  Value = " when value is " + V->getValue().toString(10);
+
+// Generate a report for this bug.
+auto R = llvm::make_unique(*BT, Msg + Value, N);
+C.emitReport(std::move(R));
+  }
+};
+}
+

Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-11-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked an inline comment as done.
danielmarjamaki added a comment.

Does anybody else think that this should be moved to clang-tidy?

I believe that the noise level is very low when I scan various open source 
projects. My script tries to run clang on all projects in the debian archive. I 
have shown triaged results before, but if you are not convinced I can upload 
the complete results so you can look at that. For comparison, I get more noise 
from existing compiler warnings.



Comment at: include/clang/AST/Decl.h:791
@@ +790,3 @@
+
+/// \brief Whether this variable has non-const use so it can't be const.
+unsigned NonConstUse:1;

hmm.. I'll change "variable" to "parameter" in the next diff.


Comment at: include/clang/AST/Decl.h:857
@@ -853,3 +856,3 @@
 public:
   typedef redeclarable_base::redecl_range redecl_range;
   typedef redeclarable_base::redecl_iterator redecl_iterator;

Thanks! I have moved NonConstUse to ParmVarDeclBits.


http://reviews.llvm.org/D12359



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


Re: [PATCH] D14773: [ARM] Support +feature targeting in -mcpu/-march

2015-11-18 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

This looks good to me. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D14773



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


Re: [PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-18 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D14695



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


[PATCH] Allow modules specified by -fmodule-map-file to shadow implicitly found ones

2015-11-18 Thread Ben Langmuir via cfe-commits
Hi Richard,

This is an updated patch for allowing -fmodule-map-file to shadow implicitly 
found modules.  I’ve tried to simplify things by just using the explicitness of 
the module rather than the original more-general approach.  I’ll make a 
separate patch for -fmodule-file, which is turning out to be more tricky 
because we already *silently* shadow any module with the same name when using 
-fmodule-file.

Ben



fmodule-map-file-shadow-1.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-11-18 Thread David Blaikie via cfe-commits
On Wed, Nov 18, 2015 at 7:41 AM, Daniel Marjamäki <
cfe-commits@lists.llvm.org> wrote:

> danielmarjamaki marked an inline comment as done.
> danielmarjamaki added a comment.
>
> Does anybody else think that this should be moved to clang-tidy?
>

Yep


>
> I believe that the noise level is very low when I scan various open source
> projects.


depends how you define noise, though - and the Clang project has
historically (& Richard's comments indicate that philosophy is ongoing)
treated anything that didn't indicate a bug or bug-like issue (where bug is
"this program behaves differently from the way the programmer intended it
to") as noise, so every instance of this diagnostic is noise by that
definition, I believe (the suggested changes, by design, never change the
behavior of the program)


> My script tries to run clang on all projects in the debian archive. I have
> shown triaged results before, but if you are not convinced I can upload the
> complete results so you can look at that. For comparison, I get more noise
> from existing compiler warnings.
>
>
> 
> Comment at: include/clang/AST/Decl.h:791
> @@ +790,3 @@
> +
> +/// \brief Whether this variable has non-const use so it can't be
> const.
> +unsigned NonConstUse:1;
> 
> hmm.. I'll change "variable" to "parameter" in the next diff.
>
> 
> Comment at: include/clang/AST/Decl.h:857
> @@ -853,3 +856,3 @@
>  public:
>typedef redeclarable_base::redecl_range redecl_range;
>typedef redeclarable_base::redecl_iterator redecl_iterator;
> 
> Thanks! I have moved NonConstUse to ParmVarDeclBits.
>
>
> http://reviews.llvm.org/D12359
>
>
>
> ___
> 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


r253466 - [libclang] Add entry points that take a full command line including argv[0].

2015-11-18 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed Nov 18 10:14:27 2015
New Revision: 253466

URL: http://llvm.org/viewvc/llvm-project?rev=253466&view=rev
Log:
[libclang] Add entry points that take a full command line including argv[0].

This provides both a more uniform interface and makes libclang behave like
clang tooling wrt relative paths against argv[0]. This is necessary for
finding paths to a c++ standard library relative to a clang binary given
in a compilation database. It can also be used to find paths relative to
libclang.so if the full path to it is passed in.

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

Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/tools/libclang/libclang.exports
cfe/trunk/unittests/libclang/LibclangTest.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253466&r1=253465&r2=253466&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed Nov 18 10:14:27 2015
@@ -1289,6 +1289,17 @@ clang_parseTranslationUnit2(CXIndex CIdx
 CXTranslationUnit *out_TU);
 
 /**
+ * \brief Same as clang_parseTranslationUnit2 but requires a full command line
+ * for \c command_line_args including argv[0]. This is useful if the standard
+ * library paths are relative to the binary.
+ */
+CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv(
+CXIndex CIdx, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+unsigned options, CXTranslationUnit *out_TU);
+
+/**
  * \brief Flags that control how translation units are saved.
  *
  * The enumerators in this enumeration type are meant to be bitwise
@@ -5681,6 +5692,18 @@ CINDEX_LINKAGE int clang_indexSourceFile
  unsigned TU_options);
 
 /**
+ * \brief Same as clang_indexSourceFile but requires a full command line
+ * for \c command_line_args including argv[0]. This is useful if the standard
+ * library paths are relative to the binary.
+ */
+CINDEX_LINKAGE int clang_indexSourceFileFullArgv(
+CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks,
+unsigned index_callbacks_size, unsigned index_options,
+const char *source_filename, const char *const *command_line_args,
+int num_command_line_args, struct CXUnsavedFile *unsaved_files,
+unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned 
TU_options);
+
+/**
  * \brief Index the given translation unit via callbacks implemented through
  * #IndexerCallbacks.
  * 

Modified: cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp?rev=253466&r1=253465&r2=253466&view=diff
==
--- cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp (original)
+++ cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp Wed Nov 18 
10:14:27 2015
@@ -39,15 +39,13 @@ clang::createInvocationFromCommandLine(A
 Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions);
   }
 
-  SmallVector Args;
-  Args.push_back(""); // FIXME: Remove dummy argument.
-  Args.insert(Args.end(), ArgList.begin(), ArgList.end());
+  SmallVector Args(ArgList.begin(), ArgList.end());
 
   // FIXME: Find a cleaner way to force the driver into restricted modes.
   Args.push_back("-fsyntax-only");
 
   // FIXME: We shouldn't have to pass in the path info.
-  driver::Driver TheDriver("clang", llvm::sys::getDefaultTargetTriple(),
+  driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(),
*Diags);
 
   // Don't check that inputs exist, they may have been remapped.

Modified: cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp?rev=253466&r1=253465&r2=253466&view=diff
==
--- cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp (original)
+++ cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp Wed Nov 18 10:14:27 2015
@@ -64,9 +64,11 @@ createDiagnostics(unsigned int argc, cha
 new DiagnosticsEngine(DiagIDs, new DiagnosticOptions(), DiagsBuffer));
 
   // Try to build a CompilerInvocation.
+  SmallVector Args;
+  Args.push_back("diagtool");
+  Args.append(argv, argv + argc);
   std::unique_ptr Invocation(
-  createInvocationFromCommandLine(llvm::makeArrayRef(argv, argc),
-  InterimDi

Re: [PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253466: [libclang] Add entry points that take a full command 
line including argv[0]. (authored by d0k).

Changed prior to commit:
  http://reviews.llvm.org/D14695?vs=40269&id=40513#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14695

Files:
  cfe/trunk/include/clang-c/Index.h
  cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
  cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
  cfe/trunk/tools/libclang/CIndex.cpp
  cfe/trunk/tools/libclang/Indexing.cpp
  cfe/trunk/tools/libclang/libclang.exports
  cfe/trunk/unittests/libclang/LibclangTest.cpp

Index: cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
===
--- cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -39,15 +39,13 @@
 Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions);
   }
 
-  SmallVector Args;
-  Args.push_back(""); // FIXME: Remove dummy argument.
-  Args.insert(Args.end(), ArgList.begin(), ArgList.end());
+  SmallVector Args(ArgList.begin(), ArgList.end());
 
   // FIXME: Find a cleaner way to force the driver into restricted modes.
   Args.push_back("-fsyntax-only");
 
   // FIXME: We shouldn't have to pass in the path info.
-  driver::Driver TheDriver("clang", llvm::sys::getDefaultTargetTriple(),
+  driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(),
*Diags);
 
   // Don't check that inputs exist, they may have been remapped.
Index: cfe/trunk/unittests/libclang/LibclangTest.cpp
===
--- cfe/trunk/unittests/libclang/LibclangTest.cpp
+++ cfe/trunk/unittests/libclang/LibclangTest.cpp
@@ -379,8 +379,10 @@
   Filename = Path.str();
   Files.insert(Filename);
 }
+llvm::sys::fs::create_directories(llvm::sys::path::parent_path(Filename));
 std::ofstream OS(Filename);
 OS << Contents;
+assert(OS.good());
   }
   void DisplayDiagnostics() {
 unsigned NumDiagnostics = clang_getNumDiagnostics(ClangTU);
@@ -465,3 +467,27 @@
   ASSERT_TRUE(ReparseTU(0, nullptr /* No unsaved files. */));
   EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
 }
+
+TEST_F(LibclangReparseTest, clang_parseTranslationUnit2FullArgv) {
+  std::string EmptyFiles[] = {"lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o",
+  "include/arm-linux-gnueabi/.keep",
+  "include/c++/4.6.1/vector"};
+
+  for (auto &Name : EmptyFiles)
+WriteFile(Name, "\n");
+
+  std::string Filename = "test.cc";
+  WriteFile(Filename, "#include \n");
+
+  std::string Clang = "bin/clang";
+  WriteFile(Clang, "");
+
+  const char *Argv[] = {Clang.c_str(), "-target", "arm-linux-gnueabi"};
+
+  EXPECT_EQ(CXError_Success,
+clang_parseTranslationUnit2FullArgv(Index, Filename.c_str(), Argv,
+sizeof(Argv) / sizeof(Argv[0]),
+nullptr, 0, TUFlags, &ClangTU));
+  EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
+  DisplayDiagnostics();
+}
Index: cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
===
--- cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
+++ cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
@@ -64,9 +64,11 @@
 new DiagnosticsEngine(DiagIDs, new DiagnosticOptions(), DiagsBuffer));
 
   // Try to build a CompilerInvocation.
+  SmallVector Args;
+  Args.push_back("diagtool");
+  Args.append(argv, argv + argc);
   std::unique_ptr Invocation(
-  createInvocationFromCommandLine(llvm::makeArrayRef(argv, argc),
-  InterimDiags));
+  createInvocationFromCommandLine(Args, InterimDiags));
   if (!Invocation)
 return nullptr;
 
Index: cfe/trunk/tools/libclang/Indexing.cpp
===
--- cfe/trunk/tools/libclang/Indexing.cpp
+++ cfe/trunk/tools/libclang/Indexing.cpp
@@ -907,6 +907,22 @@
   unsigned num_unsaved_files,
   CXTranslationUnit *out_TU,
   unsigned TU_options) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_indexSourceFileFullArgv(
+  idxAction, client_data, index_callbacks, index_callbacks_size,
+  index_options, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, out_TU, TU_options);
+}
+
+int clang_indexSourceFileFullArgv(
+CXIndexAction idxAction, CXClientData client_data,
+IndexerCallbacks *index_callbacks, unsigned index_callbacks_size,
+unsigned index_options, const char *source_filename,
+const char *const *command_line_args, int num_command_line_

Re: [cfe-commits] r119285 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c

2015-11-18 Thread Manuel Klimek via cfe-commits
(now with the right list)

On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor  wrote:

> Author: dgregor
> Date: Mon Nov 15 17:00:34 2010
> New Revision: 119285
>
> URL: http://llvm.org/viewvc/llvm-project?rev=119285&view=rev
> Log:
> Tweak libclang's heuristics for building precompiled preambles and
> caching global code-completion results. In particular, don't perform
> either operation the first time we parse, but do both after the first
> reparse.
>

Do you remember the reason behind not building the preamble on the first
parse? For really large TUs having to parse 2 times before we get a
preamble is rather painful.

Cheers,
/Manuel


> Modified:
> cfe/trunk/lib/Frontend/ASTUnit.cpp
> cfe/trunk/tools/c-index-test/c-index-test.c
>
> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff
>
> ==
> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010
> @@ -326,7 +326,6 @@
>
>// Make a note of the state when we performed this caching.
>NumTopLevelDeclsAtLastCompletionCache = top_level_size();
> -  CacheCodeCompletionCoolDown = 15;
>  }
>
>  void ASTUnit::ClearCachedCompletionResults() {
> @@ -824,12 +823,6 @@
>}
>
>Invocation.reset(Clang.takeInvocation());
> -
> -  // If we were asked to cache code-completion results and don't have any
> -  // results yet, do so now.
> -  if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())
> -CacheCodeCompletionResults();
> -
>return false;
>
>  error:
> @@ -1350,7 +1343,7 @@
>
>llvm::MemoryBuffer *OverrideMainBuffer = 0;
>if (PrecompilePreamble) {
> -PreambleRebuildCounter = 1;
> +PreambleRebuildCounter = 2;
>  OverrideMainBuffer
>= getMainBufferWithPrecompiledPreamble(*Invocation);
>}
> @@ -1377,6 +1370,7 @@
>AST->CaptureDiagnostics = CaptureDiagnostics;
>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
> +  AST->CacheCodeCompletionCoolDown = 1;
>AST->Invocation.reset(CI);
>
>return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 :
> AST.take();
> @@ -1481,6 +1475,7 @@
>AST->CaptureDiagnostics = CaptureDiagnostics;
>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
> +  AST->CacheCodeCompletionCoolDown = 1;
>AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
>AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
>AST->StoredDiagnostics.swap(StoredDiagnostics);
>
> 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=119285&r1=119284&r2=119285&view=diff
>
> ==
> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
> +++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010
> @@ -1040,6 +1040,11 @@
>  fprintf(stderr, "Unable to load translation unit!\n");
>  return 1;
>}
> +
> +  if (clang_reparseTranslationUnit(TU, 0, 0,
> clang_defaultReparseOptions(TU))) {
> +fprintf(stderr, "Unable to reparse translation init!\n");
> +return 1;
> +  }
>
>for (I = 0; I != Repeats; ++I) {
>  results = clang_codeCompleteAt(TU, filename, line, column,
>
>
> ___
> cfe-commits mailing list
> cfe-comm...@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14773: [ARM] Support +feature targeting in -mcpu/-march

2015-11-18 Thread Bradley Smith via cfe-commits
bsmith updated this revision to Diff 40515.
bsmith added a comment.

Add +crypto to testing.


Repository:
  rL LLVM

http://reviews.llvm.org/D14773

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-features.c

Index: test/Driver/arm-features.c
===
--- /dev/null
+++ test/Driver/arm-features.c
@@ -0,0 +1,13 @@
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+crc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s
+// CHECK-CRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crc"
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+crypto -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO %s
+// CHECK-CRYPTO: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crypto"
+
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+nocrc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+nocrc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s
+// CHECK-NOCRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crc"
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic+nocrypto -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO %s
+// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO %s
+// CHECK-NOCRYPTO: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crypto"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -589,23 +589,47 @@
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
+// Decode ARM features from string like +[no]featureA+[no]featureB+...
+static bool DecodeARMFeatures(const Driver &D, StringRef text,
+  std::vector &Features) {
+  SmallVector Split;
+  text.split(Split, StringRef("+"), -1, false);
+
+  for (StringRef Feature : Split) {
+const char *FeatureName = llvm::ARM::getArchExtFeature(Feature);
+if (FeatureName)
+  Features.push_back(FeatureName);
+else
+  return false;
+  }
+  return true;
+}
+
 // Check if -march is valid by checking if it can be canonicalised and parsed.
 // getARMArch is used here instead of just checking the -march value in order
 // to handle -march=native correctly.
 static void checkARMArchName(const Driver &D, const Arg *A, const ArgList &Args,
  llvm::StringRef ArchName,
+ std::vector &Features,
  const llvm::Triple &Triple) {
+  std::pair Split = ArchName.split("+");
+
   std::string MArch = arm::getARMArch(ArchName, Triple);
-  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID)
+  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID ||
+  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
 // Check -mcpu=. Needs ArchName to handle -mcpu=generic.
 static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
 llvm::StringRef CPUName, llvm::StringRef ArchName,
+std::vector &Features,
 const llvm::Triple &Triple) {
+  std::pair Split = CPUName.split("+");
+
   std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
-  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty())
+  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty() ||
+  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
@@ -771,12 +795,12 @@
   D.Diag(clang::diag::warn_drv_unused_argument)
   << ArchArg->getAsString(Args);
 ArchName = StringRef(WaArch->getValue()).substr(7);
-checkARMArchName(D, WaArch, Args, ArchName, Triple);
+checkARMArchName(D, WaArch, Args, ArchName, Features, Triple);
 // FIXME: Set Arch.
 D.Diag(clang::diag::warn_drv_unused_argument) << WaArch->getAsString(Args);
   } else if (ArchArg) {
 ArchName = ArchArg->getValue();
-checkARMArchName(D, ArchArg, Args, ArchName, Triple);
+checkARMArchName(D, ArchArg, Args, ArchName, Features, Triple);
   }
 
   // Check -mcpu. ClangAs gives preference to -Wa,-mcpu=.
@@ -787,10 +811,10 @@
   D.Diag(clang::diag::warn_drv_unused_argument)
   << CPUArg->getAsString(Args);
 CPUName = StringRe

r253467 - [Myriad]: insert -L paths into linker cmd only when they exist.

2015-11-18 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Wed Nov 18 10:24:46 2015
New Revision: 253467

URL: http://llvm.org/viewvc/llvm-project?rev=253467&view=rev
Log:
[Myriad]: insert -L paths into linker cmd only when they exist.

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

Added:

cfe/trunk/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtend.o

cfe/trunk/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crti.o

cfe/trunk/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtn.o
cfe/trunk/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/lib/
cfe/trunk/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/lib/crt0.o
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=253467&r1=253466&r2=253467&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Nov 18 10:24:46 2015
@@ -4367,6 +4367,26 @@ MyriadToolChain::MyriadToolChain(const D
   case llvm::Triple::shave:
 GCCInstallation.init(Triple, Args, {"sparc-myriad-elf"});
   }
+
+  if (GCCInstallation.isValid()) {
+// The contents of LibDir are independent of the version of gcc.
+// This contains libc, libg (a superset of libc), libm, libstdc++, libssp.
+SmallString<128> LibDir(GCCInstallation.getParentLibPath());
+if (Triple.getArch() == llvm::Triple::sparcel)
+  llvm::sys::path::append(LibDir, "../sparc-myriad-elf/lib/le");
+else
+  llvm::sys::path::append(LibDir, "../sparc-myriad-elf/lib");
+addPathIfExists(D, LibDir, getFilePaths());
+
+// This directory contains crt{i,n,begin,end}.o as well as libgcc.
+// These files are tied to a particular version of gcc.
+SmallString<128> CompilerSupportDir(GCCInstallation.getInstallPath());
+// There are actually 4 choices: {le,be} x {fpu,nofpu}
+// but as this toolchain is for LEON sparc, it can assume FPU.
+if (Triple.getArch() == llvm::Triple::sparcel)
+  llvm::sys::path::append(CompilerSupportDir, "le");
+addPathIfExists(D, CompilerSupportDir, getFilePaths());
+  }
 }
 
 MyriadToolChain::~MyriadToolChain() {}
@@ -4413,27 +4433,6 @@ Tool *MyriadToolChain::SelectTool(const
   }
 }
 
-void MyriadToolChain::getCompilerSupportDir(std::string &Dir) const {
-  // This directory contains crt{i,n,begin,end}.o as well as libgcc.
-  // These files are tied to a particular version of gcc.
-  SmallString<128> Result(GCCInstallation.getInstallPath());
-  // There are actually 4 choices: {le,be} x {fpu,nofpu}
-  // but as this toolchain is for LEON sparc, it can assume FPU.
-  if (this->getTriple().getArch() == llvm::Triple::sparcel)
-llvm::sys::path::append(Result, "le");
-  Dir.assign(Result.str());
-}
-void MyriadToolChain::getBuiltinLibDir(std::string &Dir) const {
-  // The contents of LibDir are independent of the version of gcc.
-  // This contains libc, libg (a superset of libc), libm, libstdc++, libssp.
-  SmallString<128> Result(GCCInstallation.getParentLibPath());
-  if (this->getTriple().getArch() == llvm::Triple::sparcel)
-llvm::sys::path::append(Result, "../sparc-myriad-elf/lib/le");
-  else
-llvm::sys::path::append(Result, "../sparc-myriad-elf/lib");
-  Dir.assign(Result.str());
-}
-
 Tool *MyriadToolChain::buildLinker() const {
   return new tools::Myriad::Linker(*this);
 }

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=253467&r1=253466&r2=253467&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Wed Nov 18 10:24:46 2015
@@ -1068,8 +1068,6 @@ public:
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
   Tool *SelectTool(const JobAction &JA) const override;
-  void getCompilerSupportDir(std::string &Dir) const;
-  void getBuiltinLibDir(std::string &Dir) const;
   unsigned GetDefaultDwarfVersion() const override { return 2; }
 
 protected:

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253467&r1=253466&r2=253467&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov 18 10:24:46 2015
@@ -9945,10 +9945,6 @@ void tools::Myriad::Linker::ConstructJob
   bool UseDefaultLibs =
   !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs);
 
-  std::string StartFilesDir, BuiltinLibDir;
-  TC.getCompilerSupportDir(StartFilesDir);
-  TC.getBuiltinLibDir(BuiltinLibDir);
-
   if (T.getArch() == llvm::Triple::sparc)
  

Re: [PATCH] D14754: [Myriad]: insert -L paths into linker cmd only when they exist.

2015-11-18 Thread Douglas Katzman via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253467: [Myriad]: insert -L paths into linker cmd only when 
they exist. (authored by dougk).

Changed prior to commit:
  http://reviews.llvm.org/D14754?vs=40442&id=40516#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14754

Files:
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/lib/Driver/Tools.cpp
  
cfe/trunk/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtend.o
  
cfe/trunk/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crti.o
  
cfe/trunk/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtn.o
  cfe/trunk/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/lib/crt0.o

Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -1068,8 +1068,6 @@
   const llvm::opt::ArgList &DriverArgs,
   llvm::opt::ArgStringList &CC1Args) const override;
   Tool *SelectTool(const JobAction &JA) const override;
-  void getCompilerSupportDir(std::string &Dir) const;
-  void getBuiltinLibDir(std::string &Dir) const;
   unsigned GetDefaultDwarfVersion() const override { return 2; }
 
 protected:
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -4367,6 +4367,26 @@
   case llvm::Triple::shave:
 GCCInstallation.init(Triple, Args, {"sparc-myriad-elf"});
   }
+
+  if (GCCInstallation.isValid()) {
+// The contents of LibDir are independent of the version of gcc.
+// This contains libc, libg (a superset of libc), libm, libstdc++, libssp.
+SmallString<128> LibDir(GCCInstallation.getParentLibPath());
+if (Triple.getArch() == llvm::Triple::sparcel)
+  llvm::sys::path::append(LibDir, "../sparc-myriad-elf/lib/le");
+else
+  llvm::sys::path::append(LibDir, "../sparc-myriad-elf/lib");
+addPathIfExists(D, LibDir, getFilePaths());
+
+// This directory contains crt{i,n,begin,end}.o as well as libgcc.
+// These files are tied to a particular version of gcc.
+SmallString<128> CompilerSupportDir(GCCInstallation.getInstallPath());
+// There are actually 4 choices: {le,be} x {fpu,nofpu}
+// but as this toolchain is for LEON sparc, it can assume FPU.
+if (Triple.getArch() == llvm::Triple::sparcel)
+  llvm::sys::path::append(CompilerSupportDir, "le");
+addPathIfExists(D, CompilerSupportDir, getFilePaths());
+  }
 }
 
 MyriadToolChain::~MyriadToolChain() {}
@@ -4413,27 +4433,6 @@
   }
 }
 
-void MyriadToolChain::getCompilerSupportDir(std::string &Dir) const {
-  // This directory contains crt{i,n,begin,end}.o as well as libgcc.
-  // These files are tied to a particular version of gcc.
-  SmallString<128> Result(GCCInstallation.getInstallPath());
-  // There are actually 4 choices: {le,be} x {fpu,nofpu}
-  // but as this toolchain is for LEON sparc, it can assume FPU.
-  if (this->getTriple().getArch() == llvm::Triple::sparcel)
-llvm::sys::path::append(Result, "le");
-  Dir.assign(Result.str());
-}
-void MyriadToolChain::getBuiltinLibDir(std::string &Dir) const {
-  // The contents of LibDir are independent of the version of gcc.
-  // This contains libc, libg (a superset of libc), libm, libstdc++, libssp.
-  SmallString<128> Result(GCCInstallation.getParentLibPath());
-  if (this->getTriple().getArch() == llvm::Triple::sparcel)
-llvm::sys::path::append(Result, "../sparc-myriad-elf/lib/le");
-  else
-llvm::sys::path::append(Result, "../sparc-myriad-elf/lib");
-  Dir.assign(Result.str());
-}
-
 Tool *MyriadToolChain::buildLinker() const {
   return new tools::Myriad::Linker(*this);
 }
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -9945,10 +9945,6 @@
   bool UseDefaultLibs =
   !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs);
 
-  std::string StartFilesDir, BuiltinLibDir;
-  TC.getCompilerSupportDir(StartFilesDir);
-  TC.getBuiltinLibDir(BuiltinLibDir);
-
   if (T.getArch() == llvm::Triple::sparc)
 CmdArgs.push_back("-EB");
   else // SHAVE assumes little-endian, and sparcel is expressly so.
@@ -9972,19 +9968,15 @@
   if (UseStartfiles) {
 // If you want startfiles, it means you want the builtin crti and crtbegin,
 // but not crt0. Myriad link commands provide their own crt0.o as needed.
-CmdArgs.push_back(Args.MakeArgString(StartFilesDir + "/crti.o"));
-CmdArgs.push_back(Args.MakeArgString(StartFilesDir + "/crtbegin.o"));
+CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crti.o")));
+CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtbegin.o")));
   }
 
   Args.AddAllArgs(CmdArgs, {options::OPT_L, options::O

Re: [PATCH] D14773: [ARM] Support +feature targeting in -mcpu/-march

2015-11-18 Thread Bradley Smith via cfe-commits
bsmith closed this revision.
bsmith added a comment.

Thanks, committed as r253471.


Repository:
  rL LLVM

http://reviews.llvm.org/D14773



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


r253471 - [ARM] Support +feature targeting in -mcpu/-march

2015-11-18 Thread Bradley Smith via cfe-commits
Author: brasmi01
Date: Wed Nov 18 10:33:48 2015
New Revision: 253471

URL: http://llvm.org/viewvc/llvm-project?rev=253471&view=rev
Log:
[ARM] Support +feature targeting in -mcpu/-march

Added:
cfe/trunk/test/Driver/arm-features.c   (with props)
Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253471&r1=253470&r2=253471&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov 18 10:33:48 2015
@@ -589,23 +589,47 @@ static void getARMFPUFeatures(const Driv
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
+// Decode ARM features from string like +[no]featureA+[no]featureB+...
+static bool DecodeARMFeatures(const Driver &D, StringRef text,
+  std::vector &Features) {
+  SmallVector Split;
+  text.split(Split, StringRef("+"), -1, false);
+
+  for (StringRef Feature : Split) {
+const char *FeatureName = llvm::ARM::getArchExtFeature(Feature);
+if (FeatureName)
+  Features.push_back(FeatureName);
+else
+  return false;
+  }
+  return true;
+}
+
 // Check if -march is valid by checking if it can be canonicalised and parsed.
 // getARMArch is used here instead of just checking the -march value in order
 // to handle -march=native correctly.
 static void checkARMArchName(const Driver &D, const Arg *A, const ArgList 
&Args,
  llvm::StringRef ArchName,
+ std::vector &Features,
  const llvm::Triple &Triple) {
+  std::pair Split = ArchName.split("+");
+
   std::string MArch = arm::getARMArch(ArchName, Triple);
-  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID)
+  if (llvm::ARM::parseArch(MArch) == llvm::ARM::AK_INVALID ||
+  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
 // Check -mcpu=. Needs ArchName to handle -mcpu=generic.
 static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
 llvm::StringRef CPUName, llvm::StringRef ArchName,
+std::vector &Features,
 const llvm::Triple &Triple) {
+  std::pair Split = CPUName.split("+");
+
   std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
-  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty())
+  if (arm::getLLVMArchSuffixForARM(CPU, ArchName, Triple).empty() ||
+  (Split.second.size() && !DecodeARMFeatures(D, Split.second, Features)))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 }
 
@@ -771,12 +795,12 @@ static void getARMTargetFeatures(const T
   D.Diag(clang::diag::warn_drv_unused_argument)
   << ArchArg->getAsString(Args);
 ArchName = StringRef(WaArch->getValue()).substr(7);
-checkARMArchName(D, WaArch, Args, ArchName, Triple);
+checkARMArchName(D, WaArch, Args, ArchName, Features, Triple);
 // FIXME: Set Arch.
 D.Diag(clang::diag::warn_drv_unused_argument) << WaArch->getAsString(Args);
   } else if (ArchArg) {
 ArchName = ArchArg->getValue();
-checkARMArchName(D, ArchArg, Args, ArchName, Triple);
+checkARMArchName(D, ArchArg, Args, ArchName, Features, Triple);
   }
 
   // Check -mcpu. ClangAs gives preference to -Wa,-mcpu=.
@@ -787,10 +811,10 @@ static void getARMTargetFeatures(const T
   D.Diag(clang::diag::warn_drv_unused_argument)
   << CPUArg->getAsString(Args);
 CPUName = StringRef(WaCPU->getValue()).substr(6);
-checkARMCPUName(D, WaCPU, Args, CPUName, ArchName, Triple);
+checkARMCPUName(D, WaCPU, Args, CPUName, ArchName, Features, Triple);
   } else if (CPUArg) {
 CPUName = CPUArg->getValue();
-checkARMCPUName(D, CPUArg, Args, CPUName, ArchName, Triple);
+checkARMCPUName(D, CPUArg, Args, CPUName, ArchName, Features, Triple);
   }
 
   // Add CPU features for generic CPUs
@@ -6274,7 +6298,7 @@ const std::string arm::getARMArch(String
 MArch = Arch;
   else
 MArch = Triple.getArchName();
-  MArch = StringRef(MArch).lower();
+  MArch = StringRef(MArch).split("+").first.lower();
 
   // Handle -march=native.
   if (MArch == "native") {
@@ -6313,7 +6337,7 @@ std::string arm::getARMTargetCPU(StringR
   // FIXME: Warn on inconsistent use of -mcpu and -march.
   // If we have -mcpu=, use that.
   if (!CPU.empty()) {
-std::string MCPU = StringRef(CPU).lower();
+std::string MCPU = StringRef(CPU).split("+").first.lower();
 // Handle -mcpu=native.
 if (MCPU == "native")
   return llvm::sys::getHostCPUName();

Added: cfe/trunk/test/Driver/arm-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-features.c?rev=253471&view=auto

[PATCH] D14779: Adding checker to detect excess padding in records

2015-11-18 Thread Ben Craig via cfe-commits
bcraig created this revision.
bcraig added reviewers: zaks.anna, jordan_rose, xazax.hun.
bcraig added a subscriber: cfe-commits.

The intent of this checker is to generate a report for any class / structure 
that could reduce its padding by reordering the fields.  This results in a very 
noisy checker.  To reduce the noise, this checker will currently only warn when 
the number of bytes over "optimal" is more than 8.  This value is configurable 
with -analyzer-config performance.Padding:AllowedPad=N.  Even with the default 
of 8, this checker is too noisy to justify turning on by default.  Clang+LLVM 
has hundreds of violations.  A large C codebase was capable of generating more 
than 600 GB of HTML reports with AllowedPad=0.

The checker searches for padding violations in two main ways.  First, it goes 
record by record.  A report is generated if the fields could be reordered in a 
way that reduces the padding by more than AllowedPad bytes.  Second, the 
checker will generate a report if an array will cause more than AllowedPad 
padding bytes to be generated.

The record checker currently skips many ABI specific cases.  Classes with base 
classes are skipped because base class tail padding is ABI specific.  Bitfields 
are just plain hard, and duplicating that code seems like a bad idea.  VLAs are 
both uncommon and non-trivial to fix.

The array checker isn't very thorough right now.  It only checks to see if the 
element type's fields could be reordered, and it doesn't recursively check to 
see if any of the fields' fields could be reordered.  At some point in the 
future, it would be nice if "arrays" could also look at array new usages and 
malloc patterns that appear to be creating arrays.


http://reviews.llvm.org/D14779

Files:
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
  test/Analysis/padding_c.c
  test/Analysis/padding_cpp.cpp

Index: test/Analysis/padding_cpp.cpp
===
--- /dev/null
+++ test/Analysis/padding_cpp.cpp
@@ -0,0 +1,202 @@
+// RUN: %clang_cc1 -std=c++14 -analyze -analyzer-checker=performance -analyzer-config performance.Padding:AllowedPad=2 -verify %s
+
+// Make sure that the C cases still work fine, even when compiled as C++.
+#include "padding_c.c"
+
+struct BigCharArray2 { // no-warning
+  char c[129];
+};
+
+// xxxexpected-warning@+1{{Excessive padding in 'struct LowAlignmentBase'}}
+struct LowAlignmentBase : public BigCharArray2 {
+  int i;
+  char c;
+};
+
+struct CorrectLowAlignmentBase : public BigCharArray2 { // no-warning
+  char c;
+  int i;
+};
+
+// xxxexpected-warning@+1{{Excessive padding in 'struct LowAlignmentBase2'}}
+struct LowAlignmentBase2 : public BigCharArray2 {
+  char c1;
+  int i;
+  char c2;
+};
+
+class PaddedA { // expected-warning{{Excessive padding in 'class PaddedA'}}
+  char c1;
+  int i;
+  char c2;
+};
+
+class VirtualPaddedA : public PaddedA { // no-warning
+  virtual void foo() {}
+};
+
+class VirtualIntSandwich { // expected-warning{{Excessive padding in 'class VirtualIntSandwich'}}
+  virtual void foo() {}
+  char c1;
+  int i;
+  char c2;
+};
+
+// constructed so as not to have tail padding
+class InnerPaddedB { // expected-warning{{Excessive padding in 'class InnerPaddedB'}}
+  char c1;
+  int i1;
+  char c2;
+  int i2;
+};
+
+class TailPaddedB { // expected-warning{{Excessive padding in 'class TailPaddedB'}}
+  char c1;
+  int i1;
+  char c2;
+};
+
+class SI : public PaddedA { // no-warning
+  char c;
+};
+
+class SI2 : public PaddedA { // xxxexpected-warning{{Excessive padding in 'class SI2'}}
+  char c10;
+  int i10;
+  char c11;
+};
+
+class VirtualSI : virtual public PaddedA { // no-warning
+  char c;
+};
+
+// currently not checked for
+class VirtualSI2 : virtual public PaddedA { // no-warning
+  char c10;
+  int i10;
+  char c11;
+};
+
+class VtblSI : public PaddedA { // no-warning
+  virtual void foo() {}
+  char c;
+};
+
+class VtblSI2 : public PaddedA { // xxxexpected-warning{{Excessive padding in 'class VtblSI2'}}
+  virtual void foo() {}
+  char c10;
+  int i10;
+  char c11;
+};
+
+class VtblSI3 : public VirtualPaddedA { // xxxexpected-warning{{Excessive padding in 'class VtblSI3'}}
+  char c10;
+  int i10;
+  char c11;
+};
+
+class MI : public PaddedA, public InnerPaddedB { // no-warning
+  char c;
+};
+
+class MI2 : public PaddedA, public InnerPaddedB { // xxxexpected-warning{{Excessive padding in 'class MI2'}}
+  char c10;
+  int i10;
+  char c11;
+};
+
+class VtblMI : public PaddedA, public InnerPaddedB { // xxxexpected-warning{{Excessive padding in 'class VtblMI'}}
+  virtual void foo() {}
+  char c10;
+  int i10;
+  char c11;
+};
+
+class VtblMI2 : public VirtualPaddedA, public InnerPaddedB { // xxxexpected-warning{{Excessive padding in 'class VtblMI2'}}
+  char c10;
+  int i10;
+  char c11;
+};
+
+class Empty {}; // no-warning
+
+class LotsOfSpace { // expected-warning{{Exces

Re: r252853 - libclang: add clang_Cursor_getCXXManglings

2015-11-18 Thread Saleem Abdulrasool via cfe-commits
On Tue, Nov 17, 2015 at 5:07 PM, Reid Kleckner  wrote:

> This introduced a memory leak, which I'm testing a patch for.
>

Oops, thanks.


> Aside from that, did you get Doug to review this? We probably want to be
> really careful about changing libclang's C API, so you should be more
> cautious here than you would be normally.
>

I had discussed this with Argyrios Kyrtzidis.  Is he not the current owner
for libclang?  Ill happily speak to Doug in the future if he is a better
contact for new API introductions for libclang.


> On Wed, Nov 11, 2015 at 7:57 PM, Saleem Abdulrasool via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: compnerd
>> Date: Wed Nov 11 21:57:22 2015
>> New Revision: 252853
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=252853&view=rev
>> Log:
>> libclang: add clang_Cursor_getCXXManglings
>>
>> This function permits the mangling of a C++ 'structor.  Depending on the
>> ABI and
>> the declaration, the declaration may contain more than one associated
>> symbol for
>> a given declaration.  This allows the consumer to retrieve all of the
>> associated
>> symbols for the declaration the cursor points to.
>>
>> Added:
>> cfe/trunk/test/Index/print-cxx-manglings.cpp
>> 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=252853&r1=252852&r2=252853&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang-c/Index.h (original)
>> +++ cfe/trunk/include/clang-c/Index.h Wed Nov 11 21:57:22 2015
>> @@ -3863,6 +3863,12 @@ CINDEX_LINKAGE CXString clang_Cursor_get
>>  CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor);
>>
>>  /**
>> + * \brief Retrieve the CXStrings representing the mangled symbols of the
>> C++
>> + * constructor or destructor at the cursor.
>> + */
>> +CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor);
>> +
>> +/**
>>   * @}
>>   */
>>
>>
>> Added: cfe/trunk/test/Index/print-cxx-manglings.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-cxx-manglings.cpp?rev=252853&view=auto
>>
>> ==
>> --- cfe/trunk/test/Index/print-cxx-manglings.cpp (added)
>> +++ cfe/trunk/test/Index/print-cxx-manglings.cpp Wed Nov 11 21:57:22 2015
>> @@ -0,0 +1,66 @@
>> +// REQUIRES: x86-registered-target
>> +
>> +// RUN: c-index-test -write-pch %t.itanium.ast -target i686-pc-linux-gnu
>> -fdeclspec %s
>> +// RUN: c-index-test -test-print-manglings %t.itanium.ast | FileCheck
>> --check-prefix=ITANIUM %s
>> +
>> +// RUN: c-index-test -write-pch %t.macho.ast -target i686-apple-darwin
>> -fdeclspec %s
>> +// RUN: c-index-test -test-print-manglings %t.macho.ast | FileCheck
>> --check-prefix=MACHO %s
>> +
>> +// RUN: c-index-test -write-pch %t.msvc.ast -target i686-pc-windows %s
>> +// RUN: c-index-test -test-print-manglings %t.msvc.ast | FileCheck
>> --check-prefix=MSVC %s
>> +
>> +struct s {
>> +  s(int);
>> +  ~s();
>> +  int m(int);
>> +};
>> +
>> +// ITANIUM: CXXConstructor=s{{.*}}[mangled=_ZN1sC2Ei] [mangled=_ZN1sC1Ei]
>> +// ITANIUM: CXXDestructor=~s{{.*}}[mangled=_ZN1sD2Ev]
>> [mangled=_ZN1sD1Ev] [mangled=_ZN1sD0Ev]
>> +
>> +// MACHO: CXXConstructor=s{{.*}}[mangled=__ZN1sC2Ei] [mangled=__ZN1sC1Ei]
>> +// MACHO: CXXDestructor=~s{{.*}}[mangled=__ZN1sD2Ev]
>> [mangled=__ZN1sD1Ev] [mangled=__ZN1sD0Ev]
>> +
>> +// MSVC: CXXConstructor=s{{.*}}[mangled=??0s@@QAE@H@Z]
>> +// MSVC: CXXDestructor=~s{{.*}}[mangled=??1s@@QAE@XZ]
>> +
>> +struct t {
>> +  t(int);
>> +  virtual ~t();
>> +  int m(int);
>> +};
>> +
>> +// ITANIUM: CXXConstructor=t{{.*}}[mangled=_ZN1tC2Ei] [mangled=_ZN1tC1Ei]
>> +// ITANIUM: CXXDestructor=~t{{.*}}[mangled=_ZN1tD2Ev] [mangled=_ZN1tD1Ev]
>> +
>> +// MACHO: CXXConstructor=t{{.*}}[mangled=__ZN1tC2Ei] [mangled=__ZN1tC1Ei]
>> +// MACHO: CXXDestructor=~t{{.*}}[mangled=__ZN1tD2Ev] [mangled=__ZN1tD1Ev]
>> +
>> +// MSVC: CXXConstructor=t{{.*}}[mangled=??0t@@QAE@H@Z]
>> +// MSVC: CXXDestructor=~t{{.*}}[mangled=??1t@@UAE@XZ]
>> +
>> +struct u {
>> +  u();
>> +  virtual ~u();
>> +  virtual int m(int) = 0;
>> +};
>> +
>> +// ITANIUM: CXXConstructor=u{{.*}}[mangled=_ZN1uC2Ev]
>> +// ITANIUM: CXXDestructor=~u{{.*}}[mangled=_ZN1uD2Ev] [mangled=_ZN1uD1Ev]
>> +
>> +// MACHO: CXXConstructor=u{{.*}}[mangled=__ZN1uC2Ev]
>> +// MACHO: CXXDestructor=~u{{.*}}[mangled=__ZN1uD2Ev] [mangled=__ZN1uD1Ev]
>> +
>> +// MSVC: CXXConstructor=u{{.*}}[mangled=??0u@@QAE@XZ]
>> +// MSVC: CXXDestructor=~u{{.*}}[mangled=??1u@@UAE@XZ]
>> +
>> +struct v {
>> +  __declspec(dllexport) v(int = 0);
>> +};
>> +
>> +// ITANIUM: CXXConstructor=v{{.*}}[mangled=_ZN1vC2Ei] [mangled=_ZN1vC1Ei]
>> +
>> +// MACHO: CXXConstructor=v{{.*}}[mangled=__ZN1vC2Ei] [m

Re: r253418 - Try to fix leak in CXStringSet from r252853

2015-11-18 Thread Saleem Abdulrasool via cfe-commits
On Tue, Nov 17, 2015 at 5:06 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Tue Nov 17 19:06:39 2015
> New Revision: 253418
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253418&view=rev
> Log:
> Try to fix leak in CXStringSet from r252853
>
> Modified:
> cfe/trunk/tools/libclang/CXString.cpp
>
> Modified: cfe/trunk/tools/libclang/CXString.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXString.cpp?rev=253418&r1=253417&r2=253418&view=diff
>
> ==
> --- cfe/trunk/tools/libclang/CXString.cpp (original)
> +++ cfe/trunk/tools/libclang/CXString.cpp Tue Nov 17 19:06:39 2015
> @@ -186,6 +186,8 @@ void clang_disposeString(CXString string
>  }
>
>  void clang_disposeStringSet(CXStringSet *set) {
> +  for (unsigned SI = 0, SE = set->Count; SI < SE; ++SI)
> +clang_disposeString(set->Strings[SI]);
>delete[] set->Strings;
>delete set;
>  }
>
>
Thanks for fixing this!


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



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253473 - Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers, w

2015-11-18 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov 18 11:05:39 2015
New Revision: 253473

URL: http://llvm.org/viewvc/llvm-project?rev=253473&view=rev
Log:
Adding AST matchers for VarDecl storage durations. Can now determine whether a 
VarDecl has automatic, static, or thread storage duration. This also updates 
the documentation for matchers, which appear to be missing some previous 
additions.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253473&r1=253472&r2=253473&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:05:39 2015
@@ -1774,6 +1774,21 @@ cxxMethodDecl(isConst()) matches A::foo(
 
 
 
+MatcherCXXMethodDecl>isCopyAssignmentOperator
+Matches if 
the given method declaration declares a copy assignment
+operator.
+
+Given
+struct A {
+  A &operator=(const A &);
+  A &operator=(A &&);
+};
+
+cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
+the second one.
+
+
+
 MatcherCXXMethodDecl>isFinal
 Matches if the given method 
or class declaration is final.
 
@@ -2749,6 +2764,20 @@ Example matches a || b (matcher = binary
 
 
 
+MatcherVarDecl>hasAutomaticStorageDuration
+Matches 
a variable declaration that has automatic storage duration.
+
+Example matches x, but not y, z, or a.
+(matcher = varDecl(hasAutomaticStorageDuration())
+void f() {
+  int x;
+  static int y;
+  thread_local int z;
+}
+int a;
+
+
+
 MatcherVarDecl>hasGlobalStorage
 Matches a variable 
declaration that does not have local storage.
 
@@ -2774,6 +2803,34 @@ int z;
 
 
 
+MatcherVarDecl>hasStaticStorageDuration
+Matches a 
variable declaration that has static storage duration.
+
+Example matches y and a, but not x or z.
+(matcher = varDecl(hasStaticStorageDuration())
+void f() {
+  int x;
+  static int y;
+  thread_local int z;
+}
+int a;
+
+
+
+MatcherVarDecl>hasThreadStorageDuration
+Matches a 
variable declaration that has thread storage duration.
+
+Example matches z, but not x, z, or a.
+(matcher = varDecl(hasThreadStorageDuration())
+void f() {
+  int x;
+  static int y;
+  thread_local int z;
+}
+int a;
+
+
+
 MatcherVarDecl>isConstexpr
 Matches constexpr 
variable and function declarations.
 
@@ -3040,6 +3097,22 @@ arraySubscriptExpression(hasIndex(intege
 
 
 
+MatcherArraySubscriptExpr>hasLHSMatcherExpr> 
InnerMatcher
+Matches the left hand side 
of binary operator expressions.
+
+Example matches a (matcher = binaryOperator(hasLHS()))
+  a || b
+
+
+
+MatcherArraySubscriptExpr>hasRHSMatcherExpr> 
InnerMatcher
+Matches the right hand side 
of binary operator expressions.
+
+Example matches b (matcher = binaryOperator(hasRHS()))
+  a || b
+
+
+
 MatcherArrayTypeLoc>hasElementTypeLocMatcherTypeLoc>
 Matches arrays 
and C99 complex types that have a specific element
 type.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=253473&r1=253472&r2=253473&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Wed Nov 18 11:05:39 2015
@@ -2544,6 +2544,54 @@ AST_MATCHER(VarDecl, hasGlobalStorage) {
   return Node.hasGlobalStorage();
 }
 
+/// \brief Matches a variable declaration that has automatic storage duration.
+///
+/// Example matches x, but not y, z, or a.
+/// (matcher = varDecl(hasAutomaticStorageDuration())
+/// \code
+/// void f() {
+///   int x;
+///   static int y;
+///   thread_local int z;
+/// }
+/// int a;
+/// \endcode
+AST_MATCHER(VarDecl, hasAutomaticStorageDuration) {
+  return Node.getStorageDuration() == SD_Automatic;
+}
+
+/// \brief Matches a variable declaration that has static 

r253475 - Reverting r253473 while I investigate build bot failures.

2015-11-18 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov 18 11:16:01 2015
New Revision: 253475

URL: http://llvm.org/viewvc/llvm-project?rev=253475&view=rev
Log:
Reverting r253473 while I investigate build bot failures.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253475&r1=253474&r2=253475&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:16:01 2015
@@ -1774,21 +1774,6 @@ cxxMethodDecl(isConst()) matches A::foo(
 
 
 
-MatcherCXXMethodDecl>isCopyAssignmentOperator
-Matches if 
the given method declaration declares a copy assignment
-operator.
-
-Given
-struct A {
-  A &operator=(const A &);
-  A &operator=(A &&);
-};
-
-cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
-the second one.
-
-
-
 MatcherCXXMethodDecl>isFinal
 Matches if the given method 
or class declaration is final.
 
@@ -2764,20 +2749,6 @@ Example matches a || b (matcher = binary
 
 
 
-MatcherVarDecl>hasAutomaticStorageDuration
-Matches 
a variable declaration that has automatic storage duration.
-
-Example matches x, but not y, z, or a.
-(matcher = varDecl(hasAutomaticStorageDuration())
-void f() {
-  int x;
-  static int y;
-  thread_local int z;
-}
-int a;
-
-
-
 MatcherVarDecl>hasGlobalStorage
 Matches a variable 
declaration that does not have local storage.
 
@@ -2803,34 +2774,6 @@ int z;
 
 
 
-MatcherVarDecl>hasStaticStorageDuration
-Matches a 
variable declaration that has static storage duration.
-
-Example matches y and a, but not x or z.
-(matcher = varDecl(hasStaticStorageDuration())
-void f() {
-  int x;
-  static int y;
-  thread_local int z;
-}
-int a;
-
-
-
-MatcherVarDecl>hasThreadStorageDuration
-Matches a 
variable declaration that has thread storage duration.
-
-Example matches z, but not x, z, or a.
-(matcher = varDecl(hasThreadStorageDuration())
-void f() {
-  int x;
-  static int y;
-  thread_local int z;
-}
-int a;
-
-
-
 MatcherVarDecl>isConstexpr
 Matches constexpr 
variable and function declarations.
 
@@ -3097,22 +3040,6 @@ arraySubscriptExpression(hasIndex(intege
 
 
 
-MatcherArraySubscriptExpr>hasLHSMatcherExpr> 
InnerMatcher
-Matches the left hand side 
of binary operator expressions.
-
-Example matches a (matcher = binaryOperator(hasLHS()))
-  a || b
-
-
-
-MatcherArraySubscriptExpr>hasRHSMatcherExpr> 
InnerMatcher
-Matches the right hand side 
of binary operator expressions.
-
-Example matches b (matcher = binaryOperator(hasRHS()))
-  a || b
-
-
-
 MatcherArrayTypeLoc>hasElementTypeLocMatcherTypeLoc>
 Matches arrays 
and C99 complex types that have a specific element
 type.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=253475&r1=253474&r2=253475&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Wed Nov 18 11:16:01 2015
@@ -2544,54 +2544,6 @@ AST_MATCHER(VarDecl, hasGlobalStorage) {
   return Node.hasGlobalStorage();
 }
 
-/// \brief Matches a variable declaration that has automatic storage duration.
-///
-/// Example matches x, but not y, z, or a.
-/// (matcher = varDecl(hasAutomaticStorageDuration())
-/// \code
-/// void f() {
-///   int x;
-///   static int y;
-///   thread_local int z;
-/// }
-/// int a;
-/// \endcode
-AST_MATCHER(VarDecl, hasAutomaticStorageDuration) {
-  return Node.getStorageDuration() == SD_Automatic;
-}
-
-/// \brief Matches a variable declaration that has static storage duration.
-///
-/// Example matches y and a, but not x or z.
-/// (matcher = varDecl(hasStaticStorageDuration())
-/// \code
-/// void f() {
-///   int x;
-///   static int y;
-/

Re: [cfe-commits] r119285 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c

2015-11-18 Thread Douglas Gregor via cfe-commits


Sent from my iPhone

> On Nov 18, 2015, at 8:19 AM, Manuel Klimek  wrote:
> 
> (now with the right list)
> 
>> On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor  wrote:
>> Author: dgregor
>> Date: Mon Nov 15 17:00:34 2010
>> New Revision: 119285
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=119285&view=rev
>> Log:
>> Tweak libclang's heuristics for building precompiled preambles and
>> caching global code-completion results. In particular, don't perform
>> either operation the first time we parse, but do both after the first
>> reparse.
> 
> Do you remember the reason behind not building the preamble on the first 
> parse? For really large TUs having to parse 2 times before we get a preamble 
> is rather painful.

We wanted to get the first set of results quickly, especially for syntax 
coloring when a file is first opened. 

> 
> Cheers,
> /Manuel 
> 
>> 
>> Modified:
>> cfe/trunk/lib/Frontend/ASTUnit.cpp
>> cfe/trunk/tools/c-index-test/c-index-test.c
>> 
>> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff
>> ==
>> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
>> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010
>> @@ -326,7 +326,6 @@
>> 
>>// Make a note of the state when we performed this caching.
>>NumTopLevelDeclsAtLastCompletionCache = top_level_size();
>> -  CacheCodeCompletionCoolDown = 15;
>>  }
>> 
>>  void ASTUnit::ClearCachedCompletionResults() {
>> @@ -824,12 +823,6 @@
>>}
>> 
>>Invocation.reset(Clang.takeInvocation());
>> -
>> -  // If we were asked to cache code-completion results and don't have any
>> -  // results yet, do so now.
>> -  if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())
>> -CacheCodeCompletionResults();
>> -
>>return false;
>> 
>>  error:
>> @@ -1350,7 +1343,7 @@
>> 
>>llvm::MemoryBuffer *OverrideMainBuffer = 0;
>>if (PrecompilePreamble) {
>> -PreambleRebuildCounter = 1;
>> +PreambleRebuildCounter = 2;
>>  OverrideMainBuffer
>>= getMainBufferWithPrecompiledPreamble(*Invocation);
>>}
>> @@ -1377,6 +1370,7 @@
>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>> +  AST->CacheCodeCompletionCoolDown = 1;
>>AST->Invocation.reset(CI);
>> 
>>return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : 
>> AST.take();
>> @@ -1481,6 +1475,7 @@
>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>> +  AST->CacheCodeCompletionCoolDown = 1;
>>AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
>>AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
>>AST->StoredDiagnostics.swap(StoredDiagnostics);
>> 
>> 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=119285&r1=119284&r2=119285&view=diff
>> ==
>> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
>> +++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010
>> @@ -1040,6 +1040,11 @@
>>  fprintf(stderr, "Unable to load translation unit!\n");
>>  return 1;
>>}
>> +
>> +  if (clang_reparseTranslationUnit(TU, 0, 0, 
>> clang_defaultReparseOptions(TU))) {
>> +fprintf(stderr, "Unable to reparse translation init!\n");
>> +return 1;
>> +  }
>> 
>>for (I = 0; I != Repeats; ++I) {
>>  results = clang_codeCompleteAt(TU, filename, line, column,
>> 
>> 
>> ___
>> cfe-commits mailing list
>> cfe-comm...@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253476 - [Myriad]: fix test for Windows

2015-11-18 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Wed Nov 18 11:19:47 2015
New Revision: 253476

URL: http://llvm.org/viewvc/llvm-project?rev=253476&view=rev
Log:
[Myriad]: fix test for Windows

Modified:
cfe/trunk/test/Driver/myriad-toolchain.c

Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=253476&r1=253475&r2=253476&view=diff
==
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Wed Nov 18 11:19:47 2015
@@ -1,12 +1,12 @@
 // RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems-elf %s \
 // RUN: -B %S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s 
-check-prefix=LINK_WITH_RTEMS
-// LINK_WITH_RTEMS: 
Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crti.o
-// LINK_WITH_RTEMS: 
Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtbegin.o
+// LINK_WITH_RTEMS: Inputs{{.*}}crti.o
+// LINK_WITH_RTEMS: Inputs{{.*}}crtbegin.o
 // LINK_WITH_RTEMS: 
"-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../..{{/|}}../sparc-myriad-elf/lib"
 // LINK_WITH_RTEMS: 
"-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2"
 // LINK_WITH_RTEMS: "--start-group" "-lc" "-lrtemscpu" "-lrtemsbsp" 
"--end-group" "-lgcc"
-// LINK_WITH_RTEMS: 
Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtend.o
-// LINK_WITH_RTEMS: 
Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtn.o
+// LINK_WITH_RTEMS: Inputs{{.*}}crtend.o
+// LINK_WITH_RTEMS: Inputs{{.*}}crtn.o
 
 // RUN: %clang -c -no-canonical-prefixes -### -target sparc-myriad-rtems-elf 
-x c++ %s \
 // RUN: -B %S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s 
-check-prefix=COMPILE_CXX


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


Re: [cfe-commits] r119285 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c

2015-11-18 Thread Manuel Klimek via cfe-commits
On Wed, Nov 18, 2015 at 6:19 PM Douglas Gregor  wrote:

>
>
> Sent from my iPhone
>
> On Nov 18, 2015, at 8:19 AM, Manuel Klimek  wrote:
>
> (now with the right list)
>
> On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor  wrote:
>
>> Author: dgregor
>> Date: Mon Nov 15 17:00:34 2010
>> New Revision: 119285
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=119285&view=rev
>> Log:
>> Tweak libclang's heuristics for building precompiled preambles and
>> caching global code-completion results. In particular, don't perform
>> either operation the first time we parse, but do both after the first
>> reparse.
>>
>
> Do you remember the reason behind not building the preamble on the first
> parse? For really large TUs having to parse 2 times before we get a
> preamble is rather painful.
>
>
> We wanted to get the first set of results quickly, especially for syntax
> coloring when a file is first opened.
>

Do you remember how much storing the preamble would make this slower
(without the preamble many of our parses are >> 20 seconds, so 2x that is
rather unfortunate). Perhaps we can add a flag?


>
>
> Cheers,
> /Manuel
>
>
>> Modified:
>> cfe/trunk/lib/Frontend/ASTUnit.cpp
>> cfe/trunk/tools/c-index-test/c-index-test.c
>>
>> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
>> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010
>> @@ -326,7 +326,6 @@
>>
>>// Make a note of the state when we performed this caching.
>>NumTopLevelDeclsAtLastCompletionCache = top_level_size();
>> -  CacheCodeCompletionCoolDown = 15;
>>  }
>>
>>  void ASTUnit::ClearCachedCompletionResults() {
>> @@ -824,12 +823,6 @@
>>}
>>
>>Invocation.reset(Clang.takeInvocation());
>> -
>> -  // If we were asked to cache code-completion results and don't have any
>> -  // results yet, do so now.
>> -  if (ShouldCacheCodeCompletionResults &&
>> CachedCompletionResults.empty())
>> -CacheCodeCompletionResults();
>> -
>>return false;
>>
>>  error:
>> @@ -1350,7 +1343,7 @@
>>
>>llvm::MemoryBuffer *OverrideMainBuffer = 0;
>>if (PrecompilePreamble) {
>> -PreambleRebuildCounter = 1;
>> +PreambleRebuildCounter = 2;
>>  OverrideMainBuffer
>>= getMainBufferWithPrecompiledPreamble(*Invocation);
>>}
>> @@ -1377,6 +1370,7 @@
>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>> +  AST->CacheCodeCompletionCoolDown = 1;
>>AST->Invocation.reset(CI);
>>
>>return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 :
>> AST.take();
>> @@ -1481,6 +1475,7 @@
>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>> +  AST->CacheCodeCompletionCoolDown = 1;
>>AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
>>AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
>>AST->StoredDiagnostics.swap(StoredDiagnostics);
>>
>> 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=119285&r1=119284&r2=119285&view=diff
>>
>> ==
>> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
>> +++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010
>> @@ -1040,6 +1040,11 @@
>>  fprintf(stderr, "Unable to load translation unit!\n");
>>  return 1;
>>}
>> +
>> +  if (clang_reparseTranslationUnit(TU, 0, 0,
>> clang_defaultReparseOptions(TU))) {
>> +fprintf(stderr, "Unable to reparse translation init!\n");
>> +return 1;
>> +  }
>>
>>for (I = 0; I != Repeats; ++I) {
>>  results = clang_codeCompleteAt(TU, filename, line, column,
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-comm...@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253473 - Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers

2015-11-18 Thread Bruno Cardoso Lopes via cfe-commits
Hi Aaron,

This commit is failing tests due to assertions in the tests:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/13216

Example:

Note: Google Test filter = ParserTest.CompletionNamedValues
[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from ParserTest
[ RUN  ] ParserTest.CompletionNamedValues
Assertion failed: (Constructors.find(MatcherName) ==
Constructors.end()), function registerMatcher, file
/Users/buildslave/jenkins/sharedspace/phase1@2/llvm/tools/clang/lib/ASTMatchers/Dynamic/Registry.cpp,
line 49.
0  DynamicASTMatchersTests  0x000103a9418b
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  DynamicASTMatchersTests  0x000103a93286
llvm::sys::RunSignalHandlers() + 70
2  DynamicASTMatchersTests  0x000103a94a05 SignalHandler(int) + 645
3  libsystem_platform.dylib 0x7fff965faf1a _sigtramp + 26
4  DynamicASTMatchersTests  0x000103cb6d6f nuls + 80511
5  DynamicASTMatchersTests  0x000103a946d6 abort + 22
6  DynamicASTMatchersTests  0x000103a946b1 __assert_rtn + 81
7  DynamicASTMatchersTests  0x00010353f63c
clang::ast_matchers::dynamic::(anonymous
namespace)::RegistryMaps::RegistryMaps() + 50668
8  DynamicASTMatchersTests  0x000103532f3b void*
llvm::object_creator() + 27
9  DynamicASTMatchersTests  0x000103a87050
llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void
(*)(void*)) const + 160
10 DynamicASTMatchersTests  0x000103531838
clang::ast_matchers::dynamic::Registry::lookupMatcherCtor(llvm::StringRef)
+ 72
11 DynamicASTMatchersTests  0x00010352bc74


Thanks,

On Wed, Nov 18, 2015 at 9:05 AM, Aaron Ballman via cfe-commits
 wrote:
> Author: aaronballman
> Date: Wed Nov 18 11:05:39 2015
> New Revision: 253473
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253473&view=rev
> Log:
> Adding AST matchers for VarDecl storage durations. Can now determine whether 
> a VarDecl has automatic, static, or thread storage duration. This also 
> updates the documentation for matchers, which appear to be missing some 
> previous additions.
>
> Modified:
> cfe/trunk/docs/LibASTMatchersReference.html
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>
> Modified: cfe/trunk/docs/LibASTMatchersReference.html
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253473&r1=253472&r2=253473&view=diff
> ==
> --- cfe/trunk/docs/LibASTMatchersReference.html (original)
> +++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:05:39 2015
> @@ -1774,6 +1774,21 @@ cxxMethodDecl(isConst()) matches A::foo(
>  
>
>
> +Matcher< href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html";>CXXMethodDecl>  class="name" onclick="toggle('isCopyAssignmentOperator0')"> name="isCopyAssignmentOperator0Anchor">isCopyAssignmentOperator
> +Matches 
> if the given method declaration declares a copy assignment
> +operator.
> +
> +Given
> +struct A {
> +  A &operator=(const A &);
> +  A &operator=(A &&);
> +};
> +
> +cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
> +the second one.
> +
> +
> +
>  Matcher< href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html";>CXXMethodDecl>  class="name" onclick="toggle('isFinal1')"> name="isFinal1Anchor">isFinal
>  Matches if the given 
> method or class declaration is final.
>
> @@ -2749,6 +2764,20 @@ Example matches a || b (matcher = binary
>  
>
>
> +Matcher< href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>  class="name" onclick="toggle('hasAutomaticStorageDuration0')"> name="hasAutomaticStorageDuration0Anchor">hasAutomaticStorageDuration
> + id="hasAutomaticStorageDuration0">Matches a variable declaration that 
> has automatic storage duration.
> +
> +Example matches x, but not y, z, or a.
> +(matcher = varDecl(hasAutomaticStorageDuration())
> +void f() {
> +  int x;
> +  static int y;
> +  thread_local int z;
> +}
> +int a;
> +
> +
> +
>  Matcher< href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>  class="name" onclick="toggle('hasGlobalStorage0')"> name="hasGlobalStorage0Anchor">hasGlobalStorage
>  Matches a 
> variable declaration that does not have local storage.
>
> @@ -2774,6 +2803,34 @@ int z;
>  
>
>
> +Matcher< href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>  class="name" onclick="toggle('hasStaticStorageDuration0')"> name="hasStaticStorageDuration0Anchor">hasStaticStorageDuration
> +Matches 
> a variable declaration that has static storage duration.
> +
> +Example matches y and a, but not x or z.
> +(matcher = varDecl(hasStaticStorageDuration())
> +void f() {
> +  int x;
> +  static int y;
> +  thread_local int z;
> +}
> +int a;
> +
> +
> +
> +Matcher< href="http://clang.llvm.org/doxygen

Re: r253473 - Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers

2015-11-18 Thread Aaron Ballman via cfe-commits
On Wed, Nov 18, 2015 at 12:44 PM, Bruno Cardoso Lopes
 wrote:
> Hi Aaron,
>
> This commit is failing tests due to assertions in the tests:
> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/13216

This was reverted in r253475 while I investigate.

~Aaron

>
> Example:
>
> Note: Google Test filter = ParserTest.CompletionNamedValues
> [==] Running 1 test from 1 test case.
> [--] Global test environment set-up.
> [--] 1 test from ParserTest
> [ RUN  ] ParserTest.CompletionNamedValues
> Assertion failed: (Constructors.find(MatcherName) ==
> Constructors.end()), function registerMatcher, file
> /Users/buildslave/jenkins/sharedspace/phase1@2/llvm/tools/clang/lib/ASTMatchers/Dynamic/Registry.cpp,
> line 49.
> 0  DynamicASTMatchersTests  0x000103a9418b
> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
> 1  DynamicASTMatchersTests  0x000103a93286
> llvm::sys::RunSignalHandlers() + 70
> 2  DynamicASTMatchersTests  0x000103a94a05 SignalHandler(int) + 645
> 3  libsystem_platform.dylib 0x7fff965faf1a _sigtramp + 26
> 4  DynamicASTMatchersTests  0x000103cb6d6f nuls + 80511
> 5  DynamicASTMatchersTests  0x000103a946d6 abort + 22
> 6  DynamicASTMatchersTests  0x000103a946b1 __assert_rtn + 81
> 7  DynamicASTMatchersTests  0x00010353f63c
> clang::ast_matchers::dynamic::(anonymous
> namespace)::RegistryMaps::RegistryMaps() + 50668
> 8  DynamicASTMatchersTests  0x000103532f3b void*
> llvm::object_creator namespace)::RegistryMaps>() + 27
> 9  DynamicASTMatchersTests  0x000103a87050
> llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void
> (*)(void*)) const + 160
> 10 DynamicASTMatchersTests  0x000103531838
> clang::ast_matchers::dynamic::Registry::lookupMatcherCtor(llvm::StringRef)
> + 72
> 11 DynamicASTMatchersTests  0x00010352bc74
>
>
> Thanks,
>
> On Wed, Nov 18, 2015 at 9:05 AM, Aaron Ballman via cfe-commits
>  wrote:
>> Author: aaronballman
>> Date: Wed Nov 18 11:05:39 2015
>> New Revision: 253473
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253473&view=rev
>> Log:
>> Adding AST matchers for VarDecl storage durations. Can now determine whether 
>> a VarDecl has automatic, static, or thread storage duration. This also 
>> updates the documentation for matchers, which appear to be missing some 
>> previous additions.
>>
>> Modified:
>> cfe/trunk/docs/LibASTMatchersReference.html
>> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
>> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>>
>> Modified: cfe/trunk/docs/LibASTMatchersReference.html
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253473&r1=253472&r2=253473&view=diff
>> ==
>> --- cfe/trunk/docs/LibASTMatchersReference.html (original)
>> +++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:05:39 2015
>> @@ -1774,6 +1774,21 @@ cxxMethodDecl(isConst()) matches A::foo(
>>  
>>
>>
>> +Matcher<> href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html";>CXXMethodDecl>>  class="name" onclick="toggle('isCopyAssignmentOperator0')">> name="isCopyAssignmentOperator0Anchor">isCopyAssignmentOperator
>> +Matches 
>> if the given method declaration declares a copy assignment
>> +operator.
>> +
>> +Given
>> +struct A {
>> +  A &operator=(const A &);
>> +  A &operator=(A &&);
>> +};
>> +
>> +cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
>> +the second one.
>> +
>> +
>> +
>>  Matcher<> href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html";>CXXMethodDecl>>  class="name" onclick="toggle('isFinal1')">> name="isFinal1Anchor">isFinal
>>  Matches if the given 
>> method or class declaration is final.
>>
>> @@ -2749,6 +2764,20 @@ Example matches a || b (matcher = binary
>>  
>>
>>
>> +Matcher<> href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>>  class="name" onclick="toggle('hasAutomaticStorageDuration0')">> name="hasAutomaticStorageDuration0Anchor">hasAutomaticStorageDuration
>> +> id="hasAutomaticStorageDuration0">Matches a variable declaration that 
>> has automatic storage duration.
>> +
>> +Example matches x, but not y, z, or a.
>> +(matcher = varDecl(hasAutomaticStorageDuration())
>> +void f() {
>> +  int x;
>> +  static int y;
>> +  thread_local int z;
>> +}
>> +int a;
>> +
>> +
>> +
>>  Matcher<> href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>>  class="name" onclick="toggle('hasGlobalStorage0')">> name="hasGlobalStorage0Anchor">hasGlobalStorage
>>  Matches a 
>> variable declaration that does not have local storage.
>>
>> @@ -2774,6 +2803,34 @@ int z;
>>  
>>
>>
>> +Matcher<> href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>>  class="name" onclick="toggle('hasStaticStorageDuration0')">> name="hasStaticStorageDuration0Anchor">hasStaticStorageDur

Re: r253473 - Adding AST matchers for VarDecl storage durations. Can now determine whether a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers

2015-11-18 Thread Bruno Cardoso Lopes via cfe-commits
Thanks!

On Wed, Nov 18, 2015 at 9:46 AM, Aaron Ballman  wrote:
> On Wed, Nov 18, 2015 at 12:44 PM, Bruno Cardoso Lopes
>  wrote:
>> Hi Aaron,
>>
>> This commit is failing tests due to assertions in the tests:
>> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/13216
>
> This was reverted in r253475 while I investigate.
>
> ~Aaron
>
>>
>> Example:
>>
>> Note: Google Test filter = ParserTest.CompletionNamedValues
>> [==] Running 1 test from 1 test case.
>> [--] Global test environment set-up.
>> [--] 1 test from ParserTest
>> [ RUN  ] ParserTest.CompletionNamedValues
>> Assertion failed: (Constructors.find(MatcherName) ==
>> Constructors.end()), function registerMatcher, file
>> /Users/buildslave/jenkins/sharedspace/phase1@2/llvm/tools/clang/lib/ASTMatchers/Dynamic/Registry.cpp,
>> line 49.
>> 0  DynamicASTMatchersTests  0x000103a9418b
>> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
>> 1  DynamicASTMatchersTests  0x000103a93286
>> llvm::sys::RunSignalHandlers() + 70
>> 2  DynamicASTMatchersTests  0x000103a94a05 SignalHandler(int) + 645
>> 3  libsystem_platform.dylib 0x7fff965faf1a _sigtramp + 26
>> 4  DynamicASTMatchersTests  0x000103cb6d6f nuls + 80511
>> 5  DynamicASTMatchersTests  0x000103a946d6 abort + 22
>> 6  DynamicASTMatchersTests  0x000103a946b1 __assert_rtn + 81
>> 7  DynamicASTMatchersTests  0x00010353f63c
>> clang::ast_matchers::dynamic::(anonymous
>> namespace)::RegistryMaps::RegistryMaps() + 50668
>> 8  DynamicASTMatchersTests  0x000103532f3b void*
>> llvm::object_creator> namespace)::RegistryMaps>() + 27
>> 9  DynamicASTMatchersTests  0x000103a87050
>> llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void
>> (*)(void*)) const + 160
>> 10 DynamicASTMatchersTests  0x000103531838
>> clang::ast_matchers::dynamic::Registry::lookupMatcherCtor(llvm::StringRef)
>> + 72
>> 11 DynamicASTMatchersTests  0x00010352bc74
>>
>>
>> Thanks,
>>
>> On Wed, Nov 18, 2015 at 9:05 AM, Aaron Ballman via cfe-commits
>>  wrote:
>>> Author: aaronballman
>>> Date: Wed Nov 18 11:05:39 2015
>>> New Revision: 253473
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=253473&view=rev
>>> Log:
>>> Adding AST matchers for VarDecl storage durations. Can now determine 
>>> whether a VarDecl has automatic, static, or thread storage duration. This 
>>> also updates the documentation for matchers, which appear to be missing 
>>> some previous additions.
>>>
>>> Modified:
>>> cfe/trunk/docs/LibASTMatchersReference.html
>>> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>>> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
>>> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>>>
>>> Modified: cfe/trunk/docs/LibASTMatchersReference.html
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253473&r1=253472&r2=253473&view=diff
>>> ==
>>> --- cfe/trunk/docs/LibASTMatchersReference.html (original)
>>> +++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:05:39 2015
>>> @@ -1774,6 +1774,21 @@ cxxMethodDecl(isConst()) matches A::foo(
>>>  
>>>
>>>
>>> +Matcher<>> href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html";>CXXMethodDecl>>>  class="name" onclick="toggle('isCopyAssignmentOperator0')">>> name="isCopyAssignmentOperator0Anchor">isCopyAssignmentOperator
>>> +>> id="isCopyAssignmentOperator0">Matches if the given method declaration 
>>> declares a copy assignment
>>> +operator.
>>> +
>>> +Given
>>> +struct A {
>>> +  A &operator=(const A &);
>>> +  A &operator=(A &&);
>>> +};
>>> +
>>> +cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
>>> +the second one.
>>> +
>>> +
>>> +
>>>  Matcher<>> href="http://clang.llvm.org/doxygen/classclang_1_1CXXMethodDecl.html";>CXXMethodDecl>>>  class="name" onclick="toggle('isFinal1')">>> name="isFinal1Anchor">isFinal
>>>  Matches if the given 
>>> method or class declaration is final.
>>>
>>> @@ -2749,6 +2764,20 @@ Example matches a || b (matcher = binary
>>>  
>>>
>>>
>>> +Matcher<>> href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>>>  class="name" onclick="toggle('hasAutomaticStorageDuration0')">>> name="hasAutomaticStorageDuration0Anchor">hasAutomaticStorageDuration
>>> +>> id="hasAutomaticStorageDuration0">Matches a variable declaration that 
>>> has automatic storage duration.
>>> +
>>> +Example matches x, but not y, z, or a.
>>> +(matcher = varDecl(hasAutomaticStorageDuration())
>>> +void f() {
>>> +  int x;
>>> +  static int y;
>>> +  thread_local int z;
>>> +}
>>> +int a;
>>> +
>>> +
>>> +
>>>  Matcher<>> href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html";>VarDecl>>>  class="name" onclick="toggle('hasGlobalStorage0')">>> name="hasGlobalStorage0Anchor">hasGlobalStorage
>>>  Matches a 
>>> variable declaration that does not have local storage.
>>>
>>> @@ -2774,6 +2

Re: [PATCH] D14130: Delete dead code in the LibcxxAndAbiBuilder

2015-11-18 Thread Jonathan Roelofs via cfe-commits
jroelofs closed this revision.
jroelofs added a comment.

r253480


http://reviews.llvm.org/D14130



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


r253481 - Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.

2015-11-18 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov 18 11:56:55 2015
New Revision: 253481

URL: http://llvm.org/viewvc/llvm-project?rev=253481&view=rev
Log:
Re-committing r253473 after hopefully fixing the bot breakage. There was a 
copy-pasta issue that my local testing did not catch.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=253481&r1=253480&r2=253481&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Wed Nov 18 11:56:55 2015
@@ -1774,6 +1774,21 @@ cxxMethodDecl(isConst()) matches A::foo(
 
 
 
+MatcherCXXMethodDecl>isCopyAssignmentOperator
+Matches if 
the given method declaration declares a copy assignment
+operator.
+
+Given
+struct A {
+  A &operator=(const A &);
+  A &operator=(A &&);
+};
+
+cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
+the second one.
+
+
+
 MatcherCXXMethodDecl>isFinal
 Matches if the given method 
or class declaration is final.
 
@@ -2749,6 +2764,20 @@ Example matches a || b (matcher = binary
 
 
 
+MatcherVarDecl>hasAutomaticStorageDuration
+Matches 
a variable declaration that has automatic storage duration.
+
+Example matches x, but not y, z, or a.
+(matcher = varDecl(hasAutomaticStorageDuration())
+void f() {
+  int x;
+  static int y;
+  thread_local int z;
+}
+int a;
+
+
+
 MatcherVarDecl>hasGlobalStorage
 Matches a variable 
declaration that does not have local storage.
 
@@ -2774,6 +2803,34 @@ int z;
 
 
 
+MatcherVarDecl>hasStaticStorageDuration
+Matches a 
variable declaration that has static storage duration.
+
+Example matches y and a, but not x or z.
+(matcher = varDecl(hasStaticStorageDuration())
+void f() {
+  int x;
+  static int y;
+  thread_local int z;
+}
+int a;
+
+
+
+MatcherVarDecl>hasThreadStorageDuration
+Matches a 
variable declaration that has thread storage duration.
+
+Example matches z, but not x, z, or a.
+(matcher = varDecl(hasThreadStorageDuration())
+void f() {
+  int x;
+  static int y;
+  thread_local int z;
+}
+int a;
+
+
+
 MatcherVarDecl>isConstexpr
 Matches constexpr 
variable and function declarations.
 
@@ -3040,6 +3097,22 @@ arraySubscriptExpression(hasIndex(intege
 
 
 
+MatcherArraySubscriptExpr>hasLHSMatcherExpr> 
InnerMatcher
+Matches the left hand side 
of binary operator expressions.
+
+Example matches a (matcher = binaryOperator(hasLHS()))
+  a || b
+
+
+
+MatcherArraySubscriptExpr>hasRHSMatcherExpr> 
InnerMatcher
+Matches the right hand side 
of binary operator expressions.
+
+Example matches b (matcher = binaryOperator(hasRHS()))
+  a || b
+
+
+
 MatcherArrayTypeLoc>hasElementTypeLocMatcherTypeLoc>
 Matches arrays 
and C99 complex types that have a specific element
 type.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=253481&r1=253480&r2=253481&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Wed Nov 18 11:56:55 2015
@@ -2544,6 +2544,54 @@ AST_MATCHER(VarDecl, hasGlobalStorage) {
   return Node.hasGlobalStorage();
 }
 
+/// \brief Matches a variable declaration that has automatic storage duration.
+///
+/// Example matches x, but not y, z, or a.
+/// (matcher = varDecl(hasAutomaticStorageDuration())
+/// \code
+/// void f() {
+///   int x;
+///   static int y;
+///   thread_local int z;
+/// }
+/// int a;
+/// \endcode
+AST_MATCHER(VarDecl, hasAutomaticStorageDuration) {
+  return Node.getStorageDuration() == SD_Automatic;
+}
+
+/// \brief Matches a variable declaration that has static storage duration.
+///
+/// Example matches y and a, but not x or z.
+/// (matcher = varDecl(hasStaticStorageDura

Re: [cfe-commits] r119285 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c

2015-11-18 Thread Douglas Gregor via cfe-commits

> On Nov 18, 2015, at 9:36 AM, Manuel Klimek  wrote:
> 
> 
> 
> On Wed, Nov 18, 2015 at 6:19 PM Douglas Gregor  > wrote:
> 
> 
> Sent from my iPhone
> 
> On Nov 18, 2015, at 8:19 AM, Manuel Klimek  > wrote:
> 
>> (now with the right list)
>> 
>> On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor > > wrote:
>> Author: dgregor
>> Date: Mon Nov 15 17:00:34 2010
>> New Revision: 119285
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=119285&view=rev 
>> 
>> Log:
>> Tweak libclang's heuristics for building precompiled preambles and
>> caching global code-completion results. In particular, don't perform
>> either operation the first time we parse, but do both after the first
>> reparse.
>> 
>> Do you remember the reason behind not building the preamble on the first 
>> parse? For really large TUs having to parse 2 times before we get a preamble 
>> is rather painful.
> 
> We wanted to get the first set of results quickly, especially for syntax 
> coloring when a file is first opened. 
> 
> Do you remember how much storing the preamble would make this slower (without 
> the preamble many of our parses are >> 20 seconds, so 2x that is rather 
> unfortunate). Perhaps we can add a flag?

I don’t remember the numbers from… 5 years ago. I do remember that it was a 
noticeable lag in the UI when opening a new file, primarily because the AST 
serialization step needed to produce the preamble file is fairly expensive. You 
can turn on the timers by setting the LIBCLANG_TIMING environment variable to 
see how long things are taking without having to recompile, since it’s probably 
worth re-measuring now.

- Doug

>  
> 
>> 
>> Cheers,
>> /Manuel 
>> 
>> 
>> Modified:
>> cfe/trunk/lib/Frontend/ASTUnit.cpp
>> cfe/trunk/tools/c-index-test/c-index-test.c
>> 
>> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff
>>  
>> 
>> ==
>> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
>> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010
>> @@ -326,7 +326,6 @@
>> 
>>// Make a note of the state when we performed this caching.
>>NumTopLevelDeclsAtLastCompletionCache = top_level_size();
>> -  CacheCodeCompletionCoolDown = 15;
>>  }
>> 
>>  void ASTUnit::ClearCachedCompletionResults() {
>> @@ -824,12 +823,6 @@
>>}
>> 
>>Invocation.reset(Clang.takeInvocation());
>> -
>> -  // If we were asked to cache code-completion results and don't have any
>> -  // results yet, do so now.
>> -  if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())
>> -CacheCodeCompletionResults();
>> -
>>return false;
>> 
>>  error:
>> @@ -1350,7 +1343,7 @@
>> 
>>llvm::MemoryBuffer *OverrideMainBuffer = 0;
>>if (PrecompilePreamble) {
>> -PreambleRebuildCounter = 1;
>> +PreambleRebuildCounter = 2;
>>  OverrideMainBuffer
>>= getMainBufferWithPrecompiledPreamble(*Invocation);
>>}
>> @@ -1377,6 +1370,7 @@
>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>> +  AST->CacheCodeCompletionCoolDown = 1;
>>AST->Invocation.reset(CI);
>> 
>>return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : 
>> AST.take();
>> @@ -1481,6 +1475,7 @@
>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>> +  AST->CacheCodeCompletionCoolDown = 1;
>>AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
>>AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
>>AST->StoredDiagnostics.swap(StoredDiagnostics);
>> 
>> 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=119285&r1=119284&r2=119285&view=diff
>>  
>> 
>> ==
>> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
>> +++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010
>> @@ -1040,6 +1040,11 @@
>>  fprintf(stderr, "Unable to load translation unit!\n");
>>  return 1;
>>}
>> +
>> +  if (clang_reparseTranslationUnit(TU, 0, 0, 
>> clang_defaultReparseOptions(TU))) {
>> +fprintf(stderr, "Unable to reparse translation init!\n");
>> +return 1;
>> +  }
>> 
>>   

Re: [PATCH] D14616: [libcxx] Replace TEST_HAS_NO_EXCEPTIONS with _LIBCPP_NO_EXCEPTIONS [NFC]

2015-11-18 Thread Jonathan Roelofs via cfe-commits
jroelofs requested changes to this revision.
jroelofs added a comment.
This revision now requires changes to proceed.

This change is not the right thing to do. The reason this is a separate macro 
is that we don't want the tests in `test/std` to depend on implementation 
details of libcxx itself.


http://reviews.llvm.org/D14616



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


Re: [cfe-commits] r119285 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c

2015-11-18 Thread Manuel Klimek via cfe-commits
+Val FYI

On Wed, Nov 18, 2015 at 6:59 PM Douglas Gregor  wrote:

> On Nov 18, 2015, at 9:36 AM, Manuel Klimek  wrote:
>
>
>
> On Wed, Nov 18, 2015 at 6:19 PM Douglas Gregor  wrote:
>
>>
>>
>> Sent from my iPhone
>>
>> On Nov 18, 2015, at 8:19 AM, Manuel Klimek  wrote:
>>
>> (now with the right list)
>>
>> On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor 
>> wrote:
>>
>>> Author: dgregor
>>> Date: Mon Nov 15 17:00:34 2010
>>> New Revision: 119285
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=119285&view=rev
>>> Log:
>>> Tweak libclang's heuristics for building precompiled preambles and
>>> caching global code-completion results. In particular, don't perform
>>> either operation the first time we parse, but do both after the first
>>> reparse.
>>>
>>
>> Do you remember the reason behind not building the preamble on the first
>> parse? For really large TUs having to parse 2 times before we get a
>> preamble is rather painful.
>>
>>
>> We wanted to get the first set of results quickly, especially for syntax
>> coloring when a file is first opened.
>>
>
> Do you remember how much storing the preamble would make this slower
> (without the preamble many of our parses are >> 20 seconds, so 2x that is
> rather unfortunate). Perhaps we can add a flag?
>
>
> I don’t remember the numbers from… 5 years ago. I do remember that it was
> a noticeable lag in the UI when opening a new file, primarily because the
> AST serialization step needed to produce the preamble file is fairly
> expensive. You can turn on the timers by setting the LIBCLANG_TIMING
> environment variable to see how long things are taking without having to
> recompile, since it’s probably worth re-measuring now.
>
> - Doug
>
>
>
>>
>>
>> Cheers,
>> /Manuel
>>
>>
>>> Modified:
>>> cfe/trunk/lib/Frontend/ASTUnit.cpp
>>> cfe/trunk/tools/c-index-test/c-index-test.c
>>>
>>> Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010
>>> @@ -326,7 +326,6 @@
>>>
>>>// Make a note of the state when we performed this caching.
>>>NumTopLevelDeclsAtLastCompletionCache = top_level_size();
>>> -  CacheCodeCompletionCoolDown = 15;
>>>  }
>>>
>>>  void ASTUnit::ClearCachedCompletionResults() {
>>> @@ -824,12 +823,6 @@
>>>}
>>>
>>>Invocation.reset(Clang.takeInvocation());
>>> -
>>> -  // If we were asked to cache code-completion results and don't have
>>> any
>>> -  // results yet, do so now.
>>> -  if (ShouldCacheCodeCompletionResults &&
>>> CachedCompletionResults.empty())
>>> -CacheCodeCompletionResults();
>>> -
>>>return false;
>>>
>>>  error:
>>> @@ -1350,7 +1343,7 @@
>>>
>>>llvm::MemoryBuffer *OverrideMainBuffer = 0;
>>>if (PrecompilePreamble) {
>>> -PreambleRebuildCounter = 1;
>>> +PreambleRebuildCounter = 2;
>>>  OverrideMainBuffer
>>>= getMainBufferWithPrecompiledPreamble(*Invocation);
>>>}
>>> @@ -1377,6 +1370,7 @@
>>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>>> +  AST->CacheCodeCompletionCoolDown = 1;
>>>AST->Invocation.reset(CI);
>>>
>>>return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 :
>>> AST.take();
>>> @@ -1481,6 +1475,7 @@
>>>AST->CaptureDiagnostics = CaptureDiagnostics;
>>>AST->CompleteTranslationUnit = CompleteTranslationUnit;
>>>AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;
>>> +  AST->CacheCodeCompletionCoolDown = 1;
>>>AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
>>>AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();
>>>AST->StoredDiagnostics.swap(StoredDiagnostics);
>>>
>>> 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=119285&r1=119284&r2=119285&view=diff
>>>
>>> ==
>>> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
>>> +++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010
>>> @@ -1040,6 +1040,11 @@
>>>  fprintf(stderr, "Unable to load translation unit!\n");
>>>  return 1;
>>>}
>>> +
>>> +  if (clang_reparseTranslationUnit(TU, 0, 0,
>>> clang_defaultReparseOptions(TU))) {
>>> +fprintf(stderr, "Unable to reparse translation init!\n");
>>> +return 1;
>>> +  }
>>>
>>>for (I = 0; I != Repeats; ++I) {
>>>  results = clang_codeCompleteAt(TU, filename, line, column,
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-comm...@cs.uiuc.edu
>>> http://lists

Re: [PATCH] D14779: Adding checker to detect excess padding in records

2015-11-18 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

I may be mistaken, but this check looks more appropriate for Clang-tidy.


http://reviews.llvm.org/D14779



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


r253485 - [PGO] Test update for revision 253484.

2015-11-18 Thread Betul Buyukkurt via cfe-commits
Author: betulb
Date: Wed Nov 18 12:15:55 2015
New Revision: 253485

URL: http://llvm.org/viewvc/llvm-project?rev=253485&view=rev
Log:
[PGO] Test update for revision 253484.


Modified:
cfe/trunk/test/Profile/c-linkage-available_externally.c

Modified: cfe/trunk/test/Profile/c-linkage-available_externally.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/c-linkage-available_externally.c?rev=253485&r1=253484&r2=253485&view=diff
==
--- cfe/trunk/test/Profile/c-linkage-available_externally.c (original)
+++ cfe/trunk/test/Profile/c-linkage-available_externally.c Wed Nov 18 12:15:55 
2015
@@ -5,7 +5,7 @@
 // CHECK: @__llvm_profile_name_foo = linkonce_odr hidden constant [3 x i8] 
c"foo", section "__DATA,__llvm_prf_names", align 1
 
 // CHECK: @__llvm_profile_counters_foo = linkonce_odr hidden global [1 x i64] 
zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
-// CHECK: @__llvm_profile_data_foo = linkonce_odr hidden constant { i32, i32, 
i64, i8*, i64* } { i32 3, i32 1, i64 {{[0-9]+}}, i8* getelementptr inbounds ([3 
x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64* getelementptr 
inbounds ([1 x i64], [1 x i64]* @__llvm_profile_counters_foo, i32 0, i32 0) }, 
section "__DATA,__llvm_prf_data", align 8
+// CHECK: @__llvm_profile_data_foo = linkonce_odr hidden global { i32, i32, 
i64, i8*, i64*, i8*, i8*, [1 x i16] } { i32 3, i32 1, i64 0, i8* getelementptr 
inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64* 
getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_profile_counters_foo, i32 
0, i32 0), i8* null, i8* null, [1 x i16] zeroinitializer }, section 
"__DATA,__llvm_prf_data", align 8
 inline int foo(void) { return 1; }
 
 int main(void) {


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


r253486 - Removing the AST matcher test for thread_local storage duration. Not all platforms support TLS, and on platforms that do not support it, use of thread_local causes an error. Since there's no

2015-11-18 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov 18 12:37:29 2015
New Revision: 253486

URL: http://llvm.org/viewvc/llvm-project?rev=253486&view=rev
Log:
Removing the AST matcher test for thread_local storage duration. Not all 
platforms support TLS, and on platforms that do not support it, use of 
thread_local causes an error. Since there's no way to determine whether the 
testing platform supports TLS, there's no way to know whether the test is safe 
to run or not. I will explore ways to enable this test, but this will appease 
at least one more build bot.

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=253486&r1=253485&r2=253486&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Nov 18 12:37:29 2015
@@ -1357,22 +1357,22 @@ TEST(Matcher, VarDecl_Storage) {
 
 TEST(Matcher, VarDecl_StorageDuration) {
   std::string T =
-  "void f() { int x; static int y; thread_local int z; } int a;";
+  "void f() { int x; static int y; } int a;";
 
   EXPECT_TRUE(matches(T, varDecl(hasName("x"), 
hasAutomaticStorageDuration(;
   EXPECT_TRUE(
   notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration(;
   EXPECT_TRUE(
-  notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration(;
-  EXPECT_TRUE(
   notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration(;
 
   EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration(;
   EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration(;
   EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), 
hasStaticStorageDuration(;
-  EXPECT_TRUE(notMatches(T, varDecl(hasName("z"), 
hasStaticStorageDuration(;
 
-  EXPECT_TRUE(matches(T, varDecl(hasName("z"), hasThreadStorageDuration(;
+  // FIXME: It is really hard to test with thread_local itself because not all
+  // targets support TLS, which causes this to be an error depending on what
+  // platform the test is being run on. We do not have access to the TargetInfo
+  // object to be able to test whether the platform supports TLS or not.
   EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), 
hasThreadStorageDuration(;
   EXPECT_TRUE(notMatches(T, varDecl(hasName("y"), 
hasThreadStorageDuration(;
   EXPECT_TRUE(notMatches(T, varDecl(hasName("a"), 
hasThreadStorageDuration(;


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


Some buildbot statistics for the last week

2015-11-18 Thread Galina Kistanova via cfe-commits
Hello everyone,

Here are some buildbot statistics you may found interesting. I will be
adding more statistics.
My goal is to publish metrics to help with keeping the buildbot
infrastructure healthy and improving it.

All the numbers are for the week of 11/8/2015 - 11/14/2015.

Thanks

Galina



Number of commits by project:

 project  |   commits
 -
 llvm |   286
 cfe  |   109
 lldb |76
 compiler-rt  |71
 polly|42
 lld  |38
 libcxx   |10
 openmp   | 9
 clang-tools-extra| 7
 clang-tests-external | 2
 libunwind| 1
 -
  651


Number of completed builds, failed builds and average build time for
successful builds per active builder:

 buildername   | completed  |
failed | time
-
 clang-aarch64-lnt | 57
|  3 | 02:30:12
 clang-atom-d525-fedora| 18
|| 08:28:15
 clang-atom-d525-fedora-rel| 83
|  5 | 01:29:55
 clang-bpf-build   |310
| 31 | 00:02:53
 clang-cmake-aarch64-42vma |278
| 49 | 00:16:47
 clang-cmake-aarch64-quick |209
| 29 | 00:23:46
 clang-cmake-armv7-a15 |189
|  8 | 00:25:27
 clang-cmake-armv7-a15-full|154
| 38 | 00:45:32
 clang-cmake-armv7-a15-selfhost| 58
| 24 | 03:00:19
 clang-cmake-armv7-a15-selfhost-neon   | 45
| 22 | 04:26:31
 clang-cmake-mips  |186
| 38 | 00:28:52
 clang-cmake-thumbv7-a15   |178
|  7 | 00:28:30
 clang-cmake-thumbv7-a15-full-sh   | 32
| 23 | 06:03:05
 clang-hexagon-elf |169
| 23 | 00:24:42
 clang-native-aarch64-full | 24
|  8 | 05:53:35
 clang-native-arm-lnt  | 90
|  3 | 01:06:01
 clang-native-arm-lnt-perf | 14
|| 08:57:04
 clang-ppc64-elf-linux |120
|  6 | 01:01:02
 clang-ppc64-elf-linux2| 89
| 24 | 01:29:49
 clang-sphinx-docs |113
|| 00:00:20
 clang-x64-ninja-win7  |285
| 58 | 00:09:49
 clang-x86-win2008-selfhost|268
| 46 | 00:12:10
 clang-x86_64-darwin13-cross-arm   |232
|  1 | 00:19:45
 clang-x86_64-darwin13-cross-mingw32   |217
| 12 | 00:23:20
 clang-x86_64-debian-fast  |147
| 12 | 00:11:37
 clang-x86_64-linux-abi-test   |314
|  1 | 00:18:39
 clang-x86_64-linux-selfhost-modules   |261
| 25 | 00:15:02
 clang-x86_64-ubuntu-gdb-75|124
| 62 | 00:53:12
 libcxx-libcxxabi-arm-linux|  8
|| 01:05:10
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   | 11
|  2 | 00:08:50
 libcxx-libcxxabi-x86_64-linux-debian  | 11
|  4 | 00:09:43
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  5
|  2 | 00:09:24
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 10
|  2 | 00:08:22
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03| 10
|| 00:05:12
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 10
|| 00:06:19
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14|  9
|| 00:06:56
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z| 10
|  2 | 00:06:06
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 10
|  2 | 00:17:00
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan | 10
|  1 | 

Re: Some buildbot statistics for the last week

2015-11-18 Thread Aaron Ballman via cfe-commits
On Wed, Nov 18, 2015 at 1:40 PM, Galina Kistanova via cfe-commits
 wrote:
> Hello everyone,
>
> Here are some buildbot statistics you may found interesting. I will be
> adding more statistics.
> My goal is to publish metrics to help with keeping the buildbot
> infrastructure healthy and improving it.

Thank you for tracking and reporting this information, that's fantastic!

>
> All the numbers are for the week of 11/8/2015 - 11/14/2015.
>
> Thanks
>
> Galina
>
>
>
> Number of commits by project:
>
>  project  |   commits
>  -
>  llvm |   286
>  cfe  |   109
>  lldb |76
>  compiler-rt  |71
>  polly|42
>  lld  |38
>  libcxx   |10
>  openmp   | 9
>  clang-tools-extra| 7
>  clang-tests-external | 2
>  libunwind| 1
>  -
>   651
>
>
> Number of completed builds, failed builds and average build time for
> successful builds per active builder:
>
>  buildername   | completed  |
> failed | time
> -
>  clang-aarch64-lnt | 57 |
> 3 | 02:30:12
>  clang-atom-d525-fedora| 18 |
> | 08:28:15
>  clang-atom-d525-fedora-rel| 83 |
> 5 | 01:29:55
>  clang-bpf-build   |310 |
> 31 | 00:02:53
>  clang-cmake-aarch64-42vma |278 |
> 49 | 00:16:47
>  clang-cmake-aarch64-quick |209 |
> 29 | 00:23:46
>  clang-cmake-armv7-a15 |189 |
> 8 | 00:25:27
>  clang-cmake-armv7-a15-full|154 |
> 38 | 00:45:32
>  clang-cmake-armv7-a15-selfhost| 58 |
> 24 | 03:00:19
>  clang-cmake-armv7-a15-selfhost-neon   | 45 |
> 22 | 04:26:31
>  clang-cmake-mips  |186 |
> 38 | 00:28:52
>  clang-cmake-thumbv7-a15   |178 |
> 7 | 00:28:30
>  clang-cmake-thumbv7-a15-full-sh   | 32 |
> 23 | 06:03:05
>  clang-hexagon-elf |169 |
> 23 | 00:24:42
>  clang-native-aarch64-full | 24 |
> 8 | 05:53:35
>  clang-native-arm-lnt  | 90 |
> 3 | 01:06:01
>  clang-native-arm-lnt-perf | 14 |
> | 08:57:04
>  clang-ppc64-elf-linux |120 |
> 6 | 01:01:02
>  clang-ppc64-elf-linux2| 89 |
> 24 | 01:29:49
>  clang-sphinx-docs |113 |
> | 00:00:20
>  clang-x64-ninja-win7  |285 |
> 58 | 00:09:49
>  clang-x86-win2008-selfhost|268 |
> 46 | 00:12:10
>  clang-x86_64-darwin13-cross-arm   |232 |
> 1 | 00:19:45
>  clang-x86_64-darwin13-cross-mingw32   |217 |
> 12 | 00:23:20
>  clang-x86_64-debian-fast  |147 |
> 12 | 00:11:37
>  clang-x86_64-linux-abi-test   |314 |
> 1 | 00:18:39
>  clang-x86_64-linux-selfhost-modules   |261 |
> 25 | 00:15:02
>  clang-x86_64-ubuntu-gdb-75|124 |
> 62 | 00:53:12
>  libcxx-libcxxabi-arm-linux|  8 |
> | 01:05:10
>  libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   | 11 |
> 2 | 00:08:50
>  libcxx-libcxxabi-x86_64-linux-debian  | 11 |
> 4 | 00:09:43
>  libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  5 |
> 2 | 00:09:24
>  libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 10 |
> 2 | 00:08:22
>  libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03| 10 |
> | 00:05:12
>  libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 10 |
> | 00:06:19
>  libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14|  9 |
> | 00:06:56
>  libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z| 10 |
> 2 | 00:06:06
>  libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 10 |
> 2 | 00:17:00
>  libcxx-libcxxabi-x86_64-linux-ubuntu-tsan 

Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-18 Thread Beren Minor via cfe-commits
berenm marked an inline comment as done.
berenm added a comment.

Ping?


http://reviews.llvm.org/D14325



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


Re: r253486 - Removing the AST matcher test for thread_local storage duration. Not all platforms support TLS, and on platforms that do not support it, use of thread_local causes an error. Since there'

2015-11-18 Thread Jonathan Roelofs via cfe-commits



On 11/18/15 11:37 AM, Aaron Ballman via cfe-commits wrote:

Author: aaronballman
Date: Wed Nov 18 12:37:29 2015
New Revision: 253486

URL: http://llvm.org/viewvc/llvm-project?rev=253486&view=rev
Log:
Removing the AST matcher test for thread_local storage duration. Not all 
platforms support TLS, and on platforms that do not support it, use of 
thread_local causes an error. Since there's no way to determine whether the 
testing platform supports TLS, there's no way to know whether the test is safe 
to run or not. I will explore ways to enable this test, but this will appease 
at least one more build bot.


Can you break it out in its own file, and then XFAIL on those platforms 
that don't support it?



Jon



Modified:
 cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=253486&r1=253485&r2=253486&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Nov 18 12:37:29 2015
@@ -1357,22 +1357,22 @@ TEST(Matcher, VarDecl_Storage) {

  TEST(Matcher, VarDecl_StorageDuration) {
std::string T =
-  "void f() { int x; static int y; thread_local int z; } int a;";
+  "void f() { int x; static int y; } int a;";

EXPECT_TRUE(matches(T, varDecl(hasName("x"), 
hasAutomaticStorageDuration(;
EXPECT_TRUE(
notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration(;
EXPECT_TRUE(
-  notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration(;
-  EXPECT_TRUE(
notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration(;

EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration(;
EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration(;
EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), 
hasStaticStorageDuration(;
-  EXPECT_TRUE(notMatches(T, varDecl(hasName("z"), 
hasStaticStorageDuration(;

-  EXPECT_TRUE(matches(T, varDecl(hasName("z"), hasThreadStorageDuration(;
+  // FIXME: It is really hard to test with thread_local itself because not all
+  // targets support TLS, which causes this to be an error depending on what
+  // platform the test is being run on. We do not have access to the TargetInfo
+  // object to be able to test whether the platform supports TLS or not.
EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), 
hasThreadStorageDuration(;
EXPECT_TRUE(notMatches(T, varDecl(hasName("y"), 
hasThreadStorageDuration(;
EXPECT_TRUE(notMatches(T, varDecl(hasName("a"), 
hasThreadStorageDuration(;


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



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253481 - Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.

2015-11-18 Thread Bruno Cardoso Lopes via cfe-commits
Hi Aaron,

There's one test failing now:
https://smooshbase.apple.com/ci/job/apple-clang-stage1-configure-R_master_check/7042/

FAIL: Clang-Unit ::
ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration
(8227 of 24324)
 TEST 'Clang-Unit ::
ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration'
FAILED 
Note: Google Test filter = Matcher.VarDecl_StorageDuration
[==] Running 1 test from 1 test case.
[--] Global test environment set-up.
[--] 1 test from Matcher
[ RUN  ] Matcher.VarDecl_StorageDuration
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1362:
Failure
Value of: matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1364:
Failure
Value of: notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1366:
Failure
Value of: notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1368:
Failure
Value of: notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1370:
Failure
Value of: matches(T, varDecl(hasName("y"), hasStaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1371:
Failure
Value of: matches(T, varDecl(hasName("a"), hasStaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1372:
Failure
Value of: notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1373:
Failure
Value of: notMatches(T, varDecl(hasName("z"), hasStaticStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1375:
Failure
Value of: matches(T, varDecl(hasName("z"), hasThreadStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1376:
Failure
Value of: notMatches(T, varDecl(hasName("x"), hasThreadStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1377:
Failure
Value of: notMatches(T, varDecl(hasName("y"), hasThreadStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
/Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1378:
Failure
Value of: notMatches(T, varDecl(hasName("a"), hasThreadStorageDuration()))
  Actual: false (Parsing error in "void f() { int x; static int y;
thread_local int z; } int a;")
Expected: true
[  FAILED  ] Matcher.VarDecl_StorageDuration (36 ms)
[--] 1 test from Matcher (36 ms total)

[--] Global test environment tear-down
[==] 1 test from 1 test case ran. (36 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Matcher.VarDecl_StorageDuration

 1 FAILED TEST
input.cc:1:33: error: thread-local storage is not supported for the
current target
void f() { int x; static int y; thread_local int z; } int a;
 

Re: r253481 - Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.

2015-11-18 Thread Aaron Ballman via cfe-commits
On Wed, Nov 18, 2015 at 2:07 PM, Bruno Cardoso Lopes
 wrote:
> Hi Aaron,
>
> There's one test failing now:
> https://smooshbase.apple.com/ci/job/apple-clang-stage1-configure-R_master_check/7042/

I have temporarily addressed this in r253486. The issue is that
thread_local isn't supported on all platforms.

~Aaron

>
> FAIL: Clang-Unit ::
> ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration
> (8227 of 24324)
>  TEST 'Clang-Unit ::
> ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration'
> FAILED 
> Note: Google Test filter = Matcher.VarDecl_StorageDuration
> [==] Running 1 test from 1 test case.
> [--] Global test environment set-up.
> [--] 1 test from Matcher
> [ RUN  ] Matcher.VarDecl_StorageDuration
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1362:
> Failure
> Value of: matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1364:
> Failure
> Value of: notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1366:
> Failure
> Value of: notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1368:
> Failure
> Value of: notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1370:
> Failure
> Value of: matches(T, varDecl(hasName("y"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1371:
> Failure
> Value of: matches(T, varDecl(hasName("a"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1372:
> Failure
> Value of: notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1373:
> Failure
> Value of: notMatches(T, varDecl(hasName("z"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1375:
> Failure
> Value of: matches(T, varDecl(hasName("z"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1376:
> Failure
> Value of: notMatches(T, varDecl(hasName("x"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1377:
> Failure
> Value of: notMatches(T, varDecl(hasName("y"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1378:
> Failure
> Value of: notMatches(T, varDecl(hasName("a"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> [  FAILED  ] Matcher.VarDecl_StorageDuration (36 ms)
> [--] 1 test from Matcher (36 ms total)
>
> [--] Global

Re: r253481 - Re-committing r253473 after hopefully fixing the bot breakage. There was a copy-pasta issue that my local testing did not catch.

2015-11-18 Thread Bruno Cardoso Lopes via cfe-commits
Ops, missed you follow up r253486 again.

Thanks,

On Wed, Nov 18, 2015 at 11:07 AM, Bruno Cardoso Lopes
 wrote:
> Hi Aaron,
>
> There's one test failing now:
> https://smooshbase.apple.com/ci/job/apple-clang-stage1-configure-R_master_check/7042/
>
> FAIL: Clang-Unit ::
> ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration
> (8227 of 24324)
>  TEST 'Clang-Unit ::
> ASTMatchers/Release+Asserts/ASTMatchersTests/Matcher.VarDecl_StorageDuration'
> FAILED 
> Note: Google Test filter = Matcher.VarDecl_StorageDuration
> [==] Running 1 test from 1 test case.
> [--] Global test environment set-up.
> [--] 1 test from Matcher
> [ RUN  ] Matcher.VarDecl_StorageDuration
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1362:
> Failure
> Value of: matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1364:
> Failure
> Value of: notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1366:
> Failure
> Value of: notMatches(T, varDecl(hasName("z"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1368:
> Failure
> Value of: notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1370:
> Failure
> Value of: matches(T, varDecl(hasName("y"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1371:
> Failure
> Value of: matches(T, varDecl(hasName("a"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1372:
> Failure
> Value of: notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1373:
> Failure
> Value of: notMatches(T, varDecl(hasName("z"), hasStaticStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1375:
> Failure
> Value of: matches(T, varDecl(hasName("z"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1376:
> Failure
> Value of: notMatches(T, varDecl(hasName("x"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1377:
> Failure
> Value of: notMatches(T, varDecl(hasName("y"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> /Users/buildslave/jenkins/sharedspace/apple-clang-stage1@2/clang/src/tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp:1378:
> Failure
> Value of: notMatches(T, varDecl(hasName("a"), hasThreadStorageDuration()))
>   Actual: false (Parsing error in "void f() { int x; static int y;
> thread_local int z; } int a;")
> Expected: true
> [  FAILED  ] Matcher.VarDecl_StorageDuration (36 ms)
> [--] 1 test from Matcher (36 ms total)
>
> [--] Global test environment tear-down
> [==] 1 test from 1 test case ra

Re: r253486 - Removing the AST matcher test for thread_local storage duration. Not all platforms support TLS, and on platforms that do not support it, use of thread_local causes an error. Since there'

2015-11-18 Thread Aaron Ballman via cfe-commits
On Wed, Nov 18, 2015 at 2:08 PM, Jonathan Roelofs
 wrote:
>
>
> On 11/18/15 11:37 AM, Aaron Ballman via cfe-commits wrote:
>>
>> Author: aaronballman
>> Date: Wed Nov 18 12:37:29 2015
>> New Revision: 253486
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=253486&view=rev
>> Log:
>> Removing the AST matcher test for thread_local storage duration. Not all
>> platforms support TLS, and on platforms that do not support it, use of
>> thread_local causes an error. Since there's no way to determine whether the
>> testing platform supports TLS, there's no way to know whether the test is
>> safe to run or not. I will explore ways to enable this test, but this will
>> appease at least one more build bot.
>
>
> Can you break it out in its own file, and then XFAIL on those platforms that
> don't support it?

Not easily -- these are tests run by gtest, not lit. What's more, the
"platforms that don't support it" is an unknown to me. Each individual
target gets to specify whether it supports TLS or not, so this would
be a fragile thing. Ideally, the unit testing framework would have
some information about the target platform it is being run on so that
I could decide dynamically whether to run the test or not.

Worst-case, I will white-list a few platforms where I know TLS is
supported, and only run the positive tests on those platforms.

~Aaron

>
>
> Jon
>
>
>>
>> Modified:
>>  cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>>
>> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=253486&r1=253485&r2=253486&view=diff
>>
>> ==
>> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
>> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Wed Nov 18
>> 12:37:29 2015
>> @@ -1357,22 +1357,22 @@ TEST(Matcher, VarDecl_Storage) {
>>
>>   TEST(Matcher, VarDecl_StorageDuration) {
>> std::string T =
>> -  "void f() { int x; static int y; thread_local int z; } int a;";
>> +  "void f() { int x; static int y; } int a;";
>>
>> EXPECT_TRUE(matches(T, varDecl(hasName("x"),
>> hasAutomaticStorageDuration(;
>> EXPECT_TRUE(
>> notMatches(T, varDecl(hasName("y"),
>> hasAutomaticStorageDuration(;
>> EXPECT_TRUE(
>> -  notMatches(T, varDecl(hasName("z"),
>> hasAutomaticStorageDuration(;
>> -  EXPECT_TRUE(
>> notMatches(T, varDecl(hasName("a"),
>> hasAutomaticStorageDuration(;
>>
>> EXPECT_TRUE(matches(T, varDecl(hasName("y"),
>> hasStaticStorageDuration(;
>> EXPECT_TRUE(matches(T, varDecl(hasName("a"),
>> hasStaticStorageDuration(;
>> EXPECT_TRUE(notMatches(T, varDecl(hasName("x"),
>> hasStaticStorageDuration(;
>> -  EXPECT_TRUE(notMatches(T, varDecl(hasName("z"),
>> hasStaticStorageDuration(;
>>
>> -  EXPECT_TRUE(matches(T, varDecl(hasName("z"),
>> hasThreadStorageDuration(;
>> +  // FIXME: It is really hard to test with thread_local itself because
>> not all
>> +  // targets support TLS, which causes this to be an error depending on
>> what
>> +  // platform the test is being run on. We do not have access to the
>> TargetInfo
>> +  // object to be able to test whether the platform supports TLS or not.
>> EXPECT_TRUE(notMatches(T, varDecl(hasName("x"),
>> hasThreadStorageDuration(;
>> EXPECT_TRUE(notMatches(T, varDecl(hasName("y"),
>> hasThreadStorageDuration(;
>> EXPECT_TRUE(notMatches(T, varDecl(hasName("a"),
>> hasThreadStorageDuration(;
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
> --
> Jon Roelofs
> jonat...@codesourcery.com
> CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Some buildbot statistics for the last week

2015-11-18 Thread Evgenii Stepanov via cfe-commits
Permanently failing bots are way better that 50/50 flaky bots, but
still not good.
As for the sanitizer-x86_64-linux-bootstrap, it shows some legitimate
failures in different parts of llvm that no one bothered to fix.
That's kinda understandable because MSan failures are hard to
reproduce locally (one needs to do a full bootstrap, including
libc++/libc++abi built w/ MSan), and FileCheck tends to show only part
of the report.


On Wed, Nov 18, 2015 at 10:43 AM, Aaron Ballman via llvm-commits
 wrote:
> On Wed, Nov 18, 2015 at 1:40 PM, Galina Kistanova via cfe-commits
>  wrote:
>> Hello everyone,
>>
>> Here are some buildbot statistics you may found interesting. I will be
>> adding more statistics.
>> My goal is to publish metrics to help with keeping the buildbot
>> infrastructure healthy and improving it.
>
> Thank you for tracking and reporting this information, that's fantastic!
>
>>
>> All the numbers are for the week of 11/8/2015 - 11/14/2015.
>>
>> Thanks
>>
>> Galina
>>
>>
>>
>> Number of commits by project:
>>
>>  project  |   commits
>>  -
>>  llvm |   286
>>  cfe  |   109
>>  lldb |76
>>  compiler-rt  |71
>>  polly|42
>>  lld  |38
>>  libcxx   |10
>>  openmp   | 9
>>  clang-tools-extra| 7
>>  clang-tests-external | 2
>>  libunwind| 1
>>  -
>>   651
>>
>>
>> Number of completed builds, failed builds and average build time for
>> successful builds per active builder:
>>
>>  buildername   | completed  |
>> failed | time
>> -
>>  clang-aarch64-lnt | 57 |
>> 3 | 02:30:12
>>  clang-atom-d525-fedora| 18 |
>> | 08:28:15
>>  clang-atom-d525-fedora-rel| 83 |
>> 5 | 01:29:55
>>  clang-bpf-build   |310 |
>> 31 | 00:02:53
>>  clang-cmake-aarch64-42vma |278 |
>> 49 | 00:16:47
>>  clang-cmake-aarch64-quick |209 |
>> 29 | 00:23:46
>>  clang-cmake-armv7-a15 |189 |
>> 8 | 00:25:27
>>  clang-cmake-armv7-a15-full|154 |
>> 38 | 00:45:32
>>  clang-cmake-armv7-a15-selfhost| 58 |
>> 24 | 03:00:19
>>  clang-cmake-armv7-a15-selfhost-neon   | 45 |
>> 22 | 04:26:31
>>  clang-cmake-mips  |186 |
>> 38 | 00:28:52
>>  clang-cmake-thumbv7-a15   |178 |
>> 7 | 00:28:30
>>  clang-cmake-thumbv7-a15-full-sh   | 32 |
>> 23 | 06:03:05
>>  clang-hexagon-elf |169 |
>> 23 | 00:24:42
>>  clang-native-aarch64-full | 24 |
>> 8 | 05:53:35
>>  clang-native-arm-lnt  | 90 |
>> 3 | 01:06:01
>>  clang-native-arm-lnt-perf | 14 |
>> | 08:57:04
>>  clang-ppc64-elf-linux |120 |
>> 6 | 01:01:02
>>  clang-ppc64-elf-linux2| 89 |
>> 24 | 01:29:49
>>  clang-sphinx-docs |113 |
>> | 00:00:20
>>  clang-x64-ninja-win7  |285 |
>> 58 | 00:09:49
>>  clang-x86-win2008-selfhost|268 |
>> 46 | 00:12:10
>>  clang-x86_64-darwin13-cross-arm   |232 |
>> 1 | 00:19:45
>>  clang-x86_64-darwin13-cross-mingw32   |217 |
>> 12 | 00:23:20
>>  clang-x86_64-debian-fast  |147 |
>> 12 | 00:11:37
>>  clang-x86_64-linux-abi-test   |314 |
>> 1 | 00:18:39
>>  clang-x86_64-linux-selfhost-modules   |261 |
>> 25 | 00:15:02
>>  clang-x86_64-ubuntu-gdb-75|124 |
>> 62 | 00:53:12
>>  libcxx-libcxxabi-arm-linux|  8 |
>> | 01:05:10
>>  libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   | 11 |
>> 2 | 00:08:50
>>  libcxx-libcxxabi-x86_64-linux-debian  | 11 |
>> 4 | 00:09:43
>>  libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  5

Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause

2015-11-18 Thread Kelvin Li via cfe-commits
kkwli0 marked 6 inline comments as done.
kkwli0 added a comment.

Address the comments and will post an updated patch.


http://reviews.llvm.org/D14134



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


Re: [PATCH] D14616: [libcxx] Replace TEST_HAS_NO_EXCEPTIONS with _LIBCPP_NO_EXCEPTIONS [NFC]

2015-11-18 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@jroelofs +1. We are trying to make our test suite generic enough that other 
STL maintainers may use it and contribute to it.


http://reviews.llvm.org/D14616



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


r253495 - [Sema] Don't work around a malformed AST

2015-11-18 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Wed Nov 18 13:49:19 2015
New Revision: 253495

URL: http://llvm.org/viewvc/llvm-project?rev=253495&view=rev
Log:
[Sema] Don't work around a malformed AST

We created a malformed TemplateSpecializationType: it was dependent but
had a RecordType as it's canonical type.  This would lead getAs to
crash.  r249090 worked around this but we should fix this for real by
providing a more appropriate template specialization type as the
canonical type.

This fixes PR24246.

Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=253495&r1=253494&r2=253495&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Nov 18 13:49:19 2015
@@ -3890,8 +3890,6 @@ void TypoCorrectionConsumer::addNamespac
   auto &Types = SemaRef.getASTContext().getTypes();
   for (unsigned I = 0; I != Types.size(); ++I) {
 const auto *TI = Types[I];
-if (!TI->isClassType() && isa(TI))
-  continue;
 if (CXXRecordDecl *CD = TI->getAsCXXRecordDecl()) {
   CD = CD->getCanonicalDecl();
   if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() &&

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=253495&r1=253494&r2=253495&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Nov 18 13:49:19 2015
@@ -6408,7 +6408,17 @@ Sema::ActOnClassTemplateSpecialization(S
 if (!PrevDecl)
   ClassTemplate->AddSpecialization(Specialization, InsertPos);
 
-CanonType = Context.getTypeDeclType(Specialization);
+if (CurContext->isDependentContext()) {
+  // -fms-extensions permits specialization of nested classes without
+  // fully specializing the outer class(es).
+  assert(getLangOpts().MicrosoftExt &&
+ "Only possible with -fms-extensions!");
+  TemplateName CanonTemplate = Context.getCanonicalTemplateName(Name);
+  CanonType = Context.getTemplateSpecializationType(
+  CanonTemplate, Converted.data(), Converted.size());
+} else {
+  CanonType = Context.getTypeDeclType(Specialization);
+}
   }
 
   // C++ [temp.expl.spec]p6:


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


Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause

2015-11-18 Thread Kelvin Li via cfe-commits
kkwli0 updated this revision to Diff 40537.
kkwli0 added a comment.

Updated patch with the 2nd review comments addressed.


http://reviews.llvm.org/D14134

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/OpenMPClause.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Basic/OpenMPKinds.h
  include/clang/Sema/Sema.h
  lib/AST/OpenMPClause.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/target_ast_print.cpp
  test/OpenMP/target_data_ast_print.cpp
  test/OpenMP/target_map_messages.cpp
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -2178,6 +2178,9 @@
 void OMPClauseEnqueue::VisitOMPDependClause(const OMPDependClause *C) {
   VisitOMPClauseList(C);
 }
+void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) {
+  VisitOMPClauseList(C);
+}
 }
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: test/OpenMP/target_map_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_map_messages.cpp
@@ -0,0 +1,207 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note 2 {{declared here}}
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 &s2):a(s2.a) { }
+  static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
+  static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 &s3):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 &s4);
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 &s5):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+
+S3 h;
+#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
+
+typedef int from;
+
+template  // expected-note {{declared here}}
+T tmain(T argc) {
+  const T d = 5;
+  const T da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  T i, t[20];
+  T &j = i;
+  T *k = &j;
+  T x;
+  T y;
+  T to, tofrom, always;
+  const T (&l)[5] = da;
+
+
+#pragma omp target map // expected-error {{expected '(' after 'map'}}
+#pragma omp target map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
+#pragma omp target map() // expected-error {{expected expression}}
+#pragma omp target map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
+#pragma omp target map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
+#pragma omp target map(to:) // expected-error {{expected expression}}
+#pragma omp target map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+#pragma omp target map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
+#pragma omp target map(x)
+  foo();
+#pragma omp target map(tofrom: t[:I])
+  foo();
+#pragma omp target map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
+  foo();
+#pragma omp target map(T) // expected-error {{'T' does not refer to a value}}
+  foo();
+#pragma omp target map(I) // expected-error 2 {{expected variable name, array element or array section}}
+  foo();
+#pragma omp target map(S2::S2s)
+  foo();
+#pragma omp target map(S2::S2sc)
+  foo();
+#pragma omp target map(x)
+  foo();
+#pragma omp target map(to: x)
+  foo();
+#pragma omp target map(to: to)
+  foo();
+#pragma omp target map(to)
+  foo();
+#pragma omp target map(to, x)
+  foo();
+#pragma omp target map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
+#pragma omp target map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected variable name, array element or array section}} 
+#pragma omp target map(argc)
+#pragma omp target map(S1) // expected-error {{'S1' does not refer to a value}}
+#pragma omp target map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
+#pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
+#pragma omp target map(ca)
+#pragma omp t

Re: [PATCH] D9600: Add scan-build python implementation

2015-11-18 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a reviewer: jroelofs.
jroelofs added a comment.
This revision is now accepted and ready to land.

Sounds reasonable and I can help with setting up the CMake & LIT goop once 
you've got it committed.

FWIW, I was able to get a simple example working by doing:

  $ mkdir -p $build/lib/python2.7/site-packages
  $ python setup.py build
  $ PYTHONPATH=$build/lib/python2.7/site-packages python setup.py install 
--prefix=$build
  $ cd path/to/example
  $ PYTHONPATH=$build/lib/python2.7/site-packages $build/bin/scan-build 
--override-compiler --use-cc $build/bin/clang --use-analyzer $build/bin/clang 
make

I wasn't able to get the libear interceptor to work on my Darwin machine, but 
that can be debugged later.


http://reviews.llvm.org/D9600



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


Re: [PATCH] D14779: Adding checker to detect excess padding in records

2015-11-18 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

> I may be mistaken, but this check looks more appropriate for Clang-tidy.


This is a syntactic check. Both clang-tidy as well as the clang static analyzer 
contain this type of checks. If we move all syntactic checks to clang-tidy, the 
users that use the analyzer but do not use clang-tidy will not receive the 
warnings. There is an issue in the opposite direction as well.


http://reviews.llvm.org/D14779



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


r253506 - [MSVC Compat] Make -Wmicrosoft-cast not an error by default

2015-11-18 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Wed Nov 18 15:42:38 2015
New Revision: 253506

URL: http://llvm.org/viewvc/llvm-project?rev=253506&view=rev
Log:
[MSVC Compat] Make -Wmicrosoft-cast not an error by default

Too much code is sloppy about this to error by default.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=253506&r1=253505&r2=253506&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 18 15:42:38 
2015
@@ -2713,8 +2713,7 @@ def warn_impcast_floating_point_to_bool
 InGroup;
 def ext_ms_impcast_fn_obj : ExtWarn<
   "implicit conversion between pointer-to-function and pointer-to-object is a "
-  "Microsoft extension">,
-  InGroup, DefaultError, SFINAEFailure;
+  "Microsoft extension">, InGroup;
 
 def warn_impcast_pointer_to_bool : Warning<
 "address of%select{| function| array}0 '%1' will always evaluate to "
@@ -5580,8 +5579,7 @@ def ext_cast_fn_obj : Extension<
   "cast between pointer-to-function and pointer-to-object is an extension">;
 def ext_ms_cast_fn_obj : ExtWarn<
   "static_cast between pointer-to-function and pointer-to-object is a "
-  "Microsoft extension">,
-  InGroup, DefaultError, SFINAEFailure;
+  "Microsoft extension">, InGroup;
 def warn_cxx98_compat_cast_fn_obj : Warning<
   "cast between pointer-to-function and pointer-to-object is incompatible with 
C++98">,
   InGroup, DefaultIgnore;

Modified: cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp?rev=253506&r1=253505&r2=253506&view=diff
==
--- cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp Wed Nov 18 15:42:38 
2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++98 
-Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions 
-Wno-error=microsoft-cast
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++98 
-Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions
 
 
 //MSVC allows forward enum declaration


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


Re: [PATCH] D13746: [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

2015-11-18 Thread Matthias Gehre via cfe-commits
mgehre added inline comments.


Comment at: 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-constant-array-index 
%t -- -config='{CheckOptions: [{key: 
cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: 
"dir1/gslheader.h"}]}' -- -std=c++11
+#include 
+// CHECK-FIXES: #include "dir1/gslheader.h"

chapuni wrote:
> Standard headers might be unavailable depending on a target, like host=linux 
> target=msvc.
> Could you improve it?
> 
> 
>   # Avoid 
>   # Introduce a new feature like "native"
> 
> 
Just to make sure that I understand this: The array header is unavailble 
because the target is a pre-C++11 msvc?

I can replace #include  by an stub definition of std::array. I'm not 
sure what you mean by 'Introduce a new feature like "native"'?


Repository:
  rL LLVM

http://reviews.llvm.org/D13746



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


Re: [PATCH] D13388: Add support for querying the visibility of a cursor

2015-11-18 Thread Michael Wu via cfe-commits
michaelwu added a comment.

Anyone mind landing this for me? I don't have commit access.


http://reviews.llvm.org/D13388



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


r253516 - [analyzer] Skip checking blocks in dependent contexts.

2015-11-18 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Wed Nov 18 16:46:52 2015
New Revision: 253516

URL: http://llvm.org/viewvc/llvm-project?rev=253516&view=rev
Log:
[analyzer] Skip checking blocks in dependent contexts.

Since we don't check functions in dependent contexts, we should skip blocks
in those contexts as well. This avoids an assertion failure when the
DeadStoresChecker attempts to evaluate an array subscript expression with
a dependent name type.

rdar://problem/23564220

Modified:
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/test/Analysis/dead-stores.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=253516&r1=253515&r2=253516&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Wed Nov 18 
16:46:52 2015
@@ -368,7 +368,11 @@ public:
   bool VisitBlockDecl(BlockDecl *BD) {
 if (BD->hasBody()) {
   assert(RecVisitorMode == AM_Syntax || Mgr->shouldInlineCall() == false);
-  HandleCode(BD, RecVisitorMode);
+  // Since we skip function template definitions, we should skip blocks
+  // declared in those functions as well.
+  if (!BD->isDependentContext()) {
+HandleCode(BD, RecVisitorMode);
+  }
 }
 return true;
   }

Modified: cfe/trunk/test/Analysis/dead-stores.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dead-stores.cpp?rev=253516&r1=253515&r2=253516&view=diff
==
--- cfe/trunk/test/Analysis/dead-stores.cpp (original)
+++ cfe/trunk/test/Analysis/dead-stores.cpp Wed Nov 18 16:46:52 2015
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -analyze 
-analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -analyze 
-analyzer-store=region -analyzer-constraints=range 
-analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fblocks -std=c++11 -analyze 
-analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fblocks -std=c++11 -analyze 
-analyzer-store=region -analyzer-constraints=range 
-analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
 
 
//===--===//
 // Basic dead store checking (but in C++ mode).
@@ -174,6 +174,20 @@ int radar_13213575() {
   return radar13213575_testit(5) + radar13213575_testit(3);
 }
 
+template 
+void test_block_in_dependent_context(typename T::some_t someArray) {
+  ^{
+ int i = someArray[0]; // no-warning
+  }();
+}
+
+void test_block_in_non_dependent_context(int *someArray) {
+  ^{
+ int i = someArray[0]; // expected-warning {{Value stored to 'i' during 
its initialization is never read}}
+  }();
+}
+
+
 
//===--===//
 // Dead store checking involving lambdas.
 
//===--===//


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


Re: [PATCH] D14779: Adding checker to detect excess padding in records

2015-11-18 Thread Ben Craig via cfe-commits
bcraig added a comment.

In http://reviews.llvm.org/D14779#292066, @zaks.anna wrote:

> > I may be mistaken, but this check looks more appropriate for Clang-tidy.
>
>
> This is a syntactic check. Both clang-tidy as well as the clang static 
> analyzer contain this type of checks. If we move all syntactic checks to 
> clang-tidy, the users that use the analyzer but do not use clang-tidy will 
> not receive the warnings. There is an issue in the opposite direction as well.


I am looking into clang-tidy, and if that's the way we need to go, then I'll do 
it, but I have a preference for this to exist in the static analyzer side of 
things.

Note that clang-tidy users get this "for free".  With no changes to clang tidy 
code, -checks=clang-analyzer-performance* will get you padding warnings.


http://reviews.llvm.org/D14779



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


r253519 - Fix debian build after r253512.

2015-11-18 Thread Pete Cooper via cfe-commits
Author: pete
Date: Wed Nov 18 16:53:40 2015
New Revision: 253519

URL: http://llvm.org/viewvc/llvm-project?rev=253519&view=rev
Log:
Fix debian build after r253512.

The conversion from QuantityType to the (temporary) IntegerAlignment class
was ambiguous.

For now add in explicit conversion to unsigned to satisfy the 
clang-x86_64-debian-fast bot.

I'll remove the explicit conversion when I remove the IntegerAlignment class.

Modified:
cfe/trunk/lib/CodeGen/CGBuilder.h

Modified: cfe/trunk/lib/CodeGen/CGBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=253519&r1=253518&r2=253519&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuilder.h (original)
+++ cfe/trunk/lib/CodeGen/CGBuilder.h Wed Nov 18 16:53:40 2015
@@ -273,13 +273,13 @@ public:
bool IsVolatile = false) {
 return CreateMemCpy(Dest.getPointer(), Src.getPointer(), Size,
 Dest.getAlignment().getQuantity(),
-Src.getAlignment().getQuantity(), IsVolatile);
+(unsigned)Src.getAlignment().getQuantity(), 
IsVolatile);
   }
   llvm::CallInst *CreateMemCpy(Address Dest, Address Src, uint64_t Size,
bool IsVolatile = false) {
 return CreateMemCpy(Dest.getPointer(), Src.getPointer(), Size,
 Dest.getAlignment().getQuantity(),
-Src.getAlignment().getQuantity(), IsVolatile);
+(unsigned)Src.getAlignment().getQuantity(), 
IsVolatile);
   }
 
   using CGBuilderBaseTy::CreateMemMove;
@@ -287,7 +287,8 @@ public:
 bool IsVolatile = false) {
 return CreateMemMove(Dest.getPointer(), Src.getPointer(), Size,
  Dest.getAlignment().getQuantity(),
- Src.getAlignment().getQuantity(), IsVolatile);
+ (unsigned)Src.getAlignment().getQuantity(),
+ IsVolatile);
   }
 
   using CGBuilderBaseTy::CreateMemSet;


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


Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-11-18 Thread Nathan Wilson via cfe-commits
nwilson added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2003
@@ +2002,3 @@
+def err_concept_specified_specialization : Error<
+  "%'concept' cannot be applied on an "
+  "%select{explicit instantiation|explicit specialization|partial 
specialization}0">;

aaron.ballman wrote:
> Is this an extraneous %?
Good catch. I'll remove it when making the commit.


Comment at: lib/Sema/SemaDecl.cpp:7659
@@ +7658,3 @@
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }

hubert.reinterpretcast wrote:
> I don't think the declaration should still be marked as a concept in this 
> case.
Hmm, Richard - did you have any thoughts about this? IIRC, we might be okay 
here by only looking at the concept flag of the primary template.


http://reviews.llvm.org/D13357



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


Re: [PATCH] Change memcpy/memmove/memset to have dest and source alignment

2015-11-18 Thread Pete Cooper via cfe-commits
Pushed this in LLVM r253511 and clang 253512.

Thanks again for the review Hal.

BTW, I realized the docs need to be updated.  I’ll let the bots run on this for 
a while and if it all goes well I’ll commit the docs update.

Cheers,
Pete
> On Nov 11, 2015, at 11:25 AM, Pete Cooper via cfe-commits 
>  wrote:
> 
> 
>> On Nov 11, 2015, at 11:16 AM, Hal Finkel > > wrote:
>> 
>> It seems like I dropped the ball on this. Yes, I recall being fine with them 
>> otherwise.
> Thanks Hal!  I’ll rebase the patches and land them over the next day or two.
> 
> Thanks,
> Pete
>> 
>> Thanks again,
>> Hal
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-11-18 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:7659
@@ +7658,3 @@
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }

nwilson wrote:
> hubert.reinterpretcast wrote:
> > I don't think the declaration should still be marked as a concept in this 
> > case.
> Hmm, Richard - did you have any thoughts about this? IIRC, we might be okay 
> here by only looking at the concept flag of the primary template.
A consideration:
When processing the body associated with the specialization, should the 
requirements for a function concept body be checked?


http://reviews.llvm.org/D13357



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


Re: [PATCH] D13746: [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index

2015-11-18 Thread NAKAMURA Takumi via cfe-commits
chapuni added inline comments.


Comment at: 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-constant-array-index 
%t -- -config='{CheckOptions: [{key: 
cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: 
"dir1/gslheader.h"}]}' -- -std=c++11
+#include 
+// CHECK-FIXES: #include "dir1/gslheader.h"

mgehre wrote:
> chapuni wrote:
> > Standard headers might be unavailable depending on a target, like 
> > host=linux target=msvc.
> > Could you improve it?
> > 
> > 
> >   # Avoid 
> >   # Introduce a new feature like "native"
> > 
> > 
> Just to make sure that I understand this: The array header is unavailble 
> because the target is a pre-C++11 msvc?
> 
> I can replace #include  by an stub definition of std::array. I'm not 
> sure what you mean by 'Introduce a new feature like "native"'?
It'd be good that stub version of .

"Features" mean like

```
REQUIRES: foo-supported-feature
```

See also clang-tools-extra/test/lit.cfg, or clang/test/lit.cfg.



Repository:
  rL LLVM

http://reviews.llvm.org/D13746



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


r253523 - [MS ABI] Let arbitrary entities participate in vftable ordering

2015-11-18 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Wed Nov 18 18:03:54 2015
New Revision: 253523

URL: http://llvm.org/viewvc/llvm-project?rev=253523&view=rev
Log:
[MS ABI] Let arbitrary entities participate in vftable ordering

In the Microsoft ABI, the vftable is laid out in the order in the
declaration order of the entities defined within it.

Obviously, only virtual methods end up in the vftable but they will be
placed into the table at the same position as the first entity with the
same name.

Modified:
cfe/trunk/lib/AST/VTableBuilder.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=253523&r1=253522&r2=253523&view=diff
==
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Wed Nov 18 18:03:54 2015
@@ -2882,22 +2882,26 @@ static void GroupNewVirtualOverloads(
   // Put the virtual methods into VirtualMethods in the proper order:
   // 1) Group overloads by declaration name. New groups are added to the
   //vftable in the order of their first declarations in this class
-  //(including overrides and non-virtual methods).
+  //(including overrides, non-virtual methods and any other named decl that
+  //might be nested within the class).
   // 2) In each group, new overloads appear in the reverse order of 
declaration.
   typedef SmallVector MethodGroup;
   SmallVector Groups;
   typedef llvm::DenseMap VisitedGroupIndicesTy;
   VisitedGroupIndicesTy VisitedGroupIndices;
-  for (const auto *MD : RD->methods()) {
-MD = MD->getCanonicalDecl();
+  for (const auto *D : RD->decls()) {
+const auto *ND = dyn_cast(D);
+if (!ND)
+  continue;
 VisitedGroupIndicesTy::iterator J;
 bool Inserted;
 std::tie(J, Inserted) = VisitedGroupIndices.insert(
-std::make_pair(MD->getDeclName(), Groups.size()));
+std::make_pair(ND->getDeclName(), Groups.size()));
 if (Inserted)
   Groups.push_back(MethodGroup());
-if (MD->isVirtual())
-  Groups[J->second].push_back(MD);
+if (const auto *MD = dyn_cast(ND))
+  if (MD->isVirtual())
+Groups[J->second].push_back(MD->getCanonicalDecl());
   }
 
   for (const MethodGroup &Group : Groups)

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp?rev=253523&r1=253522&r2=253523&view=diff
==
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp 
(original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp Wed 
Nov 18 18:03:54 2015
@@ -299,3 +299,18 @@ struct S {
 };
 
 S::S() {}
+
+struct T {
+  struct U {};
+};
+struct V : T {
+  // CHECK-LABEL: VFTable for 'V' (2 entries).
+  // CHECK-NEXT:   0 | void V::U()
+  // CHECK-NEXT:   1 | void V::f()
+  using T::U;
+  virtual void f();
+  virtual void U();
+  V();
+};
+
+V::V() {}


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


Re: [PATCH] D14737: Convert some ObjC msgSends to runtime calls

2015-11-18 Thread John McCall via cfe-commits
rjmccall added inline comments.


Comment at: include/clang/Basic/ObjCRuntime.h:182
@@ +181,3 @@
+switch (getKind()) {
+case FragileMacOSX: return false;
+case MacOSX: return getVersion() >= VersionTuple(10, 10);

I went ahead and asked Greg, and he agreed that it's best to not enable this on 
the Mac fragile runtime.  The functions exist, but they aren't profitable to 
call, other than a small code-size decrease.


http://reviews.llvm.org/D14737



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


Re: [PATCH] D14737: Convert some ObjC msgSends to runtime calls

2015-11-18 Thread Pete Cooper via cfe-commits

> On Nov 18, 2015, at 4:21 PM, John McCall  wrote:
> 
> rjmccall added inline comments.
> 
> 
> Comment at: include/clang/Basic/ObjCRuntime.h:182
> @@ +181,3 @@
> +switch (getKind()) {
> +case FragileMacOSX: return false;
> +case MacOSX: return getVersion() >= VersionTuple(10, 10);
> 
> I went ahead and asked Greg, and he agreed that it's best to not enable this 
> on the Mac fragile runtime.  The functions exist, but they aren't profitable 
> to call, other than a small code-size decrease.
Ah cool.  Thanks for checking.

I’m working on updating the patch now with your feedback.  Should have a new 
version soon.

I will now also add tests to ensure the fragile runtime does not get this 
change, since i’d been missing that before.

Thanks,
Pete
> 
> 
> http://reviews.llvm.org/D14737
> 
> 
> 

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


[PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-18 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: rjmccall, rnk, ABataev, hfinkel.
sfantao added a subscriber: cfe-commits.

This patch changes the generation of `CGFunctionInfo` to contain the 
`FunctionProtoType` if it is available. This enables the code generation for 
call instructions to look into this type for exception information and 
therefore generate better quality IR - it will not create invoke instructions 
for functions that are know not to throw.

The emission code had to be changed in a few places to keep the 
`FunctionProtoType` and, namely for the complex arithmetic library calls, 
create new `FunctionProtoType`s with the right exception information.

This patch is just a first step to have more accurate IR, as there may be other 
patterns that could take advantage of extra information. I'm just covering some 
cases I am aware of.

Thanks!
Samuel 

http://reviews.llvm.org/D14796

Files:
  include/clang/CodeGen/CGFunctionInfo.h
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CodeGenTypes.h
  test/CodeGenCXX/observe-noexcept.cpp

Index: test/CodeGenCXX/observe-noexcept.cpp
===
--- /dev/null
+++ test/CodeGenCXX/observe-noexcept.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -triple  powerpc64le-unknown-unknown -std=c++11 -fopenmp -fexceptions -fcxx-exceptions -O0 -emit-llvm %s -o - | FileCheck %s
+
+// Check that regions that install a terminate scope in the exception stack can
+// correctly generate complex arithmetic.
+
+// CHECK-LABEL: ffcomplex
+void ffcomplex (int a) {
+  double _Complex dc = (double)a;
+
+  // CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+  dc *= dc;
+  // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME1:@.*]] to void (i32*, i32*, ...)*), { double, double }* %{{.+}})
+  #pragma omp parallel
+  {
+dc *= dc;
+  }
+  // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME1]](
+// CHECK-NOT: invoke
+// CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+// CHECK-NOT: invoke
+// CHECK: ret void
+
+// Check if we are observing the function pointer attribute regardless what is
+// in the exception specification of the callees.
+void fnoexcp(void) noexcept;
+
+// CHECK-LABEL: foo
+void foo(int a, int b) {
+
+  void (*fptr)(void) noexcept = fnoexcp;
+
+  // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME2:@.*]] to void (i32*, i32*, ...)*), void ()** %{{.+}})
+  #pragma omp parallel
+  {
+fptr();
+  }
+  // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME2]](
+// CHECK-NOT: invoke
+// CHECK: call void %{{[0-9]+}}()
+// CHECK-NOT: invoke
+// CHECK: ret void
Index: lib/CodeGen/CodeGenTypes.h
===
--- lib/CodeGen/CodeGenTypes.h
+++ lib/CodeGen/CodeGenTypes.h
@@ -270,18 +270,41 @@
   const CGFunctionInfo &arrangeCXXMethodType(const CXXRecordDecl *RD,
  const FunctionProtoType *FTP);
 
+private:
+  /// Common generation of LLVM information for a call or type with the given
+  /// signature.
+  ///
+  /// \param argTypes - must all actually be canonical as params.
+  CGFunctionInfo &
+  commonArrangeLLVMFunctionInfo(CanQualType returnType, bool instanceMethod,
+bool chainCall, ArrayRef argTypes,
+FunctionType::ExtInfo info, RequiredArgs args);
+
+public:
   /// "Arrange" the LLVM information for a call or type with the given
   /// signature.  This is largely an internal method; other clients
   /// should use one of the above routines, which ultimately defer to
   /// this.
   ///
-  /// \param argTypes - must all actually be canonical as params
+  /// \param argTypes - must all actually be canonical as params.
   const CGFunctionInfo &arrangeLLVMFunctionInfo(CanQualType returnType,
 bool instanceMethod,
 bool chainCall,
 ArrayRef argTypes,
 FunctionType::ExtInfo info,
 RequiredArgs args);
+  /// "Arrange" the LLVM information for a call or type with the given
+  /// signature and include the function type in the resulting information.
+  /// Using this version should preferred given that the code generation is more
+  /// accurate if it has access to the function type.
+  ///
+  /// \param argTypes - must all actually be canonical as params.
+  /// \param funcTy - the type of the function being generated. Useful to get
+  /// extra information about the function to be called.
+  const CGFunctionInfo &
+  arrangeLLVMFunctionInfo(CanQualType returnType, bool instanceMethod,
+  bool chainCall

Re: [PATCH] D12614: [OpenMP] Offloading descriptor registration and device codegen.

2015-11-18 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Ping!


http://reviews.llvm.org/D12614



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


Re: [PATCH] D7606: Fix adress cast for C++ in SEMA

2015-11-18 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Ping!


http://reviews.llvm.org/D7606



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


Re: [PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-18 Thread John McCall via cfe-commits
rjmccall added a comment.

What I was thinking was something more along the lines of a little struct that 
stored either a Decl * or a FunctionType *, and you could change the TargetDecl 
argument to functions like EmitCall and ConstructAttributeList to that.  Maybe 
call it something like CalleeInfo?


http://reviews.llvm.org/D14796



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


r253532 - [analyzer] Improve modeling of static initializers.

2015-11-18 Thread Anna Zaks via cfe-commits
Author: zaks
Date: Wed Nov 18 19:25:28 2015
New Revision: 253532

URL: http://llvm.org/viewvc/llvm-project?rev=253532&view=rev
Log:
[analyzer] Improve modeling of static initializers.

Conversions between unrelated pointer types (e.g. char * and void *) involve
bitcasts which were not properly modeled in case of static initializers. The
patch fixes this problem.

The problem was originally spotted by Artem Dergachev. Patched by Yuri Gribov!

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
cfe/trunk/test/Analysis/inline.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp?rev=253532&r1=253531&r2=253532&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp Wed Nov 18 19:25:28 2015
@@ -275,11 +275,17 @@ Optional SValBuilder::getConstantV
 
   case Stmt::ImplicitCastExprClass: {
 const CastExpr *CE = cast(E);
-if (CE->getCastKind() == CK_ArrayToPointerDecay) {
-  Optional ArrayVal = getConstantVal(CE->getSubExpr());
-  if (!ArrayVal)
+switch (CE->getCastKind()) {
+default:
+  break;
+case CK_ArrayToPointerDecay:
+case CK_BitCast: {
+  const Expr *SE = CE->getSubExpr();
+  Optional Val = getConstantVal(SE);
+  if (!Val)
 return None;
-  return evalCast(*ArrayVal, CE->getType(), CE->getSubExpr()->getType());
+  return evalCast(*Val, CE->getType(), SE->getType());
+}
 }
 // FALLTHROUGH
   }

Modified: cfe/trunk/test/Analysis/inline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inline.cpp?rev=253532&r1=253531&r2=253532&view=diff
==
--- cfe/trunk/test/Analysis/inline.cpp (original)
+++ cfe/trunk/test/Analysis/inline.cpp Wed Nov 18 19:25:28 2015
@@ -275,7 +275,7 @@ namespace DefaultArgs {
 
 clang_analyzer_eval(defaultReferenceZero(1) == -1); // 
expected-warning{{TRUE}}
 clang_analyzer_eval(defaultReferenceZero() == 0); // 
expected-warning{{TRUE}}
-}
+  }
 
   double defaultFloatReference(const double &i = 42) {
 return -i;
@@ -300,6 +300,13 @@ namespace DefaultArgs {
 clang_analyzer_eval(defaultString("xyz") == 'y'); // 
expected-warning{{TRUE}}
 clang_analyzer_eval(defaultString() == 'b'); // expected-warning{{TRUE}}
   }
+
+  const void * const void_string = "abc";
+
+  void testBitcastedString() {
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval('b' == ((char *)void_string)[1]); // 
expected-warning{{TRUE}}
+  }
 }
 
 namespace OperatorNew {


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


Re: [PATCH] D14652: [analyzer] Improve modeling of static initializers.

2015-11-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253532: [analyzer] Improve modeling of static initializers. 
(authored by zaks).

Changed prior to commit:
  http://reviews.llvm.org/D14652?vs=40144&id=40582#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14652

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
  cfe/trunk/test/Analysis/inline.cpp

Index: cfe/trunk/test/Analysis/inline.cpp
===
--- cfe/trunk/test/Analysis/inline.cpp
+++ cfe/trunk/test/Analysis/inline.cpp
@@ -275,7 +275,7 @@
 
 clang_analyzer_eval(defaultReferenceZero(1) == -1); // 
expected-warning{{TRUE}}
 clang_analyzer_eval(defaultReferenceZero() == 0); // 
expected-warning{{TRUE}}
-}
+  }
 
   double defaultFloatReference(const double &i = 42) {
 return -i;
@@ -300,6 +300,13 @@
 clang_analyzer_eval(defaultString("xyz") == 'y'); // 
expected-warning{{TRUE}}
 clang_analyzer_eval(defaultString() == 'b'); // expected-warning{{TRUE}}
   }
+
+  const void * const void_string = "abc";
+
+  void testBitcastedString() {
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval('b' == ((char *)void_string)[1]); // 
expected-warning{{TRUE}}
+  }
 }
 
 namespace OperatorNew {
Index: cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -275,11 +275,17 @@
 
   case Stmt::ImplicitCastExprClass: {
 const CastExpr *CE = cast(E);
-if (CE->getCastKind() == CK_ArrayToPointerDecay) {
-  Optional ArrayVal = getConstantVal(CE->getSubExpr());
-  if (!ArrayVal)
+switch (CE->getCastKind()) {
+default:
+  break;
+case CK_ArrayToPointerDecay:
+case CK_BitCast: {
+  const Expr *SE = CE->getSubExpr();
+  Optional Val = getConstantVal(SE);
+  if (!Val)
 return None;
-  return evalCast(*ArrayVal, CE->getType(), CE->getSubExpr()->getType());
+  return evalCast(*Val, CE->getType(), SE->getType());
+}
 }
 // FALLTHROUGH
   }


Index: cfe/trunk/test/Analysis/inline.cpp
===
--- cfe/trunk/test/Analysis/inline.cpp
+++ cfe/trunk/test/Analysis/inline.cpp
@@ -275,7 +275,7 @@
 
 clang_analyzer_eval(defaultReferenceZero(1) == -1); // expected-warning{{TRUE}}
 clang_analyzer_eval(defaultReferenceZero() == 0); // expected-warning{{TRUE}}
-}
+  }
 
   double defaultFloatReference(const double &i = 42) {
 return -i;
@@ -300,6 +300,13 @@
 clang_analyzer_eval(defaultString("xyz") == 'y'); // expected-warning{{TRUE}}
 clang_analyzer_eval(defaultString() == 'b'); // expected-warning{{TRUE}}
   }
+
+  const void * const void_string = "abc";
+
+  void testBitcastedString() {
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval('b' == ((char *)void_string)[1]); // expected-warning{{TRUE}}
+  }
 }
 
 namespace OperatorNew {
Index: cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -275,11 +275,17 @@
 
   case Stmt::ImplicitCastExprClass: {
 const CastExpr *CE = cast(E);
-if (CE->getCastKind() == CK_ArrayToPointerDecay) {
-  Optional ArrayVal = getConstantVal(CE->getSubExpr());
-  if (!ArrayVal)
+switch (CE->getCastKind()) {
+default:
+  break;
+case CK_ArrayToPointerDecay:
+case CK_BitCast: {
+  const Expr *SE = CE->getSubExpr();
+  Optional Val = getConstantVal(SE);
+  if (!Val)
 return None;
-  return evalCast(*ArrayVal, CE->getType(), CE->getSubExpr()->getType());
+  return evalCast(*Val, CE->getType(), SE->getType());
+}
 }
 // FALLTHROUGH
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14652: [analyzer] Improve modeling of static initializers.

2015-11-18 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Fixed and committed.



Comment at: test/Analysis/inline.cpp:308
@@ +307,3 @@
+clang_analyzer_eval(0 != void_string); // expected-warning{{TRUE}}
+clang_analyzer_eval(0 != ((char *)void_string)[1]); // 
expected-warning{{TRUE}}
+  }

ygribov wrote:
> zaks.anna wrote:
> > Why are we checking that the first element is not '0'?
> We could check s[0] as well, there is no difference actually.
Why we are checking for non-equality to '0' instead of checking for equality to 
'b'?


Repository:
  rL LLVM

http://reviews.llvm.org/D14652



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


Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2015-11-18 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:7659
@@ +7658,3 @@
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_specified_specialization) << 1;
+  }

hubert.reinterpretcast wrote:
> nwilson wrote:
> > hubert.reinterpretcast wrote:
> > > I don't think the declaration should still be marked as a concept in this 
> > > case.
> > Hmm, Richard - did you have any thoughts about this? IIRC, we might be okay 
> > here by only looking at the concept flag of the primary template.
> A consideration:
> When processing the body associated with the specialization, should the 
> requirements for a function concept body be checked?
I think the `concept` flag logically belongs on the template declaration rather 
than on the templated declaration; moving it there would make this question 
irrelevant =)


http://reviews.llvm.org/D13357



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


Re: [PATCH] D14629: [analyzer] Configuration file for scan-build.

2015-11-18 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

> > Also, how is this different from -analyzer-config?

> 

> 

> -analyzer-config is used to transfers a number of options to the analyzer, 
> while configuration file is 

>  used to customize scan-build, ccc-analyzer and c++-analyzer scripts.


Could you elaborate on this a bit and explain the motivation behind this 
feature.

Laszlo Nagy is working on "reimplementing scan-build in python" (and improving 
the tool) effort. If the configuration file is a desirable feature, we should 
make sure it is applicable to both scan-builds.

Also, we should strive to move away from using Perl.

Adding Laszlo as a reviewer.


http://reviews.llvm.org/D14629



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


Re: [PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-18 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 40587.
sfantao added a comment.

Create `CGCalleeInfo` to forward the declaration and function type information 
during the emission of calls.


http://reviews.llvm.org/D14796

Files:
  include/clang/CodeGen/CGFunctionInfo.h
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGObjCGNU.cpp
  lib/CodeGen/CGObjCMac.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  test/CodeGenCXX/observe-noexcept.cpp

Index: test/CodeGenCXX/observe-noexcept.cpp
===
--- /dev/null
+++ test/CodeGenCXX/observe-noexcept.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -triple  powerpc64le-unknown-unknown -std=c++11 -fopenmp -fexceptions -fcxx-exceptions -O0 -emit-llvm %s -o - | FileCheck %s
+
+// Check that regions that install a terminate scope in the exception stack can
+// correctly generate complex arithmetic.
+
+// CHECK-LABEL: ffcomplex
+void ffcomplex (int a) {
+  double _Complex dc = (double)a;
+
+  // CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+  dc *= dc;
+  // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME1:@.*]] to void (i32*, i32*, ...)*), { double, double }* %{{.+}})
+  #pragma omp parallel
+  {
+dc *= dc;
+  }
+  // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME1]](
+// CHECK-NOT: invoke
+// CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+// CHECK-NOT: invoke
+// CHECK: ret void
+
+// Check if we are observing the function pointer attribute regardless what is
+// in the exception specification of the callees.
+void fnoexcp(void) noexcept;
+
+// CHECK-LABEL: foo
+void foo(int a, int b) {
+
+  void (*fptr)(void) noexcept = fnoexcp;
+
+  // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME2:@.*]] to void (i32*, i32*, ...)*), void ()** %{{.+}})
+  #pragma omp parallel
+  {
+fptr();
+  }
+  // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME2]](
+// CHECK-NOT: invoke
+// CHECK: call void %{{[0-9]+}}()
+// CHECK-NOT: invoke
+// CHECK: ret void
Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -968,16 +968,14 @@
   /// function type.
   ///
   /// \param Info - The function type information.
-  /// \param TargetDecl - The decl these attributes are being constructed
-  /// for. If supplied the attributes applied to this decl may contribute to the
-  /// function attributes and calling convention.
+  /// \param CalleeInfo - The callee information these attributes are being
+  /// constructed for. If valid, the attributes applied to this decl may
+  /// contribute to the function attributes and calling convention.
   /// \param PAL [out] - On return, the attribute list to use.
   /// \param CallingConv [out] - On return, the LLVM calling convention to use.
   void ConstructAttributeList(const CGFunctionInfo &Info,
-  const Decl *TargetDecl,
-  AttributeListType &PAL,
-  unsigned &CallingConv,
-  bool AttrOnCallSite);
+  CGCalleeInfo CalleeInfo, AttributeListType &PAL,
+  unsigned &CallingConv, bool AttrOnCallSite);
 
   StringRef getMangledName(GlobalDecl GD);
   StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD);
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2624,16 +2624,14 @@
   ///
   /// \param TargetDecl - If given, the decl of the function in a direct call;
   /// used to set attributes on the call (noreturn, etc.).
-  RValue EmitCall(const CGFunctionInfo &FnInfo,
-  llvm::Value *Callee,
-  ReturnValueSlot ReturnValue,
-  const CallArgList &Args,
-  const Decl *TargetDecl = nullptr,
+  RValue EmitCall(const CGFunctionInfo &FnInfo, llvm::Value *Callee,
+  ReturnValueSlot ReturnValue, const CallArgList &Args,
+  CGCalleeInfo CalleeInfo = CGCalleeInfo(),
   llvm::Instruction **callOrInvoke = nullptr);
 
   RValue EmitCall(QualType FnType, llvm::Value *Callee, const CallExpr *E,
   ReturnValueSlot ReturnValue,
-  const Decl *TargetDecl = nullptr,
+  CGCalleeInfo CalleeInfo = CGCalleeInfo(),
   llvm::Value *Chain = nullptr);
   RValue EmitCallExpr(const CallExpr *E,
   ReturnValueSlot ReturnValue = ReturnValueSlot());
Index: lib/CodeGen/CGObjCMac.cpp
===
--- lib/CodeGen/CGObjCMac.cpp
+++ lib/CodeG

Re: [PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

2015-11-18 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: include/clang/AST/Expr.h:631-634
@@ -630,1 +630,6 @@
 
+  /// \brief If the current Expr is either a pointer, this will try to
+  /// statically determine the number of bytes available where the pointer is
+  /// pointing.  Returns true if all of the above holds and we were able to
+  /// figure out the size, false otherwise.
+  ///

Looks OK, but you have an undesirable "either" in the comment now.


Comment at: include/clang/Basic/AttrDocs.td:272
@@ +271,3 @@
+  using ``__asm__("foo")`` to explicitly name your functions, thus preserving
+  your ABI; also, non-overloadable C functions with pass_object_size are
+  not mangled.

Missing `` around pass_object_size here.


Comment at: include/clang/Basic/AttrDocs.td:317
@@ +316,3 @@
+candidates are otherwise equally good, then the overload with one or more
+parameters with pass_object_size is preferred. This implies that the choice
+between two identical overloads both with ``pass_object_size`` on one or more

And here.


Comment at: include/clang/Basic/AttrDocs.td:351-355
@@ +350,7 @@
+
+* Only one use of pass_object_size is allowed per parameter.
+
+* It is an error to take the address of a function with pass_object_size on any
+  of its parameters. If you wish to do this, you can create an overload without
+  pass_object_size on any parameters.
+

And here.


Comment at: include/clang/Basic/AttrDocs.td:359
@@ +358,3 @@
+  are not pointers. Additionally, any parameter that ``pass_object_size`` is
+  applied to must be marked const at its function's definition.
+  }];

And around "const" here, maybe.


Comment at: include/clang/Sema/Initialization.h:832
@@ +831,3 @@
+/// \brief Trying to take the address of a function that doesn't support
+/// having its address taken
+FK_AddressOfUnaddressableFunction,

Add a period at the end of this comment.


Comment at: lib/AST/ExprConstant.cpp:6507-6509
@@ -6506,5 +6545,3 @@
 // handle all cases where the expression has side-effects.
-// Likewise, if Type is 3, we must handle this because CodeGen cannot give 
a
-// conservatively correct answer in that case.
-if (E->getArg(0)->HasSideEffects(Info.Ctx) || Type == 3)
   return Success((Type & 2) ? 0 : -1, E);

I don't disagree, but it seems logically similar to the `HasSideEffects` case, 
which is still here. Maybe that should be moved to `CodeGen` too.


Comment at: lib/AST/ExprConstant.cpp:9534
@@ +9533,3 @@
+
+  Result = llvm::APInt(/*NumBits=*/64, Size, /*IsSigned=*/true);
+  return true;

I would expect this to produce a `size_t`, rather than an arbitrary-seeming 
signed 64-bit integer. It also seems suspicious to be converting a uint64_t to 
a signed `APInt` here.


Comment at: lib/AST/ItaniumMangle.cpp:2205
@@ +2204,3 @@
+
+if (FD != nullptr) {
+  if (auto *Attr = FD->getParamDecl(I)->getAttr()) {

`if (FD)` is more common in these parts.


Comment at: lib/CodeGen/CGCall.cpp:110
@@ +109,3 @@
+  // pass_object_size. So, we preallocate for the common case.
+  prefix.reserve(FPT->getNumParams());
+

Given that this appends, `reserve(prefix.size() + FPT->getNumParams())` seems 
better.


Comment at: lib/CodeGen/CGCall.cpp:2847-2849
@@ -2803,4 +2846,5 @@
   EmitCallArg(Args, *Arg, ArgTypes[I]);
+  MaybeEmitImplicitObjectSize(I, *Arg);
   EmitNonNullArgCheck(Args.back().RV, ArgTypes[I], (*Arg)->getExprLoc(),
   CalleeDecl, ParamsToSkip + I);
 }

These seem to be in the wrong order, and the call to `Args.back()` will 
misbehave if a parameter is marked with `__attribute__((nonnull, 
pass_object_size(N)))`. Swap these calls over.


Comment at: lib/CodeGen/CGCall.cpp:2862-2864
@@ -2817,4 +2861,5 @@
 EmitCallArg(Args, *Arg, ArgTypes[I]);
+MaybeEmitImplicitObjectSize(I, *Arg);
 EmitNonNullArgCheck(Args.back().RV, ArgTypes[I], (*Arg)->getExprLoc(),
 CalleeDecl, ParamsToSkip + I);
   }

Likewise.


Comment at: lib/Sema/SemaOverload.cpp:8832-8834
@@ +8831,5 @@
+
+  auto HasPassObjSize = std::mem_fn(&ParmVarDecl::hasAttr);
+
+  auto I = std::find_if(FD->param_begin(), FD->param_end(), HasPassObjSize);
+  if (I == FD->param_end()) {

Any reason why you factor out `HasPassObjSize` here and not in the previous 
(essentially identical) function? And can you factor this out into a 
`getPassObjectSizeParamIndex` function or something, to avoid some of the 
duplication between this and the previous function?


http://reviews.llvm.org/D13263



___
cfe-commits mailing list
cfe-c

Re: [PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-18 Thread Samuel Antao via cfe-commits
sfantao added a comment.

In http://reviews.llvm.org/D14796#292336, @rjmccall wrote:

> What I was thinking was something more along the lines of a little struct 
> that stored either a Decl * or a FunctionType *, and you could change the 
> TargetDecl argument to functions like EmitCall and ConstructAttributeList to 
> that.  Maybe call it something like CalleeInfo?


Ok, in the new diff I am encoding the declaration and type in a new struct 
instead of using `CGFunctionInfo` to keep the type.

Let me know your comments.

Thanks!
Samuel


http://reviews.llvm.org/D14796



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


r253533 - Fix the emission of ARC-style ivar layouts in the fragile runtime

2015-11-18 Thread John McCall via cfe-commits
Author: rjmccall
Date: Wed Nov 18 20:27:55 2015
New Revision: 253533

URL: http://llvm.org/viewvc/llvm-project?rev=253533&view=rev
Log:
Fix the emission of ARC-style ivar layouts in the fragile runtime
to start at the offset of the first ivar instead of the rounded-up
end of the superclass.  The latter could include a large amount of
tail padding because of a highly-aligned ivar, and subclass ivars
can be laid out within that.

Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjC/mrc-weak.m

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=253533&r1=253532&r2=253533&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Nov 18 20:27:55 2015
@@ -4927,7 +4927,7 @@ CGObjCCommonMac::BuildIvarLayout(const O
   // ARC layout strings only include the class's ivars.  In non-fragile
   // runtimes, that means starting at InstanceStart, rounded up to word
   // alignment.  In fragile runtimes, there's no InstanceStart, so it means
-  // starting at the end of the superclass, rounded up to word alignment.
+  // starting at the offset of the first ivar, rounded up to word alignment.
   //
   // MRC weak layout strings follow the ARC style.
   CharUnits baseOffset;
@@ -4938,10 +4938,9 @@ CGObjCCommonMac::BuildIvarLayout(const O
 
 if (isNonFragileABI()) {
   baseOffset = beginOffset; // InstanceStart
-} else if (auto superClass = OI->getSuperClass()) {
-  auto startOffset =
-CGM.getContext().getASTObjCInterfaceLayout(superClass).getSize();
-  baseOffset = startOffset;
+} else if (!ivars.empty()) {
+  baseOffset =
+CharUnits::fromQuantity(ComputeIvarBaseOffset(CGM, OMD, ivars[0]));
 } else {
   baseOffset = CharUnits::Zero();
 }

Modified: cfe/trunk/test/CodeGenObjC/mrc-weak.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/mrc-weak.m?rev=253533&r1=253532&r2=253533&view=diff
==
--- cfe/trunk/test/CodeGenObjC/mrc-weak.m (original)
+++ cfe/trunk/test/CodeGenObjC/mrc-weak.m Wed Nov 18 20:27:55 2015
@@ -6,6 +6,26 @@
 - (void) run;
 @end
 
+// The ivars in HighlyAlignedSubclass should be placed in the tail-padding
+// of the superclass.  Ensure that they're still covered by layouts.
+@interface HighlyAligned : Object {
+  __attribute__((aligned(32))) void *array[2];
+}
+@end
+// CHECK-MODERN: @"OBJC_IVAR_$_HighlyAlignedSubclass.ivar2" = global i64 24,
+// CHECK-MODERN: @"OBJC_IVAR_$_HighlyAlignedSubclass.ivar" = global i64 16,
+// CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\02\00"
+// CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_HighlyAlignedSubclass" = {{.*}} {
+// CHECK-FRAGILE: @OBJC_INSTANCE_VARIABLES_HighlyAlignedSubclass = {{.*}}, i32 
8 }, {{.*}}, i32 12 }]
+// CHECK-FRAGILE: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\02\00"
+// CHECK-FRAGILE: @OBJC_CLASS_HighlyAlignedSubclass
+@interface HighlyAlignedSubclass : HighlyAligned {
+  __weak id ivar;
+  __weak id ivar2;
+}
+@end
+@implementation HighlyAlignedSubclass @end
+
 // CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\01\00"
 // CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_Foo" = {{.*}} { i32 772
 //   772 == 0x304


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


r253534 - Don't actually add the __unsafe_unretained qualifier in MRC;

2015-11-18 Thread John McCall via cfe-commits
Author: rjmccall
Date: Wed Nov 18 20:28:03 2015
New Revision: 253534

URL: http://llvm.org/viewvc/llvm-project?rev=253534&view=rev
Log:
Don't actually add the __unsafe_unretained qualifier in MRC;
driving a canonical difference between that and an unqualified
type is a really bad idea when both are valid.  Instead, remember
that it was there in a non-canonical way, then look for that in
the one place we really care about it: block captures.  The net
effect closely resembles the behavior of a decl attribute, except
still closely following ARC's standard qualifier parsing rules.

Added:
cfe/trunk/test/CodeGenObjCXX/mrc-weak.mm
  - copied, changed from r253533, cfe/trunk/test/CodeGenObjC/mrc-weak.m
Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenObjC/mrc-weak.m
cfe/trunk/test/SemaObjC/mrc-weak.m

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=253534&r1=253533&r2=253534&view=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Wed Nov 18 20:28:03 2015
@@ -1668,6 +1668,7 @@ public:
   bool isObjCQualifiedClassType() const;// Class
   bool isObjCObjectOrInterfaceType() const;
   bool isObjCIdType() const;// id
+  bool isObjCInertUnsafeUnretainedType() const;
 
   /// Whether the type is Objective-C 'id' or a __kindof type of an
   /// object type, e.g., __kindof NSView * or __kindof id
@@ -3636,6 +3637,7 @@ public:
 attr_nullable,
 attr_null_unspecified,
 attr_objc_kindof,
+attr_objc_inert_unsafe_unretained,
   };
 
 private:

Modified: cfe/trunk/lib/AST/Type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=253534&r1=253533&r2=253534&view=diff
==
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Wed Nov 18 20:28:03 2015
@@ -510,6 +510,28 @@ bool Type::isObjCClassOrClassKindOfType(
   return OPT->isObjCClassType() || OPT->isObjCQualifiedClassType();
 }
 
+/// Was this type written with the special inert-in-MRC __unsafe_unretained
+/// qualifier?
+///
+/// This approximates the answer to the following question: if this
+/// translation unit were compiled in ARC, would this type be qualified
+/// with __unsafe_unretained?
+bool Type::isObjCInertUnsafeUnretainedType() const {
+  const Type *cur = this;
+  while (true) {
+if (auto attributed = dyn_cast(cur)) {
+  if (attributed->getAttrKind() ==
+AttributedType::attr_objc_inert_unsafe_unretained)
+return true;
+}
+
+// Single-step desugar until we run out of sugar.
+QualType next = cur->getLocallyUnqualifiedSingleStepDesugaredType();
+if (next.getTypePtr() == cur) return false;
+cur = next.getTypePtr();
+  }
+}
+
 ObjCObjectType::ObjCObjectType(QualType Canonical, QualType Base,
ArrayRef typeArgs,
ArrayRef protocols,
@@ -2952,6 +2974,7 @@ bool AttributedType::isQualifier() const
   case AttributedType::attr_address_space:
   case AttributedType::attr_objc_gc:
   case AttributedType::attr_objc_ownership:
+  case AttributedType::attr_objc_inert_unsafe_unretained:
   case AttributedType::attr_nonnull:
   case AttributedType::attr_nullable:
   case AttributedType::attr_null_unspecified:
@@ -3010,6 +3033,7 @@ bool AttributedType::isCallingConv() con
   case attr_neon_polyvector_type:
   case attr_objc_gc:
   case attr_objc_ownership:
+  case attr_objc_inert_unsafe_unretained:
   case attr_noreturn:
   case attr_nonnull:
   case attr_nullable:

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=253534&r1=253533&r2=253534&view=diff
==
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Wed Nov 18 20:28:03 2015
@@ -1191,6 +1191,10 @@ void TypePrinter::printAttributedAfter(c
 
   printAfter(T->getModifiedType(), OS);
 
+  // Don't print the inert __unsafe_unretained attribute at all.
+  if (T->getAttrKind() == AttributedType::attr_objc_inert_unsafe_unretained)
+return;
+
   // Print nullability type specifiers that occur after
   if (T->getAttrKind() == AttributedType::attr_nonnull ||
   T->getAttrKind() == AttributedType::attr_nullable ||

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=253534&r1=253533&r2=253534&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/

r253535 - [coroutines] Tweak diagnostics to always use fully-qualified name for std::coroutine_traits.

2015-11-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov 18 20:36:35 2015
New Revision: 253535

URL: http://llvm.org/viewvc/llvm-project?rev=253535&view=rev
Log:
[coroutines] Tweak diagnostics to always use fully-qualified name for 
std::coroutine_traits.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=253535&r1=253534&r2=253535&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 18 20:36:35 
2015
@@ -7971,14 +7971,14 @@ def ext_coroutine_without_co_await_co_yi
 def err_implied_std_coroutine_traits_not_found : Error<
   "you need to include  before defining a coroutine">;
 def err_malformed_std_coroutine_traits : Error<
-  "std::coroutine_traits must be a class template">;
+  "'std::coroutine_traits' must be a class template">;
 def err_implied_std_coroutine_traits_promise_type_not_found : Error<
-  "this function cannot be a coroutine: %0 has no member named 
'promise_type'">;
+  "this function cannot be a coroutine: %q0 has no member named 
'promise_type'">;
 def err_implied_std_coroutine_traits_promise_type_not_class : Error<
   "this function cannot be a coroutine: %0 is not a class">;
 def err_coroutine_traits_missing_specialization : Error<
   "this function cannot be a coroutine: missing definition of "
-  "specialization %0">;
+  "specialization %q0">;
 }
 
 let CategoryName = "Documentation Issue" in {

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=253535&r1=253534&r2=253535&view=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Wed Nov 18 20:36:35 2015
@@ -82,6 +82,12 @@ static QualType lookupPromiseType(Sema &
   // The promise type is required to be a class type.
   QualType PromiseType = S.Context.getTypeDeclType(Promise);
   if (!PromiseType->getAsCXXRecordDecl()) {
+// Use the fully-qualified name of the type.
+auto *NNS = NestedNameSpecifier::Create(S.Context, nullptr, Std);
+NNS = NestedNameSpecifier::Create(S.Context, NNS, false,
+  CoroTrait.getTypePtr());
+PromiseType = S.Context.getElaboratedType(ETK_None, NNS, PromiseType);
+
 S.Diag(Loc, diag::err_implied_std_coroutine_traits_promise_type_not_class)
   << PromiseType;
 return QualType();

Modified: cfe/trunk/test/SemaCXX/coroutines.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/coroutines.cpp?rev=253535&r1=253534&r2=253535&view=diff
==
--- cfe/trunk/test/SemaCXX/coroutines.cpp (original)
+++ cfe/trunk/test/SemaCXX/coroutines.cpp Wed Nov 18 20:36:35 2015
@@ -21,7 +21,12 @@ void no_specialization() {
 template struct std::coroutine_traits {};
 
 int no_promise_type() {
-  co_await a; // expected-error {{this function cannot be a coroutine: 
'coroutine_traits' has no member named 'promise_type'}}
+  co_await a; // expected-error {{this function cannot be a coroutine: 
'std::coroutine_traits' has no member named 'promise_type'}}
+}
+
+template<> struct std::coroutine_traits { typedef int 
promise_type; };
+double bad_promise_type(double) {
+  co_await a; // expected-error {{this function cannot be a coroutine: 
'std::coroutine_traits::promise_type' (aka 'int') is not a 
class}}
 }
 
 struct promise; // expected-note {{forward declaration}}


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


[PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-18 Thread Vinicius Tinti via cfe-commits
tinti created this revision.
tinti added reviewers: rengolin, zatrazz, compnerd.
tinti added a subscriber: cfe-commits.
tinti set the repository for this revision to rL LLVM.

Clang should not convert tokens to Unicode when preprocessing assembly
files.

Fixes PR25558

Repository:
  rL LLVM

http://reviews.llvm.org/D14804

Files:
  lib/Lex/Lexer.cpp
  test/CodeGen/asm-unicode.S
  test/CodeGen/c-unicode.c

Index: test/CodeGen/c-unicode.c
===
--- test/CodeGen/c-unicode.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
-// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
-int \uaccess = 0;
-// ALLOWED: "곎ss":
-// ALLOWED-NOT: "\uaccess":
-// DENIED: warning: universal character names are only valid in C99 or C++; 
treating as '\' followed by identifier [-Wunicode]
-// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- test/CodeGen/asm-unicode.S
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s
-.macro  my_macro, trace=1, uaccess=1
-.if \uaccess
-// CHECK: .if \uaccess
-// CHECK-NOT: .if 곎ss
-// CHECK: my_macro trace=1
-my_macro trace=1
-.endif
-.endm
-
-foo:
-my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,9 +1354,7 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1373,9 +1371,7 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);


Index: test/CodeGen/c-unicode.c
===
--- test/CodeGen/c-unicode.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
-// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
-int \uaccess = 0;
-// ALLOWED: "곎ss":
-// ALLOWED-NOT: "\uaccess":
-// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
-// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- test/CodeGen/asm-unicode.S
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s
-.macro  my_macro, trace=1, uaccess=1
-.if \uaccess
-// CHECK: .if \uaccess
-// CHECK-NOT: .if 곎ss
-// CHECK: my_macro trace=1
-my_macro trace=1
-.endif
-.endm
-
-foo:
-my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,9 +1354,7 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1373,9 +1371,7 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.AsmPreprocessor) {
-return false;
-  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-18 Thread Vinicius Tinti via cfe-commits
tinti removed rL LLVM as the repository for this revision.
tinti updated this revision to Diff 40595.

http://reviews.llvm.org/D14804

Files:
  lib/Lex/Lexer.cpp
  test/CodeGen/asm-unicode.S
  test/CodeGen/c-unicode.c

Index: test/CodeGen/c-unicode.c
===
--- /dev/null
+++ test/CodeGen/c-unicode.c
@@ -0,0 +1,7 @@
+// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
+// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
+int \uaccess = 0;
+// ALLOWED: "곎ss":
+// ALLOWED-NOT: "\uaccess":
+// DENIED: warning: universal character names are only valid in C99 or C++; 
treating as '\' followed by identifier [-Wunicode]
+// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- /dev/null
+++ test/CodeGen/asm-unicode.S
@@ -0,0 +1,12 @@
+// RUN: %clang -S %s -o - | FileCheck %s
+.macro  my_macro, trace=1, uaccess=1
+.if \uaccess
+// CHECK: .if \uaccess
+// CHECK-NOT: .if 곎ss
+// CHECK: my_macro trace=1
+my_macro trace=1
+.endif
+.endm
+
+foo:
+my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,7 +1354,9 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1371,7 +1373,9 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);


Index: test/CodeGen/c-unicode.c
===
--- /dev/null
+++ test/CodeGen/c-unicode.c
@@ -0,0 +1,7 @@
+// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
+// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
+int \uaccess = 0;
+// ALLOWED: "곎ss":
+// ALLOWED-NOT: "\uaccess":
+// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
+// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===
--- /dev/null
+++ test/CodeGen/asm-unicode.S
@@ -0,0 +1,12 @@
+// RUN: %clang -S %s -o - | FileCheck %s
+.macro  my_macro, trace=1, uaccess=1
+.if \uaccess
+// CHECK: .if \uaccess
+// CHECK-NOT: .if 곎ss
+// CHECK: my_macro trace=1
+my_macro trace=1
+.endif
+.endm
+
+foo:
+my_macro trace=0
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,7 +1354,9 @@
 }
 
 static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
 C11AllowedIDCharRanges);
 return C11AllowedIDChars.contains(C);
@@ -1371,7 +1373,9 @@
 
 static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
   assert(isAllowedIDChar(C, LangOpts));
-  if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+  if (LangOpts.AsmPreprocessor) {
+return false;
+  } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
 static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
 C11DisallowedInitialIDCharRanges);
 return !C11DisallowedInitialIDChars.contains(C);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-18 Thread Mehdi AMINI via cfe-commits
joker.eph added a comment.

Isn't the patch reversed or do I miss something?


Repository:
  rL LLVM

http://reviews.llvm.org/D14804



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


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-18 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: test/Analysis/qt_malloc.cpp:11
@@ +10,3 @@
+  QCoreApplication::postEvent(obj, event);
+  QApplication::postEvent(obj, event);
+}

Should the leak be reported when the object is passed to  
QApplication::postEvent?

 In this test, 'event' escapes during one of these calls and the rest of the 
calls are not tested/make no difference. If you want to test that 'event' 
escapes when each of them is called, you'd need to test each of them with a 
different object.


http://reviews.llvm.org/D14170



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


Re: [PATCH] D14804: [clang] Disable Unicode in asm files

2015-11-18 Thread Mehdi AMINI via cfe-commits
joker.eph added a comment.

LGTM, please wait for another pair of eye.


Repository:
  rL LLVM

http://reviews.llvm.org/D14804



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


Re: [PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-18 Thread John McCall via cfe-commits
rjmccall added a comment.

That's exactly what I was looking for, thanks.



Comment at: lib/CodeGen/CGExpr.cpp:3751
@@ +3750,3 @@
+  // Preserve the function proto type because it contains useful information
+  // that we may be interested in using later on in the code generation.
+  const FunctionProtoType *InitalFTP = CalleeType->getAs()

Please work the following clarification into this comment:  we specifically 
need to preserve the non-canonical function type because things like exception 
specifications disappear in the canonical type.


http://reviews.llvm.org/D14796



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


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-18 Thread Evgeniy Dushistov via cfe-commits
Dushistov updated this revision to Diff 40596.
Dushistov added a comment.

Make test for usage of different variants of postEvent more robust.


http://reviews.llvm.org/D14170

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/Inputs/qt-simulator.h
  test/Analysis/qt_malloc.cpp

Index: test/Analysis/qt_malloc.cpp
===
--- /dev/null
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -analyze 
-analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus
 -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *e1 = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, 
e1);
+  QEvent *e2 = new QEvent(QEvent::None);
+  QCoreApplication::instance()->postEvent(obj, e2);
+  QEvent *e3 = new QEvent(QEvent::None);
+  QCoreApplication::postEvent(obj, e3);
+  QEvent *e4 = new QEvent(QEvent::None);
+  QApplication::postEvent(obj, e4);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- /dev/null
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,11 @@
 return true;
   }
 
+  if (FName == "postEvent" &&
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the


Index: test/Analysis/qt_malloc.cpp
===
--- /dev/null
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *e1 = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, e1);
+  QEvent *e2 = new QEvent(QEvent::None);
+  QCoreApplication::instance()->postEvent(obj, e2);
+  QEvent *e3 = new QEvent(QEvent::None);
+  QCoreApplication::postEvent(obj, e3);
+  QEvent *e4 = new QEvent(QEvent::None);
+  QApplication::postEvent(obj, e4);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- /dev/null
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,11 @@
 return true;
   }
 
+  if (FName == "postEvent" &&
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >