Re: [PATCH] D5102: [analyzer][Bugfix/improvement] Fix for PR16833

2015-08-20 Thread Aleksei Sidorin via cfe-commits
a.sidorin updated this revision to Diff 32664.
a.sidorin marked an inline comment as done.
a.sidorin added a comment.

Remove duplicating assertion.


http://reviews.llvm.org/D5102

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
  lib/Analysis/CFG.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
  lib/StaticAnalyzer/Core/SimpleConstraintManager.h
  test/Analysis/switch-case.c

Index: test/Analysis/switch-case.c
===
--- /dev/null
+++ test/Analysis/switch-case.c
@@ -0,0 +1,220 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s
+
+void clang_analyzer_eval(int);
+void clang_analyzer_warnIfReached();
+
+#define INT_MIN 0x8000
+#define INT_MAX 0x7fff
+
+// PR16833: Analyzer consumes memory until killed by kernel OOM killer
+// while analyzing large case ranges.
+void PR16833(unsigned op) {
+  switch (op) {
+  case 0x02 << 26 ... 0x03 << 26: // Analyzer should not hang here.
+return;
+  }
+}
+
+void testAdjustment(int t) {
+  switch (t + 1) {
+  case 2:
+clang_analyzer_eval(t == 1); // expected-warning{{TRUE}}
+break;
+  case 3 ... 10:
+clang_analyzer_eval(t > 1);// expected-warning{{TRUE}}
+clang_analyzer_eval(t + 2 <= 11);  // expected-warning{{TRUE}}
+clang_analyzer_eval(t > 2);// expected-warning{{UNKNOWN}}
+clang_analyzer_eval(t + 1 == 3);   // expected-warning{{UNKNOWN}}
+clang_analyzer_eval(t + 1 == 10);  // expected-warning{{UNKNOWN}}
+break;
+  default:
+clang_analyzer_warnIfReached();// expected-warning{{REACHABLE}}
+  }
+}
+
+void testUnknownVal(int value, int mask) {
+  // Once ConstraintManager will process '&' and this test will require some changes.
+  switch (value & mask) {
+case 1:
+  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  break;
+case 3 ... 10:
+  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  break;
+default:
+  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  }
+}
+
+void testSwitchCond(int arg) {
+  if (arg > 10) {
+switch (arg) {
+case INT_MIN ... 10:
+  clang_analyzer_warnIfReached(); // no-warning
+  break;
+case 11 ... 20:
+  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+  break;
+default:
+  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
+
+switch (arg) {
+case INT_MIN ... 9:
+  clang_analyzer_warnIfReached();  // no-warning
+  break;
+case 10 ... 20:
+  clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+  clang_analyzer_eval(arg > 10);   // expected-warning{{TRUE}}
+  break;
+default:
+  clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+}
+  } // arg > 10
+}
+
+void testDefaultUnreachable(int arg) {
+  if (arg > 10) {
+switch (arg) {
+case INT_MIN ... 9:
+  clang_analyzer_warnIfReached();   // no-warning
+  break;
+case 10 ... INT_MAX:
+  clang_analyzer_warnIfReached();   // expected-warning{{REACHABLE}}
+  clang_analyzer_eval(arg > 10);// expected-warning{{TRUE}}
+  break;
+default:
+  clang_analyzer_warnIfReached();   // no-warning
+}
+  }
+}
+
+void testBranchReachability(int arg) {
+  if (arg > 10 && arg < 20) {
+switch (arg) {
+case INT_MIN ... 4:
+  clang_analyzer_warnIfReached(); // no-warning
+  break;
+case 5 ... 9:
+  clang_analyzer_warnIfReached(); // no-warning
+  break;
+case 10 ... 15:
+  clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+  clang_analyzer_eval(arg > 10 && arg <= 15);  // expected-warning{{TRUE}}
+  break;
+default:
+  clang_analyzer_warnIfReached(); // no-warning
+  break;
+case 17 ... 25:
+  clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+  clang_analyzer_eval(arg >= 17 && arg < 20);  // expected-warning{{TRUE}}
+  break;
+case 26 ... INT_MAX:
+  clang_analyzer_warnIfReached();   // no-warning
+  break;
+case 16:
+  clang_analyzer_warnIfReached();   // expected-warning{{REACHABLE}}
+  clang_analyzer_eval(arg == 16);   // expected-warning{{TRUE}}
+  break;
+}
+  }
+}
+
+void testDefaultBranchRange(int arg) {
+  switch (arg) {
+  case INT_MIN ... 9:
+clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+break;
+  case 20 ... INT_MAX:
+clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+clang_analyzer_eval(arg >= 20);  // expected-warning{{TRUE}}
+break;
+  default:
+clang_analyzer_warnIfReached();  // expected-warning{{REACHABLE}}
+clang_analyzer_eval(arg == 16);  // expected-warni

Re: [PATCH] D5102: [analyzer][Bugfix/improvement] Fix for PR16833

2015-08-20 Thread Aleksei Sidorin via cfe-commits
a.sidorin marked 8 inline comments as done.
a.sidorin added a comment.

http://reviews.llvm.org/D5102



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


Re: [PATCH] D12163: [Patch] [Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() && "No error node found in the trimmed graph" (PR 24184)

2015-08-20 Thread Ying Yi via cfe-commits
MaggieYi updated this revision to Diff 32671.
MaggieYi added a comment.

Hi Anna,

Many thanks for your comments. I have modified the patch to address your 
comments. Please let me know what you think.

PS: If the updated patch looks good to you, could you please commit it for me 
(as I do not have commit access) ?

Many thanks,
Ying Yi


http://reviews.llvm.org/D12163

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
  test/Analysis/PR24184.cpp
  test/Analysis/malloc.c

Index: test/Analysis/malloc.c
===
--- test/Analysis/malloc.c
+++ test/Analysis/malloc.c
@@ -1386,7 +1386,8 @@
   int *s;
   char *b = realloc(a->p, size);
   char *m = realloc(a->p, size); // expected-warning {{Attempt to free released memory}}
-  return a->p;
+  //PR24184: Object "a->p" is returned after being freed by calling "realloc".
+  return a->p; // expected-warning {{Use of memory after it is freed}}
 }
 
 // We should not warn in this case since the caller will presumably free a->p in all cases.
Index: test/Analysis/PR24184.cpp
===
--- /dev/null
+++ test/Analysis/PR24184.cpp
@@ -0,0 +1,97 @@
+// RUN: %clang_cc1 -w -analyze -analyzer-eagerly-assume -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s
+// RUN: %clang_cc1 -w -analyze -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s
+
+// These tests used to hit an assertion in the bug report. Test case from http://llvm.org/PR24184.
+typedef struct {
+  int cbData;
+  unsigned pbData;
+} CRYPT_DATA_BLOB;
+
+typedef enum { DT_NONCE_FIXED } DATA_TYPE;
+int a;
+typedef int *vcreate_t(int *, DATA_TYPE, int, int);
+void fn1(unsigned, unsigned) {
+  char b = 0;
+  for (; 1; a++, &b + a * 0) // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+;
+}
+
+vcreate_t fn2;
+struct A {
+  CRYPT_DATA_BLOB value;
+  int m_fn1() {
+int c;
+value.pbData == 0;
+fn1(0, 0);
+  }
+};
+struct B {
+  A IkeHashAlg;
+  A IkeGType;
+  A NoncePhase1_r;
+};
+class C {
+  int m_fn2(B *);
+  void m_fn3(B *, int, int, int);
+};
+int C::m_fn2(B *p1) {
+  int *d;
+  int e = p1->IkeHashAlg.m_fn1();
+  unsigned f = p1->IkeGType.m_fn1(), h;
+  int g;
+  d = fn2(0, DT_NONCE_FIXED, (char)0, p1->NoncePhase1_r.value.cbData);
+  h = 0 | 0;
+  m_fn3(p1, 0, 0, 0);
+}
+
+// case 2:
+typedef struct {
+  int cbData;
+  unsigned char *pbData;
+} CRYPT_DATA_BLOB_1;
+typedef unsigned uint32_t;
+void fn1_1(void *p1, const void *p2) { p1 != p2; }
+
+void fn2_1(uint32_t *p1, unsigned char *p2, uint32_t p3) {
+  unsigned i = 0;
+  for (0; i < p3; i++)
+fn1_1(p1 + i, p2 + i * 0);// expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+}
+
+struct A_1 {
+  CRYPT_DATA_BLOB_1 value;
+  uint32_t m_fn1() {
+uint32_t a;
+if (value.pbData)
+  fn2_1(&a, value.pbData, value.cbData);
+return 0;
+  }
+};
+struct {
+  A_1 HashAlgId;
+} *b;
+void fn3() {
+  uint32_t c, d;
+  d = b->HashAlgId.m_fn1();
+  d << 0 | 0 | 0;
+  c = 0;
+  0 | 1 << 0 | 0 && b;
+}
+
+// case 3:
+struct ST {
+  char c;
+};
+char *p;
+int foo1(ST);
+int foo2() {
+  ST *p1 = (ST *)(p);  // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}}
+  while (p1->c & 0x0F || p1->c & 0x07)
+p1 = p1 + foo1(*p1);
+}
+
+int foo3(int *node) {
+  int i = foo2();
+  if (i)
+return foo2();
+}
\ No newline at end of file
Index: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -287,7 +287,10 @@
  bool MarkAsSink,
  ExplodedNode *P = nullptr,
  const ProgramPointTag *Tag = nullptr) {
-if (!State || (State == Pred->getState() && !Tag && !MarkAsSink))
+// It may not be safe to use the "Pred" node with no tag because the "Pred"
+// node may be recycled in the reclamation function.
+if (!State || (State == Pred->getState() && !Tag && !MarkAsSink &&
+   Pred->getLocation().getTag()))
   return Pred;
 
 Changed = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r245548 - [clang-tidy] Fold the meat of the UseNullPtrCheck into an anonymous namespace.

2015-08-20 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Aug 20 04:47:06 2015
New Revision: 245548

URL: http://llvm.org/viewvc/llvm-project?rev=245548&view=rev
Log:
[clang-tidy] Fold the meat of the UseNullPtrCheck into an anonymous namespace.

While convenient, RecursiveASTVisitor generates a ridiculous amount of dead
template code. Making it not visible from the outside lets the compiler
eliminate some of it, shrinking clang-tidy by ~140k.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245548&r1=245547&r2=245548&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Thu Aug 20 
04:47:06 2015
@@ -20,6 +20,7 @@ using namespace llvm;
 namespace clang {
 namespace tidy {
 namespace modernize {
+namespace {
 
 const char CastSequence[] = "sequence";
 
@@ -438,6 +439,7 @@ private:
   Expr *FirstSubExpr;
   bool PruneSubtree;
 };
+} // namespace
 
 UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),


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


[PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: alexfh.
angelgarcia added a subscriber: cfe-commits.
angelgarcia changed the visibility of this Differential Revision from "Public 
(No Login Required)" to "All Users".

Remove implicit conversion from nullptr to StringRef.

http://reviews.llvm.org/D12186

Files:
  clang-tidy/modernize/LoopConvertCheck.cpp

Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -338,7 +338,7 @@
 SourceRange Range) {
   if (SourceMgr.getFileID(Range.getBegin()) !=
   SourceMgr.getFileID(Range.getEnd()))
-return nullptr;
+return StringRef(nullptr, 0);
 
   return Lexer::getSourceText(CharSourceRange(Range, true), SourceMgr,
   LangOpts);


Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -338,7 +338,7 @@
 SourceRange Range) {
   if (SourceMgr.getFileID(Range.getBegin()) !=
   SourceMgr.getFileID(Range.getEnd()))
-return nullptr;
+return StringRef(nullptr, 0);
 
   return Lexer::getSourceText(CharSourceRange(Range, true), SourceMgr,
   LangOpts);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Benjamin Kramer via cfe-commits
bkramer added a subscriber: bkramer.
bkramer added a comment.

Is this tested? I'd expect a crash when constructing a StringRef implicitly 
from nullptr.



Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:341
@@ -340,3 +340,3 @@
   SourceMgr.getFileID(Range.getEnd()))
-return nullptr;
+return StringRef(nullptr, 0);
 

You can just use the default ctor `return StringRef();`


http://reviews.llvm.org/D12186



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


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

It is allowed as long as you specify that the length is 0.

assert 
https://cs.corp.google.com/#piper///depot/google3/third_party/grte/v4_x86/release/usr/grte/v4/include/assert.h&l=85&ct=xref_jump_to_def&cl=GROK&gsn=assert((data
https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/include/llvm/ADT/StringRef.h&l=76&ct=xref_jump_to_def&cl=GROK&gsn=data

|  | length 
https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/include/llvm/ADT/StringRef.h&l=76&ct=xref_jump_to_def&cl=GROK&gsn=length
 |

0) &&"StringRef cannot be built from a NULL argument with
-

non-null length");

I thought that this way it was clear that I was returning an empty
string, but they are both equivalent. I can change it if you think the
default constructor is better.


http://reviews.llvm.org/D12186



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


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

Oooops, copy pasting there was not a good idea. Sorry :(


http://reviews.llvm.org/D12186



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


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

In http://reviews.llvm.org/D12186#228702, @angelgarcia wrote:

> It is allowed as long as you specify that the length is 0.


I meant the code before your change, which calls `StringRef(const char *Str)` 
and completely disallows nullptr. In other words: this change is missing a 
regression test.

> I thought that this way it was clear that I was returning an empty

>  string, but they are both equivalent. I can change it if you think the

>  default constructor is better.


I prefer the default ctor. Using nullptr for the empty string is just an 
implementation detail, exposing it doesn't add clarity in my opinion.


http://reviews.llvm.org/D12186



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


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

In http://reviews.llvm.org/D12186#228704, @bkramer wrote:

> I meant the code before your change, which calls `StringRef(const char *Str)` 
> and completely disallows nullptr. In other words: this change is missing a 
> regression test.


You are right, the current tests don't cover this line.

> I prefer the default ctor. Using nullptr for the empty string is just an 
> implementation detail, exposing it doesn't add clarity in my opinion.


OK. I'll put the default constructor and try to write a test that covers this 
case. Thank you for your comments!


http://reviews.llvm.org/D12186



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


r245550 - [OPENMP 4.1] Initial support for modifiers in 'linear' clause.

2015-08-20 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Aug 20 05:54:39 2015
New Revision: 245550

URL: http://llvm.org/viewvc/llvm-project?rev=245550&view=rev
Log:
[OPENMP 4.1] Initial support for modifiers in 'linear' clause.

OpenMP 4.1 adds 3 optional modifiers to 'linear' clause.
Format of 'linear' clause has changed to:
```
linear(linear-list[ : linear-step])
```
where linear-list is one of the following
```
list
modifier(list)
```
where modifier is one of the following:
```
 ref (C++)
 val (C/C++)
 uval (C++)
```
Patch adds parsing and sema analysis for these modifiers.

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Basic/OpenMPKinds.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Stmt.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/OpenMP/simd_linear_messages.cpp
cfe/trunk/test/OpenMP/simd_misc_messages.c

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=245550&r1=245549&r2=245550&view=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu Aug 20 05:54:39 2015
@@ -1641,6 +1641,10 @@ public:
 ///
 class OMPLinearClause : public OMPVarListClause {
   friend class OMPClauseReader;
+  /// \brief Modifier of 'linear' clause.
+  OpenMPLinearClauseKind Modifier;
+  /// \brief Location of linear modifier if any.
+  SourceLocation ModifierLoc;
   /// \brief Location of ':'.
   SourceLocation ColonLoc;
 
@@ -1659,11 +1663,12 @@ class OMPLinearClause : public OMPVarLis
   /// \param NumVars Number of variables.
   ///
   OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
+  OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
   SourceLocation ColonLoc, SourceLocation EndLoc,
   unsigned NumVars)
   : OMPVarListClause(OMPC_linear, StartLoc, LParenLoc,
   EndLoc, NumVars),
-ColonLoc(ColonLoc) {}
+Modifier(Modifier), ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {}
 
   /// \brief Build an empty clause.
   ///
@@ -1673,7 +1678,7 @@ class OMPLinearClause : public OMPVarLis
   : OMPVarListClause(OMPC_linear, SourceLocation(),
   SourceLocation(), SourceLocation(),
   NumVars),
-ColonLoc(SourceLocation()) {}
+Modifier(OMPC_LINEAR_val), ModifierLoc(), ColonLoc() {}
 
   /// \brief Gets the list of initial values for linear variables.
   ///
@@ -1733,6 +1738,8 @@ public:
   /// \param C AST Context.
   /// \param StartLoc Starting location of the clause.
   /// \param LParenLoc Location of '('.
+  /// \param Modifier Modifier of 'linear' clause.
+  /// \param ModifierLoc Modifier location.
   /// \param ColonLoc Location of ':'.
   /// \param EndLoc Ending location of the clause.
   /// \param VL List of references to the variables.
@@ -1742,6 +1749,7 @@ public:
   /// \param CalcStep Calculation of the linear step.
   static OMPLinearClause *
   Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation 
LParenLoc,
+ OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
  SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef VL,
  ArrayRef PL, ArrayRef IL, Expr *Step, Expr *CalcStep);
 
@@ -1752,9 +1760,19 @@ public:
   ///
   static OMPLinearClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
 
+  /// \brief Set modifier.
+  void setModifier(OpenMPLinearClauseKind Kind) { Modifier = Kind; }
+  /// \brief Return modifier.
+  OpenMPLinearClauseKind getModifier() const { return Modifier; }
+
+  /// \brief Set modifier location.
+  void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
+  /// \brief Return modifier location.
+  SourceLocation getModifierLoc() const { return ModifierLoc; }
+
   /// \brief Sets the location of ':'.
   void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
-  /// \brief Returns the location of '('.
+  /// \brief Returns the location of ':'.
   SourceLocation getColonLoc() const { return ColonLoc; }
 
   /// \brief Returns linear step.

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=245550&r1=245549&r2=245550&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+

Re: [clang-tools-extra] r245548 - [clang-tidy] Fold the meat of the UseNullPtrCheck into an anonymous namespace.

2015-08-20 Thread Alexander Kornienko via cfe-commits
Thanks, Benjamin!

On Thu, Aug 20, 2015 at 11:47 AM, Benjamin Kramer via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: d0k
> Date: Thu Aug 20 04:47:06 2015
> New Revision: 245548
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245548&view=rev
> Log:
> [clang-tidy] Fold the meat of the UseNullPtrCheck into an anonymous
> namespace.
>
> While convenient, RecursiveASTVisitor generates a ridiculous amount of dead
> template code. Making it not visible from the outside lets the compiler
> eliminate some of it, shrinking clang-tidy by ~140k.
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
>
> Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=245548&r1=245547&r2=245548&view=diff
>
> ==
> --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Thu
> Aug 20 04:47:06 2015
> @@ -20,6 +20,7 @@ using namespace llvm;
>  namespace clang {
>  namespace tidy {
>  namespace modernize {
> +namespace {
>
>  const char CastSequence[] = "sequence";
>
> @@ -438,6 +439,7 @@ private:
>Expr *FirstSubExpr;
>bool PruneSubtree;
>  };
> +} // namespace
>
>  UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext
> *Context)
>  : ClangTidyCheck(Name, Context),
>
>
> ___
> 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


[PATCH] D12192: Add clang support for AAP

2015-08-20 Thread Edward Jones via cfe-commits
edward-jones created this revision.
edward-jones added a subscriber: cfe-commits.

AAP is a Harvard architecture, with features representative of a large range of 
deeply embedded microprocessors. It aims to aid the development and maintenance 
of other out-of-tree deeply embedded systems.

http://reviews.llvm.org/D12192

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  lib/Headers/float.h

Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -74,7 +74,14 @@
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#define FLT_ROUNDS (__builtin_flt_rounds())
+
+/* __builtin_flt_rounds is not supported by AAP, and the rounding mode cannot
+   be changed anyway so we just default to 'to nearest' */
+#ifdef __AAP__
+  #define FLT_ROUNDS 1
+#else
+  #define FLT_ROUNDS (__builtin_flt_rounds())
+#endif
 #define FLT_RADIX __FLT_RADIX__
 
 #define FLT_MANT_DIG __FLT_MANT_DIG__
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -57,6 +57,8 @@
const InputInfo &Output,
const InputInfoList &Inputs) const;
 
+void AddAAPTargetArgs(const llvm::opt::ArgList &Args,
+  llvm::opt::ArgStringList &CmdArgs) const;
   void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
 llvm::opt::ArgStringList &CmdArgs) const;
   void AddARMTargetArgs(const llvm::opt::ArgList &Args,
@@ -795,6 +797,35 @@
 };
 } // end namespace SHAVE
 
+
+namespace AAP {
+  class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
+  public:
+Assemble(const ToolChain &TC) : Tool("AAP::Assemble", "aap-as", TC)
+{}
+
+bool hasIntegratedCPP() const override { return false; }
+void ConstructJob(Compilation &C, const JobAction &JA,
+  const InputInfo &Output,
+  const InputInfoList &Inputs,
+  const llvm::opt::ArgList &TCArgs,
+  const char *LinkingOutput) const override;
+  };
+  class LLVM_LIBRARY_VISIBILITY Link : public Tool {
+  public:
+Link(const ToolChain &TC) : Tool("AAP::Link", "aap-ld", TC)
+{}
+
+bool hasIntegratedCPP() const override { return false; }
+bool isLinkJob() const override { return true; }
+void ConstructJob(Compilation &C, const JobAction &JA,
+  const InputInfo &Output,
+  const InputInfoList &Inputs,
+  const llvm::opt::ArgList &TCArgs,
+  const char *LinkingOutput) const override;
+  };
+}
+
 } // end namespace tools
 } // end namespace driver
 } // end namespace clang
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1900,6 +1900,11 @@
   CmdArgs.push_back("-machine-sink-split=0");
 }
 
+void Clang::AddAAPTargetArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+  return;
+}
+
 // Decode AArch64 features from string like +[no]featureA+[no]featureB+...
 static bool DecodeAArch64Features(const Driver &D, StringRef text,
   std::vector &Features) {
@@ -2574,8 +2579,9 @@
 
 static bool shouldUseFramePointerForTarget(const ArgList &Args,
const llvm::Triple &Triple) {
-  // XCore never wants frame pointers, regardless of OS.
-  if (Triple.getArch() == llvm::Triple::xcore) {
+  // XCore and AAP never want frame pointers, regardless of OS.
+  if ((Triple.getArch() == llvm::Triple::aap) ||
+  (Triple.getArch() == llvm::Triple::xcore)) {
 return false;
   }
 
@@ -3600,6 +3606,10 @@
   default:
 break;
 
+  case llvm::Triple::aap:
+AddAAPTargetArgs(Args, CmdArgs);
+break;
+
   case llvm::Triple::arm:
   case llvm::Triple::armeb:
   case llvm::Triple::thumb:
@@ -9644,3 +9654,71 @@
   C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Exec),
   CmdArgs, Inputs));
 }
