[PATCH] D30534: [analyzer] When creating a temporary object copy, properly copy the value into it.

2017-03-03 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hi Artem! Thank you for this patch. It looks very promising, but I have some 
questions and remarks.




Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:187
   const Expr *Result) {
-  SVal V = State->getSVal(Ex, LC);
+  SVal ExV = State->getSVal(Ex, LC);
   if (!Result) {

If we are touching names, should we rename Ex to InitWithAdjustments (or smth 
like this) and ExV correspondingly?



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:281
+  // Try to recover some path sensitivity in case we couldn't compute the 
value.
+  if (ExV.isUnknown())
+ExV = getSValBuilder().conjureSymbolVal(Result, LC, Ex->getType(),

Should we do all these operations with ExV/Reg if the InitV is known? There is 
a FIXME but I think it is related to all this code, not to the bindLoc only. 
And what happens if we remove this code?



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:285
+
+  // FIXME: Why do we need to do that if WipeV was known to begin with?
+  State = State->bindLoc(Reg, ExV, LC);

Seems like WipeV in comment should be InitV?



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:286
+  // FIXME: Why do we need to do that if WipeV was known to begin with?
+  State = State->bindLoc(Reg, ExV, LC);
+

If I understand correcly, if we call `bindLoc()`, we call 
`checkRegionChanges()` callbacks. And if we `bindLoc()` twice, we call them 
twice too. Is this what we want here?


https://reviews.llvm.org/D30534



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


[clang-tools-extra] r296858 - [clang-tidy] google-readability-casting: don't use constructor call syntax for const types

2017-03-03 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Mar  3 02:18:49 2017
New Revision: 296858

URL: http://llvm.org/viewvc/llvm-project?rev=296858&view=rev
Log:
[clang-tidy] google-readability-casting: don't use constructor call syntax for 
const types

Modified:
clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c
clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp

Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp?rev=296858&r1=296857&r2=296858&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp Fri Mar 
 3 02:18:49 2017
@@ -149,7 +149,7 @@ void AvoidCStyleCastsCheck::check(const
 ReplaceWithNamedCast("static_cast");
 return;
   case CK_ConstructorConversion:
-if (!DestTypeAsWritten.hasQualifiers() &&
+if (!CastExpr->getTypeAsWritten().hasQualifiers() &&
 DestTypeAsWritten->isRecordType() &&
 !DestTypeAsWritten->isElaboratedTypeSpecifier()) {
   Diag << "constructor call syntax";

Modified: clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c?rev=296858&r1=296857&r2=296858&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.c Fri 
Mar  3 02:18:49 2017
@@ -17,6 +17,8 @@ void f(const char *cpc) {
   // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type 
[google-readability-casting]
   // CHECK-FIXES: const char *cpc2 = cpc;
   char *pc = (char*)cpc;
+  typedef const char *Typedef1;
+  (Typedef1)cpc;
 }
 
 #endif

Modified: clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp?rev=296858&r1=296857&r2=296858&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp Fri 
Mar  3 02:18:49 2017
@@ -81,6 +81,9 @@ void f(int a, double b, const char *cpc,
   int b1 = (int)b;
   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: {{.*}}; use static_cast [
   // CHECK-FIXES: int b1 = static_cast(b);
+  b1 = (const int&)b;
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: {{.*}}; use 
static_cast/const_cast/reinterpret_cast [
+  // CHECK-FIXES: b1 = (const int&)b;
 
   Y *pB = (Y*)pX;
   // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use 
static_cast/const_cast/reinterpret_cast [
@@ -271,11 +274,15 @@ void conversions() {
   auto s2a = (struct S)"";
   // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; 
use static_cast [
   // CHECK-FIXES: auto s2a = static_cast("");
+  auto s2b = (const S)"";
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; 
use static_cast [
+  // FIXME: This should be constructor call syntax: S("").
+  // CHECK-FIXES: auto s2b = static_cast("");
   ConvertibleToS c;
   auto s3 = (const S&)c;
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: C-style casts are discouraged; 
use static_cast/const_cast/reinterpret_cast [
   // CHECK-FIXES: auto s3 = (const S&)c;
-  // FIXME: This should be a static_cast
+  // FIXME: This should be a static_cast.
   // C HECK-FIXES: auto s3 = static_cast(c);
   auto s4 = (S)c;
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: C-style casts are discouraged; 
use constructor call syntax [
@@ -284,7 +291,7 @@ void conversions() {
   auto s5 = (const S&)cr;
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: C-style casts are discouraged; 
use static_cast/const_cast/reinterpret_cast [
   // CHECK-FIXES: auto s5 = (const S&)cr;
-  // FIXME: This should be a static_cast
+  // FIXME: This should be a static_cast.
   // C HECK-FIXES: auto s5 = static_cast(cr);
   auto s6 = (S)cr;
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: C-style casts are discouraged; 
use constructor call syntax [


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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added inline comments.



Comment at: include/clang/Format/Format.h:309
+  /// inheritance.
+  bool BreakInhertianceBeforeColonAndComma;
+  

djasper wrote:
> Hm. I am still not sure about this flag and it's name. Fundamentally, this is 
> currently controlling two different things:
> - Whether to wrap before or after colon and comma
> - Whether or not to force wraps for multiple inheritance
> 
> That's going to get us in trouble if at some point people also want other 
> combinations of these two things. I have to alternative suggestions:
> - Add a single flag (e.g. InheritanceListWrapping) with multiple enum values 
> describing the
>   various choices.
> - Don't add a flag at all, but instead break inheritance lists exactly like 
> constructor initializers.
>   I *think* that should solve all the know use cases for now, is easier to 
> configure for users
>   and we can cross the bridge of naming additional flags when we have to.
I see your worries here and indeed the current flags does two things. I'm more 
inclined to use the num that you suggested since in this way it's easier to 
separate the coding style differences that somebody uses. 



Comment at: lib/Format/TokenAnnotator.cpp:2400
+// Returns 'true' if there is an TT_InheritanceComma in the current token list.
+static bool hasMultipleInheritance(const FormatToken &Tok) {
+  for (const FormatToken* nextTok = Tok.Next; nextTok; nextTok = nextTok->Next)

djasper wrote:
> I don't think you need this. If you set MustBreakBefore to true for the 
> InheritanceCommas and set NoLineBreak to true when adding the 
> InheritanceColon on the same line, then clang-format will already do the 
> right thing.
> 
> Fundamentally, this seems to be identical to how we wrap constructor 
> initializer lists in Mozilla style. So I think we should also implement this 
> the same way (if not even reusing the same implementation).
Now that i've seen the behaviour of NoLineBreak thanks for pointing it out to 
me, but still correct me if i'm wrong but shouldn't i use: 
``NoLineBreakInOperand``. 
My guess is if i use NoLineBreak, than breaking on the current line where we 
would have : or , would be prohibited.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh created this revision.
Herald added a subscriber: JDevlieghere.

Add -format option (disabled by default for now) to trigger formatting
of replacements.


https://reviews.llvm.org/D30564

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/ClangTidy.h
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/readability-braces-around-statements-format.cpp

Index: test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}  if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}  if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}while (2) {
+  // CHECK-FIXES-NEXT: {{^}}  if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}  do {
+  // CHECK-FIXES-NEXT: {{^}};
+  // CHECK-FIXES-NEXT: {{^}}  } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}}  }
+}
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -158,6 +158,8 @@
errors were found. If compiler errors have
attached fix-its, clang-tidy will apply them as
well.
+-format  -
+   Format code around applied fixes.
 -header-filter=  -
Regular expression matching the names of the
headers to output diagnostics from. Diagnostics
@@ -179,6 +181,11 @@
List all enabled checks and exit. Use with
-checks=* to list all available checks.
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This suppresses
+   printing statistics about ignored warnings and
+   warnings treated as errors if the respective
+   options are specified.
 -style=  -
Fallback style for reformatting after inserting fixes
if there is no clang-format config file found.
@@ -558,10 +565,10 @@
 against the fixed code (i.e., the code after generated fix-its are
 applied). In particular, ``CHECK-FIXES:`` can be used to check
 that code was not modified by fix-its, by checking that it is present
-unchanged in the fixed code.  The full set of `FileCheck`_ directives
+unchanged in the fixed code. The full set of `FileCheck`_ directives
 is available (e.g., ``CHECK-MESSAGES-SAME:``, ``CHECK-MESSAGES-NOT:``), though
 typically the basic ``CHECK`` forms (``CHECK-MESSAGES`` and ``CHECK-FIXES``)
-are sufficient for clang-tidy tests.  Note that the `FileCheck`_
+are sufficient for clang-tidy tests. Note that the `FileCheck`_
 documentation mostly assumes the default prefix (``CHECK``), and hence
 describes the directive as ``CHECK:``, ``CHECK-SAME:``, ``CHECK-NOT:``, etc.
 Replace ``CHECK`` by either ``CHECK-FIXES`` or ``CHECK-MESSAGES`` for
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -87,6 +87,9 @@
   Finds and replaces explicit calls to the constructor in a return statement by
   a braced initializer list so that the return type is not needlessly repeated.
 
+- Support clang-formatting of the code around applied fixes (``-format``
+  command-line option).
+
 Improvements to include-fixer
 -
 
Index: clang-tidy/tool/ClangTidyMain.cpp
==

[PATCH] D28297: [StaticAnalyzer] Fix crash in CastToStructChecker

2017-03-03 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Looks like a right fix.




Comment at: lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp:93
 
 // Warn when there is widening cast.
 unsigned ToWidth = Ctx.getTypeInfo(ToPointeeTy).Width;

NoQ wrote:
> I think we should move the check here then. That'd avoid double-checking if 
> `ToPointeeTy` is a record type (we could `cast<>` directly on this branch).
Or just hoist it out of condition?


https://reviews.llvm.org/D28297



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added inline comments.



Comment at: test/clang-tidy/readability-braces-around-statements-format.cpp:1
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- 
-format --
+

Will clang-tidy look for a .clang-format file?
Does this test rely on a .clang-format file being found / not found?


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh updated this revision to Diff 90442.
alexfh added a comment.

Pacify llvm::Expected<> debug checks.


https://reviews.llvm.org/D30564

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/ClangTidy.h
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/readability-braces-around-statements-format.cpp

Index: test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}  if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}  if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}while (2) {
+  // CHECK-FIXES-NEXT: {{^}}  if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}  do {
+  // CHECK-FIXES-NEXT: {{^}};
+  // CHECK-FIXES-NEXT: {{^}}  } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}}  }
+}
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -158,6 +158,8 @@
errors were found. If compiler errors have
attached fix-its, clang-tidy will apply them as
well.
+-format  -
+   Format code around applied fixes.
 -header-filter=  -
Regular expression matching the names of the
headers to output diagnostics from. Diagnostics
@@ -179,6 +181,11 @@
List all enabled checks and exit. Use with
-checks=* to list all available checks.
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This suppresses
+   printing statistics about ignored warnings and
+   warnings treated as errors if the respective
+   options are specified.
 -style=  -
Fallback style for reformatting after inserting fixes
if there is no clang-format config file found.
@@ -558,10 +565,10 @@
 against the fixed code (i.e., the code after generated fix-its are
 applied). In particular, ``CHECK-FIXES:`` can be used to check
 that code was not modified by fix-its, by checking that it is present
-unchanged in the fixed code.  The full set of `FileCheck`_ directives
+unchanged in the fixed code. The full set of `FileCheck`_ directives
 is available (e.g., ``CHECK-MESSAGES-SAME:``, ``CHECK-MESSAGES-NOT:``), though
 typically the basic ``CHECK`` forms (``CHECK-MESSAGES`` and ``CHECK-FIXES``)
-are sufficient for clang-tidy tests.  Note that the `FileCheck`_
+are sufficient for clang-tidy tests. Note that the `FileCheck`_
 documentation mostly assumes the default prefix (``CHECK``), and hence
 describes the directive as ``CHECK:``, ``CHECK-SAME:``, ``CHECK-NOT:``, etc.
 Replace ``CHECK`` by either ``CHECK-FIXES`` or ``CHECK-MESSAGES`` for
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -87,6 +87,9 @@
   Finds and replaces explicit calls to the constructor in a return statement by
   a braced initializer list so that the return type is not needlessly repeated.
 
+- Support clang-formatting of the code around applied fixes (``-format``
+  command-line option).
+
 Improvements to include-fixer
 -
 
Index: clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tidy/tool/ClangTidyMa

[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added inline comments.



Comment at: test/clang-tidy/readability-braces-around-statements-format.cpp:1
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- 
-format --
+

malcolm.parsons wrote:
> Will clang-tidy look for a .clang-format file?
> Does this test rely on a .clang-format file being found / not found?
Good question. No idea ;) Lemme check...


https://reviews.llvm.org/D30564



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


[PATCH] D30565: [analyzer] Terminate analysis on OpenMP code instead of crashing

2017-03-03 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin created this revision.

ExprEngine assumes that OpenMP statements should never appear in CFG. However, 
current CFG doesn't know anything about OpenMP and passes such statements as 
CFG nodes causing "UNREACHABLE executed!" crashes. Since I have no ideas on 
OpenMP implementation in ExprEngine or CFG, I'm changing the behaviour to stop 
the analysis on OpenMP statements to avoid crashes.


https://reviews.llvm.org/D30565

Files:
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/openmp-unsupported.c


Index: test/Analysis/openmp-unsupported.c
===
--- test/Analysis/openmp-unsupported.c
+++ test/Analysis/openmp-unsupported.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze 
-analyzer-checker=core.builtin -fopenmp -verify %s
+// expected-no-diagnostics
+
+void openmp_parallel_crash_test() {
+#pragma omp parallel
+  ;
+}
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -769,7 +769,7 @@
   assert(!isa(S) || S == cast(S)->IgnoreParens());
 
   switch (S->getStmtClass()) {
-// C++ and ARC stuff we don't support yet.
+// C++, OpenMP and ARC stuff we don't support yet.
 case Expr::ObjCIndirectCopyRestoreExprClass:
 case Stmt::CXXDependentScopeMemberExprClass:
 case Stmt::CXXInheritedCtorInitExprClass:
@@ -797,36 +797,7 @@
 case Stmt::SEHTryStmtClass:
 case Stmt::SEHExceptStmtClass:
 case Stmt::SEHLeaveStmtClass:
-case Stmt::SEHFinallyStmtClass: {
-  const ExplodedNode *node = Bldr.generateSink(S, Pred, Pred->getState());
-  Engine.addAbortedBlock(node, currBldrCtx->getBlock());
-  break;
-}
-
-case Stmt::ParenExprClass:
-  llvm_unreachable("ParenExprs already handled.");
-case Stmt::GenericSelectionExprClass:
-  llvm_unreachable("GenericSelectionExprs already handled.");
-// Cases that should never be evaluated simply because they shouldn't
-// appear in the CFG.
-case Stmt::BreakStmtClass:
-case Stmt::CaseStmtClass:
-case Stmt::CompoundStmtClass:
-case Stmt::ContinueStmtClass:
-case Stmt::CXXForRangeStmtClass:
-case Stmt::DefaultStmtClass:
-case Stmt::DoStmtClass:
-case Stmt::ForStmtClass:
-case Stmt::GotoStmtClass:
-case Stmt::IfStmtClass:
-case Stmt::IndirectGotoStmtClass:
-case Stmt::LabelStmtClass:
-case Stmt::NoStmtClass:
-case Stmt::NullStmtClass:
-case Stmt::SwitchStmtClass:
-case Stmt::WhileStmtClass:
-case Expr::MSDependentExistsStmtClass:
-case Stmt::CapturedStmtClass:
+case Stmt::SEHFinallyStmtClass:
 case Stmt::OMPParallelDirectiveClass:
 case Stmt::OMPSimdDirectiveClass:
 case Stmt::OMPForDirectiveClass:
@@ -874,6 +845,36 @@
 case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
 case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
 case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:
+case Stmt::CapturedStmtClass:
+{
+  const ExplodedNode *node = Bldr.generateSink(S, Pred, Pred->getState());
+  Engine.addAbortedBlock(node, currBldrCtx->getBlock());
+  break;
+}
+
+case Stmt::ParenExprClass:
+  llvm_unreachable("ParenExprs already handled.");
+case Stmt::GenericSelectionExprClass:
+  llvm_unreachable("GenericSelectionExprs already handled.");
+// Cases that should never be evaluated simply because they shouldn't
+// appear in the CFG.
+case Stmt::BreakStmtClass:
+case Stmt::CaseStmtClass:
+case Stmt::CompoundStmtClass:
+case Stmt::ContinueStmtClass:
+case Stmt::CXXForRangeStmtClass:
+case Stmt::DefaultStmtClass:
+case Stmt::DoStmtClass:
+case Stmt::ForStmtClass:
+case Stmt::GotoStmtClass:
+case Stmt::IfStmtClass:
+case Stmt::IndirectGotoStmtClass:
+case Stmt::LabelStmtClass:
+case Stmt::NoStmtClass:
+case Stmt::NullStmtClass:
+case Stmt::SwitchStmtClass:
+case Stmt::WhileStmtClass:
+case Expr::MSDependentExistsStmtClass:
   llvm_unreachable("Stmt should not be in analyzer evaluation loop");
 
 case Stmt::ObjCSubscriptRefExprClass:


Index: test/Analysis/openmp-unsupported.c
===
--- test/Analysis/openmp-unsupported.c
+++ test/Analysis/openmp-unsupported.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.builtin -fopenmp -verify %s
+// expected-no-diagnostics
+
+void openmp_parallel_crash_test() {
+#pragma omp parallel
+  ;
+}
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -769,7 +769,7 @@
   assert(!isa(S) || S == cast(S)->IgnoreParens());
 
   switch (S->getStmtClass())

[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added inline comments.



Comment at: docs/clang-tidy/index.rst:184
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This 
suppresses

This looks like a separate patch?


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh marked an inline comment as done.
alexfh added inline comments.



Comment at: docs/clang-tidy/index.rst:184
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This 
suppresses

kimgr wrote:
> This looks like a separate patch?
I've just pasted up-to-date -help output here. This should have been done when 
the -quiet option was added.


https://reviews.llvm.org/D30564



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


[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

Hm. I don't actually know whether these examples are useful as is. You only 
present one setting of the value in most cases. What's interesting is actually 
how the flag changes the behavior. I mean in most cases, this can be derived 
from the example, but in those cases, it's also fairly obvious what the flag 
does. Unfortunately, I also don't have a significantly better idea. Maybe 
something like https://clangformat.com/ is just better at handling this?




Comment at: include/clang/Format/Format.h:661
   /// \brief If ``true``, spaces will be inserted after ``[`` and before ``]``.
+  /// Lambdas or unspecified size array declarations will not be updated.
+  /// \code

"update" seems like the wrong word. Maybe "affected"?


https://reviews.llvm.org/D30532



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


[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

I see a lot of values in examples. If I started this review, it is because I 
was lost in all the options and could not find what I was looking for.

If you want, I can update the example to provide results with and without the 
option.

like

> With SpacesInCStyleCastParentheses: true:
>  x = ( int32 )y
>  With false:
>  x = (int32)y




https://reviews.llvm.org/D30532



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


r296861 - [PowerPC] Enable -fomit-frame-pointer by default for PPC

2017-03-03 Thread Nemanja Ivanovic via cfe-commits
Author: nemanjai
Date: Fri Mar  3 03:49:17 2017
New Revision: 296861

URL: http://llvm.org/viewvc/llvm-project?rev=296861&view=rev
Log:
[PowerPC] Enable -fomit-frame-pointer by default for PPC

As is the case on platforms like Mips, X86 and SystemZ, the -fomit-frame-pointer
should be enabled by default on PPC when optimizing at -O1 and above. This
brings the behaviour of LLVM on PPC in line with GCC.

Committing on behalf of Hiroshi Inoue.

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/frame-pointer.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=296861&r1=296860&r2=296861&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Mar  3 03:49:17 2017
@@ -2235,6 +2235,9 @@ static bool useFramePointerForTargetByDe
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:

Modified: cfe/trunk/test/Driver/frame-pointer.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer.c?rev=296861&r1=296860&r2=296861&view=diff
==
--- cfe/trunk/test/Driver/frame-pointer.c (original)
+++ cfe/trunk/test/Driver/frame-pointer.c Fri Mar  3 03:49:17 2017
@@ -17,6 +17,13 @@
 // RUN: %clang -target s390x-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK0-64 %s
 // RUN: %clang -target s390x-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK1-64 %s
 
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 
| FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 
| FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O0 %s -o %t.s 
2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O1 %s -o %t.s 
2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+
 // RUN: %clang -target mips-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK0-32 %s
 // RUN: %clang -target mips-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK1-32 %s
 // RUN: %clang -target mipsel-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-32 %s


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


[PATCH] D29750: [PPC] Enable -fomit-frame-pointer by default for PPC

2017-03-03 Thread Nemanja Ivanovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296861: [PowerPC] Enable -fomit-frame-pointer by default for 
PPC (authored by nemanjai).

Changed prior to commit:
  https://reviews.llvm.org/D29750?vs=87821&id=90443#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29750

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/frame-pointer.c


Index: cfe/trunk/test/Driver/frame-pointer.c
===
--- cfe/trunk/test/Driver/frame-pointer.c
+++ cfe/trunk/test/Driver/frame-pointer.c
@@ -17,6 +17,13 @@
 // RUN: %clang -target s390x-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK0-64 %s
 // RUN: %clang -target s390x-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK1-64 %s
 
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 
| FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 
| FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O0 %s -o %t.s 
2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O1 %s -o %t.s 
2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+
 // RUN: %clang -target mips-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK0-32 %s
 // RUN: %clang -target mips-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck 
-check-prefix=CHECK1-32 %s
 // RUN: %clang -target mipsel-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | 
FileCheck -check-prefix=CHECK0-32 %s
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2235,6 +2235,9 @@
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:


Index: cfe/trunk/test/Driver/frame-pointer.c
===
--- cfe/trunk/test/Driver/frame-pointer.c
+++ cfe/trunk/test/Driver/frame-pointer.c
@@ -17,6 +17,13 @@
 // RUN: %clang -target s390x-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
 // RUN: %clang -target s390x-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
 
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+
 // RUN: %clang -target mips-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
 // RUN: %clang -target mips-linux-gnu -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
 // RUN: %clang -target mipsel-linux-gnu -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2235,6 +2235,9 @@
 case llvm::Triple::mips64el:
 case llvm::Triple::mips:
 case llvm::Triple::mipsel:
+case llvm::Triple::ppc:
+case llvm::Triple::ppc64:
+case llvm::Triple::ppc64le:
 case llvm::Triple::systemz:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

Sure, then go ahead. If these examples would have helped you, that's one 
datapoint :).

As for presenting the difference in options, that would be useful I think. So 
if you are up to also doing that, that'd be appreciated.
For bool options it seems easiest to do something like:

  true:  x = ( int32 )y;
  false: x = (int32)y;

(I'd try to keep this as compact as possible for now as the style page getting 
much longer also hurts discoverability)


https://reviews.llvm.org/D30532



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added inline comments.



Comment at: include/clang/Format/Format.h:309
+  /// inheritance.
+  bool BreakInhertianceBeforeColonAndComma;
+  

Abpostelnicu wrote:
> djasper wrote:
> > Hm. I am still not sure about this flag and it's name. Fundamentally, this 
> > is currently controlling two different things:
> > - Whether to wrap before or after colon and comma
> > - Whether or not to force wraps for multiple inheritance
> > 
> > That's going to get us in trouble if at some point people also want other 
> > combinations of these two things. I have to alternative suggestions:
> > - Add a single flag (e.g. InheritanceListWrapping) with multiple enum 
> > values describing the
> >   various choices.
> > - Don't add a flag at all, but instead break inheritance lists exactly like 
> > constructor initializers.
> >   I *think* that should solve all the know use cases for now, is easier to 
> > configure for users
> >   and we can cross the bridge of naming additional flags when we have to.
> I see your worries here and indeed the current flags does two things. I'm 
> more inclined to use the num that you suggested since in this way it's easier 
> to separate the coding style differences that somebody uses. 
The trouble is that adding more style options should be done very carefully. 
Some of the reasons here:
https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options

So unless we know that people would want the one style for constructor 
initializers and the other style for inheritance lists, I'd keep both the flags 
and the implementation simple.



Comment at: lib/Format/TokenAnnotator.cpp:2400
+// Returns 'true' if there is an TT_InheritanceComma in the current token list.
+static bool hasMultipleInheritance(const FormatToken &Tok) {
+  for (const FormatToken* nextTok = Tok.Next; nextTok; nextTok = nextTok->Next)

Abpostelnicu wrote:
> djasper wrote:
> > I don't think you need this. If you set MustBreakBefore to true for the 
> > InheritanceCommas and set NoLineBreak to true when adding the 
> > InheritanceColon on the same line, then clang-format will already do the 
> > right thing.
> > 
> > Fundamentally, this seems to be identical to how we wrap constructor 
> > initializer lists in Mozilla style. So I think we should also implement 
> > this the same way (if not even reusing the same implementation).
> Now that i've seen the behaviour of NoLineBreak thanks for pointing it out to 
> me, but still correct me if i'm wrong but shouldn't i use: 
> ``NoLineBreakInOperand``. 
> My guess is if i use NoLineBreak, than breaking on the current line where we 
> would have : or , would be prohibited.
Yes, that would be prohibited and that is intended. Remember that I'd set this 
after placing the colon on the same line (and I should have written explicitly) 
as the class name. After that, there must not be any further line breaks.

But again, I think we should just have the exact same behavior and 
implementation as for constructor initializer lists.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added a comment.

For what it's worth, I also find this useful to be able to see at a glance what 
the setting does. I know I've tried several different settings in the past 
before finding the one I was looking for.


https://reviews.llvm.org/D30532



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments.



Comment at: test/clang-tidy/readability-braces-around-statements-format.cpp:1
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- 
-format --
+

alexfh wrote:
> malcolm.parsons wrote:
> > Will clang-tidy look for a .clang-format file?
> > Does this test rely on a .clang-format file being found / not found?
> Good question. No idea ;) Lemme check...
Yes, it will look for .clang-format file in the working directory and its 
parents. If there happens to be a .clang-format with different style, the test 
might fail. We might want to explicitly set the style or add a .clang-format 
file in the test directory.


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh updated this revision to Diff 90445.
alexfh marked an inline comment as done.
alexfh added a comment.

Replace the separate -format and -style options with -format-style (default is
'none', which means no formatting).


https://reviews.llvm.org/D30564

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/readability-braces-around-statements-format.cpp

Index: test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format-style="{IndentWidth: 3}" --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}   if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}   }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}   if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  while (2) {
+  // CHECK-FIXES-NEXT: {{^}} if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}   do {
+  // CHECK-FIXES-NEXT: {{^}}  ;
+  // CHECK-FIXES-NEXT: {{^}}   } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}} }
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}   }
+}
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -158,6 +158,9 @@
errors were found. If compiler errors have
attached fix-its, clang-tidy will apply them as
well.
+-format-style=   -
+   Style for formatting code around applied fixes.
+   'none' turns off formatting.
 -header-filter=  -
Regular expression matching the names of the
headers to output diagnostics from. Diagnostics
@@ -179,6 +182,11 @@
List all enabled checks and exit. Use with
-checks=* to list all available checks.
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This suppresses
+   printing statistics about ignored warnings and
+   warnings treated as errors if the respective
+   options are specified.
 -style=  -
Fallback style for reformatting after inserting fixes
if there is no clang-format config file found.
@@ -558,10 +566,10 @@
 against the fixed code (i.e., the code after generated fix-its are
 applied). In particular, ``CHECK-FIXES:`` can be used to check
 that code was not modified by fix-its, by checking that it is present
-unchanged in the fixed code.  The full set of `FileCheck`_ directives
+unchanged in the fixed code. The full set of `FileCheck`_ directives
 is available (e.g., ``CHECK-MESSAGES-SAME:``, ``CHECK-MESSAGES-NOT:``), though
 typically the basic ``CHECK`` forms (``CHECK-MESSAGES`` and ``CHECK-FIXES``)
-are sufficient for clang-tidy tests.  Note that the `FileCheck`_
+are sufficient for clang-tidy tests. Note that the `FileCheck`_
 documentation mostly assumes the default prefix (``CHECK``), and hence
 describes the directive as ``CHECK:``, ``CHECK-SAME:``, ``CHECK-NOT:``, etc.
 Replace ``CHECK`` by either ``CHECK-FIXES`` or ``CHECK-MESSAGES`` for
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -87,6 +87,9 @@
   Finds and replaces explicit calls to the constructor in a return statement by
   a braced initializer list so that the return type is not needlessly repeated.
 
+- Support clang-formatting of the code around applied fixes (``-format-styl

[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added a comment.

In https://reviews.llvm.org/D30564#691441, @alexfh wrote:

> Replace the separate -format and -style options with -format-style (default is
>  'none', which means no formatting).


Is there a style that means use my .clang-format file?


https://reviews.llvm.org/D30564



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


[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

> For bool options it seems easiest to do something like:
>  true:  x = ( int32 )y;
>  false: x = (int32)y;

That works for single declarations but for stuff like:

>   SomeClass::Constructor()
>   : a(a)
>   , b(b)
>   , c(c) {}

I won't be great :/


https://reviews.llvm.org/D30532



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh updated this revision to Diff 90447.
alexfh added a comment.

Expanded -format-style option description. Run cleanup tests with different 
format styles, just in case.


https://reviews.llvm.org/D30564

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/clean-up-code.cpp
  test/clang-tidy/readability-braces-around-statements-format.cpp

Index: test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format-style="{IndentWidth: 3}" --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}   if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}   }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}   if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  while (2) {
+  // CHECK-FIXES-NEXT: {{^}} if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}   do {
+  // CHECK-FIXES-NEXT: {{^}}  ;
+  // CHECK-FIXES-NEXT: {{^}}   } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}} }
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}   }
+}
Index: test/clang-tidy/clean-up-code.cpp
===
--- test/clang-tidy/clean-up-code.cpp
+++ test/clang-tidy/clean-up-code.cpp
@@ -1,4 +1,6 @@
 // RUN: %check_clang_tidy %s misc-unused-using-decls %t
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=none --
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=llvm --
 namespace a { class A {}; }
 namespace b {
 using a::A;
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -158,6 +158,15 @@
errors were found. If compiler errors have
attached fix-its, clang-tidy will apply them as
well.
+-format-style=   -
+   Style for formatting code around applied fixes:
+ - 'none' (default) turns off formatting
+ - 'file' uses the closest .clang-format file
+ - '{  }' specifies options inline, e.g.
+   -format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
+ - 'llvm', 'google', 'webkit', 'mozilla'
+   See clang-format documentation for the up-to-date
+   information about formatting styles and options.
 -header-filter=  -
Regular expression matching the names of the
headers to output diagnostics from. Diagnostics
@@ -179,6 +188,11 @@
List all enabled checks and exit. Use with
-checks=* to list all available checks.
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This suppresses
+   printing statistics about ignored warnings and
+   warnings treated as errors if the respective
+   options are specified.
 -style=  -
Fallback style for reformatting after inserting fixes
if there is no clang-format config file found.
@@ -558,10 +572,10 @@
 against the fixed code (i.e., the code after generated fix-its are
 applied). In particular, ``CHECK-FIXES:`` can be used to check
 that code was not modified by fix-its, by checking that it is present
-unchanged in the fixed code.  The full set of `FileCheck`_ directives
+unch

[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

In https://reviews.llvm.org/D30564#691446, @malcolm.parsons wrote:

> In https://reviews.llvm.org/D30564#691441, @alexfh wrote:
>
> > Replace the separate -format and -style options with -format-style (default 
> > is
> >  'none', which means no formatting).
>
>
> Is there a style that means use my .clang-format file?


Yes, `-format-style=file`, see the updated docs.


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh updated this revision to Diff 90448.
alexfh added a comment.

Clarify the 'file' option a bit.


https://reviews.llvm.org/D30564

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/clean-up-code.cpp
  test/clang-tidy/readability-braces-around-statements-format.cpp

Index: test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format-style="{IndentWidth: 3}" --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}   if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}   }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}   if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  while (2) {
+  // CHECK-FIXES-NEXT: {{^}} if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}   do {
+  // CHECK-FIXES-NEXT: {{^}}  ;
+  // CHECK-FIXES-NEXT: {{^}}   } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}} }
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}   }
+}
Index: test/clang-tidy/clean-up-code.cpp
===
--- test/clang-tidy/clean-up-code.cpp
+++ test/clang-tidy/clean-up-code.cpp
@@ -1,4 +1,6 @@
 // RUN: %check_clang_tidy %s misc-unused-using-decls %t
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=none --
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=llvm --
 namespace a { class A {}; }
 namespace b {
 using a::A;
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -158,6 +158,17 @@
errors were found. If compiler errors have
attached fix-its, clang-tidy will apply them as
well.
+-format-style=   -
+   Style for formatting code around applied fixes:
+ - 'none' (default) turns off formatting
+ - 'file' (literally 'file', not a placeholder)
+   uses .clang-format file in the closest parent
+   directory
+ - '{  }' specifies options inline, e.g.
+   -format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
+ - 'llvm', 'google', 'webkit', 'mozilla'
+   See clang-format documentation for the up-to-date
+   information about formatting styles and options.
 -header-filter=  -
Regular expression matching the names of the
headers to output diagnostics from. Diagnostics
@@ -179,6 +190,11 @@
List all enabled checks and exit. Use with
-checks=* to list all available checks.
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This suppresses
+   printing statistics about ignored warnings and
+   warnings treated as errors if the respective
+   options are specified.
 -style=  -
Fallback style for reformatting after inserting fixes
if there is no clang-format config file found.
@@ -558,10 +574,10 @@
 against the fixed code (i.e., the code after generated fix-its are
 applied). In particular, ``CHECK-FIXES:`` can be used to check
 that code was not modified by fix-its, by checking that it is present
-unchanged 

[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

I agree, just generally we should aim for keeping these short.

The example you gave might actually be reasonable to compare in two columns, 
i.e.:

  true:  false:
  SomeClass::Constructor()  vs.  SomeClass::Constructor() : a(a),
  : a(a)b(b),
  , b(b)c(c) {}
  , c(c) {}

or some such.


https://reviews.llvm.org/D30532



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added a comment.

LGTM.


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

PTAL


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Eric Liu via Phabricator via cfe-commits
ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

Lg


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments.



Comment at: clang-tidy/ClangTidy.cpp:214
+  llvm::errs() << llvm::toString(Replacements.takeError()) << "\n";
+  continue;
+}

Maybe still apply the replacements if formatting fails?


https://reviews.llvm.org/D30564



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh updated this revision to Diff 90452.
alexfh added a comment.

Apply changes even when formatting fails.


https://reviews.llvm.org/D30564

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/clean-up-code.cpp
  test/clang-tidy/readability-braces-around-statements-format.cpp

Index: test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format-style="{IndentWidth: 3}" --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}   if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}   }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}   if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  while (2) {
+  // CHECK-FIXES-NEXT: {{^}} if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}   do {
+  // CHECK-FIXES-NEXT: {{^}}  ;
+  // CHECK-FIXES-NEXT: {{^}}   } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}} }
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}   }
+}
Index: test/clang-tidy/clean-up-code.cpp
===
--- test/clang-tidy/clean-up-code.cpp
+++ test/clang-tidy/clean-up-code.cpp
@@ -1,4 +1,6 @@
 // RUN: %check_clang_tidy %s misc-unused-using-decls %t
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=none --
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=llvm --
 namespace a { class A {}; }
 namespace b {
 using a::A;
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -158,6 +158,17 @@
errors were found. If compiler errors have
attached fix-its, clang-tidy will apply them as
well.
+-format-style=   -
+   Style for formatting code around applied fixes:
+ - 'none' (default) turns off formatting
+ - 'file' (literally 'file', not a placeholder)
+   uses .clang-format file in the closest parent
+   directory
+ - '{  }' specifies options inline, e.g.
+   -format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
+ - 'llvm', 'google', 'webkit', 'mozilla'
+   See clang-format documentation for the up-to-date
+   information about formatting styles and options.
 -header-filter=  -
Regular expression matching the names of the
headers to output diagnostics from. Diagnostics
@@ -179,6 +190,11 @@
List all enabled checks and exit. Use with
-checks=* to list all available checks.
 -p=  - Build path
+-quiet   -
+   Run clang-tidy in quiet mode. This suppresses
+   printing statistics about ignored warnings and
+   warnings treated as errors if the respective
+   options are specified.
 -style=  -
Fallback style for reformatting after inserting fixes
if there is no clang-format config file found.
@@ -558,10 +574,10 @@
 against the fixed code (i.e., the code after generated fix-its are
 applied). In particular, ``CHECK-FIXES:`` can be used to check
 that code was not modified by fix-its, by checking that it is present
-u

[clang-tools-extra] r296864 - [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Mar  3 05:16:34 2017
New Revision: 296864

URL: http://llvm.org/viewvc/llvm-project?rev=296864&view=rev
Log:
[clang-tidy] Format code around applied fixes

Summary:
Add -format option (disabled by default for now) to trigger formatting
of replacements.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: kimgr, malcolm.parsons, JDevlieghere, cfe-commits

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

Added:

clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/index.rst
clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=296864&r1=296863&r2=296864&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Mar  3 05:16:34 2017
@@ -183,7 +183,6 @@ public:
   }
 
   void Finish() {
-// FIXME: Run clang-format on changes.
 if (ApplyFixes && TotalFixes > 0) {
   Rewriter Rewrite(SourceMgr, LangOpts);
   for (const auto &FileAndReplacements : FileReplacements) {
@@ -197,19 +196,28 @@ public:
   continue;
 }
 StringRef Code = Buffer.get()->getBuffer();
-auto Style = format::getStyle("file", File, FormatStyle);
+auto Style = format::getStyle(FormatStyle, File, "none");
 if (!Style) {
   llvm::errs() << llvm::toString(Style.takeError()) << "\n";
   continue;
 }
-llvm::Expected CleanReplacements =
+llvm::Expected Replacements =
 format::cleanupAroundReplacements(Code, FileAndReplacements.second,
   *Style);
-if (!CleanReplacements) {
-  llvm::errs() << llvm::toString(CleanReplacements.takeError()) << 
"\n";
+if (!Replacements) {
+  llvm::errs() << llvm::toString(Replacements.takeError()) << "\n";
   continue;
 }
-if (!tooling::applyAllReplacements(CleanReplacements.get(), Rewrite)) {
+if (llvm::Expected FormattedReplacements =
+format::formatReplacements(Code, *Replacements, *Style)) {
+  Replacements = std::move(FormattedReplacements);
+  if (!Replacements)
+llvm_unreachable("!Replacements");
+} else {
+  llvm::errs() << llvm::toString(FormattedReplacements.takeError())
+   << ". Skipping formatting.\n";
+}
+if (!tooling::applyAllReplacements(Replacements.get(), Rewrite)) {
   llvm::errs() << "Can't apply replacements for file " << File << "\n";
 }
   }

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=296864&r1=296863&r2=296864&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Fri Mar  3 
05:16:34 2017
@@ -60,7 +60,7 @@ appearance in the list. Globs without '-
 prefix add checks with matching names to the
 set, globs with the '-' prefix remove checks
 with matching names from the set of enabled
-checks.  This option's value is appended to the
+checks. This option's value is appended to the
 value of the 'Checks' option in .clang-tidy
 file, if any.
 )"),
@@ -120,12 +120,20 @@ well.
 )"),
cl::init(false), cl::cat(ClangTidyCategory));
 
-static cl::opt FormatStyle("style", cl::desc(R"(
-Fallback style for reformatting after inserting fixes
-if there is no clang-format config file found.
+static cl::opt FormatStyle("format-style", cl::desc(R"(
+Style for formatting code around applied fixes:
+  - 'none' (default) turns off formatting
+  - 'file' (literally 'file', not a placeholder)
+uses .clang-format file in the closest parent
+directory
+  - '{  }' specifies options inline, e.g.
+-format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
+  - 'llvm', 'google', 'webkit', 'mozilla'
+See clang-format documentation for the up-to-date
+information about formatting styles and options.
 )"),
-cl::init("llvm"),
-cl::cat(ClangTidyCategory));
+   cl::init("none"),
+   cl::cat(ClangTidyCategory));
 
 static cl::opt ListChecks("list-checks", cl::desc(R"(
 List all enabled checks and exit. Use with
@@ -189,7 +197,7 @@ code wit

[PATCH] D30489: [analyzer] catch out of bounds for VLA

2017-03-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment.

To me it seems that the extent is calculated properly in ArrayBoundsV2.

Existing code:

  DefinedOrUnknownSVal extentVal =
rawOffset.getRegion()->getExtent(svalBuilder);

This ugly little debug code will extract the needed VLA information from the 
extentVal...

  if (extentVal.getSubKind() == nonloc::SymbolValKind) {
SymbolRef SR = extentVal.castAs().getSymbol();
const SymbolExtent *SE = dyn_cast(SR);
const MemRegion *SEMR = SE->getRegion();
if (SEMR->getKind() == MemRegion::VarRegionKind) {
  const VarRegion *VR = cast(SEMR);
  QualType T = VR->getDecl()->getType();
  ASTContext &Ctx = checkerContext.getASTContext();
  const VariableArrayType *VLA = Ctx.getAsVariableArrayType(T);

A VLA->dump() after that will output:

  VariableArrayType 0x87f6a80 'char [sz]' variably_modified 
  |-BuiltinType 0x87f6480 'char'
  `-ImplicitCastExpr 0x87f6a70 'int' 
`-DeclRefExpr 0x87f6a58 'int' lvalue ParmVar 0x87f6948 'sz' 'int'

which is exactly what the corresponding VLA->dump() in the checkPreStmt() 
outputs.

As far as I see the problem is that the ProgramState does not keep the symbolic 
value for sz.

In checkPreStmt the state is:

  Expressions:
   (0xe4acb0,0xe04790) sz : reg_$0
   (0xe4acb0,0xe04828) array : &array
   (0xe4acb0,0xe04840) sz : &sz
   (0xe4acb0,0xe04858) array : &element{array,0 S64b,char}
   (0xe4acb0,0xe04868) sz : reg_$0
   (0xe4acb0,0xe048b0) 1 : 1 S8b

in checkLocation() the state is:

  Expressions:
   (0xe4acb0,0xe04878) array[sz] : &element{array,reg_$0,char}
   (0xe4acb0,0xe048b0) 1 : 1 S8b
   (0xe4acb0,0xe048c0) array[sz] = 1 : 1 S8b
  Ranges of symbol values:
   reg_$0 : { [0, 2147483647] }

This little code works in checkPreStmt() but not in checkLocation():

  SVal sizeV = State->getSVal(VLA->getSizeExpr(), C.getLocationContext());

In checkPreStmt that returns "reg_$0" and in checkLocation() that 
returns "Unknown".

Do you agree that this is the problem? Would it be a good idea to try to keep 
the sz in the ProgramState?


Repository:
  rL LLVM

https://reviews.llvm.org/D30489



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


[PATCH] D30564: [clang-tidy] Format code around applied fixes

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296864: [clang-tidy] Format code around applied fixes 
(authored by alexfh).

Changed prior to commit:
  https://reviews.llvm.org/D30564?vs=90452&id=90453#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30564

Files:
  clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
  clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/trunk/docs/ReleaseNotes.rst
  clang-tools-extra/trunk/docs/clang-tidy/index.rst
  clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp
  
clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp

Index: clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp
@@ -1,4 +1,6 @@
 // RUN: %check_clang_tidy %s misc-unused-using-decls %t
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=none --
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t -- -format-style=llvm --
 namespace a { class A {}; }
 namespace b {
 using a::A;
Index: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
@@ -0,0 +1,33 @@
+// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format-style="{IndentWidth: 3}" --
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+  return false;
+}
+
+void test() {
+  if (cond("if0") /*comment*/) do_something("same-line");
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
+  // CHECK-FIXES: {{^}}   if (cond("if0") /*comment*/) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  do_something("same-line");{{$}}
+  // CHECK-FIXES-NEXT: {{^}}   }{{$}}
+
+  if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES:  {{^}}   if (1) {{{$}}
+  // CHECK-FIXES-NEXT: {{^}}  while (2) {
+  // CHECK-FIXES-NEXT: {{^}} if (3) {
+  // CHECK-FIXES-NEXT: {{^}}for (;;) {
+  // CHECK-FIXES-NEXT: {{^}}   do {
+  // CHECK-FIXES-NEXT: {{^}}  ;
+  // CHECK-FIXES-NEXT: {{^}}   } while (false) /**/; /**/
+  // CHECK-FIXES-NEXT: {{^}}}
+  // CHECK-FIXES-NEXT: {{^}} }
+  // CHECK-FIXES-NEXT: {{^}}  }
+  // CHECK-FIXES-NEXT: {{^}}   }
+}
Index: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
@@ -60,7 +60,7 @@
 prefix add checks with matching names to the
 set, globs with the '-' prefix remove checks
 with matching names from the set of enabled
-checks.  This option's value is appended to the
+checks. This option's value is appended to the
 value of the 'Checks' option in .clang-tidy
 file, if any.
 )"),
@@ -120,12 +120,20 @@
 )"),
cl::init(false), cl::cat(ClangTidyCategory));
 
-static cl::opt FormatStyle("style", cl::desc(R"(
-Fallback style for reformatting after inserting fixes
-if there is no clang-format config file found.
+static cl::opt FormatStyle("format-style", cl::desc(R"(
+Style for formatting code around applied fixes:
+  - 'none' (default) turns off formatting
+  - 'file' (literally 'file', not a placeholder)
+uses .clang-format file in the closest parent
+directory
+  - '{  }' specifies options inline, e.g.
+-format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
+  - 'llvm', 'google', 'webkit', 'mozilla'
+See clang-format documentation for the up-to-date
+information about formatting styles and options.
 )"),
-cl::init("llvm"),
-cl::cat(ClangTidyCategory));
+   cl::init("none"),
+   cl::cat(ClangTidyCategory));
 
 static cl::opt ListChecks("list-checks", cl::desc(R"(
 List all enabled checks and exit. Use with
@@ -189,7 +197,7 @@
 cl::cat(ClangTidyCategory));
 
 static cl::opt Quiet("quiet", cl::desc(R"(
-Run clang-tidy in quiet mode.  This suppresses
+Run

[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

I also think that examples for the flags are good. My use case is that while 
developing/debugging its nice to see a short example for a random flag in the 
documentation pop-up.


https://reviews.llvm.org/D30532



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added inline comments.



Comment at: lib/Format/TokenAnnotator.cpp:2400
+// Returns 'true' if there is an TT_InheritanceComma in the current token list.
+static bool hasMultipleInheritance(const FormatToken &Tok) {
+  for (const FormatToken* nextTok = Tok.Next; nextTok; nextTok = nextTok->Next)

djasper wrote:
> Abpostelnicu wrote:
> > djasper wrote:
> > > I don't think you need this. If you set MustBreakBefore to true for the 
> > > InheritanceCommas and set NoLineBreak to true when adding the 
> > > InheritanceColon on the same line, then clang-format will already do the 
> > > right thing.
> > > 
> > > Fundamentally, this seems to be identical to how we wrap constructor 
> > > initializer lists in Mozilla style. So I think we should also implement 
> > > this the same way (if not even reusing the same implementation).
> > Now that i've seen the behaviour of NoLineBreak thanks for pointing it out 
> > to me, but still correct me if i'm wrong but shouldn't i use: 
> > ``NoLineBreakInOperand``. 
> > My guess is if i use NoLineBreak, than breaking on the current line where 
> > we would have : or , would be prohibited.
> Yes, that would be prohibited and that is intended. Remember that I'd set 
> this after placing the colon on the same line (and I should have written 
> explicitly) as the class name. After that, there must not be any further line 
> breaks.
> 
> But again, I think we should just have the exact same behavior and 
> implementation as for constructor initializer lists.
Yes we should have the exact behaviour like the constructor initialisation 
list, but that one is also controlled by this flag: 
``BreakConstructorInitializersBeforeComma``, that on our coding style is set to 
true.
But still the actual behaviour of initialiser list still breaks before ``'`` 
for only one item.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

Before `'`? Can you give an example?


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added a comment.

In https://reviews.llvm.org/D30487#691506, @djasper wrote:

> Before `'`? Can you give an example?


MY mistake, i wanted to write ``:`


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30565: [analyzer] Terminate analysis on OpenMP code instead of crashing

2017-03-03 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

`git blame` shows that OMP* statements were added to the switch block by 
different authors while OpenMP support in clang was implemented. Looks like 
they were put to "Should not appear" section instead of "Unsupported" by 
mistake.


https://reviews.llvm.org/D30565



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


[clang-tools-extra] r296867 - [clang-tidy] Fix modernize-use-emplace docs

2017-03-03 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Fri Mar  3 06:42:22 2017
New Revision: 296867

URL: http://llvm.org/viewvc/llvm-project?rev=296867&view=rev
Log:
[clang-tidy] Fix modernize-use-emplace docs

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst?rev=296867&r1=296866&r2=296867&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst 
Fri Mar  3 06:42:22 2017
@@ -36,7 +36,7 @@ After:
 
 std::vector> w;
 w.emplace_back(21, 37);
-// This will be fixed to w.push_back(21, 37); in next version
+// This will be fixed to w.emplace_back(21L, 37L); in next version
 w.emplace_back(std::make_pair(21L, 37L);
 
 The other situation is when we pass arguments that will be converted to a type


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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

Do you know whether that is intentional? The style guide isn't really 
conclusive.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added inline comments.



Comment at: lib/Format/TokenAnnotator.cpp:2486
   Style.BreakConstructorInitializersBeforeComma &&
   !Style.ConstructorInitializerAllOnOneLineOrOnePerLine)

At any rate, I think this is what makes single-item ctor init lists be split. 
So everything except for this spot could still share the implementation.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added a comment.

In https://reviews.llvm.org/D30487#691517, @djasper wrote:

> Do you know whether that is intentional? The style guide isn't really 
> conclusive.


Well i'm not sure, because as you said the document is not clear but i think 
that when we have a single initialiser it should be on the same line as the 
ctor declaration. In this way it would be consistent with the style for 
inheritance list. The actual implementation for inheritance list breaking was 
tailored from the `BreakConstructorInitializersBeforeComma` flag.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30569: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme created this revision.
Herald added a subscriber: JDevlieghere.

I've added a test case that (without the fix) triggers the assertion,
which happens when a move happens in an implicitly called conversion
operator.


https://reviews.llvm.org/D30569

Files:
  clang-tidy/misc/UseAfterMoveCheck.cpp
  test/clang-tidy/misc-use-after-move.cpp


Index: test/clang-tidy/misc-use-after-move.cpp
===
--- test/clang-tidy/misc-use-after-move.cpp
+++ test/clang-tidy/misc-use-after-move.cpp
@@ -282,7 +282,7 @@
   S s{std::move(a)};
   a.foo();
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }
 
 void lambdas() {
@@ -397,6 +397,21 @@
 }
 template void movedTypeIsDependentType();
 
+// We handle the case correctly where the move consists of an implicit call
+// to a conversion operator.
+void implicitConversionOperator() {
+  struct Convertible {
+operator A() && { return A(); }
+  };
+  void takeA(A a);
+
+  Convertible convertible;
+  takeA(std::move(convertible));
+  convertible;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'convertible' used after it was 
moved
+  // CHECK-MESSAGES: [[@LINE-3]]:9: note: move occurred here
+}
+
 // Using decltype on an expression is not a use.
 void decltypeIsNotUse() {
   A a;
Index: clang-tidy/misc/UseAfterMoveCheck.cpp
===
--- clang-tidy/misc/UseAfterMoveCheck.cpp
+++ clang-tidy/misc/UseAfterMoveCheck.cpp
@@ -398,7 +398,7 @@
   const auto *MovingCall = Result.Nodes.getNodeAs("moving-call");
   const auto *Arg = Result.Nodes.getNodeAs("arg");
 
-  if (!MovingCall)
+  if (!MovingCall || !MovingCall->getExprLoc().isValid())
 MovingCall = CallMove;
 
   Stmt *FunctionBody = nullptr;


Index: test/clang-tidy/misc-use-after-move.cpp
===
--- test/clang-tidy/misc-use-after-move.cpp
+++ test/clang-tidy/misc-use-after-move.cpp
@@ -282,7 +282,7 @@
   S s{std::move(a)};
   a.foo();
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }
 
 void lambdas() {
@@ -397,6 +397,21 @@
 }
 template void movedTypeIsDependentType();
 
+// We handle the case correctly where the move consists of an implicit call
+// to a conversion operator.
+void implicitConversionOperator() {
+  struct Convertible {
+operator A() && { return A(); }
+  };
+  void takeA(A a);
+
+  Convertible convertible;
+  takeA(std::move(convertible));
+  convertible;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'convertible' used after it was moved
+  // CHECK-MESSAGES: [[@LINE-3]]:9: note: move occurred here
+}
+
 // Using decltype on an expression is not a use.
 void decltypeIsNotUse() {
   A a;
Index: clang-tidy/misc/UseAfterMoveCheck.cpp
===
--- clang-tidy/misc/UseAfterMoveCheck.cpp
+++ clang-tidy/misc/UseAfterMoveCheck.cpp
@@ -398,7 +398,7 @@
   const auto *MovingCall = Result.Nodes.getNodeAs("moving-call");
   const auto *Arg = Result.Nodes.getNodeAs("arg");
 
-  if (!MovingCall)
+  if (!MovingCall || !MovingCall->getExprLoc().isValid())
 MovingCall = CallMove;
 
   Stmt *FunctionBody = nullptr;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30569: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme added inline comments.



Comment at: test/clang-tidy/misc-use-after-move.cpp:285
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }

I've seen this column number flapping back and forth between 6 and 7 before.

This seems to be unrelated to my fix and instead is triggered simply by adding 
the extra test case below; even with my fix present, this reverts back to 7 if 
I remove the test case. Looks like an obscure bug in the way the column number 
is computed...


https://reviews.llvm.org/D30569



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


[PATCH] D30569: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme marked an inline comment as done.
mboehme added inline comments.



Comment at: test/clang-tidy/misc-use-after-move.cpp:285
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }

mboehme wrote:
> I've seen this column number flapping back and forth between 6 and 7 before.
> 
> This seems to be unrelated to my fix and instead is triggered simply by 
> adding the extra test case below; even with my fix present, this reverts back 
> to 7 if I remove the test case. Looks like an obscure bug in the way the 
> column number is computed...
Should be "reverts back to 6"


https://reviews.llvm.org/D30569



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment.

Hm. Unfortunately, this seems to have been implemented to support Webkit style 
and Webkit style is explicit about wanting this 
(https://webkit.org/code-style-guidelines/) :(.

But maybe the solution to that is to add an extra flag like 
AlwaysWrapInitializerList. Really not sure how best to organize this. Any 
thoughts? (I personally care about neither of these styles, so maybe I am not 
the best to judge)

At any rate, to move forward, could you remove the hasMultipleInheritance 
function and instead use the alternative approach discussed?


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


Re: [clang-tools-extra] r296867 - [clang-tidy] Fix modernize-use-emplace docs

2017-03-03 Thread Malcolm Parsons via cfe-commits
On 3 March 2017 at 12:42, Piotr Padlewski via cfe-commits
 wrote:
>  w.emplace_back(std::make_pair(21L, 37L);

Unbalanced ().

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


[PATCH] D30569: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. Thanks!




Comment at: test/clang-tidy/misc-use-after-move.cpp:285
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }

mboehme wrote:
> mboehme wrote:
> > I've seen this column number flapping back and forth between 6 and 7 before.
> > 
> > This seems to be unrelated to my fix and instead is triggered simply by 
> > adding the extra test case below; even with my fix present, this reverts 
> > back to 7 if I remove the test case. Looks like an obscure bug in the way 
> > the column number is computed...
> Should be "reverts back to 6"
Interesting. Are you sure there's nothing else here in play? Like non-ascii 
characters or weird line endings?


https://reviews.llvm.org/D30569



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


[PATCH] D30567: [clang-tidy] Fix treating non-space whitespaces in checks list.

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

What's the practical use of newlines and tab characters in the glob list?


https://reviews.llvm.org/D30567



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


[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu added a comment.

In https://reviews.llvm.org/D30487#691535, @djasper wrote:

> Hm. Unfortunately, this seems to have been implemented to support Webkit 
> style and Webkit style is explicit about wanting this 
> (https://webkit.org/code-style-guidelines/) :(.
>
> But maybe the solution to that is to add an extra flag like 
> AlwaysWrapInitializerList. Really not sure how best to organize this. Any 
> thoughts? (I personally care about neither of these styles, so maybe I am not 
> the best to judge)
>
> At any rate, to move forward, could you remove the hasMultipleInheritance 
> function and instead use the alternative approach discussed?


Sure will drop hasMultipleInheritance and use the variable that you mentioned 
and i won't touch the rest of the patch. After that i will repost it here.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487



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


[PATCH] D30569: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-03 Thread Martin Böhme via Phabricator via cfe-commits
mboehme marked an inline comment as done.
mboehme added inline comments.



Comment at: test/clang-tidy/misc-use-after-move.cpp:285
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }

alexfh wrote:
> mboehme wrote:
> > mboehme wrote:
> > > I've seen this column number flapping back and forth between 6 and 7 
> > > before.
> > > 
> > > This seems to be unrelated to my fix and instead is triggered simply by 
> > > adding the extra test case below; even with my fix present, this reverts 
> > > back to 7 if I remove the test case. Looks like an obscure bug in the way 
> > > the column number is computed...
> > Should be "reverts back to 6"
> Interesting. Are you sure there's nothing else here in play? Like non-ascii 
> characters or weird line endings?
I just checked -- nothing I can find. The file doesn't contain any bytes with 
the high bit set, and there aren't any '\r' either.


https://reviews.llvm.org/D30569



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


[PATCH] D15090: [Static Analyzer] New checker hook: checkInitialState

2017-03-03 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

In the meantime CheckBeginFunction has been implemented separately. I think you 
should "abandon" this revision so it is shown as closed.


https://reviews.llvm.org/D15090



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


[PATCH] D30569: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-03 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added inline comments.



Comment at: test/clang-tidy/misc-use-after-move.cpp:285
   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
-  // CHECK-MESSAGES: [[@LINE-3]]:6: note: move occurred here
+  // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
 }

mboehme wrote:
> alexfh wrote:
> > mboehme wrote:
> > > mboehme wrote:
> > > > I've seen this column number flapping back and forth between 6 and 7 
> > > > before.
> > > > 
> > > > This seems to be unrelated to my fix and instead is triggered simply by 
> > > > adding the extra test case below; even with my fix present, this 
> > > > reverts back to 7 if I remove the test case. Looks like an obscure bug 
> > > > in the way the column number is computed...
> > > Should be "reverts back to 6"
> > Interesting. Are you sure there's nothing else here in play? Like non-ascii 
> > characters or weird line endings?
> I just checked -- nothing I can find. The file doesn't contain any bytes with 
> the high bit set, and there aren't any '\r' either.
Anyway, the patch LG. We can take a look at the column glitch offline.


https://reviews.llvm.org/D30569



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


[PATCH] D30341: [analyzer] clarify error messages about uninitialized function arguments

2017-03-03 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki updated this revision to Diff 90471.
danielmarjamaki added a comment.

Fix review comment


Repository:
  rL LLVM

https://reviews.llvm.org/D30341

Files:
  lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
  test/Analysis/NewDelete-checker-test.cpp
  test/Analysis/diagnostics/undef-value-param.m
  test/Analysis/malloc.m
  test/Analysis/misc-ps-region-store.m
  test/Analysis/misc-ps.m
  test/Analysis/null-deref-ps.c
  test/Analysis/nullptr.cpp
  test/Analysis/uninit-const.c
  test/Analysis/uninit-const.cpp
  test/Analysis/uninit-msg-expr.m
  test/Analysis/uninit-vals-ps.c
  test/Analysis/uninit-vals.cpp

Index: test/Analysis/uninit-vals.cpp
===
--- test/Analysis/uninit-vals.cpp
+++ test/Analysis/uninit-vals.cpp
@@ -27,7 +27,7 @@
   // case with undefined values, too.
   c1.b.a = c2->b.a;
 #else
-  c1.b.a = c2->b.a; // expected-warning{{Function call argument is an uninitialized value}}
+  c1.b.a = c2->b.a; // expected-warning{{1st function call argument is an uninitialized value}}
 #endif
 }
 }
Index: test/Analysis/uninit-vals-ps.c
===
--- test/Analysis/uninit-vals-ps.c
+++ test/Analysis/uninit-vals-ps.c
@@ -14,7 +14,7 @@
 
 int f1_b() {
   int x;
-  return bar(x)+1;  // expected-warning{{Function call argument is an uninitialized value}}
+  return bar(x)+1;  // expected-warning{{1st function call argument is an uninitialized value}}
 }
 
 int f2() {
Index: test/Analysis/uninit-msg-expr.m
===
--- test/Analysis/uninit-msg-expr.m
+++ test/Analysis/uninit-msg-expr.m
@@ -52,5 +52,5 @@
 void f3() {
   NSMutableArray *aArray = [NSArray array];
   NSString *aString;
-  [aArray addObject:aString]; // expected-warning {{Argument in message expression is an uninitialized value}}
+  [aArray addObject:aString]; // expected-warning {{1st argument in message expression is an uninitialized value}}
 }
Index: test/Analysis/uninit-const.cpp
===
--- test/Analysis/uninit-const.cpp
+++ test/Analysis/uninit-const.cpp
@@ -66,8 +66,8 @@
   int &p = t;
   int &s = p;
   int &q = s;  //expected-note {{'q' initialized here}}
-  doStuff6(q); //expected-warning {{Function call argument is an uninitialized value}}
-   //expected-note@-1 {{Function call argument is an uninitialized value}}
+  doStuff6(q); //expected-warning {{1st function call argument is an uninitialized value}}
+   //expected-note@-1 {{1st function call argument is an uninitialized value}}
 }
 
 void doStuff6_3(int& q_, int *ptr_) {}
@@ -78,32 +78,32 @@
   int &p = t;
   int &s = p;
   int &q = s;
-  doStuff6_3(q,ptr); //expected-warning {{Function call argument is an uninitialized value}}
-   //expected-note@-1 {{Function call argument is an uninitialized value}}
+  doStuff6_3(q,ptr); //expected-warning {{2nd function call argument is an uninitialized value}}
+   //expected-note@-1 {{2nd function call argument is an uninitialized value}}
 
 }
 
 void f6(void) {
   int k;   // expected-note {{'k' declared without an initial value}}
-  doStuff6(k); // expected-warning {{Function call argument is an uninitialized value}}
-   // expected-note@-1 {{Function call argument is an uninitialized value}}
+  doStuff6(k); // expected-warning {{1st function call argument is an uninitialized value}}
+   // expected-note@-1 {{1st function call argument is an uninitialized value}}
 
 }
 
 
 
 void f5(void) {
   int t;
   int* tp = &t;// expected-note {{'tp' initialized here}}
-  doStuff_uninit(tp);  // expected-warning {{Function call argument is a pointer to uninitialized value}}
-   // expected-note@-1 {{Function call argument is a pointer to uninitialized value}}
+  doStuff_uninit(tp);  // expected-warning {{1st function call argument is a pointer to uninitialized value}}
+   // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}}
 }
 
 
 void f4(void) {
   int y;// expected-note {{'y' declared without an initial value}}
-  doStuff4(y);  // expected-warning {{Function call argument is an uninitialized value}}
-// expected-note@-1 {{Function call argument is an uninitialized value}}
+  doStuff4(y);  // expected-warning {{1st function call argument is an uninitialized value}}
+// expected-note@-1 {{1st function call argument is an uninitialized value}}
 }
 
 void f3(void) {
@@ -123,6 +123,6 @@
 
 void f_uninit(void) {
   int x;
-  doStuff_uninit(&x);  // expected-warning {{Function call argument is a pointer to uninitialized value}}
-   // expected-note@-1 {{Function call argument is a pointer to uninitialized value}}
+  doStuff_uninit(&x);  // expected-warning {{1s

[PATCH] D30174: [Sema][ObjC] Warn about 'performSelector' calls with selectors that return record types

2017-03-03 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman marked 3 inline comments as done.
arphaman added inline comments.



Comment at: lib/AST/DeclObjC.cpp:987
   unsigned noParams = param_size();
   if (noParams < 1 || noParams > 3)
 family = OMF_None;

ahatanak wrote:
> It seems like this code would set "family" to OMF_None for some of the 
> performSelector functions. For example:
> 
> https://developer.apple.com/reference/objectivec/nsobject/1411637-performselectoronmainthread?language=objc
> https://developer.apple.com/reference/objectivec/nsobject/1417922-performselector?language=objc
> 
> Do those functions belong to the performSelector family of methods?
Good catch! Yes, we should be more inclusive here.



Comment at: lib/Sema/SemaExprObjC.cpp:2280
+ImpliedMethod =
+OPT->getInterfaceDecl()->lookupInstanceMethod(SE->getSelector());
+  } else {

ahatanak wrote:
> Do you need to check if OPT->getInterfaceDecl() returns null here? What 
> happens if OPT is id?
You're right, my mistake.



Comment at: lib/Sema/SemaExprObjC.cpp:2499
   checkCocoaAPI(*this, Result);
+if (Method)
+  checkFoundationAPI(*this, SelLoc, Method, makeArrayRef(Args, NumArgs),

ahatanak wrote:
> I'm not sure why checkFoundationAPI has to be called inside the else 
> statement. Was there a reason you didn't or couldn't move it outside?
We should check for 'super' calls as wells, you're right.


Repository:
  rL LLVM

https://reviews.llvm.org/D30174



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


[PATCH] D30174: [Sema][ObjC] Warn about 'performSelector' calls with selectors that return record types

2017-03-03 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 90473.
arphaman marked 3 inline comments as done.
arphaman added a comment.

The updated diff:

- Warns for vector types.
- Addresses Akira's comments.


Repository:
  rL LLVM

https://reviews.llvm.org/D30174

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/DeclObjC.cpp
  lib/Basic/IdentifierTable.cpp
  lib/Sema/SemaExprObjC.cpp
  test/SemaObjC/unsafe-perform-selector.m

Index: test/SemaObjC/unsafe-perform-selector.m
===
--- /dev/null
+++ test/SemaObjC/unsafe-perform-selector.m
@@ -0,0 +1,127 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
+// rdar://12056271
+
+@class Thread;
+
+__attribute__((objc_root_class))
+@interface NSObject
+
+- (id)performSelector:(SEL)sel;
+- (void)performSelectorInBackground:(SEL)sel withObject:(id)arg;
+- (void)performSelectorOnMainThread:(SEL)sel;
+
+- (void)performSelectorOnMainThread:(SEL)aSelector
+   onThread:(Thread *)thread
+ withObject:(id)arg
+  waitUntilDone:(int)wait
+  modes:(id *)array;
+
+@end
+
+typedef struct { int x; int y; int width; int height; } Rectangle;
+
+struct Struct { Rectangle r; };
+
+typedef union { int x; float f; } Union;
+
+@interface Base : NSObject
+
+- (struct Struct)returnsStruct2; // expected-note {{method 'returnsStruct2' that returns 'struct Struct' declared here}}
+- (Union)returnsId;
+
+@end
+
+@protocol IP
+
+- (Union)returnsUnion; // expected-note 2 {{method 'returnsUnion' that returns 'Union' declared here}}
+
+@end
+
+typedef __attribute__((__ext_vector_type__(3))) float float3;
+typedef int int4 __attribute__ ((vector_size (16)));
+
+@interface I : Base
+
+- (Rectangle)returnsStruct; // expected-note 4 {{method 'returnsStruct' that returns 'Rectangle' declared here}}
+- (id)returnsId; // shadows base 'returnsId'
+- (int)returnsInt;
+- (I *)returnPtr;
+- (float3)returnsExtVector; // expected-note {{method 'returnsExtVector' that returns 'float3' (vector of 3 'float' values) declared here}}
+- (int4)returnsVector; // expected-note {{method 'returnsVector' that returns 'int4' (vector of 4 'int' values) declared here}}
+
++ (Rectangle)returnsStructClass; // expected-note 2 {{method 'returnsStructClass' that returns 'Rectangle' declared here}}
++ (void)returnsUnion; // Not really
+
+@end
+
+void foo(I *i) {
+  [i performSelector: @selector(returnsStruct)]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+  [i performSelectorInBackground: @selector(returnsStruct) withObject:0]; // expected-warning {{'performSelectorInBackground:withObject:' is incompatible with selectors that return a struct type}}
+  [i performSelector: ((@selector(returnsUnion)))]; // expected-warning {{'performSelector:' is incompatible with selectors that return a union type}}
+  [i performSelectorOnMainThread: @selector(returnsStruct2)]; // expected-warning {{'performSelectorOnMainThread:' is incompatible with selectors that return a struct type}}
+  [I performSelector: (@selector(returnsStructClass))]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+
+  [i performSelector: @selector(returnsId)];
+  [i performSelector: @selector(returnsInt)];
+  [i performSelector: @selector(returnsPtr)];
+  [I performSelector: @selector(returnsUnion)]; // No warning expected
+
+  id obj = i;
+  [obj performSelector: @selector(returnsId)];
+  [obj performSelector: @selector(returnsStruct)];
+}
+
+@interface SubClass: I
+
+@end
+
+@interface SubClass ()
+- (struct Struct)returnsSubStructExt; // expected-note {{method 'returnsSubStructExt' that returns 'struct Struct' declared here}} expected-note {{method 'returnsSubStructExt' declared here}}
+@end
+
+@implementation SubClass // expected-warning {{method definition for 'returnsSubStructExt' not found}}
+
+- (struct Struct)returnsSubStructImpl { // expected-note {{method 'returnsSubStructImpl' that returns 'struct Struct' declared here}}
+  struct Struct Result;
+  return Result;
+}
+
+- (void)checkPrivateCalls {
+  [self performSelector: @selector(returnsSubStructExt)]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+  [self performSelector: @selector(returnsSubStructImpl)]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+}
+
+- (void)checkSuperCalls {
+  [super performSelector: @selector(returnsStruct)]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+  [super performSelectorInBackground: @selector(returnsUnion) withObject: self]; // expected-warning {{'performSelectorInBackground:withObject:' is incompatible with selectors that return a union type}}
+  [super performSelector: @selector(returnsId)];
+}
+
++ (struct Struct)r

[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu updated this revision to Diff 90475.

Repository:
  rL LLVM

https://reviews.llvm.org/D30487

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/ContinuationIndenter.cpp
  lib/Format/Format.cpp
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -1029,6 +1029,17 @@
   verifyFormat("class ::A::B {};");
 }
 
+TEST_F(FormatTest, BreakInhertianceBeforeColonAndComma) {
+  FormatStyle StyleWithInheritanceBreak = getLLVMStyle();
+  LocalStyle.BreakInhertianceBeforeColonAndComma = true;
+
+  verifyFormat("class MyClass : public X {}", LocalStyle);
+  verifyFormat("class MyClass\n"
+   ": public X\n"
+   ", public Y {}",
+   StyleWithInheritanceBreak);
+}
+
 TEST_F(FormatTest, FormatsVariableDeclarationsAfterStructOrClass) {
   verifyFormat("class A {\n} a, b;");
   verifyFormat("struct A {\n} a, b;");
@@ -8491,6 +8502,7 @@
   CHECK_PARSE_BOOL(BreakBeforeTernaryOperators);
   CHECK_PARSE_BOOL(BreakConstructorInitializersBeforeComma);
   CHECK_PARSE_BOOL(BreakStringLiterals);
+  CHECK_PARSE_BOOL(BreakInhertianceBeforeColonAndComma)
   CHECK_PARSE_BOOL(ConstructorInitializerAllOnOneLineOrOnePerLine);
   CHECK_PARSE_BOOL(DerivePointerAlignment);
   CHECK_PARSE_BOOL_FIELD(DerivePointerAlignment, "DerivePointerBinding");
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -676,6 +676,8 @@
 case tok::comma:
   if (Contexts.back().InCtorInitializer)
 Tok->Type = TT_CtorInitializerComma;
+  else if (Contexts.back().InInhertianceList)
+Tok->Type = TT_InheritanceComma;
   else if (Contexts.back().FirstStartOfName &&
(Contexts.size() == 1 || Line.startsWith(tok::kw_for))) {
 Contexts.back().FirstStartOfName->PartOfMultiVariableDeclStmt = true;
@@ -945,6 +947,7 @@
 bool CanBeExpression = true;
 bool InTemplateArgument = false;
 bool InCtorInitializer = false;
+bool InInhertianceList = false;
 bool CaretFound = false;
 bool IsForEachMacro = false;
   };
@@ -1004,6 +1007,9 @@
Current.Previous->is(TT_CtorInitializerColon)) {
   Contexts.back().IsExpression = true;
   Contexts.back().InCtorInitializer = true;
+} else if (Current.Previous &&
+   Current.Previous->is(TT_InheritanceColon)) {
+  Contexts.back().InInhertianceList = true;
 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) {
   for (FormatToken *Previous = Current.Previous;
Previous && Previous->isOneOf(tok::star, tok::amp);
@@ -2473,6 +2479,10 @@
   Style.BreakConstructorInitializersBeforeComma &&
   !Style.ConstructorInitializerAllOnOneLineOrOnePerLine)
 return true;
+  // Break only if we have multiple inheritance.
+  if (Style.BreakInhertianceBeforeColonAndComma &&
+  Right.is(TT_InheritanceComma))
+   return true;
   if (Right.is(tok::string_literal) && Right.TokenText.startswith("R\""))
 // Raw string literals are special wrt. line breaks. The author has made a
 // deliberate choice and might have aligned the contents of the string
@@ -2652,6 +2662,12 @@
   if (Right.is(TT_CtorInitializerComma) &&
   Style.BreakConstructorInitializersBeforeComma)
 return true;
+  if (Left.is(TT_InheritanceComma) &&
+  Style.BreakInhertianceBeforeColonAndComma)
+return false;
+  if (Right.is(TT_InheritanceComma) &&
+  Style.BreakInhertianceBeforeColonAndComma)
+return true;
   if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
   (Left.is(tok::less) && Right.is(tok::less)))
 return false;
Index: lib/Format/FormatToken.h
===
--- lib/Format/FormatToken.h
+++ lib/Format/FormatToken.h
@@ -48,6 +48,7 @@
   TYPE(FunctionTypeLParen) \
   TYPE(ImplicitStringLiteral) \
   TYPE(InheritanceColon) \
+  TYPE(InheritanceComma) \
   TYPE(InlineASMBrace) \
   TYPE(InlineASMColon) \
   TYPE(JavaAnnotation) \
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -521,6 +521,7 @@
  false, false, false, false, false};
   LLVMStyle.BreakAfterJavaFieldAnnotations = false;
   LLVMStyle.BreakConstructorInitializersBeforeComma = false;
+  LLVMStyle.BreakInhertianceBeforeColonAndComma = false;
   LLVMStyle.BreakStringLiterals = true;
   LLVMStyle.ColumnLimit = 80;
   LLVMStyle.CommentPragmas = "^ IWYU pragma:";
@@ -674,6 +675,7 @@
   MozillaStyle.BinPackArguments = false;
   MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla;
   MozillaStyle.BreakConstructorInitia

[PATCH] D30487: ClangFormat - Add option to break before inheritance separation operator in class declaration

2017-03-03 Thread Andi via Phabricator via cfe-commits
Abpostelnicu updated this revision to Diff 90480.
Abpostelnicu added a comment.

corrected some format issues.


Repository:
  rL LLVM

https://reviews.llvm.org/D30487

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/ContinuationIndenter.cpp
  lib/Format/Format.cpp
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -1029,6 +1029,17 @@
   verifyFormat("class ::A::B {};");
 }
 
+TEST_F(FormatTest, BreakInhertianceBeforeColonAndComma) {
+  FormatStyle StyleWithInheritanceBreak = getLLVMStyle();
+  LocalStyle.BreakInhertianceBeforeColonAndComma = true;
+
+  verifyFormat("class MyClass : public X {}", LocalStyle);
+  verifyFormat("class MyClass\n"
+   ": public X\n"
+   ", public Y {}",
+   StyleWithInheritanceBreak);
+}
+
 TEST_F(FormatTest, FormatsVariableDeclarationsAfterStructOrClass) {
   verifyFormat("class A {\n} a, b;");
   verifyFormat("struct A {\n} a, b;");
@@ -8491,6 +8502,7 @@
   CHECK_PARSE_BOOL(BreakBeforeTernaryOperators);
   CHECK_PARSE_BOOL(BreakConstructorInitializersBeforeComma);
   CHECK_PARSE_BOOL(BreakStringLiterals);
+  CHECK_PARSE_BOOL(BreakInhertianceBeforeColonAndComma)
   CHECK_PARSE_BOOL(ConstructorInitializerAllOnOneLineOrOnePerLine);
   CHECK_PARSE_BOOL(DerivePointerAlignment);
   CHECK_PARSE_BOOL_FIELD(DerivePointerAlignment, "DerivePointerBinding");
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -676,6 +676,8 @@
 case tok::comma:
   if (Contexts.back().InCtorInitializer)
 Tok->Type = TT_CtorInitializerComma;
+  else if (Contexts.back().InInhertianceList)
+Tok->Type = TT_InheritanceComma;
   else if (Contexts.back().FirstStartOfName &&
(Contexts.size() == 1 || Line.startsWith(tok::kw_for))) {
 Contexts.back().FirstStartOfName->PartOfMultiVariableDeclStmt = true;
@@ -945,6 +947,7 @@
 bool CanBeExpression = true;
 bool InTemplateArgument = false;
 bool InCtorInitializer = false;
+bool InInhertianceList = false;
 bool CaretFound = false;
 bool IsForEachMacro = false;
   };
@@ -1004,6 +1007,9 @@
Current.Previous->is(TT_CtorInitializerColon)) {
   Contexts.back().IsExpression = true;
   Contexts.back().InCtorInitializer = true;
+} else if (Current.Previous &&
+   Current.Previous->is(TT_InheritanceColon)) {
+  Contexts.back().InInhertianceList = true;
 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) {
   for (FormatToken *Previous = Current.Previous;
Previous && Previous->isOneOf(tok::star, tok::amp);
@@ -2473,6 +2479,10 @@
   Style.BreakConstructorInitializersBeforeComma &&
   !Style.ConstructorInitializerAllOnOneLineOrOnePerLine)
 return true;
+  // Break only if we have multiple inheritance.
+  if (Style.BreakInhertianceBeforeColonAndComma &&
+  Right.is(TT_InheritanceComma))
+   return true;
   if (Right.is(tok::string_literal) && Right.TokenText.startswith("R\""))
 // Raw string literals are special wrt. line breaks. The author has made a
 // deliberate choice and might have aligned the contents of the string
@@ -2652,6 +2662,12 @@
   if (Right.is(TT_CtorInitializerComma) &&
   Style.BreakConstructorInitializersBeforeComma)
 return true;
+  if (Left.is(TT_InheritanceComma) &&
+  Style.BreakInhertianceBeforeColonAndComma)
+return false;
+  if (Right.is(TT_InheritanceComma) &&
+  Style.BreakInhertianceBeforeColonAndComma)
+return true;
   if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
   (Left.is(tok::less) && Right.is(tok::less)))
 return false;
Index: lib/Format/FormatToken.h
===
--- lib/Format/FormatToken.h
+++ lib/Format/FormatToken.h
@@ -48,6 +48,7 @@
   TYPE(FunctionTypeLParen) \
   TYPE(ImplicitStringLiteral) \
   TYPE(InheritanceColon) \
+  TYPE(InheritanceComma) \
   TYPE(InlineASMBrace) \
   TYPE(InlineASMColon) \
   TYPE(JavaAnnotation) \
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -521,6 +521,7 @@
  false, false, false, false, false};
   LLVMStyle.BreakAfterJavaFieldAnnotations = false;
   LLVMStyle.BreakConstructorInitializersBeforeComma = false;
+  LLVMStyle.BreakInhertianceBeforeColonAndComma = false;
   LLVMStyle.BreakStringLiterals = true;
   LLVMStyle.ColumnLimit = 80;
   LLVMStyle.CommentPragmas = "^ IWYU pragma:";
@@ -674,6 +675,7 @@
   MozillaStyle.BinPackArguments = false;
   MozillaStyle.BreakBeforeBraces = F

[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru updated this revision to Diff 90482.
sylvestre.ledru added a comment.

With the changes requested by Daniel. This is much better indeed!


https://reviews.llvm.org/D30532

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h

Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -100,6 +100,19 @@
 
   /// \brief If ``true``, aligns escaped newlines as far left as possible.
   /// Otherwise puts them into the right-most column.
+  /// \code
+  ///   true:
+  ///   #define A   \
+  /// int ; \
+  /// int b;\
+  /// int dd;
+  ///
+  ///   false:
+  ///   #define A  \
+  /// int ;\
+  /// int b;   \
+  /// int dd;
+  /// \endcode
   bool AlignEscapedNewlinesLeft;
 
   /// \brief If ``true``, horizontally align operands of binary and ternary
@@ -114,6 +127,11 @@
   bool AlignOperands;
 
   /// \brief If ``true``, aligns trailing comments.
+  /// \code
+  ///   true:   false:
+  ///   int a; // My comment a  vs. int a; // My comment a
+  ///   int b = 2; // comment  bint b = 2; // comment about b
+  /// \endcode
   bool AlignTrailingComments;
 
   /// \brief Allow putting all parameters of a function declaration onto
@@ -126,6 +144,16 @@
   bool AllowShortBlocksOnASingleLine;
 
   /// \brief If ``true``, short case labels will be contracted to a single line.
+  /// \code
+  ///   true:   false:
+  ///   switch (a) {vs. switch (a) {
+  ///   case 1: x = 1; break;   case 1:
+  ///   case 2: return;   x = 1;
+  ///   } break;
+  ///   case 2:
+  /// return;
+  ///   }
+  /// \endcode
   bool AllowShortCaseLabelsOnASingleLine;
 
   /// \brief Different styles for merging short functions containing at most one
@@ -192,10 +220,21 @@
   /// in a file look more consistent. Thus, it will only take effect if wrapping
   /// the string at that point leads to it being indented
   /// ``ContinuationIndentWidth`` spaces from the start of the line.
+  /// \code
+  ///true:  false:
+  /// = vs.  = ""
+  ///"""";
+  ///"";
+  /// \endcode
   bool AlwaysBreakBeforeMultilineStrings;
 
   /// \brief If ``true``, always break after the ``template<...>`` of a template
   /// declaration.
+  /// \code
+  ///true:  false:
+  ///template   vs. template  class C {};
+  ///class C {};
+  /// \endcode
   bool AlwaysBreakTemplateDeclarations;
 
   /// \brief If ``false``, a function call's arguments will either be all on the
@@ -284,6 +323,13 @@
 
   /// \brief Always break constructor initializers before commas and align
   /// the commas with the colon.
+  /// \code
+  ///true:  false:
+  ///SomeClass::Constructor()  vs.  SomeClass::Constructor() : a(a),
+  ///: a(a)b(b),
+  ///, b(b)c(c) {}
+  ///, c(c) {}
+  /// \endcode
   bool BreakConstructorInitializersBeforeComma;
 
   /// \brief Break after each annotation on a field in Java files.
@@ -351,6 +397,12 @@
 
   /// \brief If ``true``, clang-format adds missing namespace end comments and
   /// fixes invalid existing ones.
+  /// \code
+  ///true:  false:
+  ///namespace a {  vs. namespace a {
+  ///foo(); foo();
+  ///} // namespace a;  }
+  /// \endcode
   bool FixNamespaceComments;
 
   /// \brief A vector of macros that should be interpreted as foreach loops
@@ -557,9 +609,18 @@
   bool SpaceAfterCStyleCast;
 
   /// \brief If \c true, a space will be inserted after the 'template' keyword.
+  /// \code
+  ///true:  false:
+  ///template  void foo(); vs. template void foo();
+  /// \endcode
   bool SpaceAfterTemplateKeyword;
 
   /// \brief If ``false``, spaces will be removed before assignment operators.
+  /// \code
+  ///true:  false:
+  ///int a = 5; vs. int a=5;
+  ///a += 42a+=42;
+  /// \endcode
   bool SpaceBeforeAssignme

[PATCH] D30492: [clang-format] Allow all but the first string literal in a sequence to be put on a newline

2017-03-03 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir abandoned this revision.
krasimir added a comment.

This patch is superseded by https://reviews.llvm.org/D30575.


https://reviews.llvm.org/D30492



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


[PATCH] D27753: [analyzer] alpha.security.DirtyScalar Checker

2017-03-03 Thread Zoltán Gera via Phabricator via cfe-commits
gerazo marked an inline comment as done.
gerazo added a comment.

Hmm... I am thinking on this issue for a week now...

I've played with the idea of implementing cleansing rules in 
GenericTaintChecker. It would be elegant but unfortunately, I have to think 
they are not general. Cleansing of a string (because it has no terminating null 
at the end) is very different from integral type cleansing. A signed value has 
to be lower bound checked as well, an unsigned only gets upper bound treatment. 
It also turns out that the type itself also can't give enough information about 
the needed cleansing rule. A number used for array indexing can be properly 
bound checked on the region extents while a simple number can only be checked 
in a way that any upper bound checking was done at all on it... All this leads 
to the need of several types of taintednesses (string taintedness, array 
taintedness, general bound check taintedness) because the cleansing can only 
take down one type of taintedness at a time. That would be the only way for a 
checker to be able to access that the taintedness type specific to the checker 
is still there or was already cleansed by the central logic. For me it shows 
that cleansing rules belong to specific checkers and cannot be efficiently 
generalized even in case of a single int type.

About the ArrayBoundCheckerV2: I agree that no redundant checks should be done 
system-wide. I would also extend ArrayBoundCheckV2 or put array checking into a 
separate checker. Currently that checker and the one implemented here do not 
give the same results. ArrayBoundCheckerV2 knows more about the array but is 
not willing to give a warning without knowing region information for the array. 
The easiest way would be to use one checker's code from the other and find out 
if the other is active and would already give a warning anyway... but I 
understand that it is against current architectural policies.


https://reviews.llvm.org/D27753



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


[PATCH] D30532: Add examples to clang-format configuration

2017-03-03 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru updated this revision to Diff 90486.
sylvestre.ledru added a comment.

updated => affected 
+ align the vs


https://reviews.llvm.org/D30532

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h

Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -100,6 +100,19 @@
 
   /// \brief If ``true``, aligns escaped newlines as far left as possible.
   /// Otherwise puts them into the right-most column.
+  /// \code
+  ///   true:
+  ///   #define A   \
+  /// int ; \
+  /// int b;\
+  /// int dd;
+  ///
+  ///   false:
+  ///   #define A  \
+  /// int ;\
+  /// int b;   \
+  /// int dd;
+  /// \endcode
   bool AlignEscapedNewlinesLeft;
 
   /// \brief If ``true``, horizontally align operands of binary and ternary
@@ -114,6 +127,11 @@
   bool AlignOperands;
 
   /// \brief If ``true``, aligns trailing comments.
+  /// \code
+  ///   true:   false:
+  ///   int a; // My comment a  vs. int a; // My comment a
+  ///   int b = 2; // comment  bint b = 2; // comment about b
+  /// \endcode
   bool AlignTrailingComments;
 
   /// \brief Allow putting all parameters of a function declaration onto
@@ -126,6 +144,16 @@
   bool AllowShortBlocksOnASingleLine;
 
   /// \brief If ``true``, short case labels will be contracted to a single line.
+  /// \code
+  ///   true:   false:
+  ///   switch (a) {vs. switch (a) {
+  ///   case 1: x = 1; break;   case 1:
+  ///   case 2: return;   x = 1;
+  ///   } break;
+  ///   case 2:
+  /// return;
+  ///   }
+  /// \endcode
   bool AllowShortCaseLabelsOnASingleLine;
 
   /// \brief Different styles for merging short functions containing at most one
@@ -192,10 +220,21 @@
   /// in a file look more consistent. Thus, it will only take effect if wrapping
   /// the string at that point leads to it being indented
   /// ``ContinuationIndentWidth`` spaces from the start of the line.
+  /// \code
+  ///true:  false:
+  /// = vs.  = ""
+  ///"""";
+  ///"";
+  /// \endcode
   bool AlwaysBreakBeforeMultilineStrings;
 
   /// \brief If ``true``, always break after the ``template<...>`` of a template
   /// declaration.
+  /// \code
+  ///true:  false:
+  ///template   vs. template  class C {};
+  ///class C {};
+  /// \endcode
   bool AlwaysBreakTemplateDeclarations;
 
   /// \brief If ``false``, a function call's arguments will either be all on the
@@ -284,6 +323,13 @@
 
   /// \brief Always break constructor initializers before commas and align
   /// the commas with the colon.
+  /// \code
+  ///true:  false:
+  ///SomeClass::Constructor()   vs. SomeClass::Constructor() : a(a),
+  ///: a(a)   b(b),
+  ///, b(b)   c(c) {}
+  ///, c(c) {}
+  /// \endcode
   bool BreakConstructorInitializersBeforeComma;
 
   /// \brief Break after each annotation on a field in Java files.
@@ -351,6 +397,12 @@
 
   /// \brief If ``true``, clang-format adds missing namespace end comments and
   /// fixes invalid existing ones.
+  /// \code
+  ///true:  false:
+  ///namespace a {  vs. namespace a {
+  ///foo(); foo();
+  ///} // namespace a;  }
+  /// \endcode
   bool FixNamespaceComments;
 
   /// \brief A vector of macros that should be interpreted as foreach loops
@@ -557,9 +609,18 @@
   bool SpaceAfterCStyleCast;
 
   /// \brief If \c true, a space will be inserted after the 'template' keyword.
+  /// \code
+  ///true:  false:
+  ///template  void foo(); vs. template void foo();
+  /// \endcode
   bool SpaceAfterTemplateKeyword;
 
   /// \brief If ``false``, spaces will be removed before assignment operators.
+  /// \code
+  ///true:  false:
+  ///int a = 5; vs. int a=5;
+  ///a += 42a+=42;
+  /// \endcode
   bool SpaceBeforeAssignmentOperators;
 
   /// \brief Dif

[PATCH] D30373: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

2017-03-03 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment.

Looks great. Thanks!!


https://reviews.llvm.org/D30373



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


[PATCH] D30565: [analyzer] Terminate analysis on OpenMP code instead of crashing

2017-03-03 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

Thanks for fixing this! It looks like this is tracked by PR31835. 
https://bugs.llvm.org//show_bug.cgi?id=31835


https://reviews.llvm.org/D30565



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


[PATCH] D30582: [Driver] Restructure handling of -ffast-math and similar options

2017-03-03 Thread John Brawn via Phabricator via cfe-commits
john.brawn created this revision.

The way -ffast-math and the various related options to tweak floating-point 
handling are handled is inflexible and rather confusing. This patch 
restructures things so that we go through the options adjusting our idea of 
what's enabled as we go, instead of trying to figure each individual thing out 
by working backwards from the end, as this makes the behaviour of each 
individual option more clear.

Doing it this way also means we get gcc-compatible behaviour for when the 
__FAST_MATH__ and __FINITE_MATH_ONLY__ macros are defined, as they should 
depend on the final set of features that are enabled and not just on 
-ffast-math and -ffinite-math-only specifically.


Repository:
  rL LLVM

https://reviews.llvm.org/D30582

Files:
  lib/Driver/Tools.cpp
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -148,20 +148,35 @@
 //
 // One umbrella flag is *really* weird and also changes the semantics of the
 // program by adding a special preprocessor macro. Check that the frontend flag
-// modeling this semantic change is provided. Also check that the semantic
-// impact remains even if every optimization is disabled.
+// modeling this semantic change is provided. Also check that the flag is not
+// present if any of the optimization is disabled.
 // RUN: %clang -### -ffast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
-// RUN: %clang -### -ffast-math -fno-finite-math-only \
-// RUN: -fno-unsafe-math-optimizations -fmath-errno -c %s 2>&1 \
+// RUN: %clang -### -funsafe-math-optimizations -ffinite-math-only \
+// RUN: -fno-math-errno -ffp-contract=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// RUN: %clang -### -fhonor-infinities -fhonor-nans -fno-math-errno \
+// RUN: -fassociative-math -freciprocal-math -fno-signed-zeros \
+// RUN: -fno-trapping-math -ffp-contract=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST-MATH %s
 // CHECK-FAST-MATH: "-cc1"
 // CHECK-FAST-MATH: "-ffast-math"
+// CHECK-FAST-MATH: "-ffinite-math-only"
 //
 // RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=on -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// RUN: %clang -### -ffast-math -ffp-contract=off -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
 // CHECK-NO-FAST-MATH: "-cc1"
 // CHECK-NO-FAST-MATH-NOT: "-ffast-math"
 //
@@ -179,6 +194,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
 // CHECK-NO-NO-INFS: "-cc1"
 // CHECK-NO-NO-INFS-NOT: "-menable-no-infs"
+// CHECK-NO-NO-INFS-NOT: "-ffinite-math-only"
 // CHECK-NO-NO-INFS: "-o"
 //
 // RUN: %clang -### -fno-honor-nans -fhonor-nans -c %s 2>&1 \
@@ -193,6 +209,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
 // CHECK-NO-NO-NANS: "-cc1"
 // CHECK-NO-NO-NANS-NOT: "-menable-no-nans"
+// CHECK-NO-NO-NANS-NOT: "-ffinite-math-only"
 // CHECK-NO-NO-NANS: "-o"
 //
 // RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3302,98 +3302,129 @@
   if (Args.hasArg(options::OPT_fsplit_stack))
 CmdArgs.push_back("-split-stacks");
 
-  // If -Ofast is the optimization level, then -ffast-math should be enabled.
-  // This alias option is being used to simplify the getLastArg logic.
-  OptSpecifier FastMathAliasOption =
-  OFastEnabled ? options::OPT_Ofast : options::OPT_ffast_math;
-
   // Handle various floating point optimization flags, mapping them to the
-  // appropriate LLVM code generation flags. The pattern for all of these is to
-  // default off the codegen optimizations, and if any flag enables them and no
-  // flag disables them after the flag enabling them, enable the codegen
-  // optimization. This is complicated by several "umbrella" flags.
-  if (Arg *A = Args.getLastArg(
-  options::OPT_ffast_math, FastMathAliasOption,
-  options::OPT_fno_fast_math, options::OPT_ffinite_math_only,
-  options::OPT_fno_finite_math_only, options::OPT_fhonor_infinities,
-  options::OPT_fno_honor_infinities))
-if (A->getOption().getID() != options::

r296884 - [Analyzer] Terminate analysis on OpenMP code instead of assertion crash

2017-03-03 Thread Aleksei Sidorin via cfe-commits
Author: a.sidorin
Date: Fri Mar  3 10:58:53 2017
New Revision: 296884

URL: http://llvm.org/viewvc/llvm-project?rev=296884&view=rev
Log:
[Analyzer] Terminate analysis on OpenMP code instead of assertion crash

* ExprEngine assumes that OpenMP statements should never appear in CFG.
  However, current CFG doesn't know anything about OpenMP and passes
  such statements as CFG nodes causing "UNREACHABLE executed!" crashes.
  Since there is no OpenMP implementation in ExprEngine or CFG,
  we stop the analysis on OpenMP statements to avoid crashes.

This fixes PR31835.

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

Added:
cfe/trunk/test/Analysis/openmp-unsupported.c
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=296884&r1=296883&r2=296884&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Fri Mar  3 10:58:53 2017
@@ -777,7 +777,7 @@ void ExprEngine::Visit(const Stmt *S, Ex
   assert(!isa(S) || S == cast(S)->IgnoreParens());
 
   switch (S->getStmtClass()) {
-// C++ and ARC stuff we don't support yet.
+// C++, OpenMP and ARC stuff we don't support yet.
 case Expr::ObjCIndirectCopyRestoreExprClass:
 case Stmt::CXXDependentScopeMemberExprClass:
 case Stmt::CXXInheritedCtorInitExprClass:
@@ -805,36 +805,7 @@ void ExprEngine::Visit(const Stmt *S, Ex
 case Stmt::SEHTryStmtClass:
 case Stmt::SEHExceptStmtClass:
 case Stmt::SEHLeaveStmtClass:
-case Stmt::SEHFinallyStmtClass: {
-  const ExplodedNode *node = Bldr.generateSink(S, Pred, Pred->getState());
-  Engine.addAbortedBlock(node, currBldrCtx->getBlock());
-  break;
-}
-
-case Stmt::ParenExprClass:
-  llvm_unreachable("ParenExprs already handled.");
-case Stmt::GenericSelectionExprClass:
-  llvm_unreachable("GenericSelectionExprs already handled.");
-// Cases that should never be evaluated simply because they shouldn't
-// appear in the CFG.
-case Stmt::BreakStmtClass:
-case Stmt::CaseStmtClass:
-case Stmt::CompoundStmtClass:
-case Stmt::ContinueStmtClass:
-case Stmt::CXXForRangeStmtClass:
-case Stmt::DefaultStmtClass:
-case Stmt::DoStmtClass:
-case Stmt::ForStmtClass:
-case Stmt::GotoStmtClass:
-case Stmt::IfStmtClass:
-case Stmt::IndirectGotoStmtClass:
-case Stmt::LabelStmtClass:
-case Stmt::NoStmtClass:
-case Stmt::NullStmtClass:
-case Stmt::SwitchStmtClass:
-case Stmt::WhileStmtClass:
-case Expr::MSDependentExistsStmtClass:
-case Stmt::CapturedStmtClass:
+case Stmt::SEHFinallyStmtClass:
 case Stmt::OMPParallelDirectiveClass:
 case Stmt::OMPSimdDirectiveClass:
 case Stmt::OMPForDirectiveClass:
@@ -882,6 +853,36 @@ void ExprEngine::Visit(const Stmt *S, Ex
 case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
 case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
 case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:
+case Stmt::CapturedStmtClass:
+{
+  const ExplodedNode *node = Bldr.generateSink(S, Pred, Pred->getState());
+  Engine.addAbortedBlock(node, currBldrCtx->getBlock());
+  break;
+}
+
+case Stmt::ParenExprClass:
+  llvm_unreachable("ParenExprs already handled.");
+case Stmt::GenericSelectionExprClass:
+  llvm_unreachable("GenericSelectionExprs already handled.");
+// Cases that should never be evaluated simply because they shouldn't
+// appear in the CFG.
+case Stmt::BreakStmtClass:
+case Stmt::CaseStmtClass:
+case Stmt::CompoundStmtClass:
+case Stmt::ContinueStmtClass:
+case Stmt::CXXForRangeStmtClass:
+case Stmt::DefaultStmtClass:
+case Stmt::DoStmtClass:
+case Stmt::ForStmtClass:
+case Stmt::GotoStmtClass:
+case Stmt::IfStmtClass:
+case Stmt::IndirectGotoStmtClass:
+case Stmt::LabelStmtClass:
+case Stmt::NoStmtClass:
+case Stmt::NullStmtClass:
+case Stmt::SwitchStmtClass:
+case Stmt::WhileStmtClass:
+case Expr::MSDependentExistsStmtClass:
   llvm_unreachable("Stmt should not be in analyzer evaluation loop");
 
 case Stmt::ObjCSubscriptRefExprClass:

Added: cfe/trunk/test/Analysis/openmp-unsupported.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/openmp-unsupported.c?rev=296884&view=auto
==
--- cfe/trunk/test/Analysis/openmp-unsupported.c (added)
+++ cfe/trunk/test/Analysis/openmp-unsupported.c Fri Mar  3 10:58:53 2017
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze 
-analyzer-checker=core.builtin -fopenmp -verify %s
+// expected-no-diagnostics
+
+void openmp_parallel_crash_test() {
+#

[PATCH] D30565: [analyzer] Terminate analysis on OpenMP code instead of crashing

2017-03-03 Thread Aleksei Sidorin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296884: [Analyzer] Terminate analysis on OpenMP code instead 
of assertion crash (authored by a.sidorin).

Changed prior to commit:
  https://reviews.llvm.org/D30565?vs=90441&id=90499#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30565

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
  cfe/trunk/test/Analysis/openmp-unsupported.c


Index: cfe/trunk/test/Analysis/openmp-unsupported.c
===
--- cfe/trunk/test/Analysis/openmp-unsupported.c
+++ cfe/trunk/test/Analysis/openmp-unsupported.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze 
-analyzer-checker=core.builtin -fopenmp -verify %s
+// expected-no-diagnostics
+
+void openmp_parallel_crash_test() {
+#pragma omp parallel
+  ;
+}
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -777,7 +777,7 @@
   assert(!isa(S) || S == cast(S)->IgnoreParens());
 
   switch (S->getStmtClass()) {
-// C++ and ARC stuff we don't support yet.
+// C++, OpenMP and ARC stuff we don't support yet.
 case Expr::ObjCIndirectCopyRestoreExprClass:
 case Stmt::CXXDependentScopeMemberExprClass:
 case Stmt::CXXInheritedCtorInitExprClass:
@@ -805,36 +805,7 @@
 case Stmt::SEHTryStmtClass:
 case Stmt::SEHExceptStmtClass:
 case Stmt::SEHLeaveStmtClass:
-case Stmt::SEHFinallyStmtClass: {
-  const ExplodedNode *node = Bldr.generateSink(S, Pred, Pred->getState());
-  Engine.addAbortedBlock(node, currBldrCtx->getBlock());
-  break;
-}
-
-case Stmt::ParenExprClass:
-  llvm_unreachable("ParenExprs already handled.");
-case Stmt::GenericSelectionExprClass:
-  llvm_unreachable("GenericSelectionExprs already handled.");
-// Cases that should never be evaluated simply because they shouldn't
-// appear in the CFG.
-case Stmt::BreakStmtClass:
-case Stmt::CaseStmtClass:
-case Stmt::CompoundStmtClass:
-case Stmt::ContinueStmtClass:
-case Stmt::CXXForRangeStmtClass:
-case Stmt::DefaultStmtClass:
-case Stmt::DoStmtClass:
-case Stmt::ForStmtClass:
-case Stmt::GotoStmtClass:
-case Stmt::IfStmtClass:
-case Stmt::IndirectGotoStmtClass:
-case Stmt::LabelStmtClass:
-case Stmt::NoStmtClass:
-case Stmt::NullStmtClass:
-case Stmt::SwitchStmtClass:
-case Stmt::WhileStmtClass:
-case Expr::MSDependentExistsStmtClass:
-case Stmt::CapturedStmtClass:
+case Stmt::SEHFinallyStmtClass:
 case Stmt::OMPParallelDirectiveClass:
 case Stmt::OMPSimdDirectiveClass:
 case Stmt::OMPForDirectiveClass:
@@ -882,6 +853,36 @@
 case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
 case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
 case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:
+case Stmt::CapturedStmtClass:
+{
+  const ExplodedNode *node = Bldr.generateSink(S, Pred, Pred->getState());
+  Engine.addAbortedBlock(node, currBldrCtx->getBlock());
+  break;
+}
+
+case Stmt::ParenExprClass:
+  llvm_unreachable("ParenExprs already handled.");
+case Stmt::GenericSelectionExprClass:
+  llvm_unreachable("GenericSelectionExprs already handled.");
+// Cases that should never be evaluated simply because they shouldn't
+// appear in the CFG.
+case Stmt::BreakStmtClass:
+case Stmt::CaseStmtClass:
+case Stmt::CompoundStmtClass:
+case Stmt::ContinueStmtClass:
+case Stmt::CXXForRangeStmtClass:
+case Stmt::DefaultStmtClass:
+case Stmt::DoStmtClass:
+case Stmt::ForStmtClass:
+case Stmt::GotoStmtClass:
+case Stmt::IfStmtClass:
+case Stmt::IndirectGotoStmtClass:
+case Stmt::LabelStmtClass:
+case Stmt::NoStmtClass:
+case Stmt::NullStmtClass:
+case Stmt::SwitchStmtClass:
+case Stmt::WhileStmtClass:
+case Expr::MSDependentExistsStmtClass:
   llvm_unreachable("Stmt should not be in analyzer evaluation loop");
 
 case Stmt::ObjCSubscriptRefExprClass:


Index: cfe/trunk/test/Analysis/openmp-unsupported.c
===
--- cfe/trunk/test/Analysis/openmp-unsupported.c
+++ cfe/trunk/test/Analysis/openmp-unsupported.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.builtin -fopenmp -verify %s
+// expected-no-diagnostics
+
+void openmp_parallel_crash_test() {
+#pragma omp parallel
+  ;
+}
Index: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -777,7 +777,7 @@
   assert(!isa(S) || S == cast(S)->Ignore

[PATCH] D30565: [analyzer] Terminate analysis on OpenMP code instead of crashing

2017-03-03 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Thank you Devin. Should we submit this to 4.0? I guess there are not many users 
of both CSA and OpenMP but PR you pointed is already the second report about 
this issue I see.


Repository:
  rL LLVM

https://reviews.llvm.org/D30565



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


[clang-tools-extra] r296888 - [clang-tidy] Yet another docs fixes

2017-03-03 Thread Piotr Padlewski via cfe-commits
Author: prazek
Date: Fri Mar  3 11:16:11 2017
New Revision: 296888

URL: http://llvm.org/viewvc/llvm-project?rev=296888&view=rev
Log:
[clang-tidy] Yet another docs fixes

Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst?rev=296888&r1=296887&r2=296888&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst 
Fri Mar  3 11:16:11 2017
@@ -69,7 +69,7 @@ exception safe. In this case the calls o
 
 This is because replacing it with ``emplace_back`` could cause a leak of this
 pointer if ``emplace_back`` would throw exception before emplacement (e.g. not
-enough memory to add new element).
+enough memory to add a new element).
 
 For more info read item 42 - "Consider emplacement instead of insertion." of
 Scott Meyers "Effective Modern C++".
@@ -79,14 +79,15 @@ The default smart pointers that are cons
 other classes use the :option:`SmartPointers` option.
 
 
-Check also fires if any argument of constructor call would be:
+Check also doesn't fire if any argument of the constructor call would be:
 
-  - bitfield (bitfields can't bind to rvalue/universal reference)
+  - a bit-field (bit-fields can't bind to rvalue/universal reference)
 
-  - ``new`` expression (to avoid leak) or if the argument would be converted 
via
-derived-to-base cast.
+  - a ``new`` expression (to avoid leak)
 
-This check requires C++11 of higher to run.
+  - if the argument would be converted via derived-to-base cast.
+
+This check requires C++11 or higher to run.
 
 Options
 ---


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


[libcxx] r296889 - Fix libc++ test to pass in C++03 mode

2017-03-03 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Mar  3 11:24:29 2017
New Revision: 296889

URL: http://llvm.org/viewvc/llvm-project?rev=296889&view=rev
Log:
Fix libc++ test to pass in C++03 mode

Was hitting: "error: scalar initializer cannot be empty"

Modified:
libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp?rev=296889&r1=296888&r2=296889&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp Fri Mar  3 
11:24:29 2017
@@ -107,7 +107,7 @@
 int main()
 {
 FILE* fp = 0;
-fpos_t fpos = {};
+fpos_t fpos = fpos_t();
 size_t s = 0;
 char* cp = 0;
 char arr[] = {'a', 'b'};

Modified: 
libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp?rev=296889&r1=296888&r2=296889&view=diff
==
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp 
(original)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp Fri 
Mar  3 11:24:29 2017
@@ -89,7 +89,7 @@
 int main()
 {
 std::FILE* fp = 0;
-std::fpos_t fpos = {};
+std::fpos_t fpos = std::fpos_t();
 std::size_t s = 0;
 char* cp = 0;
 std::va_list va;


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


[PATCH] D28297: [StaticAnalyzer] Fix crash in CastToStructChecker

2017-03-03 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

Thanks. looks good.


https://reviews.llvm.org/D28297



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


[PATCH] D30565: [analyzer] Terminate analysis on OpenMP code instead of crashing

2017-03-03 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment.

@zaks.anna: What do you think? Should we try to get this into clang 4.0?


Repository:
  rL LLVM

https://reviews.llvm.org/D30565



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


[PATCH] D30551: [AMDGPU] Add builtin functions readlane ds_permute mov_dpp

2017-03-03 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 90520.
yaxunl marked 3 inline comments as done.
yaxunl added a comment.

remove redundant code.
make mov_dpp target builtin.


https://reviews.llvm.org/D30551

Files:
  include/clang/Basic/BuiltinsAMDGPU.def
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGenOpenCL/builtins-amdgcn-vi.cl
  test/CodeGenOpenCL/builtins-amdgcn.cl
  test/SemaOpenCL/builtins-amdgcn-error.cl

Index: test/SemaOpenCL/builtins-amdgcn-error.cl
===
--- test/SemaOpenCL/builtins-amdgcn-error.cl
+++ test/SemaOpenCL/builtins-amdgcn-error.cl
@@ -1,16 +1,17 @@
 // REQUIRES: amdgpu-registered-target
 // RUN: %clang_cc1 -triple amdgcn-- -target-cpu tahiti -verify -S -o - %s
 
-// FIXME: We only get one error if the functions are the other order in the
-// file.
-
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 typedef unsigned long ulong;
 typedef unsigned int uint;
 
-ulong test_s_memrealtime()
+// To get all errors for feature checking we need to put them in one function
+// since Clang will stop codegen for the next function if it finds error during
+// codegen of the previous function.
+void test_target_builtin(global int* out, int a)
 {
-  return __builtin_amdgcn_s_memrealtime(); // expected-error {{'__builtin_amdgcn_s_memrealtime' needs target feature s-memrealtime}}
+  __builtin_amdgcn_s_memrealtime(); // expected-error {{'__builtin_amdgcn_s_memrealtime' needs target feature s-memrealtime}}
+  *out = __builtin_amdgcn_mov_dpp(a, 0, 0, 0, false); // expected-error {{'__builtin_amdgcn_mov_dpp' needs target feature dpp}}
 }
 
 void test_s_sleep(int x)
@@ -92,3 +93,12 @@
 {
   *out = __builtin_amdgcn_s_getreg(a); // expected-error {{argument to '__builtin_amdgcn_s_getreg' must be a constant integer}}
 }
+
+void test_mov_dpp2(global int* out, int a, int b, int c, int d, bool e)
+{
+  *out = __builtin_amdgcn_mov_dpp(a, b, 0, 0, false); // expected-error {{argument to '__builtin_amdgcn_mov_dpp' must be a constant integer}}
+  *out = __builtin_amdgcn_mov_dpp(a, 0, c, 0, false); // expected-error {{argument to '__builtin_amdgcn_mov_dpp' must be a constant integer}}
+  *out = __builtin_amdgcn_mov_dpp(a, 0, 0, d, false); // expected-error {{argument to '__builtin_amdgcn_mov_dpp' must be a constant integer}}
+  *out = __builtin_amdgcn_mov_dpp(a, 0, 0, 0, e); // expected-error {{argument to '__builtin_amdgcn_mov_dpp' must be a constant integer}}
+}
+
Index: test/CodeGenOpenCL/builtins-amdgcn.cl
===
--- test/CodeGenOpenCL/builtins-amdgcn.cl
+++ test/CodeGenOpenCL/builtins-amdgcn.cl
@@ -235,6 +235,34 @@
   *out = __builtin_amdgcn_ds_swizzle(a, 32);
 }
 
+// CHECK-LABEL: @test_ds_permute
+// CHECK: call i32 @llvm.amdgcn.ds.permute(i32 %a, i32 %b)
+void test_ds_permute(global int* out, int a, int b)
+{
+  out[0] = __builtin_amdgcn_ds_permute(a, b);
+}
+
+// CHECK-LABEL: @test_ds_bpermute
+// CHECK: call i32 @llvm.amdgcn.ds.bpermute(i32 %a, i32 %b)
+void test_ds_bpermute(global int* out, int a, int b)
+{
+  *out = __builtin_amdgcn_ds_bpermute(a, b);
+}
+
+// CHECK-LABEL: @test_readfirstlane
+// CHECK: call i32 @llvm.amdgcn.readfirstlane(i32 %a)
+void test_readfirstlane(global int* out, int a)
+{
+  *out = __builtin_amdgcn_readfirstlane(a);
+}
+
+// CHECK-LABEL: @test_readlane
+// CHECK: call i32 @llvm.amdgcn.readlane(i32 %a, i32 %b)
+void test_readlane(global int* out, int a, int b)
+{
+  *out = __builtin_amdgcn_readlane(a, b);
+}
+
 // CHECK-LABEL: @test_fcmp_f32
 // CHECK: call i64 @llvm.amdgcn.fcmp.f32(float %a, float %b, i32 5)
 void test_fcmp_f32(global ulong* out, float a, float b)
Index: test/CodeGenOpenCL/builtins-amdgcn-vi.cl
===
--- test/CodeGenOpenCL/builtins-amdgcn-vi.cl
+++ test/CodeGenOpenCL/builtins-amdgcn-vi.cl
@@ -81,3 +81,11 @@
 {
   *out = __builtin_amdgcn_s_memrealtime();
 }
+
+// CHECK-LABEL: @test_mov_dpp
+// CHECK: call i32 @llvm.amdgcn.mov.dpp.i32(i32 %src, i32 0, i32 0, i32 0, i1 false)
+void test_mov_dpp(global int* out, int src)
+{
+  *out = __builtin_amdgcn_mov_dpp(src, 0, 0, 0, false);
+}
+
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -8388,6 +8388,14 @@
 
   case AMDGPU::BI__builtin_amdgcn_ds_swizzle:
 return emitBinaryBuiltin(*this, E, Intrinsic::amdgcn_ds_swizzle);
+  case AMDGPU::BI__builtin_amdgcn_mov_dpp: {
+llvm::SmallVector Args;
+for (unsigned I = 0; I != 5; ++I)
+  Args.push_back(EmitScalarExpr(E->getArg(I)));
+Value *F = CGM.getIntrinsic(Intrinsic::amdgcn_mov_dpp,
+Args[0]->getType());
+return Builder.CreateCall(F, Args);
+  }
   case AMDGPU::BI__builtin_amdgcn_div_fixup:
   case AMDGPU::BI__builtin_amdgcn_div_fixupf:
   case AMDGPU::BI__builtin_amdgcn_div_fixuph:
Index: lib/Basic/Targets.cpp
===

Re: [libcxx] r296840 - Work around test failure on 32 bit OS X

2017-03-03 Thread Adrian Prantl via cfe-commits
Does that mean there is a bug in libcxx that should be documented somewhere?

-- adrian
> On Mar 2, 2017, at 3:18 PM, Eric Fiselier via cfe-commits 
>  wrote:
> 
> Author: ericwf
> Date: Thu Mar  2 17:18:40 2017
> New Revision: 296840
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=296840&view=rev
> Log:
> Work around test failure on 32 bit OS X
> 
> Modified:
>
> libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
> 
> Modified: 
> libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp?rev=296840&r1=296839&r2=296840&view=diff
> ==
> --- 
> libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
>  (original)
> +++ 
> libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
>  Thu Mar  2 17:18:40 2017
> @@ -29,16 +29,22 @@ test(S s, typename S::size_type pos1, ty
>  SV sv, typename S::size_type pos2, typename S::size_type n2,
>  S expected)
> {
> +typedef typename S::size_type SizeT;
> static_assert((!std::is_same::value), "");
> -const typename S::size_type old_size = s.size();
> +
> +// String and string_view may not always share the same size type,
> +// but both types should have the same size (ex. int vs long)
> +static_assert(sizeof(SizeT) == sizeof(typename SV::size_type), "");
> +
> +const SizeT old_size = s.size();
> S s0 = s;
> if (pos1 <= old_size && pos2 <= sv.size())
> {
> s.replace(pos1, n1, sv, pos2, n2);
> LIBCPP_ASSERT(s.__invariants());
> assert(s == expected);
> -typename S::size_type xlen = std::min(n1, old_size - pos1);
> -typename S::size_type rlen = std::min(n2, sv.size() - pos2);
> +SizeT xlen = std::min(n1, old_size - pos1);
> +SizeT rlen = std::min(n2, sv.size() - pos2);
> assert(s.size() == old_size - xlen + rlen);
> }
> #ifndef TEST_HAS_NO_EXCEPTIONS
> @@ -64,16 +70,17 @@ test_npos(S s, typename S::size_type pos
>   SV sv, typename S::size_type pos2,
>   S expected)
> {
> +typedef typename S::size_type SizeT;
> static_assert((!std::is_same::value), "");
> -const typename S::size_type old_size = s.size();
> +const SizeT old_size = s.size();
> S s0 = s;
> if (pos1 <= old_size && pos2 <= sv.size())
> {
> s.replace(pos1, n1, sv, pos2);
> LIBCPP_ASSERT(s.__invariants());
> assert(s == expected);
> -typename S::size_type xlen = std::min(n1, old_size - pos1);
> -typename S::size_type rlen = std::min(S::npos, sv.size() - pos2);
> +SizeT xlen = std::min(n1, old_size - pos1);
> +SizeT rlen = std::min(S::npos, sv.size() - pos2);
> assert(s.size() == old_size - xlen + rlen);
> }
> #ifndef TEST_HAS_NO_EXCEPTIONS
> 
> 
> ___
> 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] D27387: [libc++] Add a key function for bad_function_call

2017-03-03 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai updated this revision to Diff 90524.
smeenai added a comment.

Address comments


https://reviews.llvm.org/D27387

Files:
  include/__config
  include/functional
  lib/CMakeLists.txt
  src/functional.cpp


Index: src/functional.cpp
===
--- /dev/null
+++ src/functional.cpp
@@ -0,0 +1,26 @@
+//===--- functional.cpp 
---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "functional"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+bad_function_call::~bad_function_call() _NOEXCEPT
+{
+}
+
+const char*
+bad_function_call::what() const _NOEXCEPT
+{
+return "std::bad_function_call";
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -178,7 +178,7 @@
 split_list(LIBCXX_COMPILE_FLAGS)
 split_list(LIBCXX_LINK_FLAGS)
 
-# Add a object library that contains the compiled source files.
+# Add an object library that contains the compiled source files.
 add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} 
${LIBCXX_HEADERS})
 if(WIN32 AND NOT MINGW)
   target_compile_definitions(cxx_objects
Index: include/functional
===
--- include/functional
+++ include/functional
@@ -1388,6 +1388,12 @@
 class _LIBCPP_EXCEPTION_ABI bad_function_call
 : public exception
 {
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+public:
+virtual ~bad_function_call() _NOEXCEPT;
+
+virtual const char* what() const _NOEXCEPT;
+#endif
 };
 
 _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -59,6 +59,10 @@
 // `pointer_safety` and `get_pointer_safety()` will no longer be available
 // in C++03.
 #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
+// Define a key function for `bad_function_call` in the library, to centralize
+// its vtable and typeinfo to libc++ rather than having all other libraries
+// using that class define their own copies.
+#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
 #elif _LIBCPP_ABI_VERSION == 1
 #if !defined(_WIN32)
 // Enable compiling copies of now inline methods into the dylib to support


Index: src/functional.cpp
===
--- /dev/null
+++ src/functional.cpp
@@ -0,0 +1,26 @@
+//===--- functional.cpp ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "functional"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+bad_function_call::~bad_function_call() _NOEXCEPT
+{
+}
+
+const char*
+bad_function_call::what() const _NOEXCEPT
+{
+return "std::bad_function_call";
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -178,7 +178,7 @@
 split_list(LIBCXX_COMPILE_FLAGS)
 split_list(LIBCXX_LINK_FLAGS)
 
-# Add a object library that contains the compiled source files.
+# Add an object library that contains the compiled source files.
 add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
 if(WIN32 AND NOT MINGW)
   target_compile_definitions(cxx_objects
Index: include/functional
===
--- include/functional
+++ include/functional
@@ -1388,6 +1388,12 @@
 class _LIBCPP_EXCEPTION_ABI bad_function_call
 : public exception
 {
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+public:
+virtual ~bad_function_call() _NOEXCEPT;
+
+virtual const char* what() const _NOEXCEPT;
+#endif
 };
 
 _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -59,6 +59,10 @@
 // `pointer_safety` and `get_pointer_safety()` will no longer be available
 // in C++03.
 #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
+// Define a key function for `bad_function_call` in the library, to centralize
+// its vtable and typeinfo to libc++ rather than having all other libraries
+// using that class define their own copies.
+#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FU

[PATCH] D30589: [ExprInspectionChecker] Improve usability for C

2017-03-03 Thread Keno Fischer via Phabricator via cfe-commits
loladiro created this revision.

Some of the magic functions take arguments of arbitrary type. However,
for semantic correctness, the compiler still requires a declaration
of these functions with the correct type. Since C does not have
argument-type-overloaded function, this made those functions hard to
use in C code. Improve this situation by allowing arbitrary suffixes
in the affected magic functions' names, thus allowing the user to
create different declarations for different types.


https://reviews.llvm.org/D30589

Files:
  docs/analyzer/DebugChecks.rst
  lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
  test/Analysis/explain-svals.c


Index: test/Analysis/explain-svals.c
===
--- /dev/null
+++ test/Analysis/explain-svals.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze 
-analyzer-checker=core.builtin,debug.ExprInspection,unix.cstring -verify %s
+
+struct S {
+  int z;
+};
+
+void clang_analyzer_explain_int(int);
+void clang_analyzer_explain_voidp(void *);
+void clang_analyzer_explain_S(struct S);
+
+int glob;
+
+void test_1(int param, void *ptr) {
+  clang_analyzer_explain_voidp(&glob); // expected-warning-re^pointer to 
global variable 'glob'$
+  clang_analyzer_explain_int(param);   // expected-warning-re^argument 
'param'$
+  clang_analyzer_explain_voidp(ptr);   // expected-warning-re^argument 
'ptr'$
+  if (param == 42)
+clang_analyzer_explain_int(param); // expected-warning-re^signed 
32-bit integer '42'$
+}
+
+void test_2(struct S s) {
+  clang_analyzer_explain_S(s);  //expected-warning-re^lazily frozen 
compound value of parameter 's'$
+  clang_analyzer_explain_voidp(&s); // expected-warning-re^pointer to 
parameter 's'$
+  clang_analyzer_explain_int(s.z);  // expected-warning-re^initial value 
of field 'z' of parameter 's'$
+}
Index: lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
@@ -72,8 +72,8 @@
   &ExprInspectionChecker::analyzerWarnIfReached)
 .Case("clang_analyzer_warnOnDeadSymbol",
   &ExprInspectionChecker::analyzerWarnOnDeadSymbol)
-.Case("clang_analyzer_explain", &ExprInspectionChecker::analyzerExplain)
-.Case("clang_analyzer_dump", &ExprInspectionChecker::analyzerDump)
+.StartsWith("clang_analyzer_explain", 
&ExprInspectionChecker::analyzerExplain)
+.StartsWith("clang_analyzer_dump", &ExprInspectionChecker::analyzerDump)
 .Case("clang_analyzer_getExtent", 
&ExprInspectionChecker::analyzerGetExtent)
 .Case("clang_analyzer_printState",
   &ExprInspectionChecker::analyzerPrintState)
Index: docs/analyzer/DebugChecks.rst
===
--- docs/analyzer/DebugChecks.rst
+++ docs/analyzer/DebugChecks.rst
@@ -178,15 +178,21 @@
   This function explains the value of its argument in a human-readable manner
   in the warning message. You can make as many overrides of its prototype
   in the test code as necessary to explain various integral, pointer,
-  or even record-type values.
+  or even record-type values. To simplify usage in C code (where overloading
+  the function declaration is not allowed), you may append an arbitrary suffix
+  to the function name, without affecting functionality.
 
   Example usage::
 
 void clang_analyzer_explain(int);
 void clang_analyzer_explain(void *);
 
+// Useful in C code
+void clang_analyzer_explain_int(int);
+
 void foo(int param, void *ptr) {
   clang_analyzer_explain(param); // expected-warning{{argument 'param'}}
+  clang_analyzer_explain_int(param); // expected-warning{{argument 
'param'}}
   if (!ptr)
 clang_analyzer_explain(ptr); // expected-warning{{memory address '0'}}
 }


Index: test/Analysis/explain-svals.c
===
--- /dev/null
+++ test/Analysis/explain-svals.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.builtin,debug.ExprInspection,unix.cstring -verify %s
+
+struct S {
+  int z;
+};
+
+void clang_analyzer_explain_int(int);
+void clang_analyzer_explain_voidp(void *);
+void clang_analyzer_explain_S(struct S);
+
+int glob;
+
+void test_1(int param, void *ptr) {
+  clang_analyzer_explain_voidp(&glob); // expected-warning-re^pointer to global variable 'glob'$
+  clang_analyzer_explain_int(param);   // expected-warning-re^argument 'param'$
+  clang_analyzer_explain_voidp(ptr);   // expected-warning-re^argument 'ptr'$
+  if (param == 42)
+clang_analyzer_explain_int(param); // expected-warning-re^signed 32-bit integer '42'$
+}
+
+void test_2(struct S s) {
+  clang_analyzer_explain_S(s);  //expected-warning-re{

[PATCH] D30590: Don't assume cleanup emission preserves dominance in expr evaluation

2017-03-03 Thread Reid Kleckner via Phabricator via cfe-commits
rnk created this revision.

Because of the existence branches out of GNU statement expressions, it
is possible that emitting cleanups for a full expression may cause the
new insertion point to not be dominated by the result of the inner
expression. Consider this example:

  struct Foo { Foo(); ~Foo(); int x; };
  int g(Foo, int);
  int f(bool cond) {
int n = g(Foo(), ({ if (cond) return 0; 42; }));
return n;
  }

Before this change, result of the call to 'g' did not dominate its use
in the store to 'n'. The early return exit from the statement expression
branches to a shared cleanup block, which ends in a switch between the
fallthrough destination (the assignment to 'n') or the function exit
block.

This change solves the problem by spilling and reloading expression
evaluation results when any of the active cleanups have branches.

I audited the other call sites of enterFullExpression, and they don't
appear to keep and Values live across the site of the cleanup, except in
ARC code. I wasn't able to create a test case for ARC that exhibits this
problem, though.


https://reviews.llvm.org/D30590

Files:
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenCXX/stmtexpr.cpp

Index: test/CodeGenCXX/stmtexpr.cpp
===
--- test/CodeGenCXX/stmtexpr.cpp
+++ test/CodeGenCXX/stmtexpr.cpp
@@ -80,3 +80,64 @@
   y = ({ A a(1); if (b) goto G; a.i; });
   G: return y;
 }
+
+// When we emit a full expression with cleanups that contains branches out of
+// the full expression, the result of the inner expression (the call to
+// call_with_cleanups in this case) may not dominate the fallthrough destination
+// of the shared cleanup block.
+//
+// In this case the CFG will be a sequence of two diamonds, but the only
+// dynamically possible execution paths are both left hand branches and both
+// right hand branches. The first diamond LHS will call bar, and the second
+// diamond LHS will assign the result to v, but the call to bar does not
+// dominate the assignment.
+int bar(A, int);
+extern "C" int full_expr_branch(bool b) {
+  int v = bar(A(1), ({ if (b) return 42; 13; }));
+  return v;
+}
+
+// CHECK-LABEL: define i32 @full_expr_branch({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: %[[v:[^ ]*]] = call i32 @_Z3bar1Ai({{.*}})
+// CHECK-NEXT: store i32 %[[v]], i32* %[[tmp:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v:[^ ]*]] = load i32, i32* %[[tmp]]
+// CHECK-NEXT: store i32 %[[v]], i32* %v
+
+// We handle ExprWithCleanups for complex evaluation type separately, and it had
+// the same bug.
+_Complex float bar_complex(A, int);
+extern "C" int full_expr_branch_complex(bool b) {
+  _Complex float v = bar_complex(A(1), ({ if (b) return 42; 13; }));
+  return v;
+}
+
+// CHECK-LABEL: define i32 @full_expr_branch_complex({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: call {{.*}} @_Z11bar_complex1Ai({{.*}})
+// CHECK: store float %{{.*}}, float* %[[tmp1:[^, ]*]]
+// CHECK: store float %{{.*}}, float* %[[tmp2:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v1:[^ ]*]] = load float, float* %[[tmp1]]
+// CHECK: %[[v2:[^ ]*]] = load float, float* %[[tmp2]]
+// CHECK: store float %[[v1]], float* %v.realp
+// CHECK: store float %[[v2]], float* %v.imagp
+
+// No need to spill when the expression result is a constant, constants don't
+// have dominance problems.
+extern "C" int full_expr_branch_constant(bool b) {
+  int v = (A(1), (void)({ if (b) return 42; 0; }), 13);
+  return v;
+}
+
+// CHECK-LABEL: define i32 @full_expr_branch_constant({{.*}})
+// CHECK: store i32 13, i32* %v
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -536,6 +536,7 @@
   protected:
 bool PerformCleanup;
   private:
+SmallVector ValuesToReload;
 
 RunCleanupsScope(const RunCleanupsScope &) = delete;
 void operator=(const RunCleanupsScope &) = delete;
@@ -555,28 +556,33 @@
   CGF.DidCallStackSave = false;
 }
 
-/// \brief Exit this cleanup scope, emitting any accumulated
-/// cleanups.
+/// \brief Exit this cleanup scope, emitting any accumulated cleanups.
 ~RunCleanupsScope() {
-  if (PerformCleanup) {
-CGF.DidCallStackSave = OldDidCallStackSave;
-CGF.PopCleanupBlocks(CleanupStackDepth,
- LifetimeExtendedCleanupStackSize);
-  }
+  if (PerformCleanup)
+ForceCleanup();
 }
 
 /// \brief Determine whether this scope requires any cleanups.
 bool requiresCleanups() const {
   return CGF.EHStack.stable_begin() != CleanupStackDepth;
 }
 
+/// Ens

[PATCH] D28543: Eliminates uninitialized warning for volatile variables.

2017-03-03 Thread CJ DiMeglio via Phabricator via cfe-commits
lethalantidote added a comment.

Is there any subgroup that one could suggest for this warning to fall under?


https://reviews.llvm.org/D28543



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


[PATCH] D30591: Introduce the feature "linux" for tests only for linux

2017-03-03 Thread Taewook Oh via Phabricator via cfe-commits
twoh created this revision.

This feature is needed to re-enable https://reviews.llvm.org/rL293004, which 
resembles gcc's behavior in
finding the input file name from a preprocessed source. The patch has been
reverted in https://reviews.llvm.org/rL293032, because the test checks FILE 
symbol of ELF file, which is
not valid on OSes not using ELF. With the patch, we can add "REQUIRES: linux"
to the tests on ELF files, or tests that require any linux-specific features.


https://reviews.llvm.org/D30591

Files:
  test/lit.cfg


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -427,6 +427,10 @@
 if not re.match(r'.*-(cygwin)$', config.target_triple):
 config.available_features.add('clang-driver')
 
+# Set on linux environment
+if re.match(r'.*-linux', config.target_triple):
+config.available_features.add("linux")
+
 # [PR18856] Depends to remove opened file. On win32, a file could be removed
 # only if all handles were closed.
 if platform.system() not in ['Windows']:


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -427,6 +427,10 @@
 if not re.match(r'.*-(cygwin)$', config.target_triple):
 config.available_features.add('clang-driver')
 
+# Set on linux environment
+if re.match(r'.*-linux', config.target_triple):
+config.available_features.add("linux")
+
 # [PR18856] Depends to remove opened file. On win32, a file could be removed
 # only if all handles were closed.
 if platform.system() not in ['Windows']:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30015: Add arch-specific directory to search path

2017-03-03 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.

Looks good with a minor comment about a comment in the test case.




Comment at: lib/Driver/Tools.cpp:2007-2009
+  // In the cross-compilation case, arch-specific library path is likely
+  // unavailable at runtime.
+  if (TC.isCrossCompiling()) return;

This seems like a really poor heuristic for "will the user ship this binary to 
another computer that doesn't have clang installed in the same location", but 
the convenience of not having to add clang's unpredictably named resource 
library directory to LD_LIBRARY_PATH seems worth baking in a possibly-wrong 
rpath.



Comment at: test/Driver/arch-specific-libdir-rpath.c:9
+//
+// Add LIBPATH but no RPATH for -fsanitize=address
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \

This comment seems wrong, with -shared-libasan we add it to rpath. It's really, 
only add rpath if we are using shared libraries.


https://reviews.llvm.org/D30015



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


[PATCH] D30239: enable -flto=thin in clang-cl

2017-03-03 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

Do you guys think that maybe -flto should imply -fuse-ld=lld, or is that too 
much magic?


Repository:
  rL LLVM

https://reviews.llvm.org/D30239



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


[PATCH] D30592: [clang-tidy] Fix diag message for catch-by-value

2017-03-03 Thread Florian Gross via Phabricator via cfe-commits
fgross created this revision.
Herald added a subscriber: JDevlieghere.

  catch (std::exception ex)
  {
  }

Was flagged with "catch handler catches a pointer value".


https://reviews.llvm.org/D30592

Files:
  clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp


Index: clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
===
--- clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
+++ clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
@@ -131,22 +131,24 @@
 
 void ThrowByValueCatchByReferenceCheck::diagnoseCatchLocations(
 const CXXCatchStmt *catchStmt, ASTContext &context) {
-  const char *diagMsgCatchReference = "catch handler catches a pointer value; "
-  "should throw a non-pointer value and "
-  "catch by reference instead";
   if (!catchStmt)
 return;
   auto caughtType = catchStmt->getCaughtType();
   if (caughtType.isNull())
 return;
   auto *varDecl = catchStmt->getExceptionDecl();
   if (const auto *PT = caughtType.getCanonicalType()->getAs()) {
+const char *diagMsgCatchReference = "catch handler catches a pointer 
value; "
+"should throw a non-pointer value and "
+"catch by reference instead";
 // We do not diagnose when catching pointer to strings since we also allow
 // throwing string literals.
 if (!PT->getPointeeType()->isAnyCharacterType())
   diag(varDecl->getLocStart(), diagMsgCatchReference);
   } else if (!caughtType->isReferenceType()) {
-// If it's not a pointer and not a reference then it must be thrown "by
+const char *diagMsgCatchReference = "catch handler catches by value; "
+"should catch by reference instead";
+// If it's not a pointer and not a reference then it must be caught "by
 // value". In this case we should emit a diagnosis message unless the type
 // is trivial.
 if (!caughtType.isTrivialType(context))


Index: clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
===
--- clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
+++ clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
@@ -131,22 +131,24 @@
 
 void ThrowByValueCatchByReferenceCheck::diagnoseCatchLocations(
 const CXXCatchStmt *catchStmt, ASTContext &context) {
-  const char *diagMsgCatchReference = "catch handler catches a pointer value; "
-  "should throw a non-pointer value and "
-  "catch by reference instead";
   if (!catchStmt)
 return;
   auto caughtType = catchStmt->getCaughtType();
   if (caughtType.isNull())
 return;
   auto *varDecl = catchStmt->getExceptionDecl();
   if (const auto *PT = caughtType.getCanonicalType()->getAs()) {
+const char *diagMsgCatchReference = "catch handler catches a pointer value; "
+"should throw a non-pointer value and "
+"catch by reference instead";
 // We do not diagnose when catching pointer to strings since we also allow
 // throwing string literals.
 if (!PT->getPointeeType()->isAnyCharacterType())
   diag(varDecl->getLocStart(), diagMsgCatchReference);
   } else if (!caughtType->isReferenceType()) {
-// If it's not a pointer and not a reference then it must be thrown "by
+const char *diagMsgCatchReference = "catch handler catches by value; "
+"should catch by reference instead";
+// If it's not a pointer and not a reference then it must be caught "by
 // value". In this case we should emit a diagnosis message unless the type
 // is trivial.
 if (!caughtType.isTrivialType(context))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30015: Add arch-specific directory to search path

2017-03-03 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 90532.
pirama edited the summary of this revision.
pirama added a comment.

Fixed comment in test and added a test for -fsanitize=address without 
-shared-libasan.


https://reviews.llvm.org/D30015

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  lib/Driver/Tools.cpp
  test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep
  test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep
  test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep
  test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep
  test/Driver/arch-specific-libdir-rpath.c
  test/Driver/arch-specific-libdir.c
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -392,6 +392,10 @@
 if config.host_triple == config.target_triple:
 config.available_features.add("native")
 
+# Test Driver/arch-specific-libdir-rpath.c is restricted to x86_64-linux
+if re.match(r'^x86_64.*-linux', config.target_triple):
+config.available_features.add("x86_64-linux")
+
 # Case-insensitive file system
 def is_filesystem_case_insensitive():
 handle, path = tempfile.mkstemp(prefix='case-test', dir=config.test_exec_root)
Index: test/Driver/arch-specific-libdir.c
===
--- /dev/null
+++ test/Driver/arch-specific-libdir.c
@@ -0,0 +1,53 @@
+// Test that the driver adds an arch-specific subdirectory in
+// {RESOURCE_DIR}/lib/linux to the search path.
+//
+// RUN: %clang %s -### 2>&1 -target i386-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
+//
+// RUN: %clang %s -### 2>&1 -target i386-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
+//
+// RUN: %clang %s -### 2>&1 -target i686-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
+//
+// RUN: %clang %s -### 2>&1 -target i686-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
+//
+// RUN: %clang %s -### 2>&1 -target x86_64-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-x86_64 %s
+//
+// RUN: %clang %s -### 2>&1 -target x86_64-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
+//
+// RUN: %clang %s -### 2>&1 -target arm-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-arm %s
+//
+// RUN: %clang %s -### 2>&1 -target arm-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
+//
+// RUN: %clang %s -### 2>&1 -target aarch64-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-aarch64 %s
+//
+// RUN: %clang %s -### 2>&1 -target aarch64-unknown-linux \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s
+//
+//
+// FILEPATH: "-x" "c" "[[FILE_PATH:.*]]/{{.*}}.c"
+// ARCHDIR-i386:-L[[FILE_PATH]]/Inputs/resource_dir_with_arch_subdir/lib/linux/i386
+// ARCHDIR-x86_64:  -L[[FILE_PATH]]/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64
+// ARCHDIR-arm: -L[[FILE_PATH]]/Inputs/resource_dir_with_arch_subdir/lib/linux/arm
+// ARCHDIR-aarch64: -L[[FILE_PATH]]/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64
+//
+// Have a stricter check for no-archdir - that the driver doesn't add any
+// subdirectory from the provided resource directory.
+// NO-ARCHDIR-NOT: -L[[FILE_PATH]]/Inputs/resource_dir
Index: test/Driver/arch-specific-libdir-rpath.c
===
--- /dev/null
+++ test/Driver/arch-specific-libdir-rpath.c
@@ -0,0 +1,50 @@
+// Test that the driver adds an arch-specific subdirectory in
+// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath' for native
+// compilations.
+//
+// -rpath only gets added during native compilation.  To keep the test simple,
+// just test for x86_64-linux native compilation.
+// REQUIRES: x86_64-linux
+//
+// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
+// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s
+//
+// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=add

[PATCH] D30239: enable -flto=thin in clang-cl

2017-03-03 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

In https://reviews.llvm.org/D30239#691972, @rnk wrote:

> Do you guys think that maybe -flto should imply -fuse-ld=lld, or is that too 
> much magic?


I don't know enough about windows, but I would think it may be surprising for a 
user that -flto changes the linker behind his back?

I'm biased but as a user I rather have to opt-in instead of the compiler doing 
stuff without me knowing about it.


Repository:
  rL LLVM

https://reviews.llvm.org/D30239



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


[PATCH] D30015: Add arch-specific directory to search path

2017-03-03 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama marked an inline comment as done.
pirama added inline comments.



Comment at: lib/Driver/Tools.cpp:2007-2009
+  // In the cross-compilation case, arch-specific library path is likely
+  // unavailable at runtime.
+  if (TC.isCrossCompiling()) return;

rnk wrote:
> This seems like a really poor heuristic for "will the user ship this binary 
> to another computer that doesn't have clang installed in the same location", 
> but the convenience of not having to add clang's unpredictably named resource 
> library directory to LD_LIBRARY_PATH seems worth baking in a possibly-wrong 
> rpath.
This is indeed poor, but a good check that omits rpath when it is definitely 
useless but leave it in case it might be useful.


https://reviews.llvm.org/D30015



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


[PATCH] D30589: [ExprInspectionChecker] Improve usability for C

2017-03-03 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Thanks! This bugged me as well, but i didn't think of this trick :)


https://reviews.llvm.org/D30589



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


[PATCH] D30341: [analyzer] clarify error messages about uninitialized function arguments

2017-03-03 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

The code looks good to me, but i'm expressing a tiny doubt: regardless of the 
output format, the user always has the relevant argument highlighted anyway 
(column number, tilde-underlined in command line, blue-ish box in scan-build, 
etc.), so the only significant clarification i see is on test files, where the 
column is not obvious.

If having that information duplicated to the warning message is considered 
useful (easier to read, catchy), i'm ok with it :)

The definitive document on this debate is 
https://clang.llvm.org/diagnostics.html : it begins with explicitly encouraging 
highlights through column numbers and underlines, but it doesn't provide an 
opinion on including this info in the warning message. So i'm confused.


Repository:
  rL LLVM

https://reviews.llvm.org/D30341



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


[libcxx] r296919 - Fix hash requirements check in __hash_table.

2017-03-03 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Mar  3 16:35:58 2017
New Revision: 296919

URL: http://llvm.org/viewvc/llvm-project?rev=296919&view=rev
Log:
Fix hash requirements check in __hash_table.

r296565 attempted to add better diagnostics when an unordered container
is instantiated with a hash that doesn't meet the Hash requirements.

However I mistakenly checked the wrong set of requirements. Specifically
it checked if the hash met the requirements for specializations of
std::hash. However these requirements are stricter than the generic
Hash requirements.

This patch fixes the assertions to only check the Hash requirements.

Modified:
libcxx/trunk/include/__hash_table
libcxx/trunk/include/utility

libcxx/trunk/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp

Modified: libcxx/trunk/include/__hash_table
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=296919&r1=296918&r2=296919&view=diff
==
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Fri Mar  3 16:35:58 2017
@@ -871,16 +871,15 @@ public:
 template 
 struct __diagnose_hash_table_helper {
   static constexpr bool __trigger_diagnostics()
-_LIBCPP_DIAGNOSE_WARNING(__has_enabled_hash<_Key, _Hash>::value
+_LIBCPP_DIAGNOSE_WARNING(__check_hash_requirements<_Key, _Hash>::value
  && !__invokable<_Hash const&, _Key const&>::value,
   "the specified hash functor does not provide a const call operator")
 _LIBCPP_DIAGNOSE_WARNING(is_copy_constructible<_Equal>::value
   && !__invokable<_Equal const&, _Key const&, _Key 
const&>::value,
   "the specified comparator type does not provide a const call operator")
   {
-static_assert(__has_enabled_hash<_Key, _Hash>::value,
-  "the specified hash functor does not meet the requirements for an "
-  "enabled hash");
+static_assert(__check_hash_requirements<_Key, _Hash>::value,
+  "the specified hash does not meet the Hash requirements");
 static_assert(is_copy_constructible<_Equal>::value,
   "the specified comparator is required to be copy constructible");
 return true;

Modified: libcxx/trunk/include/utility
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=296919&r1=296918&r2=296919&view=diff
==
--- libcxx/trunk/include/utility (original)
+++ libcxx/trunk/include/utility Fri Mar  3 16:35:58 2017
@@ -1560,14 +1560,19 @@ struct _LIBCPP_TEMPLATE_VIS hash >
-using __has_enabled_hash = integral_constant::value &&
+template 
+using __check_hash_requirements = integral_constant::value &&
 is_move_constructible<_Hash>::value &&
 __invokable_r::value
 >;
 
+template  >
+using __has_enabled_hash = integral_constant::value &&
+is_default_constructible<_Hash>::value
+>;
+
 #if _LIBCPP_STD_VER > 14
 template 
 using __enable_hash_helper_imp = _Type;

Modified: 
libcxx/trunk/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp?rev=296919&r1=296918&r2=296919&view=diff
==
--- 
libcxx/trunk/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp
 Fri Mar  3 16:35:58 2017
@@ -23,14 +23,48 @@
 #include 
 
 using VT = std::pair;
-using Set = std::unordered_set;
+
+struct BadHashNoCopy {
+  BadHashNoCopy() = default;
+  BadHashNoCopy(BadHashNoCopy const&) = delete;
+
+  template 
+  size_t operator()(T const&) const { return 0; }
+};
+
+struct BadHashNoCall {
+
+};
+
+
+struct GoodHashNoDefault {
+  explicit GoodHashNoDefault(void*) {}
+  template 
+  size_t operator()(T const&) const { return 0; }
+};
 
 int main() {
 
-  Set s; // expected-error@__hash_table:* {{the specified hash functor does 
not meet the requirements for an enabled hash}}
+  {
+using Set = std::unordered_set;
+Set s; // expected-error@__hash_table:* {{the specified hash does not meet 
the Hash requirements}}
+
 
   // FIXME: It would be great to suppress the below diagnostic all together.
   //but for now it's sufficient that it appears last. However there is
   //currently no way to test the order diagnostics are issued.
   // expected-error@memory:* {{call to implicitly-deleted default constructor 
of 'std::__1::hash >'}}
+  }
+  {
+using Set = std::unordered_set;
+Set s; // expected-error@__hash_table:* {{the specified hash does not meet 
the Hash requirements}}
+  }
+  {
+using Set = std::unordered_set;
+Set s; // expected-error@__hash_table:* {{the specified hash does not meet 
the Hash requirements}}

[PATCH] D30489: [analyzer] catch out of bounds for VLA

2017-03-03 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D30489#691475, @danielmarjamaki wrote:

> Do you agree that this is the problem? Would it be a good idea to try to keep 
> the sz in the ProgramState?


Environment stores values only temporarily. It's kind of a scratch pad for 
temporary symbolic calculations: we compute sub-expressions, put them in the 
Environment, compute the expression itself, then throw the sub-expressions away 
immediately. Store, on the other hand, is a permanent storage.

Also, in your state dumps no information is actually lost. The fact that the 
value of variable `sz` is `reg_$0` is trivial: you could ask the Store 
what's the value of the variable `sz` and it'd say `reg_$0` if there are no 
bindings over it.

Or, alternatively, you see the same value in the dump of the ElementRegion as 
its index.

P.S. I'd agree that it's better to merge the two versions of the checker than 
trying to fix one of them to be at least as good as the other, through 
different approaches.


Repository:
  rL LLVM

https://reviews.llvm.org/D30489



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


[libcxx] r296922 - Remove the buildit and testit scripts; they haven't been supported in years

2017-03-03 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Mar  3 16:47:45 2017
New Revision: 296922

URL: http://llvm.org/viewvc/llvm-project?rev=296922&view=rev
Log:
Remove the buildit and testit scripts; they haven't been supported in years

Removed:
libcxx/trunk/lib/buildit
libcxx/trunk/test/testit

Removed: libcxx/trunk/lib/buildit
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/buildit?rev=296921&view=auto
==
--- libcxx/trunk/lib/buildit (original)
+++ libcxx/trunk/lib/buildit (removed)
@@ -1,189 +0,0 @@
-#! /bin/sh
-#
-# Set the $TRIPLE environment variable to your system's triple before
-# running this script.  If you set $CXX, that will be used to compile
-# the library.  Otherwise we'll use clang++.
-
-set -e
-
-echo "-- WARNING --"
-echo "buildit is no longer supported and will be removed in the next week!"
-echo "please contact the libc++ maintainers if you have any concerns"
-echo ""
-
-if [ `basename $(pwd)` != "lib" ]
-then
-echo "current directory must be lib"
-exit 1
-fi
-
-if [ -z "$CXX" ]
-then
-CXX=clang++
-fi
-
-if [ -z "$CXX_LANG" ]
-then
-CXX_LANG=c++11
-fi
-
-if [ -z "$CC" ]
-then
-CC=clang
-fi
-
-if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]
-then
-if [ -z "$IPHONEOS_DEPLOYMENT_TARGET" ]
-then
-MACOSX_DEPLOYMENT_TARGET=10.7
-fi
-fi
-
-if [ -z "$RC_ProjectSourceVersion" ]
-then
-  RC_ProjectSourceVersion=1
-fi
-
-EXTRA_FLAGS="-nostdinc++ -std=${CXX_LANG} -fstrict-aliasing -Wall -Wextra 
-Wshadow -Wconversion \
- -Wstrict-aliasing=2 -Wstrict-overflow=4 
-D_LIBCPP_BUILDING_LIBRARY "
-
-case $TRIPLE in
-  *-apple-*)
-if [ -z $RC_XBS ]
-then
-  RC_CFLAGS="-arch i386 -arch x86_64"
-fi
-SOEXT=dylib
-if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ]
-then
-EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__"
-LDSHARED_FLAGS="-o libc++.1.dylib \
--dynamiclib -nodefaultlibs -current_version 1 \
--compatibility_version 1 \
--install_name /usr/lib/libc++.1.dylib \
--Wl,-reexport_library,/usr/lib/libc++abi.dylib \
--Wl,-unexported_symbols_list,libc++unexp.exp  \
-/usr/lib/libSystem.B.dylib"
-else
-if [ -n "$SDKROOT" ]
-then
-EXTRA_FLAGS+="-isysroot ${SDKROOT} "
-if echo "${RC_ARCHS}" | grep -q "armv7"  
-then
-RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib 
-Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
-else
-
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
-fi
-CXX=`xcrun -sdk "${SDKROOT}"  -find clang++`
-CC=`xcrun -sdk "${SDKROOT}"  -find clang`
-else
-# Check if we have _LIBCPPABI_VERSION, to determine the reexport 
list to use.
-if (echo "#include " | $CXX -E -dM -x c++ - | \
-grep _LIBCPPABI_VERSION > /dev/null)
-then
-RE_EXPORT_LINE="/usr/lib/libc++abi.dylib 
-Wl,-reexported_symbols_list,libc++abi2.exp"
-else
-RE_EXPORT_LINE="/usr/lib/libc++abi.dylib 
-Wl,-reexported_symbols_list,libc++abi.exp"
-fi
-fi
-LDSHARED_FLAGS="-o libc++.1.dylib \
--dynamiclib -nodefaultlibs  \
--current_version ${RC_ProjectSourceVersion} \
--compatibility_version 1 \
--install_name /usr/lib/libc++.1.dylib \
--lSystem  \
--Wl,-unexported_symbols_list,libc++unexp.exp  \
-${RE_EXPORT_LINE}  \
--Wl,-force_symbols_not_weak_list,notweak.exp \
--Wl,-force_symbols_weak_list,weak.exp"
-fi
-;;
-  *-*-mingw*)
-# FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt 
and LLVM/compiler-rt
-SOEXT=dll
-LDSHARED_FLAGS="-o libc++.dll \
--shared -nodefaultlibs -Wl,--export-all-symbols 
-Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \
--lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex 
-lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc 
-lmoldname -lmingwex -lmsvcrt"
-;;
-  *-ibm-*)
-hostOS=`uname`
-hostOS=`echo $hostOS | sed -e "s/\s+$//"`
-hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'`
-
-if [ $hostOS = "linux" ]
-then
-  LDSHARED_FLAGS="-o libc++.so.1 \
--qmkshrobj -Wl,-soname,libc++.so.1 \
--lpthread -lrt -lc -lstdc++"
-  EXTRA_FLAGS="-qlanglvl=extended0x -D__GLIBCXX__=1"
-else
-  LDSHARED_FLAGS="-o shr.o -qmkshrobj -lpthread -bnoquiet"
-  EXTRA_FLAGS="-qlanglvl=extended0x"
-fi
-RC_CFLAGS="-qpic=large"
-;;
-  *)
-RC_CFLAGS="-fPIC"
-SOEXT=so
-LDSHARED_FLAGS="-o libc++.so.1.0 \
--shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
--lpthread -lrt -lc -lstdc++"
-;;
-esac
-
-if [ -z "$RC_XBS" ]
-then

Re: [libcxx] r296919 - Fix hash requirements check in __hash_table.

2017-03-03 Thread Nico Weber via cfe-commits
"the specified hash does not meet the Hash requirements" isn't a very
actionable diagnostic. Is it possible to use some warning text that lets
people know what they need to do to make the compiler happy, instead of
just telling them that the compiler is unhappy?

On Fri, Mar 3, 2017 at 5:35 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Mar  3 16:35:58 2017
> New Revision: 296919
>
> URL: http://llvm.org/viewvc/llvm-project?rev=296919&view=rev
> Log:
> Fix hash requirements check in __hash_table.
>
> r296565 attempted to add better diagnostics when an unordered container
> is instantiated with a hash that doesn't meet the Hash requirements.
>
> However I mistakenly checked the wrong set of requirements. Specifically
> it checked if the hash met the requirements for specializations of
> std::hash. However these requirements are stricter than the generic
> Hash requirements.
>
> This patch fixes the assertions to only check the Hash requirements.
>
> Modified:
> libcxx/trunk/include/__hash_table
> libcxx/trunk/include/utility
> libcxx/trunk/test/libcxx/containers/unord/unord.set/
> missing_hash_specialization.fail.cpp
>
> Modified: libcxx/trunk/include/__hash_table
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_
> _hash_table?rev=296919&r1=296918&r2=296919&view=diff
> 
> ==
> --- libcxx/trunk/include/__hash_table (original)
> +++ libcxx/trunk/include/__hash_table Fri Mar  3 16:35:58 2017
> @@ -871,16 +871,15 @@ public:
>  template 
>  struct __diagnose_hash_table_helper {
>static constexpr bool __trigger_diagnostics()
> -_LIBCPP_DIAGNOSE_WARNING(__has_enabled_hash<_Key, _Hash>::value
> +_LIBCPP_DIAGNOSE_WARNING(__check_hash_requirements<_Key,
> _Hash>::value
>   && !__invokable<_Hash const&, _Key
> const&>::value,
>"the specified hash functor does not provide a const call operator")
>  _LIBCPP_DIAGNOSE_WARNING(is_copy_constructible<_Equal>::value
>&& !__invokable<_Equal const&, _Key const&,
> _Key const&>::value,
>"the specified comparator type does not provide a const call
> operator")
>{
> -static_assert(__has_enabled_hash<_Key, _Hash>::value,
> -  "the specified hash functor does not meet the requirements for an "
> -  "enabled hash");
> +static_assert(__check_hash_requirements<_Key, _Hash>::value,
> +  "the specified hash does not meet the Hash requirements");
>  static_assert(is_copy_constructible<_Equal>::value,
>"the specified comparator is required to be copy constructible");
>  return true;
>
> Modified: libcxx/trunk/include/utility
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/
> utility?rev=296919&r1=296918&r2=296919&view=diff
> 
> ==
> --- libcxx/trunk/include/utility (original)
> +++ libcxx/trunk/include/utility Fri Mar  3 16:35:58 2017
> @@ -1560,14 +1560,19 @@ struct _LIBCPP_TEMPLATE_VIS hash  #endif
>
>  #ifndef _LIBCPP_CXX03_LANG
> -template  >
> -using __has_enabled_hash = integral_constant -is_default_constructible<_Hash>::value &&
> +template 
> +using __check_hash_requirements = integral_constant  is_copy_constructible<_Hash>::value &&
>  is_move_constructible<_Hash>::value &&
>  __invokable_r::value
>  >;
>
> +template  >
> +using __has_enabled_hash = integral_constant +__check_hash_requirements<_Key, _Hash>::value &&
> +is_default_constructible<_Hash>::value
> +>;
> +
>  #if _LIBCPP_STD_VER > 14
>  template 
>  using __enable_hash_helper_imp = _Type;
>
> Modified: libcxx/trunk/test/libcxx/containers/unord/unord.set/
> missing_hash_specialization.fail.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/
> libcxx/containers/unord/unord.set/missing_hash_
> specialization.fail.cpp?rev=296919&r1=296918&r2=296919&view=diff
> 
> ==
> --- libcxx/trunk/test/libcxx/containers/unord/unord.set/
> missing_hash_specialization.fail.cpp (original)
> +++ libcxx/trunk/test/libcxx/containers/unord/unord.set/
> missing_hash_specialization.fail.cpp Fri Mar  3 16:35:58 2017
> @@ -23,14 +23,48 @@
>  #include 
>
>  using VT = std::pair;
> -using Set = std::unordered_set;
> +
> +struct BadHashNoCopy {
> +  BadHashNoCopy() = default;
> +  BadHashNoCopy(BadHashNoCopy const&) = delete;
> +
> +  template 
> +  size_t operator()(T const&) const { return 0; }
> +};
> +
> +struct BadHashNoCall {
> +
> +};
> +
> +
> +struct GoodHashNoDefault {
> +  explicit GoodHashNoDefault(void*) {}
> +  template 
> +  size_t operator()(T const&) const { return 0; }
> +};
>
>  int main() {
>
> -  Set s; // expected-error@__hash_table:* {{the specified hash functor
> does not meet the requirements for an enabled hash}}
> +  {
> +using Set = std::un

[PATCH] D30593: Add correct "-isystem" warning handling to static analysis' BugReporter.

2017-03-03 Thread Kevin Marshall via Phabricator via cfe-commits
kmarshall added a comment.

Note to reviewers:  this diff is relative to "llvm/cfe" - I couldn't find a way 
to specify a repository subpath to use for this diff.


Repository:
  rL LLVM

https://reviews.llvm.org/D30593



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


[PATCH] D30593: Add correct "-isystem" warning handling to static analysis' BugReporter.

2017-03-03 Thread Kevin Marshall via Phabricator via cfe-commits
kmarshall created this revision.

The Clang static analyzer doesn't follow the warning suppression semantics of 
the "-isystem" command line flag. This patch adds a check to BugReporter which 
causes it to drop any BugReports which originated from a system header 
(descendant of an -isystem path).


Repository:
  rL LLVM

https://reviews.llvm.org/D30593

Files:
  lib/StaticAnalyzer/Core/BugReporter.cpp


Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -3251,6 +3251,12 @@
   return;
   }

+  // Suppress BugReports which originate from system headers (located beneath
+  // an -isystem include path).
+  if (getSourceManager().isInSystemHeader(
+  R->getLocation(getSourceManager()).asLocation()))
+return;
+
   bool ValidSourceLoc = R->getLocation(getSourceManager()).isValid();
   assert(ValidSourceLoc);
   // If we mess up in a release build, we'd still prefer to just drop the bug


Index: lib/StaticAnalyzer/Core/BugReporter.cpp
===
--- lib/StaticAnalyzer/Core/BugReporter.cpp
+++ lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -3251,6 +3251,12 @@
   return;
   }

+  // Suppress BugReports which originate from system headers (located beneath
+  // an -isystem include path).
+  if (getSourceManager().isInSystemHeader(
+  R->getLocation(getSourceManager()).asLocation()))
+return;
+
   bool ValidSourceLoc = R->getLocation(getSourceManager()).isValid();
   assert(ValidSourceLoc);
   // If we mess up in a release build, we'd still prefer to just drop the bug
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30593: Add correct "-isystem"/"-isysroot" warning handling to static analysis' BugReporter.

2017-03-03 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

http://llvm-cs.pcc.me.uk/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h/risInSystemHeader
 suggests that the analyzer has some plumbing for this, so I added dcoughlin as 
reviewer, who has touched some of those lines before. dcoughlin, as background: 
We're playing with running the analyzer on chromium, and we were pretty 
surprised that it defaults to printing diagnostics for system headers. That's 
different from what regular clang does, and there isn't much applications can 
do about diagnostics in system headers. kmarshall wrote a script to manually 
filter out diagnostics from system headers, but we figured it'd make more sense 
if the analyzer didn't emit those diagnostics in the first place -- probably by 
default, but maybe behind some flag. Are you familiar with the design behind 
the current behavior? Does it make sense to change this? Are we missing some 
existing flag?

(kmarshall: In the future, please send some context lines with your diffs, see 
http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface.)


Repository:
  rL LLVM

https://reviews.llvm.org/D30593



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


[PATCH] D30591: Introduce the feature "linux" for tests only for linux

2017-03-03 Thread Bob Haarman via Phabricator via cfe-commits
inglorion added a comment.

Checking for linux when really you want to check for ELF doesn't seem right. In 
this case, I think there is an better way to do it; instead of relying on 
llvm-objdump, could you emit an LLVM assembly file and check that for presence 
of the string you want? I think if you compile with clang -g -S -emit-llvm, it 
will give you LLVM assembly with metadata for the records you need and you 
won't need to generate an object file.


https://reviews.llvm.org/D30591



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


r296927 - Add arch-specific directory to search path

2017-03-03 Thread Pirama Arumuga Nainar via cfe-commits
Author: pirama
Date: Fri Mar  3 17:20:49 2017
New Revision: 296927

URL: http://llvm.org/viewvc/llvm-project?rev=296927&view=rev
Log:
Add arch-specific directory to search path

Summary:

This change adds an arch-specific subdirectory in /lib/
to the linker search path.  This path also gets added as '-rpath' for
native compilation if a runtime is linked in as a shared object.  This
allows arch-specific libraries to be installed alongside clang.

Reviewers: danalbert, cbergstrom, javed.absar

Subscribers: srhines

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

Added:
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/

cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/

cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/

cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/

cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/

cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep
cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
cfe/trunk/test/Driver/arch-specific-libdir.c
Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=296927&r1=296926&r2=296927&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Mar  3 17:20:49 2017
@@ -299,6 +299,11 @@ public:
   const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
  StringRef Component,
  bool Shared = false) const;
+
+  // Returns /lib//.  This is used by runtimes (such
+  // as OpenMP) to find arch-specific libraries.
+  std::string getArchSpecificLibPath() const;
+
   /// needsProfileRT - returns true if instrumentation profile is on.
   static bool needsProfileRT(const llvm::opt::ArgList &Args);
 

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=296927&r1=296926&r2=296927&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Mar  3 17:20:49 2017
@@ -10,6 +10,7 @@
 #include "clang/Driver/ToolChain.h"
 #include "Tools.h"
 #include "clang/Basic/ObjCRuntime.h"
+#include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Driver.h"
@@ -74,6 +75,10 @@ ToolChain::ToolChain(const Driver &D, co
 if (!isThreadModelSupported(A->getValue()))
   D.Diag(diag::err_drv_invalid_thread_model_for_target)
   << A->getValue() << A->getAsString(Args);
+
+  std::string CandidateLibPath = getArchSpecificLibPath();
+  if (getVFS().exists(CandidateLibPath))
+getFilePaths().push_back(CandidateLibPath);
 }
 
 ToolChain::~ToolChain() {
@@ -320,6 +325,14 @@ const char *ToolChain::getCompilerRTArgS
   return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
 }
 
+std::string ToolChain::getArchSpecificLibPath() const {
+  SmallString<128> Path(getDriver().ResourceDir);
+  StringRef OSLibName = getTriple().isOSFreeBSD() ? "freebsd" : getOS();
+  llvm::sys::path::append(Path, "lib", OSLibName,
+  llvm::Triple::getArchTypeName(getArch()));
+  return Path.str();
+}
+
 bool ToolChain::needsProfileRT(const ArgList &Args) {
   if (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
false) ||

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=296927&r1=296926&r2=296927&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Mar  3 17:20:49 2017
@@ -14,6 +14,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Version.h"
+#include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Compilation.h"
@@ -238,8 +239,9 @@ static void AddLinkerInputs(const ToolCh
 
   // LIBRARY_PATH - included following th

[PATCH] D30015: Add arch-specific directory to search path

2017-03-03 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296927: Add arch-specific directory to search path (authored 
by pirama).

Changed prior to commit:
  https://reviews.llvm.org/D30015?vs=90532&id=90545#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30015

Files:
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep
  cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep
  
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep
  
cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep
  cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
  cfe/trunk/test/Driver/arch-specific-libdir.c
  cfe/trunk/test/lit.cfg

Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -10,6 +10,7 @@
 #include "clang/Driver/ToolChain.h"
 #include "Tools.h"
 #include "clang/Basic/ObjCRuntime.h"
+#include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Driver.h"
@@ -74,6 +75,10 @@
 if (!isThreadModelSupported(A->getValue()))
   D.Diag(diag::err_drv_invalid_thread_model_for_target)
   << A->getValue() << A->getAsString(Args);
+
+  std::string CandidateLibPath = getArchSpecificLibPath();
+  if (getVFS().exists(CandidateLibPath))
+getFilePaths().push_back(CandidateLibPath);
 }
 
 ToolChain::~ToolChain() {
@@ -320,6 +325,14 @@
   return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
 }
 
+std::string ToolChain::getArchSpecificLibPath() const {
+  SmallString<128> Path(getDriver().ResourceDir);
+  StringRef OSLibName = getTriple().isOSFreeBSD() ? "freebsd" : getOS();
+  llvm::sys::path::append(Path, "lib", OSLibName,
+  llvm::Triple::getArchTypeName(getArch()));
+  return Path.str();
+}
+
 bool ToolChain::needsProfileRT(const ArgList &Args) {
   if (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
false) ||
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -14,6 +14,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Version.h"
+#include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Config/config.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Compilation.h"
@@ -238,8 +239,9 @@
 
   // LIBRARY_PATH - included following the user specified library paths.
   //and only supported on native toolchains.
-  if (!TC.isCrossCompiling())
+  if (!TC.isCrossCompiling()) {
 addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH");
+  }
 }
 
 /// Add OpenMP linker script arguments at the end of the argument list so that
@@ -2000,6 +2002,19 @@
   }
 }
 
+static void addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,
+ ArgStringList &CmdArgs) {
+  // In the cross-compilation case, arch-specific library path is likely
+  // unavailable at runtime.
+  if (TC.isCrossCompiling()) return;
+
+  std::string CandidateRPath = TC.getArchSpecificLibPath();
+  if (TC.getVFS().exists(CandidateRPath)) {
+CmdArgs.push_back("-rpath");
+CmdArgs.push_back(Args.MakeArgString(CandidateRPath.c_str()));
+  }
+}
+
 static void addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC,
   const ArgList &Args) {
   if (!Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
@@ -2020,6 +2035,8 @@
 // Already diagnosed.
 break;
   }
+
+  addArchSpecificRPath(TC, Args, CmdArgs);
 }
 
 static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
@@ -2030,6 +2047,10 @@
   if (IsWhole) CmdArgs.push_back("-whole-archive");
   CmdArgs.push_back(TC.getCompilerRTArgString(Args, Sanitizer, IsShared));
   if (IsWhole) CmdArgs.push_back("-no-whole-archive");
+
+  if (IsShared) {
+addArchSpecificRPath(TC, Args, CmdArgs);
+  }
 }
 
 // Tries to use a file with the list of dynamic symbols that need to be exported
@@ -9002,6 +9023,8 @@
 }
 if (JA.isHostOffloading(Action::OFK_OpenMP))
   CmdArgs.push_back("-lomptarget");
+
+addArchSpecificRPath(ToolChain, Args, CmdArgs);
   }
 
   AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
Index: cfe/trunk/include/clang/Driver/ToolChain.h
===
--- cfe/trunk/include/clang/Driver/ToolChain.h
+++ cfe/trunk/include/clang/Driver/ToolChain.h
@@ -299,6 +299,11 @@
   const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
   

[PATCH] D30015: Add arch-specific directory to search path

2017-03-03 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Committed.  Thanks for the reviews!


Repository:
  rL LLVM

https://reviews.llvm.org/D30015



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


[PATCH] D30592: [clang-tidy] Fix diag message for catch-by-value

2017-03-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman requested changes to this revision.
aaron.ballman added a comment.
This revision now requires changes to proceed.

This change is missing test cases.


https://reviews.llvm.org/D30592



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


  1   2   >