+
+void AAP::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+  ArgStringList CmdArgs;
+
+  // Add input assembly files to command line
+  for (InputInfoList::const_iterator it = Inputs.begin(), ie = Inputs.end();
+   it != ie;
+   ++it) {
+const InputInfo &II = *it;
+CmdArgs.push_back(II.getFilename());
+  }
+
+  const char *Exec =
+Args.MakeArgString(getToolChain().GetProgramPath("aap-as

Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

In http://reviews.llvm.org/D11784#227939, @aaron.ballman wrote:

> Addressed review comments. I re-ran the updated patch against LLVM and Clang, 
> and there were some more false positives that I would like to address if 
> possible. It seems my previous run against the source base was before 
> expanding the scope of the patch to include more than just base class 
> initialization (sorry for the earlier misinformation).
>
> 1. SourceMgr.h:58 is an example where the checker issues a diagnostic (for 
> IncludeLoc), but given the triviality of the type, I don't see a reason to 
> diagnose. However, this requires support from Sema, so I think a FIXME may be 
> the best I can do. Note, adding a call to std::move() in these instances is 
> not wrong, it's just not particularly useful.


Determining whether a type is trivially-copyable can be done on the AST level 
without Sema (see QualType::isTriviallyCopyableType).

> 2. we should not be warning on anything an implicit constructor does. For 
> instance LiveQueryResult is triggering this because of SlotIndex. This should 
> be fixed with this patch.

> 

>   Running over Clang and LLVM, there are 7 distinct false positives (repeated 
> due to being in header files) and they all relate to triviality. The total 
> false positive count was 832 of which two warnings (SourceMgr.h and 
> Preprocessor.h) accounted for probably close to 90% of the diagnostics. This 
> time around there were no true positives.


Can you list the list of unique locations?



Comment at: test/clang-tidy/misc-move-constructor-init.cpp:65
@@ +64,3 @@
+struct K {}; // Has implicit copy and move constructors
+struct L : K {
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes base class 
by calling a copy constructor [misc-move-constructor-init]

Please try to use the python script from http://reviews.llvm.org/D12180.


http://reviews.llvm.org/D11784



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


r245556 - [OPENMP 4.1] Allow to use 'uval' and 'ref' modifiers for reference types only.

2015-08-20 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Aug 20 07:15:57 2015
New Revision: 245556

URL: http://llvm.org/viewvc/llvm-project?rev=245556&view=rev
Log:
[OPENMP 4.1] Allow to use 'uval' and 'ref' modifiers for reference types only.
Standard allows to use 'uval' and 'ref' modifiers in 'linear' clause for 
variables with reference types only. Added check for it and modified test.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/simd_linear_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=245556&r1=24&r2=245556&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Aug 20 07:15:57 
2015
@@ -7669,6 +7669,8 @@ def err_omp_parent_cancel_region_ordered
   "parent region for 'omp %select{cancellation point/cancel}0' construct 
cannot be ordered">;
 def err_omp_wrong_linear_modifier : Error<
   "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
+def err_omp_wrong_linear_modifier_non_reference : Error<
+  "variable of non-reference type %0 can be used only with 'val' modifier, but 
used with '%1'">;
 } // end of OpenMP category
 
 let CategoryName = "Related Result Type Issue" in {

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=245556&r1=24&r2=245556&view=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Thu Aug 20 07:15:57 2015
@@ -785,9 +785,8 @@ OMPClause *Parser::ParseOpenMPVarListCla
   } else if (Kind == OMPC_linear) {
 // Try to parse modifier if any.
 if (Tok.is(tok::identifier) && PP.LookAhead(0).is(tok::l_paren)) {
-  StringRef TokSpelling = PP.getSpelling(Tok);
   LinearModifier = static_cast(
-  getOpenMPSimpleClauseType(Kind, TokSpelling));
+  getOpenMPSimpleClauseType(Kind, PP.getSpelling(Tok)));
   DepLinLoc = ConsumeToken();
   LinearT.consumeOpen();
   NeedRParenForLinear = true;

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=245556&r1=24&r2=245556&view=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Aug 20 07:15:57 2015
@@ -6383,6 +6383,12 @@ OMPClause *Sema::ActOnOpenMPLinearClause
 diag::err_omp_linear_incomplete_type)) {
   continue;
 }
+if ((LinKind == OMPC_LINEAR_uval || LinKind == OMPC_LINEAR_ref) &&
+!QType->isReferenceType()) {
+  Diag(ELoc, diag::err_omp_wrong_linear_modifier_non_reference)
+  << QType << getOpenMPSimpleClauseTypeName(OMPC_linear, LinKind);
+  continue;
+}
 QType = QType.getNonReferenceType();
 
 // A list item must not be const-qualified.

Modified: cfe/trunk/test/OpenMP/simd_linear_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_linear_messages.cpp?rev=245556&r1=24&r2=245556&view=diff
==
--- cfe/trunk/test/OpenMP/simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/simd_linear_messages.cpp Thu Aug 20 07:15:57 2015
@@ -135,11 +135,11 @@ template int foomain(I
   for (int k = 0; k < argc; ++k) ++k;
   #pragma omp simd linear (argv[1]) // expected-error {{expected variable 
name}}
   for (int k = 0; k < argc; ++k) ++k;
-  #pragma omp simd linear(ref(e, g))
+  #pragma omp simd linear(ref(e, g)) // expected-error 2 {{variable of 
non-reference type 'int' can be used only with 'val' modifier, but used with 
'ref'}}
   for (int k = 0; k < argc; ++k) ++k;
   #pragma omp simd linear(h) // expected-error {{threadprivate or thread local 
variable cannot be linear}}
   for (int k = 0; k < argc; ++k) ++k;
-  #pragma omp simd linear(uval(i))
+  #pragma omp simd linear(uval(i)) // expected-error {{variable of 
non-reference type 'int' can be used only with 'val' modifier, but used with 
'uval'}}
   for (int k = 0; k < argc; ++k) ++k;
   #pragma omp parallel
   {
@@ -148,7 +148,9 @@ template int foomain(I
 #pragma omp simd linear(v:i)
 for (int k = 0; k < argc; ++k) { i = k; v += i; }
   }
-  #pragma omp simd linear(j)
+  #pragma omp simd linear(ref(j))
+  for (int k = 0; k < argc; ++k) ++k;
+  #pragma omp simd linear(uval(j))
   for (int k = 0; k < argc; ++k) ++k;
   int v = 0;
   #pragma omp simd linear(v:j)
@@ -167,7 +169,7 @@ using A::x;
 }
 
 void linear_modifiers(int argc) {
-  int f;
+  int &f = argc;
   

Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 32688.
angelgarcia added a comment.

Add a test.


http://reviews.llvm.org/D12186

Files:
  clang-tidy/modernize/LoopConvertCheck.cpp
  test/clang-tidy/Inputs/modernize-loop-convert/structures.h
  test/clang-tidy/modernize-loop-convert-extra.cpp

Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -605,4 +605,25 @@
   }
 }
 
+} // namespace SingleIterator
+
+
+namespace Macros {
+
+const int N = 10;
+int arr[N];
+
+void messing_with_macros() {
+  for (int i = 0; i < N; ++i) {
+printf("Value: %d\n", arr[i]);
+  }
+  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: for (auto & elem : arr) {
+  // CHECK-FIXES-NEXT:  printf("Value: %d\n", elem);
+
+  for (int i = 0; i < N; ++i) {
+printf("Value: %d\n", CONT arr[i]);
+  }
 }
+
+} // namespace Macros
Index: test/clang-tidy/Inputs/modernize-loop-convert/structures.h
===
--- test/clang-tidy/Inputs/modernize-loop-convert/structures.h
+++ test/clang-tidy/Inputs/modernize-loop-convert/structures.h
@@ -176,4 +176,15 @@
   iterator begin() const;
   iterator end() const;
 };
+
+namespace Macros {
+
+struct MacroStruct {
+  int arr[10];
+};
+static MacroStruct *MacroSt;
+#define CONT MacroSt->
+
+} // namespace Macros
+
 #endif  // STRUCTURES_H
Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -337,8 +337,9 @@
 const LangOptions &LangOpts,
 SourceRange Range) {
   if (SourceMgr.getFileID(Range.getBegin()) !=
-  SourceMgr.getFileID(Range.getEnd()))
-return nullptr;
+  SourceMgr.getFileID(Range.getEnd())) {
+return StringRef(); // Empty string.
+  }
 
   return Lexer::getSourceText(CharSourceRange(Range, true), SourceMgr,
   LangOpts);


Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -605,4 +605,25 @@
   }
 }
 
+} // namespace SingleIterator
+
+
+namespace Macros {
+
+const int N = 10;
+int arr[N];
+
+void messing_with_macros() {
+  for (int i = 0; i < N; ++i) {
+printf("Value: %d\n", arr[i]);
+  }
+  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: for (auto & elem : arr) {
+  // CHECK-FIXES-NEXT:  printf("Value: %d\n", elem);
+
+  for (int i = 0; i < N; ++i) {
+printf("Value: %d\n", CONT arr[i]);
+  }
 }
+
+} // namespace Macros
Index: test/clang-tidy/Inputs/modernize-loop-convert/structures.h
===
--- test/clang-tidy/Inputs/modernize-loop-convert/structures.h
+++ test/clang-tidy/Inputs/modernize-loop-convert/structures.h
@@ -176,4 +176,15 @@
   iterator begin() const;
   iterator end() const;
 };
+
+namespace Macros {
+
+struct MacroStruct {
+  int arr[10];
+};
+static MacroStruct *MacroSt;
+#define CONT MacroSt->
+
+} // namespace Macros
+
 #endif  // STRUCTURES_H
Index: clang-tidy/modernize/LoopConvertCheck.cpp
===
--- clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tidy/modernize/LoopConvertCheck.cpp
@@ -337,8 +337,9 @@
 const LangOptions &LangOpts,
 SourceRange Range) {
   if (SourceMgr.getFileID(Range.getBegin()) !=
-  SourceMgr.getFileID(Range.getEnd()))
-return nullptr;
+  SourceMgr.getFileID(Range.getEnd())) {
+return StringRef(); // Empty string.
+  }
 
   return Lexer::getSourceText(CharSourceRange(Range, true), SourceMgr,
   LangOpts);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a reviewer: bkramer.
bkramer added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


http://reviews.llvm.org/D12186



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


r245560 - Fix crash with two typos in the arguments of a function

2015-08-20 Thread Olivier Goffart via cfe-commits
Author: ogoffart
Date: Thu Aug 20 08:11:14 2015
New Revision: 245560

URL: http://llvm.org/viewvc/llvm-project?rev=245560&view=rev
Log:
Fix crash with two typos in the arguments of a function

The problem is that the arguments are of TheCall are reset later
to the ones in Args, making TypoExpr put back. Some TypoExpr that have
already  been diagnosed and will assert later in Sema::getTypoExprState

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/typo-correction.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245560&r1=245559&r2=245560&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Aug 20 08:11:14 2015
@@ -4937,6 +4937,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
 if (!Result.isUsable()) return ExprError();
 TheCall = dyn_cast(Result.get());
 if (!TheCall) return Result;
+Args = ArrayRef(TheCall->getArgs(), TheCall->getNumArgs());
   }
 
   // Bail out early if calling a builtin with custom typechecking.

Modified: cfe/trunk/test/Sema/typo-correction.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typo-correction.c?rev=245560&r1=245559&r2=245560&view=diff
==
--- cfe/trunk/test/Sema/typo-correction.c (original)
+++ cfe/trunk/test/Sema/typo-correction.c Thu Aug 20 08:11:14 2015
@@ -49,3 +49,9 @@ extern double cabs(_Complex double z);
 void fn1() {
   cabs(errij);  // expected-error {{use of undeclared identifier 'errij'}}
 }
+
+extern long afunction(int); // expected-note {{'afunction' declared here}}
+void fn2() {
+  f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier 
'THIS_IS_AN_ERROR'}}
+afunction(afunction_));  // expected-error {{use of undeclared identifier 
'afunction_'; did you mean 'afunction'?}}
+}


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


[clang-tools-extra] r245561 - [clang-tidy] Fix bug in modernize-loop-convert check.

2015-08-20 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 20 08:18:23 2015
New Revision: 245561

URL: http://llvm.org/viewvc/llvm-project?rev=245561&view=rev
Log:
[clang-tidy] Fix bug in modernize-loop-convert check.

http://reviews.llvm.org/D12186

Patch by Angel Garcia!

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp

clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-loop-convert/structures.h
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=245561&r1=245560&r2=245561&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Thu Aug 
20 08:18:23 2015
@@ -337,8 +337,9 @@ static StringRef getStringFromRange(Sour
 const LangOptions &LangOpts,
 SourceRange Range) {
   if (SourceMgr.getFileID(Range.getBegin()) !=
-  SourceMgr.getFileID(Range.getEnd()))
-return nullptr;
+  SourceMgr.getFileID(Range.getEnd())) {
+return StringRef(); // Empty string.
+  }
 
   return Lexer::getSourceText(CharSourceRange(Range, true), SourceMgr,
   LangOpts);

Modified: 
clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-loop-convert/structures.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-loop-convert/structures.h?rev=245561&r1=245560&r2=245561&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-loop-convert/structures.h
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/Inputs/modernize-loop-convert/structures.h
 Thu Aug 20 08:18:23 2015
@@ -176,4 +176,15 @@ struct RValueDerefContainer {
   iterator begin() const;
   iterator end() const;
 };
+
+namespace Macros {
+
+struct MacroStruct {
+  int arr[10];
+};
+static MacroStruct *MacroSt;
+#define CONT MacroSt->
+
+} // namespace Macros
+
 #endif  // STRUCTURES_H

Modified: 
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp?rev=245561&r1=245560&r2=245561&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp 
Thu Aug 20 08:18:23 2015
@@ -605,4 +605,25 @@ void different_type() {
   }
 }
 
+} // namespace SingleIterator
+
+
+namespace Macros {
+
+const int N = 10;
+int arr[N];
+
+void messing_with_macros() {
+  for (int i = 0; i < N; ++i) {
+printf("Value: %d\n", arr[i]);
+  }
+  // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: for (auto & elem : arr) {
+  // CHECK-FIXES-NEXT:  printf("Value: %d\n", elem);
+
+  for (int i = 0; i < N; ++i) {
+printf("Value: %d\n", CONT arr[i]);
+  }
 }
+
+} // namespace Macros


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


Re: [PATCH] D12186: Fix bug in modernize-loop-convert check.

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh closed this revision.
alexfh added a comment.

Thanks!
Committed revision 245561.


http://reviews.llvm.org/D12186



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


r245562 - Silence a "not all control paths return a value" warning; NFC.

2015-08-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Aug 20 08:31:16 2015
New Revision: 245562

URL: http://llvm.org/viewvc/llvm-project?rev=245562&view=rev
Log:
Silence a "not all control paths return a value" warning; NFC.

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=245562&r1=245561&r2=245562&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 20 08:31:16 2015
@@ -3063,7 +3063,7 @@ static const char *RelocationModelName(l
   case llvm::Reloc::DynamicNoPIC:
 return "dynamic-no-pic";
   }
-  assert(false && "Unknown Reloc::Model kind");
+  llvm_unreachable("Unknown Reloc::Model kind");
 }
 
 static void AddAssemblerKPIC(const ToolChain &ToolChain, const ArgList &Args,


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


Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Yay! I'm really excited for this! Unfortunately, it fails all over the place on 
Windows. The errors are all in the form:

58>  
58>  FAIL: Clang Tools :: 
clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp (7280 
of 23187)
58>   TEST 'Clang Tools :: 
clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp' 
FAILED 
58>  Script:
58>  --
58>  $(dirname 
E:\llvm\llvm\tools\clang\tools\extra\test\clang-tidy\readability-simplify-bool-expr-chained-conditional-return.cpp)/check_clang_tidy.py
 
E:\llvm\llvm\tools\clang\tools\extra\test\clang-tidy\readability-simplify-bool-expr-chained-conditional-return.cpp
 readability-simplify-boolean-expr 
E:\llvm\2015\tools\clang\tools\extra\test\clang-tidy\Output\readability-simplify-bool-expr-chained-conditional-return.cpp.tmp
 -config="{CheckOptions: [{key: 
"readability-simplify-boolean-expr.ChainedConditionalReturn", value: 1}]}" --
58>  --
58>  Exit Code: 127
58>
58>  Command Output (stdout):
58>  --
58>  Command 0: "$(dirname" 
"E:\llvm\llvm\tools\clang\tools\extra\test\clang-tidy\readability-simplify-bool-expr-chained-conditional-return.cpp)/check_clang_tidy.py"
 
"E:\llvm\llvm\tools\clang\tools\extra\test\clang-tidy\readability-simplify-bool-expr-chained-conditional-return.cpp"
 "readability-simplify-boolean-expr" 
"E:\llvm\2015\tools\clang\tools\extra\test\clang-tidy\Output\readability-simplify-bool-expr-chained-conditional-return.cpp.tmp"
 "-config={CheckOptions: [{key: 
readability-simplify-boolean-expr.ChainedConditionalReturn, value: 1}]}" "--"
58>  Command 0 Result: 127
58>  Command 0 Output:
58>
58>
58>  Command 0 Stderr:
58>  '$(dirname': command not found
58>
58>
58>  --
58>
58>  
58>  FAIL: Clang Tools :: clang-tidy/readability-identifier-naming.cpp (7281 of 
23187)
58>   TEST 'Clang Tools :: 
clang-tidy/readability-identifier-naming.cpp' FAILED 
58>  Script:
58>  --
58>  $(dirname 
E:\llvm\llvm\tools\clang\tools\extra\test\clang-tidy\readability-identifier-naming.cpp)/check_clang_tidy.py
 
E:\llvm\llvm\tools\clang\tools\extra\test\clang-tidy\readability-identifier-naming.cpp
 readability-identifier-naming 
E:\llvm\2015\tools\clang\tools\extra\test\clang-tidy\Output\readability-identifier-naming.cpp.tmp
-config='{CheckOptions: [  {key: 
readability-identifier-naming.AbstractClassCase, value: CamelCase},  {key: 
readability-identifier-naming.AbstractClassPrefix, value: 'A'},  {key: 
readability-identifier-naming.ClassCase, value: CamelCase},  {key: 
readability-identifier-naming.ClassPrefix, value: 'C'},  {key: 
readability-identifier-naming.ClassConstantCase, value: CamelCase},  {key: 
readability-identifier-naming.ClassConstantPrefix, value: 'k'},  {key: 
readability-identifier-naming.ClassMemberCase, value: CamelCase},  {key: 
readability-identifier-naming.ClassMethodCase, value: camelBack},  {key: 
readability-identifier-naming.ConstantCase, value: UPPER_CASE},  {key: 
readability-identifier-naming.ConstantSuffix, value: '_CST'},  {key: 
readability-identifier-naming.ConstexprFunctionCase, value: lower_case},  
{key: readability-identifier-naming.ConstexprMethodCase, value: lower_case},
  {key: readability-identifier-naming.ConstexprVariableCase, value: 
lower_case},  {key: readability-identifier-naming.EnumCase, value: 
CamelCase},  {key: readability-identifier-naming.EnumPrefix, value: 'E'},   
   {key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE},
  {key: readability-identifier-naming.FunctionCase, value: camelBack},  
{key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE}, 
 {key: readability-identifier-naming.GlobalFunctionCase, value: CamelCase}, 
 {key: readability-identifier-naming.GlobalVariableCase, value: lower_case},
  {key: readability-identifier-naming.GlobalVariablePrefix, value: 'g_'},  
{key: readability-identifier-naming.InlineNamespaceCase, value: lower_case},
  {key: readability-identifier-naming.LocalConstantCase, value: CamelCase}, 
 {key: readability-identifier-naming.LocalConstantPrefix, value: 'k'},  
{key: readability-identifier-naming.LocalVariableCase, value: lower_case},  
{key: readability-identifier-naming.MemberCase, value: CamelCase},  {key: 
readability-identifier-naming.MemberPrefix, value: 'm_'},  {key: 
readability-identifier-naming.ConstantMemberCase, value: lower_case},  
{key: readability-identifier-naming.PrivateMemberPrefix, value: '__'},  
{key: readability-identifier-naming.ProtectedMemberPrefix, value: '_'},  
{key: readability-identifier-naming.PublicMemberCase, value: lower_case},  
{key: readability-identifier-naming.MethodCase, value: camelBack},  {key: 
readability-identifier-naming.PrivateMethodPrefix, value: '__'},  {key: 
readability-identi

Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread NAKAMURA Takumi via cfe-commits
chapuni added a comment.

Alex, thanks for your working. I tweaked to run on my hosts.

- mingw-w64 with Py3.3
- Linux with Py2.7 and Py3.4

My change is here; 
https://github.com/chapuni/llvm-project/commit/0f4a303bdc7b925f42c0cd48817052d2b49b2234
Could you merge it, please?



Comment at: test/clang-tidy/arg-comments.cpp:1
@@ -1,3 +1,2 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-argument-comment %t
-// REQUIRES: shell
+// RUN: $(dirname %s)/check_clang_tidy.py %s misc-argument-comment %t
 

$(dirname %s) assumes shell. use %S instead.
Lit internal runner is not capable of !shbang. use %python.

  // RUN: %python %S/check_clang_tidy.py %s misc-argument-comment %t


Comment at: test/clang-tidy/check_clang_tidy.py:71
@@ +70,3 @@
+  print('Running ' + repr(args) + '...')
+  clang_tidy_output = subprocess.check_output(args, stderr=subprocess.STDOUT)
+

It is not string, but bytes. It wouldn't run on py3.

  +  clang_tidy_output = subprocess.check_output(args, 
stderr=subprocess.STDOUT).decode()


Comment at: test/clang-tidy/check_clang_tidy.py:85
@@ +84,3 @@
+  print('-- Fixes -\n' 
+
+diff_output +
+'\n--')

It cannot be concatenated to string. Use encode.

  +diff_output.decode() +


Comment at: test/clang-tidy/google-readability-casting.c:7
@@ -6,3 +6,3 @@
 // RUN: clang-tidy --checks=-*,google-readability-casting -header-filter='.*' 
%t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s 
-check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
 // REQUIRES: shell
 

It can be pruned.


Comment at: test/clang-tidy/misc-unused-parameters.cpp:5
@@ -4,3 +4,3 @@
 // RUN: diff %T/header.h %T/header-fixed.h
 // REQUIRES: shell
 

It can be pruned.


http://reviews.llvm.org/D12180



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


Re: [PATCH] D12152: [OPENMP] Info about OpenMP Support in Users Manual

2015-08-20 Thread Kelvin Li via cfe-commits
kkwli0 added inline comments.


Comment at: docs/UsersManual.rst:1860
@@ +1859,3 @@
+
+Clang fully implements all of standard OpenMP 3.1 directives and clauses + some
+features of OpenMP 4.0, including ``#pragma omp simd``,

Clang supports all OpenMP 3.1 directives and clauses.  In addition, some 
features of OpenMP 4.0 are supported.  For example, ''#pragma omp simd'', ..., 
and ''#pragma omp taskgroup'' directives.


Comment at: docs/UsersManual.rst:1868
@@ +1867,3 @@
+
+OpenMP support is disabled by default. Use option::`-fopenmp=libomp` to enable
+it. Support for OpenMP can be disabled with :option:`-fno-openmp`.

Should it be :option:`-fopenmp=libomp`?


http://reviews.llvm.org/D12152



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


[clang-tools-extra] r245565 - clang-tools-extra/test/lit.cfg: Prune an obsolete feature, python27. Now we requires python>=2.7.

2015-08-20 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Aug 20 10:04:32 2015
New Revision: 245565

URL: http://llvm.org/viewvc/llvm-project?rev=245565&view=rev
Log:
clang-tools-extra/test/lit.cfg: Prune an obsolete feature, python27. Now we 
requires python>=2.7.

clang-tools-extra/test/clang-tidy/clang-tidy-diff.cpp was the only user.

Modified:
clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
clang-tools-extra/trunk/test/lit.cfg

Modified: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp?rev=245565&r1=245564&r2=245565&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp Thu Aug 20 
10:04:32 2015
@@ -1,4 +1,3 @@
-// REQUIRES: python27
 // RUN: sed 's/placeholder_for_f/f/' %s > %t.cpp
 // RUN: clang-tidy -checks=-*,misc-use-override %t.cpp -- -std=c++11 | 
FileCheck -check-prefix=CHECK-SANITY %s
 // RUN: not diff -U0 %s %t.cpp | %python 
%S/../../clang-tidy/tool/clang-tidy-diff.py -checks=-*,misc-use-override -- 
-std=c++11 2>&1 | FileCheck %s

Modified: clang-tools-extra/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.cfg?rev=245565&r1=245564&r2=245565&view=diff
==
--- clang-tools-extra/trunk/test/lit.cfg (original)
+++ clang-tools-extra/trunk/test/lit.cfg Thu Aug 20 10:04:32 2015
@@ -189,8 +189,3 @@ if platform.system() not in ['Windows']:
 config.available_features.add('ansi-escape-sequences')
 
 config.substitutions.append( ('%python', config.python_executable) )
-
-import sys
-# Scripts using argparse need Python 2.7.
-if sys.version_info >= (2, 7):
-  config.available_features.add('python27')


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


[clang-tools-extra] r245567 - Tweak clang-tidy-diff.py to pass JSON argument correctly to clang-tidy on win32 arg parser.

2015-08-20 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Aug 20 10:04:46 2015
New Revision: 245567

URL: http://llvm.org/viewvc/llvm-project?rev=245567&view=rev
Log:
Tweak clang-tidy-diff.py to pass JSON argument correctly to clang-tidy on win32 
arg parser.

  - Single quotation is not recognized.
  - Use """ to pass a double quotation.

It also reverts r211831.

Modified:
clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp

Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245567&r1=245566&r2=245567&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Thu Aug 20 
10:04:46 2015
@@ -99,13 +99,19 @@ def main():
 [{"name" : name, "lines" : lines_by_file[name]} for name in lines_by_file],
 separators = (',', ':'))
 
+  quote = "";
+  if sys.platform == 'win32':
+line_filter_json=re.sub(r'"', r'"""', line_filter_json)
+  else:
+quote = "'";
+
   # Run clang-tidy on files containing changes.
   command = [args.clang_tidy_binary]
-  command.append('-line-filter=\'' + line_filter_json + '\'')
+  command.append('-line-filter=' + quote + line_filter_json + quote)
   if args.fix:
 command.append('-fix')
   if args.checks != '':
-command.append('-checks=\'' + args.checks + '\'')
+command.append('-checks=' + quote + args.checks + quote)
   command.extend(lines_by_file.keys())
   command.extend(clang_tidy_args)
 

Modified: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp?rev=245567&r1=245566&r2=245567&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp Thu Aug 20 
10:04:46 2015
@@ -16,6 +16,3 @@ struct B : public A {
 };
 // CHECK-SANITY-NOT: Suppressed
 // CHECK: Suppressed 1 warnings (1 due to line filter).
-
-// FIXME: clang-tidy-diff.py is incompatible to dos path. Excluding win32.
-// REQUIRES: shell


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


[clang-tools-extra] r245566 - Tweak clang-tools-extra/test/clang-tidy/file-filter.cpp to pass on win32.

2015-08-20 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Aug 20 10:04:39 2015
New Revision: 245566

URL: http://llvm.org/viewvc/llvm-project?rev=245566&view=rev
Log:
Tweak clang-tools-extra/test/clang-tidy/file-filter.cpp to pass on win32.

FIXME: "-I %S/Inputs/file-filter/system/.." must be redundant.
On Win32, file-filter/system\system-header1.h precedes file-filter\header*.h 
due to code order between '/' and '\\'.

We should remove such a tweak to introduce the *right* path canonicalization.

Posix:
  file-filter/header*.h
  file-filter/system/system-header1.h

Win32:
  file-filter/system\system-header1.h
  file-filter\header*.h

Win32, tweaked:
  file-filter/system/..\header*.h
  file-filter/system\system-header1.h

It had been disabled since r220837.

Modified:
clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp?rev=245566&r1=245565&r2=245566&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/file-filter.cpp Thu Aug 20 10:04:39 
2015
@@ -1,7 +1,10 @@
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='' 
%s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | 
FileCheck %s
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' 
-header-filter='.*' %s -- -I %S/Inputs/file-filter -isystem 
%S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK2 %s
 // RUN: clang-tidy -checks='-*,google-explicit-constructor' 
-header-filter='header2\.h' %s -- -I %S/Inputs/file-filter -isystem 
%S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK3 %s
-// RUN: clang-tidy -checks='-*,google-explicit-constructor' 
-header-filter='.*' -system-headers %s -- -I %S/Inputs/file-filter -isystem 
%S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK4 %s
+// FIXME: "-I %S/Inputs/file-filter/system/.." must be redundant.
+//   On Win32, file-filter/system\system-header1.h precedes
+//   file-filter\header*.h due to code order between '/' and '\\'.
+// RUN: clang-tidy -checks='-*,google-explicit-constructor' 
-header-filter='.*' -system-headers %s -- -I %S/Inputs/file-filter/system/.. 
-isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK4 %s
 
 #include "header1.h"
 // CHECK-NOT: warning:
@@ -40,6 +43,3 @@ class A { A(int); };
 // CHECK3: Use -header-filter=.* {{.*}}
 // CHECK4-NOT: Suppressed {{.*}} warnings
 // CHECK4-NOT: Use -header-filter=.* {{.*}}
-
-// FIXME: It doesn't pass on win32. Investigating.
-// REQUIRES: shell


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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-20 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: test/clang-tidy/misc-move-constructor-init.cpp:65
@@ +64,3 @@
+struct K {}; // Has implicit copy and move constructors
+struct L : K {
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes base class 
by calling a copy constructor [misc-move-constructor-init]

alexfh wrote:
> Please try to use the python script from http://reviews.llvm.org/D12180.
Unfortunately, that script does not work for me on Windows yet. I am happy to 
switch the test over to using the new script, even if it's a follow-up commit, 
whenever the new script has landed (I don't think it should block this patch).


http://reviews.llvm.org/D11784



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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-20 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 32697.
aaron.ballman added a comment.

In http://reviews.llvm.org/D11784#228764, @alexfh wrote:

> In http://reviews.llvm.org/D11784#227939, @aaron.ballman wrote:
>
> > Addressed review comments. I re-ran the updated patch against LLVM and 
> > Clang, and there were some more false positives that I would like to 
> > address if possible. It seems my previous run against the source base was 
> > before expanding the scope of the patch to include more than just base 
> > class initialization (sorry for the earlier misinformation).
> >
> > 1. SourceMgr.h:58 is an example where the checker issues a diagnostic (for 
> > IncludeLoc), but given the triviality of the type, I don't see a reason to 
> > diagnose. However, this requires support from Sema, so I think a FIXME may 
> > be the best I can do. Note, adding a call to std::move() in these instances 
> > is not wrong, it's just not particularly useful.
>
>
> Determining whether a type is trivially-copyable can be done on the AST level 
> without Sema (see QualType::isTriviallyCopyableType).


That should get us closer, but doesn't quite cut it. I think I may be able to 
combine this with CXXRecordDecl::isTriviallyCopyable() to get us close enough 
to cut down on the number of false positives. Thank you for pointing this out, 
it is implemented in this patch.

> > 2. we should not be warning on anything an implicit constructor does. For 
> > instance LiveQueryResult is triggering this because of SlotIndex. This 
> > should be fixed with this patch.

> 

> > 

> 

> >   Running over Clang and LLVM, there are 7 distinct false positives 
> > (repeated due to being in header files) and they all relate to triviality. 
> > The total false positive count was 832 of which two warnings (SourceMgr.h 
> > and Preprocessor.h) accounted for probably close to 90% of the diagnostics. 
> > This time around there were no true positives.

> 

> 

> Can you list the list of unique locations?


With the triviality implementation, I now get zero false positives (and zero 
true positives) in the Clang and LLVM source base.


http://reviews.llvm.org/D11784

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tidy/misc/MoveConstructorInitCheck.h
  test/clang-tidy/misc-move-constructor-init.cpp

Index: test/clang-tidy/misc-move-constructor-init.cpp
===
--- test/clang-tidy/misc-move-constructor-init.cpp
+++ test/clang-tidy/misc-move-constructor-init.cpp
@@ -0,0 +1,78 @@
+// RUN: clang-tidy %s -checks=-*,misc-move-constructor-init -- -std=c++14 | FileCheck %s -implicit-check-not="{{warning|error}}:"
+
+template  struct remove_reference  {typedef T type;};
+template  struct remove_reference  {typedef T type;};
+template  struct remove_reference {typedef T type;};
+
+template 
+typename remove_reference::type&& move(T&& arg) {
+  return static_cast::type&&>(arg);
+}
+
+struct C {
+  C() = default;
+  C(const C&) = default;
+};
+
+struct B {
+  B() {}
+  B(const B&) {}
+  B(B &&) {}
+};
+
+struct D : B {
+  D() : B() {}
+  D(const D &RHS) : B(RHS) {}
+  // CHECK: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [misc-move-constructor-init]
+  // CHECK: 19:3: note: copy constructor being called
+  // CHECK: 20:3: note: candidate move constructor here
+  D(D &&RHS) : B(RHS) {}
+};
+
+struct E : B {
+  E() : B() {}
+  E(const E &RHS) : B(RHS) {}
+  E(E &&RHS) : B(move(RHS)) {} // ok
+};
+
+struct F {
+  C M;
+
+  F(F &&) : M(C()) {} // ok
+};
+
+struct G {
+  G() = default;
+  G(const G&) = default;
+  G(G&&) = delete;
+};
+
+struct H : G {
+  H() = default;
+  H(const H&) = default;
+  H(H &&RHS) : G(RHS) {} // ok
+};
+
+struct I {
+  I(const I &) = default; // suppresses move constructor creation
+};
+
+struct J : I {
+  J(J &&RHS) : I(RHS) {} // ok
+};
+
+struct K {}; // Has implicit copy and move constructors, is trivially copyable
+struct L : K {
+  L(L &&RHS) : K(RHS) {} // ok
+};
+
+struct M {
+  B Mem;
+  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes class member by calling a copy constructor [misc-move-constructor-init]
+  M(M &&RHS) : Mem(RHS.Mem) {}
+};
+
+struct N {
+  B Mem;
+  N(N &&RHS) : Mem(move(RHS.Mem)) {}
+};
Index: clang-tidy/misc/MoveConstructorInitCheck.h
===
--- clang-tidy/misc/MoveConstructorInitCheck.h
+++ clang-tidy/misc/MoveConstructorInitCheck.h
@@ -0,0 +1,32 @@
+//===--- MoveConstructorInitCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY

Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.

2015-08-20 Thread Michael Wong via cfe-commits
fraggamuffin added a comment.





Comment at: lib/Parse/ParseDeclCXX.cpp:3011
@@ -3010,3 +3010,3 @@
   if (Tok.is(tok::annot_pragma_openmp)) {
-ParseOpenMPDeclarativeDirective();
 continue;

While testing this patch with the latest trunk for my work on declare target, I 
kept getting a build error in ParseDeclCXX.cpp as there seems to be no CurAS in 
scope, this may be because of recent changes. But this line:
  if (Tok.is(tok::annot_pragma_openmp))
return ParseOpenMPDeclarativeDirective(CurAS);
Seems to work better as
  if (Tok.is(tok::annot_pragma_openmp))
return ParseOpenMPDeclarativeDirective(AS);


http://reviews.llvm.org/D11182



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


Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

> With the triviality implementation, I now get zero false positives (and zero 
> true positives) in the Clang and LLVM source base.


Awesome! Thanks for working on this!

LGTM


http://reviews.llvm.org/D11784



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


[clang-tools-extra] r245571 - Add a new clang-tidy check (misc-move-constructor-init) that diagnoses move constructor initializations that call copy constructors instead of move constructors.

2015-08-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Aug 20 10:52:52 2015
New Revision: 245571

URL: http://llvm.org/viewvc/llvm-project?rev=245571&view=rev
Log:
Add a new clang-tidy check (misc-move-constructor-init) that diagnoses move 
constructor initializations that call copy constructors instead of move 
constructors.

Added:
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h
clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt?rev=245571&r1=245570&r2=245571&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt Thu Aug 20 10:52:52 
2015
@@ -10,6 +10,7 @@ add_clang_library(clangTidyMiscModule
   MacroParenthesesCheck.cpp
   MacroRepeatedSideEffectsCheck.cpp
   MiscTidyModule.cpp
+  MoveConstructorInitCheck.cpp
   NoexceptMoveConstructorCheck.cpp
   StaticAssertCheck.cpp
   SwappedArgumentsCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=245571&r1=245570&r2=245571&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp Thu Aug 20 
10:52:52 2015
@@ -18,6 +18,7 @@
 #include "InefficientAlgorithmCheck.h"
 #include "MacroParenthesesCheck.h"
 #include "MacroRepeatedSideEffectsCheck.h"
+#include "MoveConstructorInitCheck.h"
 #include "NoexceptMoveConstructorCheck.h"
 #include "StaticAssertCheck.h"
 #include "SwappedArgumentsCheck.h"
@@ -50,6 +51,8 @@ public:
 "misc-macro-parentheses");
 CheckFactories.registerCheck(
 "misc-macro-repeated-side-effects");
+CheckFactories.registerCheck(
+"misc-move-constructor-init");
 CheckFactories.registerCheck(
 "misc-noexcept-move-constructor");
 CheckFactories.registerCheck(

Added: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=245571&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Thu 
Aug 20 10:52:52 2015
@@ -0,0 +1,77 @@
+//===--- MoveConstructorInitCheck.cpp - 
clang-tidy-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "MoveConstructorInitCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+
+void MoveConstructorInitCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+constructorDecl(unless(isImplicit()), allOf(
+  isMoveConstructor(),
+  hasAnyConstructorInitializer(
+ctorInitializer(withInitializer(constructExpr(hasDeclaration(
+  constructorDecl(isCopyConstructor()).bind("ctor")
+.bind("init")
+  )
+)), this);
+}
+
+void MoveConstructorInitCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *CopyCtor = Result.Nodes.getNodeAs("ctor");
+  const auto *Initializer = Result.Nodes.getNodeAs("init");
+
+  // Do not diagnose if the expression used to perform the initialization is a
+  // trivially-copyable type.
+  QualType QT = Initializer->getInit()->getType();
+  if (QT.isTriviallyCopyableType(*Result.Context))
+return;
+  
+  const auto *RD = QT->getAsCXXRecordDecl();
+  if (RD && RD->isTriviallyCopyable())
+return;
+
+  // Diagnose when the class type has a move constructor available, but the
+  // ctor-initializer uses the copy constructor instead.
+  const CXXConstructorDecl *Candidate = nullptr;
+  for (const auto *Ctor : CopyCtor->getParent()->ctors()) {
+if (Ctor->isMoveConstructor() && Ctor->getAccess() <= AS_protected &&
+!Ctor->isDeleted()) {
+  // The type has a move constructor that is at least accessible to the
+  // initializer.
+  //
+  // FIXME: Determine whether the move constructor is a viable candidate
+  // for the ctor-initializer, perhaps pr

Re: [PATCH] D11784: [PATCH] clang-tidy check for incorrect move constructor initializers

2015-08-20 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Closed with commit r245571.


http://reviews.llvm.org/D11784



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


Re: r245560 - Fix crash with two typos in the arguments of a function

2015-08-20 Thread Hans Wennborg via cfe-commits
It was requested that this be merged to 3.7.

Richard: OK for merging?

Thanks,
Hans

On Thu, Aug 20, 2015 at 6:11 AM, Olivier Goffart via cfe-commits
 wrote:
> Author: ogoffart
> Date: Thu Aug 20 08:11:14 2015
> New Revision: 245560
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245560&view=rev
> Log:
> Fix crash with two typos in the arguments of a function
>
> The problem is that the arguments are of TheCall are reset later
> to the ones in Args, making TypoExpr put back. Some TypoExpr that have
> already  been diagnosed and will assert later in Sema::getTypoExprState
>
> Modified:
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/test/Sema/typo-correction.c
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245560&r1=245559&r2=245560&view=diff
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Aug 20 08:11:14 2015
> @@ -4937,6 +4937,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
>  if (!Result.isUsable()) return ExprError();
>  TheCall = dyn_cast(Result.get());
>  if (!TheCall) return Result;
> +Args = ArrayRef(TheCall->getArgs(), TheCall->getNumArgs());
>}
>
>// Bail out early if calling a builtin with custom typechecking.
>
> Modified: cfe/trunk/test/Sema/typo-correction.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typo-correction.c?rev=245560&r1=245559&r2=245560&view=diff
> ==
> --- cfe/trunk/test/Sema/typo-correction.c (original)
> +++ cfe/trunk/test/Sema/typo-correction.c Thu Aug 20 08:11:14 2015
> @@ -49,3 +49,9 @@ extern double cabs(_Complex double z);
>  void fn1() {
>cabs(errij);  // expected-error {{use of undeclared identifier 'errij'}}
>  }
> +
> +extern long afunction(int); // expected-note {{'afunction' declared here}}
> +void fn2() {
> +  f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier 
> 'THIS_IS_AN_ERROR'}}
> +afunction(afunction_));  // expected-error {{use of undeclared 
> identifier 'afunction_'; did you mean 'afunction'?}}
> +}
>
>
> ___
> 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] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh updated this revision to Diff 32705.
alexfh marked 4 inline comments as done.
alexfh added a comment.

Addressed review comments.


http://reviews.llvm.org/D12180

Files:
  test/clang-tidy/arg-comments.cpp
  test/clang-tidy/check_clang_tidy.py
  test/clang-tidy/google-explicit-constructor.cpp
  test/clang-tidy/google-explicit-make-pair.cpp
  test/clang-tidy/google-member-string-references.cpp
  test/clang-tidy/google-memset-zero-length.cpp
  test/clang-tidy/google-overloaded-unary-and.cpp
  test/clang-tidy/google-readability-casting.c
  test/clang-tidy/google-readability-casting.cpp
  test/clang-tidy/google-readability-namespace-comments.cpp
  test/clang-tidy/google-readability-todo.cpp
  test/clang-tidy/google-runtime-int.cpp
  test/clang-tidy/llvm-include-order.cpp
  test/clang-tidy/llvm-twine-local.cpp
  test/clang-tidy/misc-assert-side-effect.cpp
  test/clang-tidy/misc-assign-operator-signature.cpp
  test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp
  test/clang-tidy/misc-inaccurate-erase.cpp
  test/clang-tidy/misc-inefficient-algorithm.cpp
  test/clang-tidy/misc-macro-parentheses.cpp
  test/clang-tidy/misc-noexcept-move-constructor.cpp
  test/clang-tidy/misc-repeated-side-effects-in-macro.c
  test/clang-tidy/misc-static-assert.cpp
  test/clang-tidy/misc-swapped-arguments.cpp
  test/clang-tidy/misc-undelegated-constructor.cpp
  test/clang-tidy/misc-uniqueptr-reset-release.cpp
  test/clang-tidy/misc-unused-alias-decls.cpp
  test/clang-tidy/misc-unused-parameters.c
  test/clang-tidy/misc-unused-parameters.cpp
  test/clang-tidy/misc-unused-raii.cpp
  test/clang-tidy/misc-use-override-cxx98.cpp
  test/clang-tidy/misc-use-override.cpp
  test/clang-tidy/modernize-loop-convert-basic.cpp
  test/clang-tidy/modernize-loop-convert-extra.cpp
  test/clang-tidy/modernize-loop-convert-negative.cpp
  test/clang-tidy/modernize-pass-by-value.cpp
  test/clang-tidy/modernize-use-nullptr-basic.cpp
  test/clang-tidy/modernize-use-nullptr.cpp
  test/clang-tidy/readability-braces-around-statements-few-lines.cpp
  test/clang-tidy/readability-braces-around-statements-same-line.cpp
  test/clang-tidy/readability-braces-around-statements-single-line.cpp
  test/clang-tidy/readability-braces-around-statements.cpp
  test/clang-tidy/readability-container-size-empty.cpp
  test/clang-tidy/readability-else-after-return.cpp
  test/clang-tidy/readability-function-size.cpp
  test/clang-tidy/readability-identifier-naming.cpp
  test/clang-tidy/readability-named-parameter.cpp
  test/clang-tidy/readability-redundant-smartptr-get.cpp
  test/clang-tidy/readability-redundant-string-cstr.cpp
  test/clang-tidy/readability-shrink-to-fit.cpp
  
test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
  test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
  test/clang-tidy/readability-simplify-bool-expr.cpp

Index: test/clang-tidy/readability-simplify-bool-expr.cpp
===
--- test/clang-tidy/readability-simplify-bool-expr.cpp
+++ test/clang-tidy/readability-simplify-bool-expr.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-simplify-boolean-expr %t
-// REQUIRES: shell
+// RUN: %python %S/check_clang_tidy.py %s readability-simplify-boolean-expr %t
 
 bool a1 = false;
 
Index: test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
===
--- test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
+++ test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalReturn", value: 1}]}" --
-// REQUIRES: shell
+// RUN: %python %S/check_clang_tidy.py %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalReturn", value: 1}]}" --
 
 bool chained_conditional_compound_return(int i) {
   if (i < 0) {
Index: test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
===
--- test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
+++ test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalAssignment", value: 1}]}" --
-// REQUIRES: shell
+// RUN: %python %S/check_clang_tidy.py %s readability-simplify-boolean-expr %t -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalAssignment", value: 1}]}" --
 
 void chained_conditional_compound_assignment(int i) {
   bool b;
Index: test/clang-tidy/readability-shri

Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: test/clang-tidy/arg-comments.cpp:1
@@ -1,3 +1,2 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-argument-comment %t
-// REQUIRES: shell
+// RUN: $(dirname %s)/check_clang_tidy.py %s misc-argument-comment %t
 

chapuni wrote:
> $(dirname %s) assumes shell. use %S instead.
> Lit internal runner is not capable of !shbang. use %python.
> 
>   // RUN: %python %S/check_clang_tidy.py %s misc-argument-comment %t
Sure, I should have noticed this. Thanks for pointing out!


Comment at: test/clang-tidy/google-readability-casting.c:7
@@ -6,3 +6,3 @@
 // RUN: clang-tidy --checks=-*,google-readability-casting -header-filter='.*' 
%t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s 
-check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
 // REQUIRES: shell
 

chapuni wrote:
> It can be pruned.
Line 5 runs `cp`, will it work on Windows?


http://reviews.llvm.org/D12180



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


Re: [Diffusion] rL245435: clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease…

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Thanks for the explanation.

FTR, this check on line 190 fails with -fdelayed-template-parsing:

  // CHECK-FIXES: {{^}}GlobalFunction(1, 2);{{$}}


Users:
  chapuni (Author)

http://reviews.llvm.org/rL245435



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


Re: [Diffusion] rL245435: clang-tools-extra/test/clang-tidy/readability-identifier-naming.cpp: Appease…

2015-08-20 Thread Aaron Ballman via cfe-commits
On Thu, Aug 20, 2015 at 1:01 PM, Alexander Kornienko via cfe-commits
 wrote:
> alexfh added a comment.
>
> Thanks for the explanation.
>
> FTR, this check on line 190 fails with -fdelayed-template-parsing:
>
>   // CHECK-FIXES: {{^}}GlobalFunction(1, 2);{{$}}

FWIW, I think there's a checker bug with delayed template parsing. See
thread starting at:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150817/136172.html

~Aaron

>
>
> Users:
>   chapuni (Author)
>
> http://reviews.llvm.org/rL245435
>
>
>
> ___
> 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] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread NAKAMURA Takumi via cfe-commits
chapuni accepted this revision.
chapuni added a comment.
This revision is now accepted and ready to land.

Ready to commit regardless of one REQUIRES.

  Testing Time: 4.73s
Expected Passes: 72

Note, llvm-include-order.cpp will XFAIL for targeting msvc.



Comment at: test/clang-tidy/google-readability-casting.c:7
@@ -6,3 +6,3 @@
 // RUN: clang-tidy --checks=-*,google-readability-casting -header-filter='.*' 
%t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s 
-check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
 // REQUIRES: shell
 

It should work.
We require GnuWin32 to run tests on Windows. It has cp(1).


http://reviews.llvm.org/D12180



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


Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

The latest patch works for me when testing on Windows with MSVC. LGTM, and 
thank you!


http://reviews.llvm.org/D12180



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


Re: [PATCH] D12002: Initial WebAssembly support in clang

2015-08-20 Thread Dan Gohman via cfe-commits
sunfish marked 2 inline comments as done.


Comment at: lib/CodeGen/ItaniumCXXABI.cpp:364
@@ +363,3 @@
+ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true,
+  /* UseARMGuardVarABI = */ true) {}
+

jfb wrote:
> It's more common to have no spaces for these comments: 
> `/*UseARMMethodPtrABI=*/true,`.
Ok. I updated this in my local patch.


Comment at: lib/Driver/Tools.cpp:1567
@@ +1566,3 @@
+
+#ifdef __wasm__
+// Handle "native" by examining the host.

jfb wrote:
> Could you expand a bit on why "native" doesn't make sense if LLVM itself 
> wasn't compiled for wasm?
Ok. I added a comment to my local patch that says: "native" isn't meaningful 
when cross compiling, so only support this when the host is also WebAssembly.


Repository:
  rL LLVM

http://reviews.llvm.org/D12002



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


Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Gentle ping. There is going to be a couple of days lag time between committing 
this and it showing up at libcxx.llvm.org/docs.
Once it is available at `libcxx.llvm.org/docs` we still have time to review it 
before we link to it from the homepage. 
For this reason, and because the sphinx bits already got a thumbs up I would 
like to commit this now.

Plus I think the documentation is better reviewed in its generated form and not 
it's as plaintext.

@mclow.lists Would you have an objection to this approach?

NOTE: This patch **does not** change `libcxx.llvm.org` page or any existing 
documentation.


http://reviews.llvm.org/D12129



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


[PATCH] D12200: Add framework for iterative compilation to clang

2015-08-20 Thread Zoran Jovanovic via cfe-commits
zoran.jovanovic created this revision.
zoran.jovanovic added reviewers: hfinkel, atrick, chandlerc.
zoran.jovanovic added subscribers: cfe-commits, yaron.keren, petarj, 
Atlantic777, Radovan.Obradovic.

This patch adds command line option for iterative compilation, as well
as the code that invokes clang iteratively.
Communication between multiple runs is done over temporary files.

http://reviews.llvm.org/D12200

Files:
  include/clang/Driver/Compilation.h
  include/clang/Driver/Driver.h
  include/clang/Driver/Options.td
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Driver.cpp
  lib/Driver/Tools.cpp
  tools/driver/driver.cpp

Index: tools/driver/driver.cpp
===
--- tools/driver/driver.cpp
+++ tools/driver/driver.cpp
@@ -50,6 +50,10 @@
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
+#include "llvm/Analysis/IterativeCompilation.h"
+#include "llvm/Support/Program.h"
+#include 
+#include 
 using namespace clang;
 using namespace clang::driver;
 using namespace llvm::opt;
@@ -386,6 +390,80 @@
   return 1;
 }
 
+void initControlFiles(llvm::ModuleDecisionTrees &MDT, int CurrentIteration)
+{
+  std::string ICResultsFile;
+  std::string ICResultsFile2;
+
+  // assign control files
+  llvm::ICResultsFile results1("ic-results", CurrentIteration);
+  llvm::ICResultsFile results2("ic-results2", CurrentIteration);
+  MDT.getICResultsFile() = results1;
+  MDT.getICResultsFile2() = results2;
+
+  llvm::ICInputFile input1("ic-input", CurrentIteration);
+  llvm::ICInputFile input2("ic-input2", CurrentIteration);
+  MDT.getICInputFile() = input1;
+  MDT.getICInputFile2() = input2;
+}
+
+void writeInputFiles(llvm::ModuleDecisionTrees &MDT)
+{
+  // inits and declarations
+  llvm::ICPathsMap paths;
+  llvm::ICPathsMap pathBeforeCodegen;
+  llvm::ICPathsMap pathAfterCodegen;
+
+  // split paths
+  MDT.getPaths(paths);
+  MDT.splitPaths(paths, pathBeforeCodegen, pathAfterCodegen);
+
+  // convert paths to strings and write them to files
+  llvm::ICInputFile input1 = MDT.getICInputFile();
+  llvm::ICInputFile input2 = MDT.getICInputFile2();
+
+  input1.setPaths(pathBeforeCodegen);
+  input2.setPaths(pathAfterCodegen);
+
+  input1.write();
+  input2.write();
+}
+
+void removeControlFiles(llvm::ModuleDecisionTrees &MDT) {
+  MDT.getICResultsFile().remove();
+  MDT.getICResultsFile2().remove();
+}
+
+int loadResultFiles(llvm::ModuleDecisionTrees &MDT,
+std::vector &merged) {
+  llvm::ICResultsFile results1 = MDT.getICResultsFile();
+  llvm::ICResultsFile results2 = MDT.getICResultsFile2();
+
+  int r1 = results1.read();
+  int r2 = results2.read();
+
+  if(r1 || r2)
+return 1;
+
+  llvm::MdtResults::mergeMdtResults(merged,
+  results1.getResults(), results2.getResults());
+
+  return 0;
+}
+
+llvm::MdtResults* getModuleResults(std::vector &merged,
+   std::string name)
+{
+  llvm::MdtResults *moduleResults = NULL;
+
+  for(auto res : merged) {
+if (res.FunctionNameAndPhase.getName() == name)
+  moduleResults = new llvm::MdtResults(res);
+  }
+
+  return moduleResults;
+}
+
 int main(int argc_, const char **argv_) {
   llvm::sys::PrintStackTraceOnErrorSignal();
   llvm::PrettyStackTraceProgram X(argc_, argv_);
@@ -506,6 +584,31 @@
 Diags.takeClient(), std::move(SerializedConsumer)));
   }
 
+  // Get number of iterations for iterative compilation.
+  // declare files and number of iterations
+  int ICNumberOfIterations = 0;
+
+  // extract number of iterations from cli args
+  std::unique_ptr CCopts(createDriverOptTable());
+  unsigned MissingArgIndex, MissingArgCount;
+  ArrayRef argv_ref(argv);
+  InputArgList Args = CCopts->ParseArgs(argv_ref.slice(1),
+MissingArgIndex, MissingArgCount);
+  if (Args.getLastArg(options::OPT_fiterative_comp_EQ)) {
+std::string Val = Args.getLastArgValue(options::OPT_fiterative_comp_EQ, "1");
+std::stringstream Convert(Val);
+Convert >> ICNumberOfIterations;
+   }
+  if (!ICNumberOfIterations)
+ICNumberOfIterations = 1; // Default value is 1.
+
+  llvm::ModuleDecisionTrees moduleDecisionTrees;
+  int CurrentIteration = 0;
+  int Res = 0;
+
+  llvm::FnNameAndPhase::ICPhase CurrICPhase = llvm::FnNameAndPhase::ModulePhase;
+
+  for (; CurrentIteration < ICNumberOfIterations; CurrentIteration++) {
   ProcessWarningOptions(Diags, *DiagOpts, /*ReportDiags=*/false);
 
   Driver TheDriver(Path, llvm::sys::getDefaultTargetTriple(), Diags);
@@ -516,12 +619,51 @@
 
   SetBackdoorDriverOutputsFromEnvVars(TheDriver);
 
+  if (ICNumberOfIterations > 1) {
+TheDriver.setModuleDecisionTrees(&moduleDecisionTrees);
+
+initControlFiles(moduleDecisionTrees, CurrentIteration);
+writeInputFiles(moduleDecisionTrees);
+
+moduleDecisionTrees.startNewIteration();
+  }
+
   std::unique_ptr C(TheDriver.BuildCompilation(argv));
   int Res = 0;
   SmallVector, 4> FailingCommands;
   if (C.get())
 Res = TheDri

Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

Both styles look ok to me, with a slight preference toward matching clang's.



Comment at: docs/BuildingLibcxx.rst:56
@@ +55,3 @@
+Mac users, remember to be careful when replacing the system's libc++.
+**Your system will not be able to boot without a functioning libc++.**
+

Is there a way to make this more prominent, perhaps by putting it in a red box? 
This is a very important detail that is very painful to recover from if you 
miss it.


Comment at: docs/BuildingLibcxx.rst:243
@@ +242,3 @@
+
+Note the first two entries happen to be what we are looking for. This
+may not be correct on other platforms.

s/Note the/Note that the/


Comment at: docs/index.rst:87
@@ +86,3 @@
+   
+OS   Arch CompilersABI Library
+   

Should we mention the unwinders used/supported here too?


http://reviews.llvm.org/D12129



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


Re: [PATCH] D12200: Add framework for iterative compilation to clang

2015-08-20 Thread Zoran Jovanovic via cfe-commits
zoran.jovanovic added a comment.

This patch needs to be applied along with the patch for llvm.
See http://reviews.llvm.org/D12199 for more details.

As suggested new revision created for this patch,
previous patch versions can be found here:
http://reviews.llvm.org/D4724


http://reviews.llvm.org/D12200



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


Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Dan Albert via cfe-commits
danalbert accepted this revision.
danalbert added a comment.

I think I prefer the haiku style, but I couldn't give you any concrete reasons 
for that.


http://reviews.llvm.org/D12129



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


[clang-tools-extra] r245583 - [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 20 12:58:07 2015
New Revision: 245583

URL: http://llvm.org/viewvc/llvm-project?rev=245583&view=rev
Log:
[clang-tidy] Use a python script instead of a shell script to run clang-tidy 
tests.

Summary:
Add check_clang_tidy.py script that is functionally identical to the
check_clang_tidy.py, but should also be functional on windows.

I've verified that the script works on linux. Would be nice if folks using
Windows could test the patch before I break windows bots ;)

Reviewers: chapuni, aaron.ballman

Subscribers: cfe-commits

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

Added:
clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py   (with props)
Modified:
clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp
clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp
clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp
clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp
clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp
clang-tools-extra/trunk/test/clang-tidy/google-overloaded-unary-and.cpp
clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c
clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp

clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp
clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp
clang-tools-extra/trunk/test/clang-tidy/google-runtime-int.cpp
clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp
clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-assert-side-effect.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-assign-operator-signature.cpp

clang-tools-extra/trunk/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-inaccurate-erase.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-inefficient-algorithm.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-macro-parentheses.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-noexcept-move-constructor.cpp

clang-tools-extra/trunk/test/clang-tidy/misc-repeated-side-effects-in-macro.c
clang-tools-extra/trunk/test/clang-tidy/misc-static-assert.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-swapped-arguments.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-undelegated-constructor.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-uniqueptr-reset-release.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-unused-alias-decls.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.c
clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-use-override-cxx98.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-use-override.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-negative.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr-basic.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-few-lines.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-same-line.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-single-line.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-container-size-empty.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-function-size.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-named-parameter.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-shrink-to-fit.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp

clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp?rev=245583&r1=245582&r2=245583&view=diff
==

Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245583: [clang-tidy] Use a python script instead of a shell 
script to run clang-tidy… (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D12180?vs=32705&id=32712#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12180

Files:
  clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp
  clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
  clang-tools-extra/trunk/test/clang-tidy/google-explicit-constructor.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-member-string-references.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-memset-zero-length.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-overloaded-unary-and.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c
  clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp
  
clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-readability-todo.cpp
  clang-tools-extra/trunk/test/clang-tidy/google-runtime-int.cpp
  clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp
  clang-tools-extra/trunk/test/clang-tidy/llvm-twine-local.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-assert-side-effect.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-assign-operator-signature.cpp
  
clang-tools-extra/trunk/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-inaccurate-erase.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-inefficient-algorithm.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-macro-parentheses.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-noexcept-move-constructor.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-repeated-side-effects-in-macro.c
  clang-tools-extra/trunk/test/clang-tidy/misc-static-assert.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-swapped-arguments.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-undelegated-constructor.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-uniqueptr-reset-release.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-unused-alias-decls.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.c
  clang-tools-extra/trunk/test/clang-tidy/misc-unused-parameters.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-use-override-cxx98.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-use-override.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-negative.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr-basic.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-few-lines.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-same-line.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-single-line.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-container-size-empty.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-function-size.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-named-parameter.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-shrink-to-fit.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp

Index: clang-tools-extra/trunk/test/clang-tidy/misc-uniqueptr-reset-release.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-uniqueptr-reset-release.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-uniqueptr-reset-release.cpp
@@ -1,5 +1,4 @@
-// RUN: $(dirname %s)/check_clang_tidy.sh %s misc-uniqueptr-reset-release %t
-// REQUIRES: shell
+// RUN: %python %S/check_clang_tidy.py %s misc-uniqueptr-reset-release %t
 
 namespace std {
 
Index: clang-tools-extra/trunk/test/clang-tidy/misc-static-assert.cpp
===
--- clang-tools-extra/tr

Re: [PATCH] D12180: [clang-tidy] Use a python script instead of a shell script to run clang-tidy tests.

2015-08-20 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: test/clang-tidy/google-readability-casting.c:7
@@ -6,3 +6,3 @@
 // RUN: clang-tidy --checks=-*,google-readability-casting -header-filter='.*' 
%t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s 
-check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
 // REQUIRES: shell
 

chapuni wrote:
> It should work.
> We require GnuWin32 to run tests on Windows. It has cp(1).
Removed `REQUIRES: shell`.


Repository:
  rL LLVM

http://reviews.llvm.org/D12180



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


[clang-tools-extra] r245586 - [clang-tidy] Use check_clang_tidy.py instead of check_clang_tidy.sh by default.

2015-08-20 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 20 13:11:13 2015
New Revision: 245586

URL: http://llvm.org/viewvc/llvm-project?rev=245586&view=rev
Log:
[clang-tidy] Use check_clang_tidy.py instead of check_clang_tidy.sh by default.

Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py

Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=245586&r1=245585&r2=245586&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Thu Aug 20 13:11:13 2015
@@ -183,7 +183,7 @@ def write_test(module_path, module, chec
   check_name_dashes + '.cpp')
   with open(filename, 'w') as f:
 f.write(
-"""// RUN: $(dirname %%s)/check_clang_tidy.sh %%s %(check_name_dashes)s %%t
+"""// RUN: %%python %%S/check_clang_tidy.py %%s %(check_name_dashes)s %%t
 // REQUIRES: shell
 
 // FIXME: Add something that triggers the check here.


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


[clang-tools-extra] r245587 - [clang-tidy] Mention check_clang_tidy.py instead of check_clang_tidy.sh in the docs.

2015-08-20 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Aug 20 13:16:13 2015
New Revision: 245587

URL: http://llvm.org/viewvc/llvm-project?rev=245587&view=rev
Log:
[clang-tidy] Mention check_clang_tidy.py instead of check_clang_tidy.sh in the 
docs.

Modified:
clang-tools-extra/trunk/docs/clang-tidy.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy.rst?rev=245587&r1=245586&r2=245587&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy.rst Thu Aug 20 13:16:13 2015
@@ -442,7 +442,7 @@ with strict checks. `Lit`_ tests allow u
 expressions which makes them more suitable for writing compact tests for
 diagnostic messages.
 
-The ``check_clang_tidy.sh`` script provides an easy way to test both
+The ``check_clang_tidy.py`` script provides an easy way to test both
 diagnostic messages and fix-its. It filters out ``CHECK`` lines from the test
 file, runs :program:`clang-tidy` and verifies messages and fixes with two
 separate `FileCheck`_ invocations. To use the script, put a .cpp file with the
@@ -454,12 +454,11 @@ It's advised to make the checks as speci
 to incorrect parts of the input. Use ``[[@LINE+X]]``/``[[@LINE-X]]``
 substitutions and distinct function and variable names in the test code.
 
-Here's an example of a test using the ``check_clang_tidy.sh`` script:
+Here's an example of a test using the ``check_clang_tidy.py`` script:
 
 .. code-block:: bash
 
-  // RUN: $(dirname %s)/check_clang_tidy.sh %s google-readability-casting %t
-  // REQUIRES: shell
+  // RUN: %python %S/check_clang_tidy.py %s google-readability-casting %t
 
   void f(int a) {
 int b = (int)a;


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


[PATCH] D12201: [Sparc] Add '-EL' when invoking gcc to link little-endian binaries.

2015-08-20 Thread Douglas Katzman via cfe-commits
dougk created this revision.
dougk added a reviewer: jyknight.
dougk added a subscriber: cfe-commits.

http://reviews.llvm.org/D12201

Files:
  lib/Driver/Tools.cpp
  test/Driver/biarch.c

Index: test/Driver/biarch.c
===
--- test/Driver/biarch.c
+++ test/Driver/biarch.c
@@ -28,6 +28,9 @@
 // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
 
+// RUN: %clang -target sparcel -o foo %s -### 2> %t
+// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
+
 // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
 
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5617,12 +5617,22 @@
   //
   // FIXME: The triple class should directly provide the information we want
   // here.
-  const llvm::Triple::ArchType Arch = getToolChain().getArch();
-  if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc)
+  switch (getToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::x86:
+  case llvm::Triple::ppc:
 CmdArgs.push_back("-m32");
-  else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 ||
-   Arch == llvm::Triple::ppc64le)
+break;
+  case llvm::Triple::x86_64:
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
 CmdArgs.push_back("-m64");
+break;
+  case llvm::Triple::sparcel:
+CmdArgs.push_back("-EL");
+break;
+  }
 
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");


Index: test/Driver/biarch.c
===
--- test/Driver/biarch.c
+++ test/Driver/biarch.c
@@ -28,6 +28,9 @@
 // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
 
+// RUN: %clang -target sparcel -o foo %s -### 2> %t
+// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
+
 // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
 
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5617,12 +5617,22 @@
   //
   // FIXME: The triple class should directly provide the information we want
   // here.
-  const llvm::Triple::ArchType Arch = getToolChain().getArch();
-  if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc)
+  switch (getToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::x86:
+  case llvm::Triple::ppc:
 CmdArgs.push_back("-m32");
-  else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 ||
-   Arch == llvm::Triple::ppc64le)
+break;
+  case llvm::Triple::x86_64:
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
 CmdArgs.push_back("-m64");
+break;
+  case llvm::Triple::sparcel:
+CmdArgs.push_back("-EL");
+break;
+  }
 
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12123: [analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.

2015-08-20 Thread Gábor Horváth via cfe-commits
xazax.hun added inline comments.


Comment at: lib/StaticAnalyzer/Core/CheckerManager.cpp:237
@@ +236,3 @@
+return PreObjCMessageCheckers;
+break;
+  case ObjCMessageVisitKind::Post:

nit: remove the break after the return.


Comment at: lib/StaticAnalyzer/Core/ExprEngineObjC.cpp:197
@@ +196,3 @@
+  // Generate a transition to non-Nil state, dropping any potential
+  // non-nil flow.
+  if (notNilState != State) {

Aren't we dropping the nil flow here instead of the non-nil? If that's the 
case, the comment should reflect that.


http://reviews.llvm.org/D12123



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


r245592 - Revert r245496 "[CUDA] Add appropriate host/device attribute to builtins."

2015-08-20 Thread Artem Belevich via cfe-commits
Author: tra
Date: Thu Aug 20 13:28:56 2015
New Revision: 245592

URL: http://llvm.org/viewvc/llvm-project?rev=245592&view=rev
Log:
Revert r245496 "[CUDA] Add appropriate host/device attribute to builtins."

It's breaking internal test.

Removed:
cfe/trunk/test/SemaCUDA/builtins.cu
Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCUDA/implicit-intrinsic.cu

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=245592&r1=245591&r2=245592&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Thu Aug 20 13:28:56 2015
@@ -81,11 +81,6 @@ public:
 return getRecord(ID).Type;
   }
 
-  /// \brief Return true if this function is a target-specific builtin
-  bool isTSBuiltin(unsigned ID) const {
-return ID >= Builtin::FirstTSBuiltin;
-  }
-
   /// \brief Return true if this function has no side effects and doesn't
   /// read memory.
   bool isConst(unsigned ID) const {

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=245592&r1=245591&r2=245592&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Aug 20 13:28:56 2015
@@ -525,7 +525,7 @@ Sema::CheckBuiltinFunctionCall(FunctionD
 
   // Since the target specific builtins for each arch overlap, only check those
   // of the arch we are compiling for.
-  if (Context.BuiltinInfo.isTSBuiltin(BuiltinID)) {
+  if (BuiltinID >= Builtin::FirstTSBuiltin) {
 switch (Context.getTargetInfo().getTriple().getArch()) {
   case llvm::Triple::arm:
   case llvm::Triple::armeb:

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=245592&r1=245591&r2=245592&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 20 13:28:56 2015
@@ -11187,17 +11187,6 @@ void Sema::AddKnownFunctionAttributes(Fu
   FD->addAttr(NoThrowAttr::CreateImplicit(Context, FD->getLocation()));
 if (Context.BuiltinInfo.isConst(BuiltinID) && !FD->hasAttr())
   FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
-if (getLangOpts().CUDA && Context.BuiltinInfo.isTSBuiltin(BuiltinID) &&
-!FD->hasAttr() && !FD->hasAttr()) {
-  // Target-specific builtins are assumed to be intended for use
-  // in this particular CUDA compilation mode and should have
-  // appropriate attribute set so we can enforce CUDA function
-  // call restrictions.
-  if (getLangOpts().CUDAIsDevice)
-FD->addAttr(CUDADeviceAttr::CreateImplicit(Context, 
FD->getLocation()));
-  else
-FD->addAttr(CUDAHostAttr::CreateImplicit(Context, FD->getLocation()));
-}
   }
 
   IdentifierInfo *Name = FD->getIdentifier();

Removed: cfe/trunk/test/SemaCUDA/builtins.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/builtins.cu?rev=245591&view=auto
==
--- cfe/trunk/test/SemaCUDA/builtins.cu (original)
+++ cfe/trunk/test/SemaCUDA/builtins.cu (removed)
@@ -1,35 +0,0 @@
-// Tests that target-specific builtins have appropriate host/device
-// attributes and that CUDA call restrictions are enforced. Also
-// verify that non-target builtins can be used from both host and
-// device functions.
-//
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-cuda -fcuda-is-device \
-// RUN:   -fsyntax-only -verify %s
-
-
-#ifdef __CUDA_ARCH__
-// Device-side builtins are not allowed to be called from host functions.
-void hf() {
-  int x = __builtin_ptx_read_tid_x(); // expected-note  
{{'__builtin_ptx_read_tid_x' declared here}}
-  // expected-error@-1 {{reference to __device__ function 
'__builtin_ptx_read_tid_x' in __host__ function}}
-  x = __builtin_abs(1);
-}
-__attribute__((device)) void df() {
-  int x = __builtin_ptx_read_tid_x();
-  x = __builtin_abs(1);
-}
-#else
-// Host-side builtins are not allowed to be called from device functions.
-__attribute__((device)) void df() {
-  int x = __builtin_ia32_rdtsc();   // expected-note {{'__builtin_ia32_rdtsc' 
declared here}}
-  // expected-error@-1 {{reference to __host__ function '__builtin_ia32_rdtsc' 
in __device__ function}}
-  x = __builtin_abs(1);
-}
-void hf() {
-  int x = __builtin_ia32_rdtsc();
-  x = __builtin_abs(1);
-}
-#endif

Modified: cfe/trunk/test/SemaCUDA/implici

Re: [PATCH] D12123: [analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.

2015-08-20 Thread Devin Coughlin via cfe-commits
dcoughlin marked 2 inline comments as done.


Comment at: lib/StaticAnalyzer/Core/ExprEngineObjC.cpp:197
@@ +196,3 @@
+  // Generate a transition to non-Nil state, dropping any potential
+  // non-nil flow.
+  if (notNilState != State) {

xazax.hun wrote:
> Aren't we dropping the nil flow here instead of the non-nil? If that's the 
> case, the comment should reflect that.
Yes, you're right. I'll update the comment.


Comment at: test/Analysis/objc-message.m:25
@@ +24,3 @@
+
+  // We intentionally drop the non-nil flow (dropping coverage) after a method
+  // call when the receiver may be nil in order to avoid inconsistencies of

This comment is wrong too (we drop the *nil* flow). I'll update it.


http://reviews.llvm.org/D12123



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


r245595 - [Sparc] Add '-EL' when invoking gcc to link little-endian binaries.

2015-08-20 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Thu Aug 20 13:32:26 2015
New Revision: 245595

URL: http://llvm.org/viewvc/llvm-project?rev=245595&view=rev
Log:
[Sparc] Add '-EL' when invoking gcc to link little-endian binaries.

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/biarch.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245595&r1=245594&r2=245595&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 20 13:32:26 2015
@@ -5617,12 +5617,22 @@ void gcc::Common::ConstructJob(Compilati
   //
   // FIXME: The triple class should directly provide the information we want
   // here.
-  const llvm::Triple::ArchType Arch = getToolChain().getArch();
-  if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc)
+  switch (getToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::x86:
+  case llvm::Triple::ppc:
 CmdArgs.push_back("-m32");
-  else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 ||
-   Arch == llvm::Triple::ppc64le)
+break;
+  case llvm::Triple::x86_64:
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
 CmdArgs.push_back("-m64");
+break;
+  case llvm::Triple::sparcel:
+CmdArgs.push_back("-EL");
+break;
+  }
 
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");

Modified: cfe/trunk/test/Driver/biarch.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/biarch.c?rev=245595&r1=245594&r2=245595&view=diff
==
--- cfe/trunk/test/Driver/biarch.c (original)
+++ cfe/trunk/test/Driver/biarch.c Thu Aug 20 13:32:26 2015
@@ -28,6 +28,9 @@
 // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
 
+// RUN: %clang -target sparcel -o foo %s -### 2> %t
+// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
+
 // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
 


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


Re: [PATCH] D12201: [Sparc] Add '-EL' when invoking gcc to link little-endian binaries.

2015-08-20 Thread Douglas Katzman via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245595: [Sparc] Add '-EL' when invoking gcc to link 
little-endian binaries. (authored by dougk).

Changed prior to commit:
  http://reviews.llvm.org/D12201?vs=32715&id=32716#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12201

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/biarch.c

Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -5617,12 +5617,22 @@
   //
   // FIXME: The triple class should directly provide the information we want
   // here.
-  const llvm::Triple::ArchType Arch = getToolChain().getArch();
-  if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc)
+  switch (getToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::x86:
+  case llvm::Triple::ppc:
 CmdArgs.push_back("-m32");
-  else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 ||
-   Arch == llvm::Triple::ppc64le)
+break;
+  case llvm::Triple::x86_64:
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
 CmdArgs.push_back("-m64");
+break;
+  case llvm::Triple::sparcel:
+CmdArgs.push_back("-EL");
+break;
+  }
 
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");
Index: cfe/trunk/test/Driver/biarch.c
===
--- cfe/trunk/test/Driver/biarch.c
+++ cfe/trunk/test/Driver/biarch.c
@@ -28,6 +28,9 @@
 // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
 
+// RUN: %clang -target sparcel -o foo %s -### 2> %t
+// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
+
 // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
 


Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -5617,12 +5617,22 @@
   //
   // FIXME: The triple class should directly provide the information we want
   // here.
-  const llvm::Triple::ArchType Arch = getToolChain().getArch();
-  if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc)
+  switch (getToolChain().getArch()) {
+  default:
+break;
+  case llvm::Triple::x86:
+  case llvm::Triple::ppc:
 CmdArgs.push_back("-m32");
-  else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 ||
-   Arch == llvm::Triple::ppc64le)
+break;
+  case llvm::Triple::x86_64:
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
 CmdArgs.push_back("-m64");
+break;
+  case llvm::Triple::sparcel:
+CmdArgs.push_back("-EL");
+break;
+  }
 
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");
Index: cfe/trunk/test/Driver/biarch.c
===
--- cfe/trunk/test/Driver/biarch.c
+++ cfe/trunk/test/Driver/biarch.c
@@ -28,6 +28,9 @@
 // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
 
+// RUN: %clang -target sparcel -o foo %s -### 2> %t
+// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
+
 // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 32718.
EricWF marked an inline comment as done.
EricWF updated the summary for this revision.
EricWF added a comment.

Address review comments.


http://reviews.llvm.org/D12129

Files:
  CMakeLists.txt
  cmake/Modules/HandleOutOfTreeLLVM.cmake
  cmake/config-ix.cmake
  docs/BuildingLibcxx.rst
  docs/CMakeLists.txt
  docs/README.txt
  docs/TestingLibcxx.rst
  docs/UsingLibcxx.rst
  docs/_static/llvm.css
  docs/_templates/indexsidebar.html
  docs/_templates/layout.html
  docs/_themes/llvm-theme/layout.html
  docs/_themes/llvm-theme/static/llvm-theme.css
  docs/_themes/llvm-theme/theme.conf
  docs/conf.py
  docs/index.rst

Index: docs/index.rst
===
--- /dev/null
+++ docs/index.rst
@@ -0,0 +1,171 @@
+.. _index:
+
+=
+"libc++" C++ Standard Library
+=
+
+Overview
+
+
+libc++ is a new implementation of the C++ standard library, targeting C++11.
+
+* Features and Goals
+
+  * Correctness as defined by the C++11 standard.
+  * Fast execution.
+  * Minimal memory use.
+  * Fast compile times.
+  * ABI compatibility with gcc's libstdc++ for some low-level features
+such as exception objects, rtti and memory allocation.
+  * Extensive unit tests.
+
+* Design and Implementation:
+
+  * Extensive unit tests
+  * Internal linker model can be dumped/read to textual format
+  * Additional linking features can be plugged in as "passes"
+  * OS specific and CPU specific code factored out
+
+
+Getting Started with libc++
+---
+
+.. toctree::
+   :maxdepth: 2
+
+   UsingLibcxx
+   BuildingLibcxx
+   TestingLibcxx
+
+Current Status
+--
+
+After its initial introduction, many people have asked "why start a new
+library instead of contributing to an existing library?" (like Apache's
+libstdcxx, GNU's libstdc++, STLport, etc).  There are many contributing
+reasons, but some of the major ones are:
+
+From years of experience (including having implemented the standard
+library before), we've learned many things about implementing
+the standard containers which require ABI breakage and fundamental changes
+to how they are implemented.  For example, it is generally accepted that
+building std::string using the "short string optimization" instead of
+using Copy On Write (COW) is a superior approach for multicore
+machines (particularly in C++11, which has rvalue references).  Breaking
+ABI compatibility with old versions of the library was
+determined to be critical to achieving the performance goals of
+libc++.
+
+Mainline libstdc++ has switched to GPL3, a license which the developers
+of libc++ cannot use.  libstdc++ 4.2 (the last GPL2 version) could be
+independently extended to support C++11, but this would be a fork of the
+codebase (which is often seen as worse for a project than starting a new
+independent one).  Another problem with libstdc++ is that it is tightly
+integrated with G++ development, tending to be tied fairly closely to the
+matching version of G++.
+
+STLport and the Apache libstdcxx library are two other popular
+candidates, but both lack C++11 support.  Our experience (and the
+experience of libstdc++ developers) is that adding support for C++11 (in
+particular rvalue references and move-only types) requires changes to
+almost every class and function, essentially amounting to a rewrite.
+Faced with a rewrite, we decided to start from scratch and evaluate every
+design decision from first principles based on experience.
+
+Further, both projects are apparently abandoned: STLport 5.2.1 was
+released in Oct'08, and STDCXX 4.2.1 in May'08.
+
+Platform and Compiler Support
+-
+
+libc++ is known to work on the following platforms, using gcc-4.2 and
+clang  (lack of C++11 language support disables some functionality).
+Note that functionality provided by  is only functional with clang
+and GCC.
+
+   
+OS   Arch CompilersABI Library
+   
+Mac OS X i386, x86_64 Clang, GCC   libc++abi
+FreeBSD 10+  i386, x86_64, ARMClang, GCC   libcxxrt, libc++abi
+Linuxi386, x86_64 Clang, GCC   libc++abi
+   
+
+The following minimum compiler versions are strongly recommended.
+
+* Clang 3.5 and above
+* GCC 4.7 and above.
+
+Anything older *may* work.
+
+C++ Dialect Support
+-
+
+* C++11 - Complete
+* `C++14 - Complete `__
+* `C++1z - In Progress `__
+* `Post C++14 Technical Specifications - In Progress `__
+
+.. _cxx14 status: http://libcxx.llvm.org/cxx1y_status.html
+.. _cxx1z status: http://libcxx.llvm.org/cxx1z_status.html
+.. _ts status: http://libcxx.llvm.org/ts1z_status.html
+
+
+Notes and Known Issues
+

Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: docs/BuildingLibcxx.rst:56
@@ +55,3 @@
+Mac users, remember to be careful when replacing the system's libc++.
+**Your system will not be able to boot without a functioning libc++.**
+

jroelofs wrote:
> Is there a way to make this more prominent, perhaps by putting it in a red 
> box? This is a very important detail that is very painful to recover from if 
> you miss it.
I'll make it happen. I was also thinking about adding loud CMake warnings 
whenever CMake tries to install libc++ to `/usr` on OS X. 


Comment at: docs/index.rst:87
@@ +86,3 @@
+   
+OS   Arch CompilersABI Library
+   

jroelofs wrote:
> Should we mention the unwinders used/supported here too?
Sure but can we do that later? I have no clue what platforms support what and I 
would have to get some input on that.


http://reviews.llvm.org/D12129



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


Re: [PATCH] D12181: [sanitizer] Add -fsanitize-trap-function.

2015-08-20 Thread Alexey Samsonov via cfe-commits
samsonov added a comment.

Please upload the patch with more context (see 
http://llvm.org/docs/Phabricator.html).



Comment at: tools/clang/include/clang/Driver/Options.td:610
@@ -608,1 +609,3 @@
+ Flags<[CC1Option, CoreOption]>,
+ HelpText<"Issue call to specified function 
rather than a trap instruction">;
 def fsanitize_undefined_trap_on_error : Flag<["-"], 
"fsanitize-undefined-trap-on-error">,

Fix the help text: Make trapping sanitizers issue a call to specified function 
rather than a trap instruction.


Comment at: tools/clang/include/clang/Frontend/CodeGenOptions.h:205
@@ +204,3 @@
+  /// If not an empty string, trap intrinsics are lowered to calls to this
+  /// function instead of to trap instructions.
+  std::string SanitizeTrapFuncName;

Fix the comment here as well.


Comment at: tools/clang/lib/CodeGen/CGExpr.cpp:2388
@@ +2387,3 @@
+  }
+  return EmitTrapCheck(Checked);
+}

This is confusing. So, you have the following behavior whenever you need to 
emit a check for `-fsanitize-trap=foo`:
  # Emit a call to `-fsanitize-trap-function`, if it's specified
  # Otherwise, emit a call to `-ftrap-function`, if it's specified
  # Otherwise, emit a trap instruction.

Do you really want it? Don't you need to skip (2) instead? If you do, you 
should carefully document it.




Comment at: tools/clang/lib/CodeGen/CGExpr.cpp:2415
@@ -2403,1 +2414,3 @@
 
+llvm::CallInst *CodeGenFunction::EmitSanitizeTrapCall(llvm::Intrinsic::ID 
IntrID) {
+  if (!CGM.getCodeGenOpts().SanitizeTrapFuncName.empty()) {

This function should not be needed.


Comment at: tools/clang/lib/CodeGen/CGExpr.cpp:2422
@@ -2404,1 +2421,3 @@
+
 llvm::CallInst *CodeGenFunction::EmitTrapCall(llvm::Intrinsic::ID IntrID) {
+  return EmitTrapCall(IntrID, CGM.getCodeGenOpts().TrapFuncName);

Isn't it easier to just kill this function, and always pass in 
CGM.getCodeGenOpts().TrapFuncName where applicable?


Comment at: tools/clang/lib/CodeGen/CGExprScalar.cpp:2386
@@ -2385,3 +2385,3 @@
 } else
-  CGF.EmitTrapCheck(Builder.CreateNot(overflow));
+  CGF.EmitSanitizeTrapCheck(Builder.CreateNot(overflow));
 return result;

Why? Looks like this check is not emitted as a part of 
`-fsanitize=signed-integer-overflow` 


Comment at: tools/clang/lib/Frontend/CompilerInvocation.cpp:507
@@ -506,2 +506,3 @@
   Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
+  Opts.SanitizeTrapFuncName = 
Args.getLastArgValue(OPT_fsanitize_trap_function_EQ);
   Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array);

Please parse this argument next to another sanitizer arguments.


Repository:
  rL LLVM

http://reviews.llvm.org/D12181



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


Re: [PATCH] D11380: Implement LFTS searchers. Boyer_Moore and Boyer_Moore_Horspool

2015-08-20 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Added more review comments for the boyer_moore searcher.



Comment at: include/experimental/functional:256
@@ +255,3 @@
+
+public: // TODO private:
+_RandomAccessIterator1 __first_;

Is this for testing?


Comment at: include/experimental/functional:313
@@ +312,3 @@
+
+void build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 
__l, 
+_BinaryPredicate __pred)

This needs to be a reserved identifier right?


Comment at: include/experimental/functional:319
@@ +318,3 @@
+{
+_VSTD::vector reversed(__count);
+(void) _VSTD::reverse_copy(__f, __l, reversed.begin ());

It seems like we could do a lot more in this section to

1. Use less memory at any given time.
2. Reuse previously allocated memory.

I think the following changes could improve the QoI.

1. Move the loop that uses  `__prefix` to be directly following the 
initialization of it.
2. Pass reverse_iterator adaptors to `__compute_bm_prefix` instead of computing 
`reversed`.
3. Reuse the memory in `__prefix`  for `__prefix_reversed`. 

Unless I'm missing something those changes should be possible, and they reduce 
the amount of memory used by two thirds. 


http://reviews.llvm.org/D11380



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


Re: r245560 - Fix crash with two typos in the arguments of a function

2015-08-20 Thread Richard Smith via cfe-commits
LGTM for branch.
On Aug 20, 2015 9:47 AM, "Hans Wennborg"  wrote:

> It was requested that this be merged to 3.7.
>
> Richard: OK for merging?
>
> Thanks,
> Hans
>
> On Thu, Aug 20, 2015 at 6:11 AM, Olivier Goffart via cfe-commits
>  wrote:
> > Author: ogoffart
> > Date: Thu Aug 20 08:11:14 2015
> > New Revision: 245560
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=245560&view=rev
> > Log:
> > Fix crash with two typos in the arguments of a function
> >
> > The problem is that the arguments are of TheCall are reset later
> > to the ones in Args, making TypoExpr put back. Some TypoExpr that have
> > already  been diagnosed and will assert later in Sema::getTypoExprState
> >
> > Modified:
> > cfe/trunk/lib/Sema/SemaExpr.cpp
> > cfe/trunk/test/Sema/typo-correction.c
> >
> > Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245560&r1=245559&r2=245560&view=diff
> >
> ==
> > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Aug 20 08:11:14 2015
> > @@ -4937,6 +4937,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
> >  if (!Result.isUsable()) return ExprError();
> >  TheCall = dyn_cast(Result.get());
> >  if (!TheCall) return Result;
> > +Args = ArrayRef(TheCall->getArgs(), TheCall->getNumArgs());
> >}
> >
> >// Bail out early if calling a builtin with custom typechecking.
> >
> > Modified: cfe/trunk/test/Sema/typo-correction.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typo-correction.c?rev=245560&r1=245559&r2=245560&view=diff
> >
> ==
> > --- cfe/trunk/test/Sema/typo-correction.c (original)
> > +++ cfe/trunk/test/Sema/typo-correction.c Thu Aug 20 08:11:14 2015
> > @@ -49,3 +49,9 @@ extern double cabs(_Complex double z);
> >  void fn1() {
> >cabs(errij);  // expected-error {{use of undeclared identifier
> 'errij'}}
> >  }
> > +
> > +extern long afunction(int); // expected-note {{'afunction' declared
> here}}
> > +void fn2() {
> > +  f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier
> 'THIS_IS_AN_ERROR'}}
> > +afunction(afunction_));  // expected-error {{use of undeclared
> identifier 'afunction_'; did you mean 'afunction'?}}
> > +}
> >
> >
> > ___
> > 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] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Jonathan Roelofs via cfe-commits
jroelofs added inline comments.


Comment at: docs/BuildingLibcxx.rst:57
@@ +56,3 @@
+  select a safe place to install libc++.
+
+  * ``make install-libcxx install-libcxxabi`` --- Will install the libraries 
and the headers

I feel like a warning is not enough... perhaps a hard error, with a message 
that says something like: "If you're really really sure you know what you're 
doing, add -DLIBCXX_OVERRIDE_DARWIN_INSTALL=YES to silence this message"?


Comment at: docs/index.rst:88
@@ +87,3 @@
+OS   Arch CompilersABI Library
+   
+Mac OS X i386, x86_64 Clang, GCC   libc++abi

Yeah. This is good for now. I just wanted to mention it while I was thinking of 
it.


http://reviews.llvm.org/D12129



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


Re: r245595 - [Sparc] Add '-EL' when invoking gcc to link little-endian binaries.

2015-08-20 Thread Joerg Sonnenberger via cfe-commits
On Thu, Aug 20, 2015 at 06:32:27PM -, Douglas Katzman via cfe-commits wrote:
> Modified: cfe/trunk/test/Driver/biarch.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/biarch.c?rev=245595&r1=245594&r2=245595&view=diff
> ==
> --- cfe/trunk/test/Driver/biarch.c (original)
> +++ cfe/trunk/test/Driver/biarch.c Thu Aug 20 13:32:26 2015
> @@ -28,6 +28,9 @@
>  // RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
>  // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
>  
> +// RUN: %clang -target sparcel -o foo %s -### 2> %t
> +// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
> +

Can you make that a full triple including at least the proper unknown
placeholder for the OS?

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


[clang-tools-extra] r245600 - Change the test to use the new python script instead of the more verbose RUN line.

2015-08-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Aug 20 14:21:07 2015
New Revision: 245600

URL: http://llvm.org/viewvc/llvm-project?rev=245600&view=rev
Log:
Change the test to use the new python script instead of the more verbose RUN 
line.

Modified:
clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp?rev=245600&r1=245599&r2=245600&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp Thu 
Aug 20 14:21:07 2015
@@ -1,4 +1,4 @@
-// RUN: clang-tidy %s -checks=-*,misc-move-constructor-init -- -std=c++14 | 
FileCheck %s -implicit-check-not="{{warning|error}}:"
+// RUN: %python %S/check_clang_tidy.py %s misc-move-constructor-init %t
 
 template  struct remove_reference  {typedef T type;};
 template  struct remove_reference  {typedef T type;};
@@ -23,9 +23,9 @@ struct B {
 struct D : B {
   D() : B() {}
   D(const D &RHS) : B(RHS) {}
-  // CHECK: :[[@LINE+3]]:16: warning: move constructor initializes base class 
by calling a copy constructor [misc-move-constructor-init]
-  // CHECK: 19:3: note: copy constructor being called
-  // CHECK: 20:3: note: candidate move constructor here
+  // CHECK-MESSAGES: :[[@LINE+3]]:16: warning: move constructor initializes 
base class by calling a copy constructor [misc-move-constructor-init]
+  // CHECK-MESSAGES: 19:3: note: copy constructor being called
+  // CHECK-MESSAGES: 20:3: note: candidate move constructor here
   D(D &&RHS) : B(RHS) {}
 };
 
@@ -68,7 +68,7 @@ struct L : K {
 
 struct M {
   B Mem;
-  // CHECK: :[[@LINE+1]]:16: warning: move constructor initializes class 
member by calling a copy constructor [misc-move-constructor-init]
+  // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: move constructor initializes 
class member by calling a copy constructor [misc-move-constructor-init]
   M(M &&RHS) : Mem(RHS.Mem) {}
 };
 


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


[libcxx] r245601 - Remove completed items from TODO.TXT

2015-08-20 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Thu Aug 20 14:22:35 2015
New Revision: 245601

URL: http://llvm.org/viewvc/llvm-project?rev=245601&view=rev
Log:
Remove completed items from TODO.TXT

Modified:
libcxx/trunk/TODO.TXT

Modified: libcxx/trunk/TODO.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/TODO.TXT?rev=245601&r1=245600&r2=245601&view=diff
==
--- libcxx/trunk/TODO.TXT (original)
+++ libcxx/trunk/TODO.TXT Thu Aug 20 14:22:35 2015
@@ -21,11 +21,11 @@ CXX Runtime Library Tasks
 
 Atomic Related Tasks
 
-* Support  in C++03 (needed for internal use).
+* Enable mixing of clang and GCC atomics internally. Currently some
+  parts of libc++ use atomics only when clang provides them.
+  (see memory@5380 for an example)
 * Audit use of libatomic builtins in  with GCC.
 * future should use  for synchronization.
-* call_once should use  for synchronization.
-* Audit shared_ptr use of 
 
 Test Suite Tasks
 
@@ -42,8 +42,6 @@ Misc Tasks
 * Look at basic_string's move assignment operator, re LWG 2063 and POCMA
 * libc++ is missing try_emplace
 * Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
-* Investigate the effect of using __decltype instead of __typeof__ to provide
-  decltype in C++03. What code could be broken by this change?
 * Convert failure tests to use Clang Verify.
 * Document support (or lack of) for C++11 libraries in C++03.
 * Document supported compilers.


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


r245603 - [CMake] Exclude 'bootstrap' target from 'all' where possible.

2015-08-20 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Aug 20 15:12:18 2015
New Revision: 245603

URL: http://llvm.org/viewvc/llvm-project?rev=245603&view=rev
Log:
[CMake] Exclude 'bootstrap' target from 'all' where possible.

EXCLUDE_FROM_ALL in ExternalProject is only available on CMake 3.1 and later.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=245603&r1=245602&r2=245603&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Aug 20 15:12:18 2015
@@ -559,6 +559,10 @@ endif ()
 if (CLANG_ENABLE_BOOTSTRAP)
   include(ExternalProject)
 
+  if(CMAKE_VERSION VERSION_GREATER 3.1.0)
+set(cmake_3_1_EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL 1)
+  endif()
+
   if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
 set(cmake_3_4_USES_TERMINAL_OPTIONS)
 set(cmake_3_4_USES_TERMINAL)
@@ -594,6 +598,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
 BINARY_DIR ${BINARY_DIR}
+${cmake_3_1_EXCLUDE_FROM_ALL}
 CMAKE_ARGS
 # We shouldn't need to set this here, but INSTALL_DIR doesn't
 # seem to work, so instead I'm passing this through


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


r245604 - [CMake] Simplifying logic for USES_TERMINAL on bootstrap targets.

2015-08-20 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Aug 20 15:12:20 2015
New Revision: 245604

URL: http://llvm.org/viewvc/llvm-project?rev=245604&view=rev
Log:
[CMake] Simplifying logic for USES_TERMINAL on bootstrap targets.

In CMake variables that haven't been set are evaluated to empty strings, so we 
don't need to set the variables to empty strings.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=245604&r1=245603&r2=245604&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Aug 20 15:12:20 2015
@@ -563,10 +563,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
 set(cmake_3_1_EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL 1)
   endif()
 
-  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
-set(cmake_3_4_USES_TERMINAL_OPTIONS)
-set(cmake_3_4_USES_TERMINAL)
-  else()
+  if(CMAKE_VERSION VERSION_GREATER 3.3.20150708)
 set(cmake_3_4_USES_TERMINAL_OPTIONS
   USES_TERMINAL_CONFIGURE 1
   USES_TERMINAL_BUILD 1


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


Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Sean Silva via cfe-commits
silvas added inline comments.


Comment at: docs/BuildingLibcxx.rst:57
@@ +56,3 @@
+  select a safe place to install libc++.
+
+  * ``make install-libcxx install-libcxxabi`` --- Will install the libraries 
and the headers

jroelofs wrote:
> I feel like a warning is not enough... perhaps a hard error, with a message 
> that says something like: "If you're really really sure you know what you're 
> doing, add -DLIBCXX_OVERRIDE_DARWIN_INSTALL=YES to silence this message"?
FYI, Sphinx has some directives designed for prominent warnings like this: 
http://docutils.sourceforge.net/docs/ref/rst/directives.html#danger

Should render similar to the "Warning" box on 
http://clang.llvm.org/docs/ReleaseNotes.html (see clang/docs/ReleaseNotes.rst)


http://reviews.llvm.org/D12129



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


Re: [PATCH] D12129: [libcxx] Add new Sphinx documentation

2015-08-20 Thread Sean Silva via cfe-commits
silvas added inline comments.


Comment at: docs/BuildingLibcxx.rst:57
@@ +56,3 @@
+  select a safe place to install libc++.
+
+  * ``make install-libcxx install-libcxxabi`` --- Will install the libraries 
and the headers

silvas wrote:
> jroelofs wrote:
> > I feel like a warning is not enough... perhaps a hard error, with a message 
> > that says something like: "If you're really really sure you know what 
> > you're doing, add -DLIBCXX_OVERRIDE_DARWIN_INSTALL=YES to silence this 
> > message"?
> FYI, Sphinx has some directives designed for prominent warnings like this: 
> http://docutils.sourceforge.net/docs/ref/rst/directives.html#danger
> 
> Should render similar to the "Warning" box on 
> http://clang.llvm.org/docs/ReleaseNotes.html (see clang/docs/ReleaseNotes.rst)
The general names for these things are "admonitions" and there are e.g. 'note' 
'danger' 'warning' etc. that are hopefully appropriately styled by the theme.


http://reviews.llvm.org/D12129



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


[PATCH] D12209: [libcxx] Remove installation rules on Darwin when it would overwrite the system installation.

2015-08-20 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: mclow.lists, beanz, jroelofs.
EricWF added a subscriber: cfe-commits.

On Mac OS X overwriting `/usr/lib/libc++.dylib` can cause your computer to fail 
to boot. This patch tries to make it harder to do that accidentally. 

If `CMAKE_SYSTEM_NAME` is `Darwin` and `CMAKE_INSTALL_PREFIX` is `/usr` don't 
generate installation rules unless the user explicitly provides 
`LIBCXX_OVERRIDE_DARWIN_INSTALL=ON`. Note that `CMAKE_INSTALL_PREFIX` is always 
absolute so we don't need to worry about things like `/usr/../usr`.

http://reviews.llvm.org/D12209

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibCXXABI.cmake
  lib/CMakeLists.txt

Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -133,15 +133,18 @@
 SOVERSION "1"
   )
 
-install(TARGETS cxx
-  LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-  ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-  )
+if (LIBCXX_INSTALL_LIBRARY)
+  install(TARGETS cxx
+LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+)
+endif()
 
-if (NOT CMAKE_CONFIGURATION_TYPES)
-  add_custom_target(install-libcxx
-DEPENDS cxx
-COMMAND "${CMAKE_COMMAND}"
--DCMAKE_INSTALL_COMPONENT=libcxx
--P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
+if (NOT CMAKE_CONFIGURATION_TYPES AND (LIBCXX_INSTALL_LIBRARY OR
+   LIBCXX_INSTALL_HEADERS))
+add_custom_target(install-libcxx
+  DEPENDS cxx
+  COMMAND "${CMAKE_COMMAND}"
+  -DCMAKE_INSTALL_COMPONENT=libcxx
+  -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
 endif()
Index: cmake/Modules/HandleLibCXXABI.cmake
===
--- cmake/Modules/HandleLibCXXABI.cmake
+++ cmake/Modules/HandleLibCXXABI.cmake
@@ -41,11 +41,13 @@
 file(COPY "${incpath}/${fpath}"
   DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
   )
-install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
-  DESTINATION include/c++/v1/${dstdir}
-  COMPONENT libcxx
-  PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  )
+if (LIBCXX_INSTALL_HEADERS)
+  install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
+DESTINATION include/c++/v1/${dstdir}
+COMPONENT libcxx
+PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+)
+endif()
 list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
   endif()
 endforeach()
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -55,6 +55,7 @@
 set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
 "Define suffix of library directory name (32/64)")
 option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
+option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
 option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
 
 # ABI Library options -
@@ -94,6 +95,23 @@
 set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
 "The Profile-rt library used to build with code coverage")
 
+# Don't allow a user to accidentally overwrite the system libc++ installation 
on Darwin.
+# If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for 
libc++
+# will not be generated and a warning will be issued.
+option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ 
installation." OFF)
+mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by 
default.
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT 
LIBCXX_OVERRIDE_DARWIN_INSTALL)
+  if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
+message(WARNING "Disabling libc++ install rules because installation would 
"
+"overwrite the systems installation. Configure with "
+"-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this 
behaviour.")
+mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override 
option.
+set(LIBCXX_INSTALL_HEADERS OFF)
+set(LIBCXX_INSTALL_LIBRARY OFF)
+  endif()
+endif()
+
 
#===
 # Check option configurations
 
#===


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -133,15 +133,18 @@
 SOVERSION "1"
   )
 
-install(TARGETS cxx
-  LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-  AR

r245605 - [Headers][X86] Use __builtin_shufflevector in AVX2 broadcasts.

2015-08-20 Thread Ahmed Bougacha via cfe-commits
Author: ab
Date: Thu Aug 20 15:27:21 2015
New Revision: 245605

URL: http://llvm.org/viewvc/llvm-project?rev=245605&view=rev
Log:
[Headers][X86] Use __builtin_shufflevector in AVX2 broadcasts.

This lets us optimize them better. We agreed to remove the intrinsics,
instead of combining them later, as, at -O0, we generate the expected
instructions. Plus, it's a nice cleanup.

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx2intrin.h
cfe/trunk/test/CodeGen/avx2-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=245605&r1=245604&r2=245605&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Aug 20 15:27:21 2015
@@ -590,17 +590,6 @@ TARGET_BUILTIN(__builtin_ia32_psrld256,
 TARGET_BUILTIN(__builtin_ia32_psrlqi256, "V4LLiV4LLii", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psrlq256, "V4LLiV4LLiV2LLi", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_movntdqa256, "V4LLiV4LLi*", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_vbroadcastss_ps, "V4fV4f", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_vbroadcastss_ps256, "V8fV4f", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_vbroadcastsd_pd256, "V4dV2d", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastb256, "V32cV16c", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastw256, "V16sV8s", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastd256, "V8iV4i", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq256, "V4LLiV2LLi", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastb128, "V16cV16c", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastw128, "V8sV8s", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastd128, "V4iV4i", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pbroadcastq128, "V2LLiV2LLi", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_permvarsi256, "V8iV8iV8i", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_permti256, "V4LLiV4LLiV4LLiIc", "", "avx2")

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=245605&r1=245604&r2=245605&view=diff
==
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h Thu Aug 20 15:27:21 2015
@@ -760,7 +760,7 @@ _mm256_stream_load_si256(__m256i *__V)
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_broadcastss_ps(__m128 __X)
 {
-  return (__m128)__builtin_ia32_vbroadcastss_ps((__v4sf)__X);
+  return (__m128)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0);
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
@@ -772,13 +772,13 @@ _mm_broadcastsd_pd(__m128d __a)
 static __inline__ __m256 __DEFAULT_FN_ATTRS
 _mm256_broadcastss_ps(__m128 __X)
 {
-  return (__m256)__builtin_ia32_vbroadcastss_ps256((__v4sf)__X);
+  return (__m256)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0, 
0, 0, 0, 0);
 }
 
 static __inline__ __m256d __DEFAULT_FN_ATTRS
 _mm256_broadcastsd_pd(__m128d __X)
 {
-  return (__m256d)__builtin_ia32_vbroadcastsd_pd256((__v2df)__X);
+  return (__m256d)__builtin_shufflevector((__v2df)__X, (__v2df)__X, 0, 0, 0, 
0);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
@@ -812,50 +812,50 @@ _mm256_broadcastsi128_si256(__m128i __X)
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_broadcastb_epi8(__m128i __X)
 {
-  return (__m256i)__builtin_ia32_pbroadcastb256((__v16qi)__X);
+  return (__m256i)__builtin_shufflevector((__v16qi)__X, (__v16qi)__X, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_broadcastw_epi16(__m128i __X)
 {
-  return (__m256i)__builtin_ia32_pbroadcastw256((__v8hi)__X);
+  return (__m256i)__builtin_shufflevector((__v8hi)__X, (__v8hi)__X, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_broadcastd_epi32(__m128i __X)
 {
-  return (__m256i)__builtin_ia32_pbroadcastd256((__v4si)__X);
+  return (__m256i)__builtin_shufflevector((__v4si)__X, (__v4si)__X, 0, 0, 0, 
0, 0, 0, 0, 0);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
 _mm256_broadcastq_epi64(__m128i __X)
 {
-  return (__m256i)__builtin_ia32_pbroadcastq256(__X);
+  return (__m256i)__builtin_shufflevector(__X, __X, 0, 0, 0, 0);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_broadcastb_epi8(__m128i __X)
 {
-  return (__m128i)__builtin_ia32_pbroadcastb128((__v16qi)__X);
+  return (__m128i)__builtin_shufflevector((__v16qi)__X, (__v16qi)__X, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
 }
 
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_broadcastw_epi16(__m128i __

Re: [PATCH] D10556: [Headers][X86] Replace avx2.pbroadcast intrinsics with native IR.

2015-08-20 Thread Ahmed Bougacha via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245605: [Headers][X86] Use __builtin_shufflevector in AVX2 
broadcasts. (authored by ab).

Changed prior to commit:
  http://reviews.llvm.org/D10556?vs=27973&id=32729#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D10556

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avx2intrin.h
  cfe/trunk/test/CodeGen/avx2-builtins.c

Index: cfe/trunk/test/CodeGen/avx2-builtins.c
===
--- cfe/trunk/test/CodeGen/avx2-builtins.c
+++ cfe/trunk/test/CodeGen/avx2-builtins.c
@@ -607,7 +607,9 @@
 }
 
 __m128 test_mm_broadcastss_ps(__m128 a) {
-  // CHECK: @llvm.x86.avx2.vbroadcast.ss.ps
+  // CHECK-LABEL: test_mm_broadcastss_ps
+  // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps
+  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer
   return _mm_broadcastss_ps(a);
 }
 
@@ -617,12 +619,16 @@
 }
 
 __m256 test_mm256_broadcastss_ps(__m128 a) {
-  // CHECK: @llvm.x86.avx2.vbroadcast.ss.ps.256
+  // CHECK-LABEL: test_mm256_broadcastss_ps
+  // CHECK-NOT: @llvm.x86.avx2.vbroadcast.ss.ps.256
+  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <8 x i32> zeroinitializer
   return _mm256_broadcastss_ps(a);
 }
 
 __m256d test_mm256_broadcastsd_pd(__m128d a) {
-  // check: @llvm.x86.avx2.vbroadcast.sd.pd.256
+  // CHECK-LABEL: test_mm256_broadcastsd_pd
+  // CHECK-NOT: @llvm.x86.avx2.vbroadcast.sd.pd.256
+  // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <4 x i32> zeroinitializer
   return _mm256_broadcastsd_pd(a);
 }
 
@@ -646,42 +652,58 @@
 }
 
 __m256i test_mm256_broadcastb_epi8(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastb.256
+  // CHECK-LABEL: test_mm256_broadcastb_epi8
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastb.256
+  // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <32 x i32> zeroinitializer
   return _mm256_broadcastb_epi8(a);
 }
 
 __m256i test_mm256_broadcastw_epi16(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastw.256
+  // CHECK-LABEL: test_mm256_broadcastw_epi16
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastw.256
+  // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <16 x i32> zeroinitializer
   return _mm256_broadcastw_epi16(a);
 }
 
 __m256i test_mm256_broadcastd_epi32(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastd.256
+  // CHECK-LABEL: test_mm256_broadcastd_epi32
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastd.256
+  // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <8 x i32> zeroinitializer
   return _mm256_broadcastd_epi32(a);
 }
 
 __m256i test_mm256_broadcastq_epi64(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastq.256
+  // CHECK-LABEL: test_mm256_broadcastq_epi64
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastq.256
+  // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <4 x i32> zeroinitializer
   return _mm256_broadcastq_epi64(a);
 }
 
 __m128i test_mm_broadcastb_epi8(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastb.128
+  // CHECK-LABEL: test_mm_broadcastb_epi8
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastb.128
+  // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i32> zeroinitializer
   return _mm_broadcastb_epi8(a);
 }
 
 __m128i test_mm_broadcastw_epi16(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastw.128
+  // CHECK-LABEL: test_mm_broadcastw_epi16
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastw.128
+  // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> zeroinitializer
   return _mm_broadcastw_epi16(a);
 }
 
 __m128i test_mm_broadcastd_epi32(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastd.128
+  // CHECK-LABEL: test_mm_broadcastd_epi32
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastd.128
+  // CHECK: shufflevector <4 x i32> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> zeroinitializer
   return _mm_broadcastd_epi32(a);
 }
 
 __m128i test_mm_broadcastq_epi64(__m128i a) {
-  // CHECK: @llvm.x86.avx2.pbroadcastq.128
+  // CHECK-LABEL: test_mm_broadcastq_epi64
+  // CHECK-NOT: @llvm.x86.avx2.pbroadcastq.128
+  // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <2 x i32> zeroinitializer
   return _mm_broadcastq_epi64(a);
 }
 
Index: cfe/trunk/lib/Headers/avx2intrin.h
===
--- cfe/trunk/lib/Headers/avx2intrin.h
+++ cfe/trunk/lib/Headers/avx2intrin.h
@@ -760,7 +760,7 @@
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_broadcastss_ps(__m128 __X)
 {
-  return (__m128)__builtin_ia32_vbroadcastss_ps((__v4sf)__X);
+  return (__m128)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0);
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
@@ -772,13 +772,13 @@
 static __inline__ __m256 __DEFAULT_FN_ATTRS
 _mm256_broadcastss_ps(__m128 __X)
 {
-  return (__m256)__builtin_ia32_vbroadcastss_ps256((__v4sf)__X);
+  return (__m256)__builtin_shufflevector((__v4sf)__X, (__v4sf)__X, 0, 0, 0, 0, 0, 0, 0, 0);

[PATCH] D12212: [Headers][X86] Add -O0 assembly tests for intrinsics.

2015-08-20 Thread Ahmed Bougacha via cfe-commits
ab created this revision.
ab added reviewers: spatel, RKSimon.
ab added subscribers: cfe-commits, chandlerc, silvas, qcolombet.

We agreed in D10555 that, as long as we don't affect -O0 codegen too much, it's 
OK to use native constructs rather than intrinsics.  Let's test that, starting 
with AVX2 here.  I'll add others if people are fine with the idea, or have 
objections to the mixed testing.

http://reviews.llvm.org/D12212

Files:
  avx2-builtins-codegen.c

Index: avx2-builtins-codegen.c
===
--- avx2-builtins-codegen.c
+++ avx2-builtins-codegen.c
@@ -1,178 +1,215 @@
 // RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +avx2 -emit-llvm -o - -Werror | FileCheck %s
+// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +avx2 -S -o - -Werror | FileCheck %s --check-prefix=CHECK-ASM
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H
 
 #include 
 
 __m256i test_mm256_mpsadbw_epu8(__m256i x, __m256i y) {
   // CHECK: @llvm.x86.avx2.mpsadbw({{.*}}, {{.*}}, i8 3)
+  // CHECK-ASM: vmpsadbw $3, %ymm{{.*}}
   return _mm256_mpsadbw_epu8(x, y, 3);
 }
 
 __m256i test_mm256_sad_epu8(__m256i x, __m256i y) {
   // CHECK: @llvm.x86.avx2.psad.bw
+  // CHECK-ASM: vpsadbw %ymm{{.*}}
   return _mm256_sad_epu8(x, y);
 }
 
 __m256i test_mm256_abs_epi8(__m256i a) {
   // CHECK: @llvm.x86.avx2.pabs.b
+  // CHECK-ASM: vpabsb %ymm{{.*}}
   return _mm256_abs_epi8(a);
 }
 
 __m256i test_mm256_abs_epi16(__m256i a) {
   // CHECK: @llvm.x86.avx2.pabs.w
+  // CHECK-ASM: vpabsw %ymm{{.*}}
   return _mm256_abs_epi16(a);
 }
 
 __m256i test_mm256_abs_epi32(__m256i a) {
   // CHECK: @llvm.x86.avx2.pabs.d
+  // CHECK-ASM: vpabsd %ymm{{.*}}
   return _mm256_abs_epi32(a);
 }
 
 __m256i test_mm256_packs_epi16(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.packsswb
+  // CHECK-ASM: vpacksswb %ymm{{.*}}
   return _mm256_packs_epi16(a, b);
 }
 
 __m256i test_mm256_packs_epi32(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.packssdw
+  // CHECK-ASM: vpackssdw %ymm{{.*}}
   return _mm256_packs_epi32(a, b);
 }
 
 __m256i test_mm256_packs_epu16(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.packuswb
+  // CHECK-ASM: vpackuswb %ymm{{.*}}
   return _mm256_packus_epi16(a, b);
 }
 
 __m256i test_mm256_packs_epu32(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.packusdw
+  // CHECK-ASM: vpackusdw %ymm{{.*}}
   return _mm256_packus_epi32(a, b);
 }
 
 __m256i test_mm256_add_epi8(__m256i a, __m256i b) {
   // CHECK: add <32 x i8>
+  // CHECK-ASM: vpaddb %ymm{{.*}}
   return _mm256_add_epi8(a, b);
 }
 
 __m256i test_mm256_add_epi16(__m256i a, __m256i b) {
   // CHECK: add <16 x i16>
+  // CHECK-ASM: vpaddw %ymm{{.*}}
   return _mm256_add_epi16(a, b);
 }
 
 __m256i test_mm256_add_epi32(__m256i a, __m256i b) {
   // CHECK: add <8 x i32>
+  // CHECK-ASM: vpaddd %ymm{{.*}}
   return _mm256_add_epi32(a, b);
 }
 
 __m256i test_mm256_add_epi64(__m256i a, __m256i b) {
   // CHECK: add <4 x i64>
+  // CHECK-ASM: vpaddq {{.*}}, %ymm{{.*}}
   return _mm256_add_epi64(a, b);
 }
 
 __m256i test_mm256_adds_epi8(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.padds.b
+  // CHECK-ASM: vpaddsb %ymm{{.*}}
   return _mm256_adds_epi8(a, b);
 }
 
 __m256i test_mm256_adds_epi16(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.padds.w
+  // CHECK-ASM: vpaddsw %ymm{{.*}}
   return _mm256_adds_epi16(a, b);
 }
 
 __m256i test_mm256_adds_epu8(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.paddus.b
+  // CHECK-ASM: vpaddusb %ymm{{.*}}
   return _mm256_adds_epu8(a, b);
 }
 
 __m256i test_mm256_adds_epu16(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.paddus.w
+  // CHECK-ASM: vpaddusw %ymm{{.*}}
   return _mm256_adds_epu16(a, b);
 }
 
 __m256i test_mm256_alignr_epi8(__m256i a, __m256i b) {
   // CHECK: shufflevector <32 x i8> %{{.*}}, <32 x i8> %{{.*}}, <32 x i32> 
+  // CHECK-ASM: vpalignr $2, %ymm{{.*}}
   return _mm256_alignr_epi8(a, b, 2);
 }
 
 __m256i test2_mm256_alignr_epi8(__m256i a, __m256i b) {
   // CHECK: shufflevector <32 x i8> %{{.*}}, <32 x i8> zeroinitializer, <32 x i32> 
+  // CHECK-ASM: vpsrldq $1, %ymm{{.*}}
   return _mm256_alignr_epi8(a, b, 17);
 }
 
 __m256i test_mm256_sub_epi8(__m256i a, __m256i b) {
   // CHECK: sub <32 x i8>
+  // CHECK-ASM: vpsubb %ymm{{.*}}
   return _mm256_sub_epi8(a, b);
 }
 
 __m256i test_mm256_sub_epi16(__m256i a, __m256i b) {
   // CHECK: sub <16 x i16>
+  // CHECK-ASM: vpsubw %ymm{{.*}}
   return _mm256_sub_epi16(a, b);
 }
 
 __m256i test_mm256_sub_epi32(__m256i a, __m256i b) {
   // CHECK: sub <8 x i32>
+  // CHECK-ASM: vpsubd %ymm{{.*}}
   return _mm256_sub_epi32(a, b);
 }
 
 __m256i test_mm256_sub_epi64(__m256i a, __m256i b) {
   // CHECK: sub <4 x i64>
+  // CHECK-ASM: vpsubq {{.*}}, %ymm{{.*}}
   return _mm256_sub_epi64(a, b);
 }
 
 __m256i test_mm256_subs_epi8(__m256i a, __m256i b) {
   // CHECK: @llvm.x86.avx2.psubs.b
+  // CHECK-ASM: vpsubsb %ymm{{.*}}
   return _mm256_subs_ep

Re: [PATCH] D12209: [libcxx] Remove installation rules on Darwin when it would overwrite the system installation.

2015-08-20 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

I like it!


http://reviews.llvm.org/D12209



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


r245607 - Fix test on Windows to accept both gcc and gcc.exe.

2015-08-20 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Thu Aug 20 15:37:58 2015
New Revision: 245607

URL: http://llvm.org/viewvc/llvm-project?rev=245607&view=rev
Log:
Fix test on Windows to accept both gcc and gcc.exe.


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

Modified: cfe/trunk/test/Driver/biarch.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/biarch.c?rev=245607&r1=245606&r2=245607&view=diff
==
--- cfe/trunk/test/Driver/biarch.c (original)
+++ cfe/trunk/test/Driver/biarch.c Thu Aug 20 15:37:58 2015
@@ -29,7 +29,7 @@
 // RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
 
 // RUN: %clang -target sparcel -o foo %s -### 2> %t
-// RUN: grep 'gcc" "-EL" "-o" "foo"' %t
+// RUN: grep 'gcc\(\.exe\)\?" "-EL" "-o" "foo"' %t
 
 // RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
 // RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t


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


Re: [PATCH] D12181: [sanitizer] Add -fsanitize-trap-function.

2015-08-20 Thread Josh Gao via cfe-commits
jmgao updated this revision to Diff 32736.
jmgao added a comment.

Uploading diff with arcanist.


http://reviews.llvm.org/D12181

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/sanitize-trap-function.c

Index: test/CodeGen/sanitize-trap-function.c
===
--- /dev/null
+++ test/CodeGen/sanitize-trap-function.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=integer-divide-by-zero -fsanitize-trap=integer-divide-by-zero | FileCheck %s -check-prefix=NONE -check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=integer-divide-by-zero -fsanitize-trap=integer-divide-by-zero -ftrap-function=foo | FileCheck %s -check-prefix=TRAP -check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=integer-divide-by-zero -fsanitize-trap=integer-divide-by-zero -fsanitize-trap-function=bar | FileCheck %s -check-prefix=SANITIZE -check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=integer-divide-by-zero -fsanitize-trap=integer-divide-by-zero -ftrap-function=foo -fsanitize-trap-function=bar | FileCheck %s -check-prefix=SANITIZE -check-prefix=CHECK
+
+int f(int x, int y) {
+  // CHECK: call void @llvm.trap() #[[N:[0-9]+]],
+  // CHECK-NEXT: unreachable
+
+  // NONE-NOT: trap-func-name
+  // TRAP: attributes #[[N]] {{.+}} "trap-func-name"="foo"
+  // SANITIZE: attributes #[[N]] {{.+}} "trap-func-name"="bar"
+  return x / y;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -504,6 +504,7 @@
 << Args.getLastArg(OPT_mthread_model)->getAsString(Args)
 << Opts.ThreadModel;
   Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
+  Opts.SanitizeTrapFuncName = Args.getLastArgValue(OPT_fsanitize_trap_function_EQ);
   Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array);
 
   Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections,
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2886,11 +2886,16 @@
 
   /// \brief Create a basic block that will call the trap intrinsic, and emit a
   /// conditional branch to it, for the -ftrapv checks.
+  void EmitSanitizeTrapCheck(llvm::Value *Checked);
   void EmitTrapCheck(llvm::Value *Checked);
+  void EmitTrapCheck(llvm::Value *Checked, const std::string &TrapFuncName);
 
   /// \brief Emit a call to trap or debugtrap and attach function attribute
   /// "trap-func-name" if specified.
+  llvm::CallInst *EmitSanitizeTrapCall(llvm::Intrinsic::ID IntrID);
   llvm::CallInst *EmitTrapCall(llvm::Intrinsic::ID IntrID);
+  llvm::CallInst *EmitTrapCall(llvm::Intrinsic::ID IntrID,
+   const std::string &TrapFuncName);
 
   /// \brief Create a check for a function parameter that may potentially be
   /// declared as non-null.
Index: lib/CodeGen/CGExprScalar.cpp
===
--- lib/CodeGen/CGExprScalar.cpp
+++ lib/CodeGen/CGExprScalar.cpp
@@ -2383,7 +2383,7 @@
   : SanitizerKind::UnsignedIntegerOverflow;
   EmitBinOpCheck(std::make_pair(NotOverflow, Kind), Ops);
 } else
-  CGF.EmitTrapCheck(Builder.CreateNot(overflow));
+  CGF.EmitSanitizeTrapCheck(Builder.CreateNot(overflow));
 return result;
   }
 
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -2301,7 +2301,7 @@
   }
 
   if (TrapCond)
-EmitTrapCheck(TrapCond);
+EmitSanitizeTrapCheck(TrapCond);
   if (!FatalCond && !RecoverableCond)
 return;
 
@@ -2381,16 +2381,27 @@
   EmitBlock(Cont);
 }
 
+void CodeGenFunction::EmitSanitizeTrapCheck(llvm::Value *Checked) {
+  if (!CGM.getCodeGenOpts().SanitizeTrapFuncName.empty()) {
+return EmitTrapCheck(Checked, CGM.getCodeGenOpts().SanitizeTrapFuncName);
+  }
+  return EmitTrapCheck(Checked);
+}
+
 void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked) {
+  return EmitTrapCheck(Checked, CGM.getCodeGenOpts().TrapFuncName);
+}
+
+void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked, const std::string &TrapFuncName) {
   llvm::BasicBlock *Cont = createBasicBlock("cont");
 
   // If we're optimizing, collapse all calls to trap down to just one per
   // function to save on code size.
   if (!CGM.getCodeGenOpts().OptimizationLevel || !TrapBB) {
 TrapBB = createBasicBlock("trap");
 Builder.CreateCondBr(Checked, Cont, TrapBB);
 EmitBlock(TrapBB);
-llvm::CallInst *TrapCall = EmitTrapCall(llvm::Intrinsic::trap);
+llvm::CallInst *TrapCall = EmitTrapCall(llvm::In

r245609 - PR24483: Delete some dead/incorrect code that triggered assertions.

2015-08-20 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Aug 20 15:45:25 2015
New Revision: 245609

URL: http://llvm.org/viewvc/llvm-project?rev=245609&view=rev
Log:
PR24483: Delete some dead/incorrect code that triggered assertions.

Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaTemplate/instantiate-var-template.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=245609&r1=245608&r2=245609&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Aug 20 15:45:25 2015
@@ -2469,25 +2469,6 @@ DeclResult Sema::ActOnVarTemplateSpecial
 false, Converted))
 return true;
 
-  // Check that the type of this variable template specialization
-  // matches the expected type.
-  TypeSourceInfo *ExpectedDI;
-  {
-// Do substitution on the type of the declaration
-TemplateArgumentList TemplateArgList(TemplateArgumentList::OnStack,
- Converted.data(), Converted.size());
-InstantiatingTemplate Inst(*this, TemplateKWLoc, VarTemplate);
-if (Inst.isInvalid())
-  return true;
-VarDecl *Templated = VarTemplate->getTemplatedDecl();
-ExpectedDI =
-SubstType(Templated->getTypeSourceInfo(),
-  MultiLevelTemplateArgumentList(TemplateArgList),
-  Templated->getTypeSpecStartLoc(), Templated->getDeclName());
-  }
-  if (!ExpectedDI)
-return true;
-
   // Find the variable template (partial) specialization declaration that
   // corresponds to these arguments.
   if (IsPartialSpecialization) {

Modified: cfe/trunk/test/SemaTemplate/instantiate-var-template.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-var-template.cpp?rev=245609&r1=245608&r2=245609&view=diff
==
--- cfe/trunk/test/SemaTemplate/instantiate-var-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-var-template.cpp Thu Aug 20 
15:45:25 2015
@@ -34,3 +34,9 @@ namespace InstantiationDependent {
 static_assert(a == 0, ""); // expected-error 
{{static_assert failed}}
   }
 }
+
+namespace PR24483 {
+  template struct A;
+  template A models;
+  template<> struct B models<>; // expected-error {{incomplete type 'struct 
B'}} expected-note {{forward declaration}}
+}


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


Re: [PATCH] D12212: [Headers][X86] Add -O0 assembly tests for intrinsics.

2015-08-20 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

Definitely like this idea - hopefully it'll make it safer to remove unnecessary 
builtins.



Comment at: avx2-builtins-codegen.c:182
@@ -151,1 +181,3 @@
+  // FIXME-CHECK-ASM: vpxor %ymm{{.*}}
+  // FIXME-CHECK-ASM: vandps {{.*}}, %ymm{{.*}}
   return _mm256_andnot_si256(a, b);

Please can you add a comment explaining the FIXME?


http://reviews.llvm.org/D12212



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


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-20 Thread Ismail Pazarbasi via cfe-commits
ismailp updated this revision to Diff 32745.
ismailp added a comment.

- Renamed `Out` parameter to `Stm`.
- Removed assertion that checks whether an ExplodedNode has an edge to itself.
- Added '-analyzer-viz-egraph-ubigraph' to an analyzer invocation in a test.


http://reviews.llvm.org/D12119

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/cfg.cpp

Index: test/Analysis/cfg.cpp
===
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple 
x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -std=c++11 %s > 
%t 2>&1
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple 
x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true 
-analyzer-viz-egraph-ubigraph -std=c++11 %s > %t 2>&1
 // RUN: FileCheck --input-file=%t %s
 
 // CHECK-LABEL: void checkWrap(int i)
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -745,9 +745,6 @@
 }
 
 void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
-
-  assert (Src != Dst && "Self-edges are not allowed.");
-
   // Lookup the Src.  If it is a new node, it's a root.
   VMap::iterator SrcI= M.find(Src);
   unsigned SrcID;
@@ -778,8 +775,8 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr Stm, StringRef Filename)
+: Out(std::move(Stm)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"


Index: test/Analysis/cfg.cpp
===
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -std=c++11 %s > %t 2>&1
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -analyzer-viz-egraph-ubigraph -std=c++11 %s > %t 2>&1
 // RUN: FileCheck --input-file=%t %s
 
 // CHECK-LABEL: void checkWrap(int i)
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -745,9 +745,6 @@
 }
 
 void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
-
-  assert (Src != Dst && "Self-edges are not allowed.");
-
   // Lookup the Src.  If it is a new node, it's a root.
   VMap::iterator SrcI= M.find(Src);
   unsigned SrcID;
@@ -778,8 +775,8 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr Stm, StringRef Filename)
+: Out(std::move(Stm)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r245560 - Fix crash with two typos in the arguments of a function

2015-08-20 Thread Hans Wennborg via cfe-commits
Merged in r245615.

Thanks,
Hans

On Thu, Aug 20, 2015 at 12:13 PM, Richard Smith  wrote:
> LGTM for branch.
>
> On Aug 20, 2015 9:47 AM, "Hans Wennborg"  wrote:
>>
>> It was requested that this be merged to 3.7.
>>
>> Richard: OK for merging?
>>
>> Thanks,
>> Hans
>>
>> On Thu, Aug 20, 2015 at 6:11 AM, Olivier Goffart via cfe-commits
>>  wrote:
>> > Author: ogoffart
>> > Date: Thu Aug 20 08:11:14 2015
>> > New Revision: 245560
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=245560&view=rev
>> > Log:
>> > Fix crash with two typos in the arguments of a function
>> >
>> > The problem is that the arguments are of TheCall are reset later
>> > to the ones in Args, making TypoExpr put back. Some TypoExpr that have
>> > already  been diagnosed and will assert later in Sema::getTypoExprState
>> >
>> > Modified:
>> > cfe/trunk/lib/Sema/SemaExpr.cpp
>> > cfe/trunk/test/Sema/typo-correction.c
>> >
>> > Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245560&r1=245559&r2=245560&view=diff
>> >
>> > ==
>> > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>> > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Aug 20 08:11:14 2015
>> > @@ -4937,6 +4937,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
>> >  if (!Result.isUsable()) return ExprError();
>> >  TheCall = dyn_cast(Result.get());
>> >  if (!TheCall) return Result;
>> > +Args = ArrayRef(TheCall->getArgs(), TheCall->getNumArgs());
>> >}
>> >
>> >// Bail out early if calling a builtin with custom typechecking.
>> >
>> > Modified: cfe/trunk/test/Sema/typo-correction.c
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typo-correction.c?rev=245560&r1=245559&r2=245560&view=diff
>> >
>> > ==
>> > --- cfe/trunk/test/Sema/typo-correction.c (original)
>> > +++ cfe/trunk/test/Sema/typo-correction.c Thu Aug 20 08:11:14 2015
>> > @@ -49,3 +49,9 @@ extern double cabs(_Complex double z);
>> >  void fn1() {
>> >cabs(errij);  // expected-error {{use of undeclared identifier
>> > 'errij'}}
>> >  }
>> > +
>> > +extern long afunction(int); // expected-note {{'afunction' declared
>> > here}}
>> > +void fn2() {
>> > +  f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier
>> > 'THIS_IS_AN_ERROR'}}
>> > +afunction(afunction_));  // expected-error {{use of undeclared
>> > identifier 'afunction_'; did you mean 'afunction'?}}
>> > +}
>> >
>> >
>> > ___
>> > 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: r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-20 Thread Richard Smith via cfe-commits
On Wed, Aug 19, 2015 at 11:42 AM, Yaron Keren  wrote:

> Yes, it looks like a legacy issue. Documentation says so:
>
> *https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html
> *
>
> -m96bit-long-double-m128bit-long-doubleThese switches control the size of long
> double type. The i386 application binary interface specifies the size to
> be 96 bits, so -m96bit-long-double is the default in 32-bit mode.
>
> Modern architectures (Pentium and newer) prefer long double to be aligned
> to an 8- or 16-byte boundary. In arrays or structures conforming to the
> ABI, this is not possible. So specifying -m128bit-long-double aligns long
> double to a 16-byte boundary by padding the long double with an
> additional 32-bit zero.
>
> In the x86-64 compiler, -m128bit-long-double is the default choice as its
> ABI specifies that long double is aligned on 16-byte boundary.
>
> Notice that neither of these options enable any extra precision over the
> x87 standard of 80 bits for a long double.
>
> *Warning:* if you override the default value for your target ABI, this
> changes the size of structures and arrays containing long double variables,
> as well as modifying the function calling convention for functions taking long
> double. Hence they are not binary-compatible with code compiled without
> that switch.
>
> And practical testing agrees:
>
> sh-4.3$ cat < a.cpp
> #include 
> int main() {
>   long double a;
>   std::cout< }
> sh-4.3$ g++ -v
> Using built-in specs.
> COLLECT_GCC=C:\mingw32\bin\g++.exe
>
> COLLECT_LTO_WRAPPER=C:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/5.1.0/lto-wrapper.exe
> Target: i686-w64-mingw32
> Configured with: ../../../src/gcc-5.1.0/configure --host=i686-w64-mingw32
> --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32
> --with-sysroot=/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32
> --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++
> --enable-shared --enable-static --disable-multilib
> --enable-languages=c,c++,fortran,objc,obj-c++,lto
> --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp
> --enable-libatomic --enable-lto --enable-graphite --enable-checking=release
> --enable-fully-dynamic-string --enable-version-specific-runtime-libs
> --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check
> --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap
> --disable-rpath --disable-win32-registry --disable-nls --disable-werror
> --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686
> --with-tune=generic --with-libiconv --with-system-zlib
> --with-gmp=/c/mingw510/prerequisites/i686-w64-mingw32-static
> --with-mpfr=/c/mingw510/prerequisites/i686-w64-mingw32-static
> --with-mpc=/c/mingw510/prerequisites/i686-w64-mingw32-static
> --with-isl=/c/mingw510/prerequisites/i686-w64-mingw32-static
> --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project'
> --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
> -I/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/include
> -I/c/mingw510/prerequisites/i686-zlib-static/include
> -I/c/mingw510/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2
> -pipe -I/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/include
> -I/c/mingw510/prerequisites/i686-zlib-static/include
> -I/c/mingw510/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=
> LDFLAGS='-pipe
> -L/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/lib
> -L/c/mingw510/prerequisites/i686-zlib-static/lib
> -L/c/mingw510/prerequisites/i686-w64-mingw32-static/lib
> -Wl,--large-address-aware'
> Thread model: posix
> gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)
>
> sh-4.3$ g++ a.cpp
> sh-4.3$ ./a.exe
> 12
>
> Without the patch clang outputs 16 and seg faults on a boost::math example.
>

None of that answers my question. Our default GCC-compatible behavior for
x86_32 long double is to give it 4-byte alignment, 12-byte size, and this
matches the behavior I observe with GCC. Does MinGW /really/ deviate from
this and give long double a 16-byte alignment?


> 2015-08-19 21:29 GMT+03:00 Richard Smith :
>
>> On Wed, Aug 19, 2015 at 10:02 AM, Yaron Keren via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: yrnkrn
>>> Date: Wed Aug 19 12:02:32 2015
>>> New Revision: 245459
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=245459&view=rev
>>> Log:
>>> According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.
>>> See
>>>  https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
>>>
>>>
>>> Added:
>>> cfe/trunk/test/CodeGen/mingw-long-double-size.c
>>> Modified:
>>> cfe/trunk/lib/Basic/Targets.cpp
>>>
>>> Modified: cfe/trunk/lib/Basic/Targets.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245459&r1=245458&r2=245459&view=diff
>>>
>>> ===

Re: [PATCH] Fix out-of-bounds array access when setting arm float registers

2015-08-20 Thread Hans Wennborg via cfe-commits
+Saleem and Renato; maybe you can take a look?

On Tue, Aug 18, 2015 at 11:24 AM, Leandro Graciá Gil
 wrote:
> Hi,
>
> Please find attached a patch fixing an out-of-bounds array access present in
> the current libunwind top of tree code.
>
> The problem is caused by subtracting the wrong base register in
> Registers_arm::SetFloatRegister and should become obvious after taking a
> quick look to the code.
>
> Could someone please commit this to trunk and merge it to the release 37
> branch?
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: FunctionDecl::getBody() returning nullptr

2015-08-20 Thread Richard Smith via cfe-commits
On Wed, Aug 19, 2015 at 2:52 PM, Aaron Ballman 
wrote:

> On Wed, Aug 19, 2015 at 5:23 PM, Richard Smith 
> wrote:
> > It looks like this would only happen for a late-parsed template that the
> > analysis code is checking before it is parsed. Should we really be
> running
> > these checks at all in that case?
>
> This code is being called from DataRecursiveASTVisitor (using an
> AnalysisContext) on generic Decl objects to determine whether we
> *should* run a checker or not. I think it's reasonable, but am not
> overly familiar with this part of the code.
>
> > Also, it looks like this code doesn't actually want the body at all, and
> > just wants to get the location of the definition. Asking for the body
> here
> > does not seem like the right approach, because it'll cause the external
> AST
> > source (if there is one) to fault the body in.
> >
> > The right fix is probably something like:
> >
> >   const FunctionDecl *Def;
> >   SourceLocation SL = (D->isDefined(Def) ? Def : D)->getLocation();
>
> I've attached an updated patch with this suggested approach. It
> appears to work nicely. If you like the approach, I'll see what I can
> come up with for a test case and commit.


I suspect this patch breaks Objective-C cases (I hadn't previously noticed
that D was just a Decl*, not a FunctionDecl*). Since it's using a
RecursiveASTVisitor, it's going to deserialize everything anyway, so we
don't really gain from formulating it this way. Let's go with your original
patch.

~Aaron
>
> >
> > On Wed, Aug 19, 2015 at 1:44 PM, Aaron Ballman 
> > wrote:
> >>
> >> The attached patch resolves the null pointer crash I am seeing.
> >>
> >> ~Aaron
> >>
> >> On Wed, Aug 19, 2015 at 1:24 PM, Aaron Ballman 
> >> wrote:
> >> > On Wed, Aug 19, 2015 at 11:33 AM, Aaron Ballman <
> aa...@aaronballman.com>
> >> > wrote:
> >> >> When I run the following test code through clang-tidy -checks=*, I
> get
> >> >> a crash from some relatively strange behavior with FunctionDecl.
> >> >>
> >> >> template  struct remove_reference  {typedef T type;};
> >> >> template  struct remove_reference  {typedef T type;};
> >> >> template  struct remove_reference {typedef T type;};
> >> >>
> >> >> template 
> >> >> typename remove_reference::type&& move(T&& arg) {
> >> >>   return static_cast::type&&>(arg);
> >> >> }
> >> >>
> >> >> AnalysisConsumer::getModeForDecl() is called, and it has code that
> >> >> does: D->hasBody() ? D->getBody()->stuff : stuff;
> >> >>
> >> >> What's strange is that hasBody() returns true, but getBody() returns
> >> >> nullptr. I don't think that this should be possible. I'm wondering
> >> >> whether it's purposeful that hasBody() does not check
> >> >> Definition->Body?
> >> >
> >> > Looking into this a bit further, the issue is that hasBody() checks
> >> > for Definition->Body *or* Definition->IsLateTemplateParsed when
> >> > deciding to return true. In my case, Body is null, but
> >> > IsLateTemplateParsed is true, so hasBody() returns true. However,
> >> > getBody() doesn't have any special logic for late template parsed
> >> > function bodies.
> >> >
> >> >> Also, the FunctionDecl in question is for move(), which does have a
> >> >> body, so I do not understand why the definition would claim there is
> >> >> no body.
> >> >>
> >> >> Ideas, or should I file a bug report?
> >> >
> >> > From my further look, I wonder if the correct solution to this is to
> >> > simply call getBody() and handle a nullptr return instead of calling
> >> > hasBody() first. It basically makes the check to ignore late parsed
> >> > template bodies an implicit one.
> >> >
> >> > ~Aaron
> >
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11194: Instantiate function declarations in instantiated functions.

2015-08-20 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a reviewer: rsmith.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM with a couple of tweaks. Thanks!



Comment at: lib/AST/DeclBase.cpp:276
@@ +275,3 @@
+  return false;
+LDC = LDC->getParent();
+  } while (LDC);

`getLexicalParent()`?


Comment at: lib/AST/DeclBase.cpp:277-278
@@ +276,4 @@
+LDC = LDC->getParent();
+  } while (LDC);
+  return false;
+}

I think we can actually recast this loop as `while (true)`, since we must 
eventually reach the TU and return false.


http://reviews.llvm.org/D11194



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


Re: Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error

2015-08-20 Thread Richard Smith via cfe-commits
On Tue, Aug 18, 2015 at 12:20 PM, Li, Charles via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hi Justin and Richard,
>
> >> +// RUN: %clang_cc1 -E -C -P -triple x86_64-apple-darwin10 %s > %t1.c
> >> +// RUN: %clang_cc1 -fsyntax-only -verify -triple
> >> +x86_64-apple-darwin10 %t1.c
>
> > I think you forgot to switch this one to stop preprocessing first.
>
> Thank you for catching this. I have removed it for this patch.
>
>
> > +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L) // C or C++03
> or earlier modes
> > You can simplify that to:
> > #if __cplusplus <= 199711L
> > Otherwise, this LGTM.
>
> Thank you, I have made the simplifications
>
>
> > __cplusplus will expand to 0 inside a #if in C (as will any un#defined
> identifier).
>
> As an aside, I did a "-E -dM" and __cplusplus is not in the macro dump.
> Likewise, having __cplusplus stand alone inside a t.c file will not cause
> preprocessor to replace it with 0.
> It appears the macro replacement of __cplusplus is context sensitive.
>

This happens for any identifier used in the condition of a #if that is not
#defined; this is a standard feature of the C preprocessor.


> Cheers,
> Charles
>
> -Original Message-
> From: Justin Bogner [mailto:jus...@justinbogner.com] On Behalf Of Justin
> Bogner
> Sent: Monday, August 17, 2015 9:28 PM
> To: Li, Charles
> Cc: Richard Smith; cfe-commits@lists.llvm.org
> Subject: Re: Second Lit tests C++11 compatibility patch: using
> preprocessor to filter expected-error
>
> "Li, Charles"  writes:
> > Hi Richard,
> >
> > I have modified the “expected-“ lines as you requested.
> >
> > Cheers,
> >
> > Charles
> >
> > From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of
> > Richard Smith
> > Sent: Monday, August 17, 2015 5:41 PM
> > To: Li, Charles
> > Cc: Justin Bogner; cfe-commits@lists.llvm.org
> > Subject: Re: Second Lit tests C++11 compatibility patch: using
> > preprocessor to filter expected-error
> >
> > On Mon, Aug 17, 2015 at 5:15 PM, Li, Charles via cfe-commits <
> > cfe-commits@lists.llvm.org> wrote:
> >
> > Hi Richard and Justin,
> >
> >> What's the upside to this approach? AFAICT it makes the test harder
> >> to read
> > and errors less informative due to pointing at the wrong lines, but
> > (at least in switch-1.c) it doesn't actually reduce any code
> > duplication or anything like that. What is this gaining us apart from
> > not having to create one more file?
> >
> > Thank you Justin.
> >
> > Our original intention was to get the Lit tests to run at any default
> > C++ dialect.
> >
> > We first discovered that FileCheck does not respect #ifdef since it
> > does not know about pre-defined macros.
> >
> > So we figured if we preprocess the source first, the preprocessor will
> > filter the #ifdef sections and the output will feed nicely into
> FileCheck.
> >
> > The upside is the test can run at the default dialect in addition to
> > explicitly specified dialect.
> >
> > The downside is, as you mentioned, the errors diagnostics would point
> > to the wrong lines.
> >
> >> The only thing novel about this approach is using the preprocessor to
> > achieve it. -verify *does* respect #ifdef, and we have a lot of tests
> > that rely on that.
> >
> > Thank you Richard.
> >
> > We erroneously assumed that “// CHECK:” and “// expected-error” work
> > the same way.
> >
> > But now we realized that assumption was wrong.
> >
> > In light this discussion, I have removed the preprocessing to
> > temporary step for all tests.
> >
> > The attached patch (Lit_24.patch) revised 2 test fixes relative to the
> > previous patch (Lit_22.patch)
> >
> >   test/Analysis/temp-obj-dtors-cfg-output.cpp
> >
> > This test uses FileCheck to check for CFG dump.
> >
> > Instead of using #ifdef for the dialect specific “// CHECK:”
> > lines,
> >
> > I have created 2 check-prefixes “CXX11” and “CXX98”.
> >
> > The pre-process step have been removed.
> >
> >   test/Sema/switch-1.c
> >
> > This test uses –verify to check for integer overflows diagnostics.
> >
> > The pre-process step have been removed.
> >
> > The #ifdef is kept since it works with -verify.
> >
> > Instead of duplicating the code, you can do this:
> >
> > case blah:
> >
> > #if __cplusplus >= 201103L
> >
> > // expected-error@-2 {{error 2 lines above}}
> >
> > #else
> >
> > // expected-error@-4 {{error 4 lines above}}
> >
> > #endif
> >
> > Please let me know how you feel about this patch.
> >
> > Sincerely,
> >
> > Charles
> >
> > From: meta...@gmail.com [mailto:meta...@gmail.com] On Behalf Of
> Richard
> > Smith
> > Sent: Monday, August 17, 2015 1:07 PM
> > To: Li, Charles
> > Cc: cfe-commits@lists.llvm.org
> > Subject: Re: Second Lit tests C++11 compatibility patch: using
> > preprocessor to filter expected-error
> >
> > On Mon, Aug 17, 2015 at 9:56 AM, Li, Charles via cfe-commits <
> > cfe-commits@lists.llvm.org> wrote:
> >
> > Hi Clang developers,
> >
> > W

Re: [PATCH] D12181: [sanitizer] Add -fsanitize-trap-function.

2015-08-20 Thread Richard Smith via cfe-commits
rsmith added a comment.

Can you please give a brief description of the motivation for this change? When 
would it be appropriate to use this rather than `-ftrap-function`?

Please also include an update for the Clang documentation to describe the new 
flag.


http://reviews.llvm.org/D12181



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


Re: r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-20 Thread Yaron Keren via cfe-commits
OK, based on testing, mingw i686 aligns long doubles to 4 bytes:

sh-4.3$ cat < a.cpp
#include 
int main() {
  struct {
char c[1];
long double d;
  } s;
  std::cout<<&s.c<:

> On Wed, Aug 19, 2015 at 11:42 AM, Yaron Keren 
> wrote:
>
>> Yes, it looks like a legacy issue. Documentation says so:
>>
>> *https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html
>> *
>>
>> -m96bit-long-double-m128bit-long-doubleThese switches control the size
>> of long double type. The i386 application binary interface specifies the
>> size to be 96 bits, so -m96bit-long-double is the default in 32-bit mode.
>>
>> Modern architectures (Pentium and newer) prefer long double to be
>> aligned to an 8- or 16-byte boundary. In arrays or structures conforming to
>> the ABI, this is not possible. So specifying -m128bit-long-double aligns long
>> double to a 16-byte boundary by padding the long double with an
>> additional 32-bit zero.
>>
>> In the x86-64 compiler, -m128bit-long-double is the default choice as
>> its ABI specifies that long double is aligned on 16-byte boundary.
>>
>> Notice that neither of these options enable any extra precision over the
>> x87 standard of 80 bits for a long double.
>>
>> *Warning:* if you override the default value for your target ABI, this
>> changes the size of structures and arrays containing long double variables,
>> as well as modifying the function calling convention for functions taking 
>> long
>> double. Hence they are not binary-compatible with code compiled without
>> that switch.
>>
>> And practical testing agrees:
>>
>> sh-4.3$ cat < a.cpp
>> #include 
>> int main() {
>>   long double a;
>>   std::cout<> }
>> sh-4.3$ g++ -v
>> Using built-in specs.
>> COLLECT_GCC=C:\mingw32\bin\g++.exe
>>
>> COLLECT_LTO_WRAPPER=C:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/5.1.0/lto-wrapper.exe
>> Target: i686-w64-mingw32
>> Configured with: ../../../src/gcc-5.1.0/configure --host=i686-w64-mingw32
>> --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32
>> --with-sysroot=/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32
>> --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++
>> --enable-shared --enable-static --disable-multilib
>> --enable-languages=c,c++,fortran,objc,obj-c++,lto
>> --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp
>> --enable-libatomic --enable-lto --enable-graphite --enable-checking=release
>> --enable-fully-dynamic-string --enable-version-specific-runtime-libs
>> --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check
>> --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap
>> --disable-rpath --disable-win32-registry --disable-nls --disable-werror
>> --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686
>> --with-tune=generic --with-libiconv --with-system-zlib
>> --with-gmp=/c/mingw510/prerequisites/i686-w64-mingw32-static
>> --with-mpfr=/c/mingw510/prerequisites/i686-w64-mingw32-static
>> --with-mpc=/c/mingw510/prerequisites/i686-w64-mingw32-static
>> --with-isl=/c/mingw510/prerequisites/i686-w64-mingw32-static
>> --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project'
>> --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2
>> -pipe -I/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/include
>> -I/c/mingw510/prerequisites/i686-zlib-static/include
>> -I/c/mingw510/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2
>> -pipe -I/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/include
>> -I/c/mingw510/prerequisites/i686-zlib-static/include
>> -I/c/mingw510/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=
>> LDFLAGS='-pipe
>> -L/c/mingw510/i686-510-posix-dwarf-rt_v4-rev0/mingw32/opt/lib
>> -L/c/mingw510/prerequisites/i686-zlib-static/lib
>> -L/c/mingw510/prerequisites/i686-w64-mingw32-static/lib
>> -Wl,--large-address-aware'
>> Thread model: posix
>> gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)
>>
>> sh-4.3$ g++ a.cpp
>> sh-4.3$ ./a.exe
>> 12
>>
>> Without the patch clang outputs 16 and seg faults on a boost::math
>> example.
>>
>
> None of that answers my question. Our default GCC-compatible behavior for
> x86_32 long double is to give it 4-byte alignment, 12-byte size, and this
> matches the behavior I observe with GCC. Does MinGW /really/ deviate from
> this and give long double a 16-byte alignment?
>
>
>> 2015-08-19 21:29 GMT+03:00 Richard Smith :
>>
>>> On Wed, Aug 19, 2015 at 10:02 AM, Yaron Keren via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: yrnkrn
 Date: Wed Aug 19 12:02:32 2015
 New Revision: 245459

 URL: http://llvm.org/viewvc/llvm-project?rev=245459&view=rev
 Log:
 According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.
 See

 https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html


 Added:
 cfe/trunk

Re: FunctionDecl::getBody() returning nullptr

2015-08-20 Thread Aaron Ballman via cfe-commits
On Thu, Aug 20, 2015 at 5:18 PM, Richard Smith  wrote:
> On Wed, Aug 19, 2015 at 2:52 PM, Aaron Ballman 
> wrote:
>>
>> On Wed, Aug 19, 2015 at 5:23 PM, Richard Smith 
>> wrote:
>> > It looks like this would only happen for a late-parsed template that the
>> > analysis code is checking before it is parsed. Should we really be
>> > running
>> > these checks at all in that case?
>>
>> This code is being called from DataRecursiveASTVisitor (using an
>> AnalysisContext) on generic Decl objects to determine whether we
>> *should* run a checker or not. I think it's reasonable, but am not
>> overly familiar with this part of the code.
>>
>> > Also, it looks like this code doesn't actually want the body at all, and
>> > just wants to get the location of the definition. Asking for the body
>> > here
>> > does not seem like the right approach, because it'll cause the external
>> > AST
>> > source (if there is one) to fault the body in.
>> >
>> > The right fix is probably something like:
>> >
>> >   const FunctionDecl *Def;
>> >   SourceLocation SL = (D->isDefined(Def) ? Def : D)->getLocation();
>>
>> I've attached an updated patch with this suggested approach. It
>> appears to work nicely. If you like the approach, I'll see what I can
>> come up with for a test case and commit.
>
>
> I suspect this patch breaks Objective-C cases (I hadn't previously noticed
> that D was just a Decl*, not a FunctionDecl*). Since it's using a
> RecursiveASTVisitor, it's going to deserialize everything anyway, so we
> don't really gain from formulating it this way. Let's go with your original
> patch.

Yeah, I think it would break ObjC. I went with the original patch,
plus a test case, in r245616. Thanks!

~Aaron

>
>> ~Aaron
>>
>> >
>> > On Wed, Aug 19, 2015 at 1:44 PM, Aaron Ballman 
>> > wrote:
>> >>
>> >> The attached patch resolves the null pointer crash I am seeing.
>> >>
>> >> ~Aaron
>> >>
>> >> On Wed, Aug 19, 2015 at 1:24 PM, Aaron Ballman 
>> >> wrote:
>> >> > On Wed, Aug 19, 2015 at 11:33 AM, Aaron Ballman
>> >> > 
>> >> > wrote:
>> >> >> When I run the following test code through clang-tidy -checks=*, I
>> >> >> get
>> >> >> a crash from some relatively strange behavior with FunctionDecl.
>> >> >>
>> >> >> template  struct remove_reference  {typedef T type;};
>> >> >> template  struct remove_reference  {typedef T type;};
>> >> >> template  struct remove_reference {typedef T type;};
>> >> >>
>> >> >> template 
>> >> >> typename remove_reference::type&& move(T&& arg) {
>> >> >>   return static_cast::type&&>(arg);
>> >> >> }
>> >> >>
>> >> >> AnalysisConsumer::getModeForDecl() is called, and it has code that
>> >> >> does: D->hasBody() ? D->getBody()->stuff : stuff;
>> >> >>
>> >> >> What's strange is that hasBody() returns true, but getBody() returns
>> >> >> nullptr. I don't think that this should be possible. I'm wondering
>> >> >> whether it's purposeful that hasBody() does not check
>> >> >> Definition->Body?
>> >> >
>> >> > Looking into this a bit further, the issue is that hasBody() checks
>> >> > for Definition->Body *or* Definition->IsLateTemplateParsed when
>> >> > deciding to return true. In my case, Body is null, but
>> >> > IsLateTemplateParsed is true, so hasBody() returns true. However,
>> >> > getBody() doesn't have any special logic for late template parsed
>> >> > function bodies.
>> >> >
>> >> >> Also, the FunctionDecl in question is for move(), which does have a
>> >> >> body, so I do not understand why the definition would claim there is
>> >> >> no body.
>> >> >>
>> >> >> Ideas, or should I file a bug report?
>> >> >
>> >> > From my further look, I wonder if the correct solution to this is to
>> >> > simply call getBody() and handle a nullptr return instead of calling
>> >> > hasBody() first. It basically makes the check to ignore late parsed
>> >> > template bodies an implicit one.
>> >> >
>> >> > ~Aaron
>> >
>> >
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r245616 - Do not crash when static analysis encounters a FunctionDecl that has a delayed template parse of its body.

2015-08-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Aug 20 16:27:35 2015
New Revision: 245616

URL: http://llvm.org/viewvc/llvm-project?rev=245616&view=rev
Log:
Do not crash when static analysis encounters a FunctionDecl that has a delayed 
template parse of its body.

Added:
cfe/trunk/test/Analysis/delayed-template-parsing-crash.cpp
Modified:
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=245616&r1=245615&r2=245616&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Thu Aug 20 
16:27:35 2015
@@ -588,8 +588,8 @@ AnalysisConsumer::getModeForDecl(Decl *D
   // - Header files: run non-path-sensitive checks only.
   // - System headers: don't run any checks.
   SourceManager &SM = Ctx->getSourceManager();
-  SourceLocation SL = D->hasBody() ? D->getBody()->getLocStart()
- : D->getLocation();
+  const Stmt *Body = D->getBody();
+  SourceLocation SL = Body ? Body->getLocStart() : D->getLocation();
   SL = SM.getExpansionLoc(SL);
 
   if (!Opts->AnalyzeAll && !SM.isWrittenInMainFile(SL)) {

Added: cfe/trunk/test/Analysis/delayed-template-parsing-crash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/delayed-template-parsing-crash.cpp?rev=245616&view=auto
==
--- cfe/trunk/test/Analysis/delayed-template-parsing-crash.cpp (added)
+++ cfe/trunk/test/Analysis/delayed-template-parsing-crash.cpp Thu Aug 20 
16:27:35 2015
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -std=c++11 
-fdelayed-template-parsing -verify %s
+// expected-no-diagnostics
+
+template  struct remove_reference  {typedef T type;};
+template  struct remove_reference  {typedef T type;};
+template  struct remove_reference {typedef T type;};
+
+template 
+typename remove_reference::type&& move(T&& arg) { // this used to crash
+  return static_cast::type&&>(arg);
+}


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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-20 Thread Adrian Prantl via cfe-commits

> On Aug 19, 2015, at 2:15 PM, Richard Smith  wrote:
> 
> rsmith added a subscriber: rsmith.
> 
> 
> Comment at: include/clang/Frontend/CodeGenOptions.def:164-165
> @@ -163,1 +163,4 @@
> 
> +CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should 
> contain
> +   ///< external references to a PCH or 
> module.
> +
> 
> Does this flag end up in the module hash? It presumably should do so.
> 
> 
> Comment at: lib/Driver/Tools.cpp:3708
> @@ +3707,3 @@
> +CmdArgs.push_back("-dwarf-ext-refs");
> +CmdArgs.push_back("-fmodule-format=obj");
> +  }
> 
> What happens if we get a module cache hash collision between module files 
> with different formats? This didn't really matter when the choice was 
> essentially made per-platform, but if it's affected by a user-facing -g flag, 
> we should make sure this works reliably. (You can probably test this by using 
> `-disable-module-hash` and then using the same module with two different 
> module formats specified.)

Maybe this is missing the point, but a hash collision between module files with 
different formats should be highly unlikely because we add the module format 
into the hash.

llvm::hash_code Hash =
  llvm::hash_combine(DirName.lower(), FileName.lower(),
 HSOpts->ModuleFormat);

Or do you mean a collision in spite of this?

-- adrian

> 
> 
> Repository:
>  rL LLVM
> 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11958&d=BQIFaQ&c=eEvniauFctOgLOKGJOplqw&r=cTx6f1tAfqPeajYunFWp7_8ot79RnHyNteqzig4fXmA&m=Hif7tUdT99UHfmvRzCmBZwy6dNprsPRxUGBxEk-_7N8&s=49H83hq9XpGzkDxo54JS1C3LveyHd66KK0SoZFrFhHU&e=
>  
> 
> 
> 

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


r245618 - Revert the 32bit part of r245084; mingw values were correct before it.

2015-08-20 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Thu Aug 20 16:36:14 2015
New Revision: 245618

URL: http://llvm.org/viewvc/llvm-project?rev=245618&view=rev
Log:
Revert the 32bit part of r245084; mingw values were correct before it.


Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245618&r1=245617&r2=245618&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 20 16:36:14 2015
@@ -3784,11 +3784,7 @@ namespace {
 class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
 public:
   MinGWX86_32TargetInfo(const llvm::Triple &Triple)
-  : WindowsX86_32TargetInfo(Triple) {
-LongDoubleWidth = 96;
-LongDoubleAlign = 128;
-LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
-  }
+  : WindowsX86_32TargetInfo(Triple) {}
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override {
 WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);


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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-20 Thread Adrian Prantl via cfe-commits
aprantl added a comment.

Maybe this is missing the point, but a hash collision between module files with 
different formats should be highly unlikely because we add the module format 
into the hash.

  llvm::hash_code Hash =
llvm::hash_combine(DirName.lower(), FileName.lower(),
   HSOpts->ModuleFormat);

Or do you mean a collision in spite of this?

- adrian


Repository:
  rL LLVM

http://reviews.llvm.org/D11958



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


[PATCH] D12215: [UBSan] Add the ability to print more precise error kind in summary line.

2015-08-20 Thread Alexey Samsonov via cfe-commits
samsonov created this revision.
samsonov added reviewers: rsmith, pcc.
samsonov added a subscriber: cfe-commits.

http://reviews.llvm.org/D12215

Files:
  lib/ubsan/ubsan_checks.inc
  lib/ubsan/ubsan_diag.cc
  lib/ubsan/ubsan_diag.h
  lib/ubsan/ubsan_flags.inc
  lib/ubsan/ubsan_handlers.cc
  lib/ubsan/ubsan_handlers_cxx.cc
  test/ubsan/TestCases/Float/cast-overflow.cpp
  test/ubsan/TestCases/Integer/summary.cpp
  test/ubsan/TestCases/Misc/bool.cpp

Index: test/ubsan/TestCases/Misc/bool.cpp
===
--- test/ubsan/TestCases/Misc/bool.cpp
+++ test/ubsan/TestCases/Misc/bool.cpp
@@ -1,10 +1,13 @@
-// RUN: %clangxx -fsanitize=bool %s -O3 -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -fsanitize=bool %s -O3 -o %t
+// RUN: not %run %t 2>&1 | FileCheck %s
+// RUN: env UBSAN_OPTIONS=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
 
 unsigned char NotABool = 123;
 
 int main(int argc, char **argv) {
   bool *p = (bool*)&NotABool;
 
-  // CHECK: bool.cpp:9:10: runtime error: load of value 123, which is not a valid value for type 'bool'
+  // CHECK: bool.cpp:[[@LINE+1]]:10: runtime error: load of value 123, which is not a valid value for type 'bool'
   return *p;
+  // SUMMARY: SUMMARY: {{.*}}Sanitizer: invalid-bool-load {{.*}}bool.cpp:[[@LINE-1]]
 }
Index: test/ubsan/TestCases/Integer/summary.cpp
===
--- test/ubsan/TestCases/Integer/summary.cpp
+++ test/ubsan/TestCases/Integer/summary.cpp
@@ -1,10 +1,13 @@
-// RUN: %clangxx -fsanitize=integer %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx -fsanitize=integer %s -o %t
+// RUN: %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
+// RUN: env UBSAN_OPTIONS=report_error_type=1 %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
 // REQUIRES: ubsan-asan
 
 #include 
 
 int main() {
   (void)(uint64_t(1000ull) + uint64_t(900ull));
-  // CHECK: SUMMARY: AddressSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:44
+  // CHECK-NOTYPE: SUMMARY: AddressSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:44
+  // CHECK-TYPE: SUMMARY: AddressSanitizer: unsigned-integer-overflow {{.*}}summary.cpp:[[@LINE-2]]:44
   return 0;
 }
Index: test/ubsan/TestCases/Float/cast-overflow.cpp
===
--- test/ubsan/TestCases/Float/cast-overflow.cpp
+++ test/ubsan/TestCases/Float/cast-overflow.cpp
@@ -1,6 +1,6 @@
 // RUN: %clangxx -fsanitize=float-cast-overflow %s -o %t
 // RUN: %run %t _
-// RUN: env UBSAN_OPTIONS=print_summary=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0
+// RUN: env UBSAN_OPTIONS=print_summary=1:report_error_type=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0
 // RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-1
 // RUN: %run %t 2 2>&1 | FileCheck %s --check-prefix=CHECK-2
 // RUN: %run %t 3 2>&1 | FileCheck %s --check-prefix=CHECK-3
@@ -88,7 +88,7 @@
 // successfully round-trip, depending on the rounding mode.
 // CHECK-0: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: value 2.14748{{.*}} is outside the range of representable values of type 'int'
 static int test_int = MaxFloatRepresentableAsInt + 0x80;
-// CHECK-0: SUMMARY: {{.*}}Sanitizer: undefined-behavior {{.*}}cast-overflow.cpp:[[@LINE-1]]
+// CHECK-0: SUMMARY: {{.*}}Sanitizer: float-cast-overflow {{.*}}cast-overflow.cpp:[[@LINE-1]]
 return 0;
 }
   case '1': {
Index: lib/ubsan/ubsan_handlers_cxx.cc
===
--- lib/ubsan/ubsan_handlers_cxx.cc
+++ lib/ubsan/ubsan_handlers_cxx.cc
@@ -45,7 +45,7 @@
   if (Loc.isDisabled())
 return;
 
-  ScopedReport R(Opts, Loc);
+  ScopedReport R(Opts, Loc, ErrorType::DynamicTypeMismatch);
 
   Diag(Loc, DL_Error,
"%0 address %1 which does not point to an object of type %2")
@@ -85,7 +85,7 @@
 static void HandleCFIBadType(CFIBadTypeData *Data, ValueHandle Vtable,
  ReportOptions Opts) {
   SourceLocation Loc = Data->Loc.acquire();
-  ScopedReport R(Opts, Loc);
+  ScopedReport R(Opts, Loc, ErrorType::CFIBadType);
   DynamicTypeInfo DTI = getDynamicTypeInfoFromVtable((void*)Vtable);
 
   static const char *TypeCheckKinds[] = {
Index: lib/ubsan/ubsan_handlers.cc
===
--- lib/ubsan/ubsan_handlers.cc
+++ lib/ubsan/ubsan_handlers.cc
@@ -53,18 +53,22 @@
 
   ScopedReport R(Opts, Loc);
 
-  if (!Pointer)
+  if (!Pointer) {
+R.setErrorType(ErrorType::NullPointerUse);
 Diag(Loc, DL_Error, "%0 null pointer of type %1")
   << TypeCheckKinds[Data->TypeCheckKind] << Data->Type;
-  else if (Data->Alignment && (Pointer & (Data->Alignment - 1)))
+  } else if (Data->Alignment && (Pointer & (Data->Alignment - 1))) {
+R.setErrorType(ErrorType::MisalignedPointerUse);
 Diag(Loc, DL_Error

Re: [PATCH] D12181: [sanitizer] Add -fsanitize-trap-function.

2015-08-20 Thread Alexey Samsonov via cfe-commits
samsonov added a comment.

See https://llvm.org/bugs/show_bug.cgi?id=24443 (it's worth including this 
reference to change description).


http://reviews.llvm.org/D12181



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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-20 Thread Adrian Prantl via cfe-commits
aprantl added inline comments.


Comment at: include/clang/Frontend/CodeGenOptions.def:164-165
@@ -163,1 +163,4 @@
 
+CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should 
contain
+   ///< external references to a PCH or module.
+

rsmith wrote:
> Does this flag end up in the module hash? It presumably should do so.
It does not get hashed:

  - If the module has no debug info, then this flag is meaningless, because it 
only affects the debug info output.
  - If the module has debug info, the module format is "obj" (hence a different 
hash) and this flag must be turned on. I will make sure this is enforced via an 
assertion.

[I don't see a point in having "obj" modules without debug info, If we want 
these, we'll need to add it to the hash.]



Repository:
  rL LLVM

http://reviews.llvm.org/D11958



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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-20 Thread David Blaikie via cfe-commits
On Thu, Aug 20, 2015 at 2:45 PM, Adrian Prantl via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> aprantl added inline comments.
>
> 
> Comment at: include/clang/Frontend/CodeGenOptions.def:164-165
> @@ -163,1 +163,4 @@
>
> +CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should
> contain
> +   ///< external references to a PCH or
> module.
> +
> 
> rsmith wrote:
> > Does this flag end up in the module hash? It presumably should do so.
> It does not get hashed:
>
>   - If the module has no debug info, then this flag is meaningless,
> because it only affects the debug info output.
>   - If the module has debug info, the module format is "obj" (hence a
> different hash) and this flag must be turned on. I will make sure this is
> enforced via an assertion.
>
> [I don't see a point in having "obj" modules without debug info, If we
> want these, we'll need to add it to the hash.]
>

I imagine this will eventually happen when we start putting bitcode and
object code in modules (for inline function definitions, for example).


>
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11958
>
>
>
> ___
> 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


r245619 - Revert r245344.

2015-08-20 Thread Evgeniy Stepanov via cfe-commits
Author: eugenis
Date: Thu Aug 20 16:47:16 2015
New Revision: 245619

URL: http://llvm.org/viewvc/llvm-project?rev=245619&view=rev
Log:
Revert r245344.

That change is causing strange test failures on Fedora 22 (PR24503),
and it does not have any effect with Gold linker anyway (PR15823,
https://sourceware.org/bugzilla/show_bug.cgi?id=18859).

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=245619&r1=245618&r2=245619&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 20 16:47:16 2015
@@ -2484,7 +2484,6 @@ static void linkSanitizerRuntimeDeps(con
   CmdArgs.push_back("--no-as-needed");
   CmdArgs.push_back("-lpthread");
   CmdArgs.push_back("-lrt");
-  CmdArgs.push_back("-lutil");
   CmdArgs.push_back("-lm");
   // There's no libdl on FreeBSD.
   if (TC.getTriple().getOS() != llvm::Triple::FreeBSD)

Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=245619&r1=245618&r2=245619&view=diff
==
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Thu Aug 20 16:47:16 2015
@@ -14,7 +14,6 @@
 // CHECK-ASAN-LINUX-NOT: "-export-dynamic"
 // CHECK-ASAN-LINUX: "-lpthread"
 // CHECK-ASAN-LINUX: "-lrt"
-// CHECK-ASAN-LINUX: "-lutil"
 // CHECK-ASAN-LINUX: "-ldl"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -30,7 +29,6 @@
 // CHECK-SHARED-ASAN-LINUX: "-whole-archive" 
"{{.*}}libclang_rt.asan-preinit-i386.a" "-no-whole-archive"
 // CHECK-SHARED-ASAN-LINUX-NOT: "-lpthread"
 // CHECK-SHARED-ASAN-LINUX-NOT: "-lrt"
-// CHECK-SHARED-ASAN-LINUX-NOT: "-lutil"
 // CHECK-SHARED-ASAN-LINUX-NOT: "-ldl"
 // CHECK-SHARED-ASAN-LINUX-NOT: "-export-dynamic"
 // CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
@@ -48,7 +46,6 @@
 // CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan-i386.so"
 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lpthread"
 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lrt"
-// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lutil"
 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-ldl"
 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-export-dynamic"
 // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
@@ -68,7 +65,6 @@
 // CHECK-ASAN-FREEBSD: "-export-dynamic"
 // CHECK-ASAN-FREEBSD: "-lpthread"
 // CHECK-ASAN-FREEBSD: "-lrt"
-// CHECK-ASAN-FREEBSD: "-lutil"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: -target i386-unknown-freebsd -fsanitize=address \
@@ -94,7 +90,6 @@
 // CHECK-ASAN-LINUX-CXX: stdc++
 // CHECK-ASAN-LINUX-CXX: "-lpthread"
 // CHECK-ASAN-LINUX-CXX: "-lrt"
-// CHECK-ASAN-LINUX-CXX: "-lutil"
 // CHECK-ASAN-LINUX-CXX: "-ldl"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \
@@ -172,7 +167,6 @@
 // CHECK-TSAN-LINUX-CXX: stdc++
 // CHECK-TSAN-LINUX-CXX: "-lpthread"
 // CHECK-TSAN-LINUX-CXX: "-lrt"
-// CHECK-TSAN-LINUX-CXX: "-lutil"
 // CHECK-TSAN-LINUX-CXX: "-ldl"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -191,7 +185,6 @@
 // CHECK-MSAN-LINUX-CXX: stdc++
 // CHECK-MSAN-LINUX-CXX: "-lpthread"
 // CHECK-MSAN-LINUX-CXX: "-lrt"
-// CHECK-MSAN-LINUX-CXX: "-lutil"
 // CHECK-MSAN-LINUX-CXX: "-ldl"
 
 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \


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


Re: [PATCH] D11958: Add a -gmodules option to the clang driver.

2015-08-20 Thread Adrian Prantl via cfe-commits
aprantl added a comment.

Alright, let's hash it, then.


Repository:
  rL LLVM

http://reviews.llvm.org/D11958



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


Re: r245344 - [sanitizer] Add -lutil to static runtime link flags.

2015-08-20 Thread Evgenii Stepanov via cfe-commits
Reverted in r245619.

On Wed, Aug 19, 2015 at 10:49 AM, H.J. Lu  wrote:
> On Tue, Aug 18, 2015 at 1:36 PM, Evgeniy Stepanov via cfe-commits
>  wrote:
>> Author: eugenis
>> Date: Tue Aug 18 15:36:11 2015
>> New Revision: 245344
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=245344&view=rev
>> Log:
>> [sanitizer] Add -lutil to static runtime link flags.
>>
>> This is needed to prevent breakage of -Wl,-as-needed link when
>> interceptors for functions in libutil are added. See PR15823.
>>
>
> This caused:
>
> https://llvm.org/bugs/show_bug.cgi?id=24503
>
> --
> H.J.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >