[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny updated this revision to Diff 73887.
mgorny added a comment.

A simple test case included.


https://reviews.llvm.org/D25338

Files:
  docs/CommandGuide/clang.rst
  include/clang/Driver/Options.td
  lib/Driver/Driver.cpp
  test/Driver/print-libgcc-file-name.c


Index: test/Driver/print-libgcc-file-name.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name.c
@@ -0,0 +1,15 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=.
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
Index: docs/CommandGuide/clang.rst
===
--- docs/CommandGuide/clang.rst
+++ docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 


Index: test/Driver/print-libgcc-file-name.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name.c
@@ -0,0 +1,15 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=.
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << "\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added reviewers: NoQ, zaks.anna, dcoughlin, a.sidorin, 
xazax.hun.
danielmarjamaki added a comment.

adding reviewers.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25309: [clang-move] Support moving multiple classes in one run.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 73888.
hokein marked 3 inline comments as done.
hokein added a comment.

Update.


https://reviews.llvm.org/D25309

Files:
  clang-move/ClangMove.cpp
  clang-move/ClangMove.h
  clang-move/tool/ClangMoveMain.cpp
  test/clang-move/Inputs/database_template.json
  test/clang-move/Inputs/multiple_class_test.cpp
  test/clang-move/Inputs/multiple_class_test.h
  test/clang-move/move-class.cpp
  test/clang-move/move-multiple-classes.cpp
  unittests/clang-move/ClangMoveTests.cpp

Index: unittests/clang-move/ClangMoveTests.cpp
===
--- unittests/clang-move/ClangMoveTests.cpp
+++ unittests/clang-move/ClangMoveTests.cpp
@@ -210,7 +210,7 @@
 
 TEST(ClangMove, MoveHeaderAndCC) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Name = "a::b::Foo";
+  Spec.Names = "a::b::Foo";
   Spec.OldHeader = "foo.h";
   Spec.OldCC = "foo.cc";
   Spec.NewHeader = "new_foo.h";
@@ -225,7 +225,7 @@
 
 TEST(ClangMove, MoveHeaderOnly) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Name = "a::b::Foo";
+  Spec.Names = "a::b::Foo";
   Spec.OldHeader = "foo.h";
   Spec.NewHeader = "new_foo.h";
   auto Results = runClangMoveOnCode(Spec);
@@ -236,7 +236,7 @@
 
 TEST(ClangMove, MoveCCOnly) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Name = "a::b::Foo";
+  Spec.Names = "a::b::Foo";
   Spec.OldCC = "foo.cc";
   Spec.NewCC = "new_foo.cc";
   std::string ExpectedHeader = "#include \"foo.h\"\n\n";
@@ -248,7 +248,7 @@
 
 TEST(ClangMove, MoveNonExistClass) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Name = "NonExistFoo";
+  Spec.Names = "NonExistFoo";
   Spec.OldHeader = "foo.h";
   Spec.OldCC = "foo.cc";
   Spec.NewHeader = "new_foo.h";
Index: test/clang-move/move-multiple-classes.cpp
===
--- /dev/null
+++ test/clang-move/move-multiple-classes.cpp
@@ -0,0 +1,58 @@
+// RUN: mkdir -p %T/clang-move/build
+// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json
+// RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
+// RUN: cd %T/clang-move
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp
+// RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
+// RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s
+// RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
+// RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s
+//
+// CHECK-OLD-TEST-H: namespace c {
+// CHECK-OLD-TEST-H: class NoMove {
+// CHECK-OLD-TEST-H: public:
+// CHECK-OLD-TEST-H:   int f();
+// CHECK-OLD-TEST-H: };
+// CHECK-OLD-TEST-H: } // namespace c
+
+// CHECK-OLD-TEST-CPP: #include "{{.*}}multiple_class_test.h"
+// CHECK-OLD-TEST-CPP: namespace c {
+// CHECK-OLD-TEST-CPP: int NoMove::f() {
+// CHECK-OLD-TEST-CPP:   return 0;
+// CHECK-OLD-TEST-CPP: }
+// CHECK-OLD-TEST-CPP: } // namespace c
+
+// CHECK-NEW-TEST-H: namespace a {
+// CHECK-NEW-TEST-H: class Move1 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: } // namespace a
+// CHECK-NEW-TEST-H: namespace b {
+// CHECK-NEW-TEST-H: class Move2 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: } // namespace b
+// CHECK-NEW-TEST-H: namespace c {
+// CHECK-NEW-TEST-H: class Move3 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: class Move4 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: } // namespace c
+
+// CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h"
+// CHECK-NEW-TEST-CPP: namespace a {
+// CHECK-NEW-TEST-CPP: int Move1::f() { return 0; }
+// CHECK-NEW-TEST-CPP: } // namespace a
+// CHECK-NEW-TEST-CPP: namespace b {
+// CHECK-NEW-TEST-CPP: int Move2::f() { return 0; }
+// CHECK-NEW-TEST-CPP: } // namespace b
+// CHECK-NEW-TEST-CPP: namespace c {
+// CHECK-NEW-TEST-CPP: int Move3::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int Move4::f() { return 0; }
+// CHECK-NEW-TEST-CPP: } // namespace c
Index: test/clang-move/move-class.cpp
===
--- test/clang-move/move-class.cpp
+++ test/clang-move/move-class.cpp
@@ -3,15 +3,15 @@
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: touch %T/clang-move/test2.h
 // RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/c

[PATCH] D25309: [clang-move] Support moving multiple classes in one run.

2016-10-07 Thread Eric Liu via cfe-commits
ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

Lg. Thanks!


https://reviews.llvm.org/D25309



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

In https://reviews.llvm.org/D25326#564082, @NoQ wrote:

> Funny facts about the Environment:
>
> (a) Environment allows taking SVals of ReturnStmt, which is not an 
> expression, by transparently converting it into its sub-expression. In fact, 
> it only stores expressions.
>
> Having just noticed (a), i also understand that (a) is not of direct 
> importance to the question, however:
>
> (b)  With a similar trick, Environment allows taking SVal of literal 
> expressions, but never stores literal expressions. Instead, it reconstructs 
> the constant value by looking at the literal and returns the freshly 
> constructed value when asked.
>
> This leads to "return 0;" and "return 1;" branches having the same program 
> state. The difference should have been within Environment (return values are 
> different), however return values are literals, and they aren't stored in the 
> Environment, and hence the Environment is equal in both states. If only the 
> function returned, say, 0 and i, the problem wouldn't have been there.


I did not know "a" and "b", thanks for info.

> This leaves us with two options:
> 
> 1. Tell the Environment to store everything. This would make things heavy. 
> However, i do not completely understand the consequences of this bug at the 
> moment - perhaps there would be more problems due to this state merging 
> unless we start storing everything.
> 2. Rely on the ProgramPoint to remember where we are. After all, why do we 
> merge when program points should clearly be different? The program point that 
> fails us is CallExitBegin - we could construct it with ReturnStmt and its 
> block count to discriminate between different returns. It should fix this 
> issue, and is similar to the approach taken in this patch (just puts things 
> to their own place), however, as i mentioned, there might be more problems 
> with misbehavior (b) of the Environment, need to think.



1. yes sounds heavy.
2. I assume you are right.. however as I understand it the ProgramPoint when 
CallExitBegin is called is the same (in the exit block). do you suggest that we 
take the ProgramPoint for the exit block's predecessor?

> Finally, i'm not quite sure why CallExitBegin is at all necessary. I wonder 
> if we could just remove it and jump straight to Bind Return Value, also need 
> to think.

me too. however there is much I wonder about when it comes to ExplodedGraph. :-)


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D22968: [analyzer] A checker for macOS-specific bool- and number-like objects.

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 73889.
NoQ added a comment.

- Rename test files for consistency.
- Suppress false positives on `intptr_t`.
- Add a triple to the tests to in order to stop worrying about integer types.


https://reviews.llvm.org/D22968

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
  test/Analysis/Inputs/system-header-simulator-objc.h
  test/Analysis/number-object-conversion.cpp
  test/Analysis/number-object-conversion.m

Index: test/Analysis/number-object-conversion.m
===
--- /dev/null
+++ test/Analysis/number-object-conversion.m
@@ -0,0 +1,79 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -w -analyze -analyzer-checker=osx.NumberObjectConversion %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -w -analyze -analyzer-checker=osx.NumberObjectConversion -analyzer-config osx.NumberObjectConversion:Pedantic=true -DPEDANTIC %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -fobjc-arc -w -analyze -analyzer-checker=osx.NumberObjectConversion %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -fobjc-arc -w -analyze -analyzer-checker=osx.NumberObjectConversion -analyzer-config osx.NumberObjectConversion:Pedantic=true -DPEDANTIC %s -verify
+
+#include "Inputs/system-header-simulator-objc.h"
+
+void bad(NSNumber *p) {
+#ifdef PEDANTIC
+  if (p) {} // expected-warning{{Converting 'NSNumber *' to a plain boolean value for branching; please compare the pointer to nil instead to suppress this warning}}
+  if (!p) {} // expected-warning{{Converting 'NSNumber *' to a plain boolean value for branching; please compare the pointer to nil instead to suppress this warning}}
+  (!p) ? 1 : 2; // expected-warning{{Converting 'NSNumber *' to a plain boolean value for branching; please compare the pointer to nil instead to suppress this warning}}
+  (BOOL)p; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; please compare the pointer to nil instead to suppress this warning}}
+#endif
+  if (p == YES) {} // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  if (p == NO) {} // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  BOOL x = p; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  x = p; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  x = (p == YES); // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  if (p == 0) {} // expected-warning{{Converting 'NSNumber *' to a plain integer value; please compare the pointer to nil instead to suppress this warning}}
+  if (p == 1) {} // expected-warning{{Converting 'NSNumber *' to a plain integer value; pointer value is being used instead}}
+  if (p > 0) {} // expected-warning{{Converting 'NSNumber *' to a plain integer value; please compare the pointer to nil instead to suppress this warning}}
+  int y = p; // expected-warning{{Converting 'NSNumber *' to a plain integer value; pointer value is being used instead}}
+  y = p; // expected-warning{{Converting 'NSNumber *' to a plain integer value; pointer value is being used instead}}
+}
+
+typedef NSNumber *SugaredNumber;
+void bad_sugared(SugaredNumber p) {
+  p == YES; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+}
+
+@interface I : NSObject {
+@public
+  NSNumber *ivar;
+  NSNumber *prop;
+}
+- (NSNumber *)foo;
+@property(copy) NSNumber *prop;
+@end
+
+@implementation I
+@synthesize prop;
+@end
+
+void bad_ivar(I *i) {
+  i->ivar == YES; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  i->prop == YES; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+  [i foo] == YES; // expected-warning{{Converting 'NSNumber *' to a plain BOOL value; pointer value is being used instead}}
+}
+
+void good(NSNumber *p) {
+  if ([p boolValue] == NO) {} // no-warning
+  if ([p boolValue] == YES) {} // no-warning
+  BOOL x = [p boolValue]; // no-warning
+}
+
+void suppression(NSNumber *p) {
+  if (p == NULL) {} // no-warning
+  if (p == nil) {} // no-warning
+}
+
+// Conversion of a pointer to an intptr_t is fine.
+typedef long intptr_t;
+typedef unsigned long uintptr_t;
+typedef long fintptr_t; // Fake, for testing the regex.
+void test_intptr_t(NSNumber *p) {
+  (long)p; // expected-warning{{Converting 'NSNumber *' to a plain integer value; pointer value is being used instead}}
+  (intptr_t)p; // no-warning
+  (unsigned long)p; // expected-warning{{Converting 'NSNumber *' to a plain integer value; pointer value is being 

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D25326#564185, @danielmarjamaki wrote:

> as I understand it the ProgramPoint when CallExitBegin is called is the same 
> (in the exit block). do you suggest that we take the ProgramPoint for the 
> exit block's predecessor?


CallExitBegin is //**the**// program point. I propose to make different exits 
from the same function be different program points. This could be achieved by 
adding more members to the CallExitBegin class - return statement and block 
count would probably be sufficient.

In fact, not sure if we need block count. If we're, say, returning from a loop 
with the same statement, then we're either returning different values, or 
returning the same literal expression, so Environment would do the job for us 
well in both cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[clang-tools-extra] r283525 - Revert "Revert "Add a static_assert to enforce that parameters to llvm::format() are not totally unsafe""

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 03:25:42 2016
New Revision: 283525

URL: http://llvm.org/viewvc/llvm-project?rev=283525&view=rev
Log:
Revert "Revert "Add a static_assert to enforce that parameters to 
llvm::format() are not totally unsafe""

This reverts commit r283510 and reapply r283509, with updates to
clang-tools-extra as well.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=283525&r1=283524&r2=283525&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Fri Oct  7 03:25:42 2016
@@ -777,7 +777,7 @@ void IdentifierNamingCheck::check(const
 DEBUG(llvm::dbgs()
   << Decl->getLocStart().printToString(*Result.SourceManager)
   << llvm::format(": unable to split words for %s '%s'\n",
-  KindName.c_str(), Name));
+  KindName.c_str(), Name.str().c_str()));
   }
 } else {
   NamingCheckFailure &Failure = NamingCheckFailures[NamingCheckId(
@@ -811,7 +811,7 @@ void IdentifierNamingCheck::checkMacro(S
   DEBUG(
   llvm::dbgs() << MacroNameTok.getLocation().printToString(SourceMgr)
<< llvm::format(": unable to split words for %s '%s'\n",
-   KindName.c_str(), Name));
+   KindName.c_str(), Name.str().c_str()));
 }
   } else {
 NamingCheckId ID(MI->getDefinitionLoc(), Name);


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


[clang-tools-extra] r283526 - [clang-move] Support moving multiple classes in one run.

2016-10-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Oct  7 03:29:20 2016
New Revision: 283526

URL: http://llvm.org/viewvc/llvm-project?rev=283526&view=rev
Log:
[clang-move] Support moving multiple classes in one run.

Reviewers: ioeric

Subscribers: cfe-commits

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

Added:
clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.cpp
clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.h
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp
clang-tools-extra/trunk/clang-move/ClangMove.h
clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=283526&r1=283525&r2=283526&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Fri Oct  7 03:29:20 2016
@@ -287,31 +287,43 @@ ClangMoveTool::ClangMoveTool(
 : Spec(MoveSpec), FileToReplacements(FileToReplacements),
   OriginalRunningDirectory(OriginalRunningDirectory),
   FallbackStyle(FallbackStyle) {
-  Spec.Name = llvm::StringRef(Spec.Name).ltrim(':');
   if (!Spec.NewHeader.empty())
 CCIncludes.push_back("#include \"" + Spec.NewHeader + "\"\n");
 }
 
 void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
-  std::string FullyQualifiedName = "::" + Spec.Name;
+  SmallVector ClassNames;
+  llvm::StringRef(Spec.Names).split(ClassNames, ',');
+  Optional> InMovedClassNames;
+  for (StringRef ClassName : ClassNames) {
+llvm::StringRef GlobalClassName = ClassName.trim().ltrim(':');
+const auto HasName = hasName(("::" + GlobalClassName).str());
+InMovedClassNames =
+InMovedClassNames ? anyOf(*InMovedClassNames, HasName) : HasName;
+  }
+  if (!InMovedClassNames) {
+llvm::errs() << "No classes being moved.\n";
+return;
+  }
+
   auto InOldHeader = isExpansionInFile(
   MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader));
   auto InOldCC = isExpansionInFile(
   MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC));
   auto InOldFiles = anyOf(InOldHeader, InOldCC);
   auto InMovedClass =
-  hasDeclContext(cxxRecordDecl(hasName(FullyQualifiedName)));
+  hasDeclContext(cxxRecordDecl(*InMovedClassNames));
 
   // Match moved class declarations.
   auto MovedClass = cxxRecordDecl(
-  InOldFiles, hasName(FullyQualifiedName), isDefinition(),
+  InOldFiles, *InMovedClassNames, isDefinition(),
   hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl(;
   Finder->addMatcher(MovedClass.bind("moved_class"), this);
 
   // Match moved class methods (static methods included) which are defined
   // outside moved class declaration.
   Finder->addMatcher(cxxMethodDecl(InOldFiles,
-   ofClass(hasName(FullyQualifiedName)),
+   ofClass(*InMovedClassNames),
isDefinition())
  .bind("class_method"),
  this);

Modified: clang-tools-extra/trunk/clang-move/ClangMove.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.h?rev=283526&r1=283525&r2=283526&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.h (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.h Fri Oct  7 03:29:20 2016
@@ -37,8 +37,9 @@ public:
   };
 
   struct MoveDefinitionSpec {
-// A fully qualified name, e.g. "X", "a::X".
-std::string Name;
+// A comma-separated list of fully qualified names, e.g. "Foo",
+// "a::Foo, b::Foo".
+std::string Names;
 // The file path of old header, can be relative path and absolute path.
 std::string OldHeader;
 // The file path of old cc, can be relative path and absolute path.

Modified: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp?rev=283526&r1=283525&r2=283526&view=diff
==
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp (original)
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp Fri Oct  7 
03:29:20 2016
@@ -37,8 +37,10 @@ std::error_code CreateNewFile(const llvm
 
 cl::OptionCategory ClangMoveCategory("clang-move options");
 
-cl::opt Name("name", cl::desc("The name of class being moved."),
-  cl::cat(ClangMove

r283527 - Use StringReg in TargetParser APIs (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 03:37:29 2016
New Revision: 283527

URL: http://llvm.org/viewvc/llvm-project?rev=283527&view=rev
Log:
Use StringReg in TargetParser APIs (NFC)

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

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=283527&r1=283526&r2=283527&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Oct  7 03:37:29 2016
@@ -5055,7 +5055,7 @@ public:
  StringRef CPU,
  const std::vector &FeaturesVec) const override {
 
-std::vector TargetFeatures;
+std::vector TargetFeatures;
 unsigned Arch = llvm::ARM::parseArch(getTriple().getArchName());
 
 // get default FPU features
@@ -5066,9 +5066,9 @@ public:
 unsigned Extensions = llvm::ARM::getDefaultExtensions(CPU, Arch);
 llvm::ARM::getExtensionFeatures(Extensions, TargetFeatures);
 
-for (const char *Feature : TargetFeatures)
+for (auto Feature : TargetFeatures)
   if (Feature[0] == '+')
-Features[Feature+1] = true;
+Features[Feature.drop_front(1)] = true;
 
 return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
   }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=283527&r1=283526&r2=283527&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct  7 03:37:29 2016
@@ -54,7 +54,7 @@ using namespace clang;
 using namespace llvm::opt;
 
 static void handleTargetFeaturesGroup(const ArgList &Args,
-  std::vector &Features,
+  std::vector &Features,
   OptSpecifier Group) {
   for (const Arg *A : Args.filtered(Group)) {
 StringRef Name = A->getOption().getName();
@@ -694,7 +694,7 @@ static void getARMArchCPUFromArgs(const
 // FIXME: Use ARMTargetParser.
 static void getARMHWDivFeatures(const Driver &D, const Arg *A,
 const ArgList &Args, StringRef HWDiv,
-std::vector &Features) {
+std::vector &Features) {
   unsigned HWDivID = llvm::ARM::parseHWDiv(HWDiv);
   if (!llvm::ARM::getHWDivFeatures(HWDivID, Features))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
@@ -703,7 +703,7 @@ static void getARMHWDivFeatures(const Dr
 // Handle -mfpu=.
 static void getARMFPUFeatures(const Driver &D, const Arg *A,
   const ArgList &Args, StringRef FPU,
-  std::vector &Features) {
+  std::vector &Features) {
   unsigned FPUID = llvm::ARM::parseFPU(FPU);
   if (!llvm::ARM::getFPUFeatures(FPUID, Features))
 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
@@ -711,13 +711,13 @@ static void getARMFPUFeatures(const Driv
 
 // Decode ARM features from string like +[no]featureA+[no]featureB+...
 static bool DecodeARMFeatures(const Driver &D, StringRef text,
-  std::vector &Features) {
+  std::vector &Features) {
   SmallVector Split;
   text.split(Split, StringRef("+"), -1, false);
 
   for (StringRef Feature : Split) {
-const char *FeatureName = llvm::ARM::getArchExtFeature(Feature);
-if (FeatureName)
+StringRef FeatureName = llvm::ARM::getArchExtFeature(Feature);
+if (!FeatureName.empty())
   Features.push_back(FeatureName);
 else
   return false;
@@ -730,7 +730,7 @@ static bool DecodeARMFeatures(const Driv
 // to handle -march=native correctly.
 static void checkARMArchName(const Driver &D, const Arg *A, const ArgList 
&Args,
  llvm::StringRef ArchName,
- std::vector &Features,
+ std::vector &Features,
  const llvm::Triple &Triple) {
   std::pair Split = ArchName.split("+");
 
@@ -743,7 +743,7 @@ static void checkARMArchName(const Drive
 // Check -mcpu=. Needs ArchName to handle -mcpu=generic.
 static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
 llvm::StringRef CPUName, llvm::StringRef ArchName,
-std::vector &Features,
+std::vector &Features,
 const llvm::Triple &Triple) {
   std::pair Split = CPUName.split("+");
 
@@ -867,7 +867,7 @@ arm::FloatABI arm::getARMFloatABI(const
 static void getARMTargetFeatures(const ToolChain &TC,
  const llvm::Triple &Triple,
  const ArgList &Args,
-  

[PATCH] D25309: [clang-move] Support moving multiple classes in one run.

2016-10-07 Thread Eric Liu via cfe-commits
ioeric added inline comments.



Comment at: clang-move/ClangMove.cpp:316
   auto InMovedClass =
-  hasDeclContext(cxxRecordDecl(hasName(FullyQualifiedName)));
+  hasDeclContext(cxxRecordDecl(*InMovedClassNames));
 

ioeric wrote:
> hokein wrote:
> > ioeric wrote:
> > > What would happen if `InMovedClassNames == false`?
> > "InMovedClassNames" should not be false in the matcher. Added an assert.
> I think you should instead exit early if `ClassNames.empty()` or assert not 
> empty.
Test nested comments.



Comment at: clang-move/ClangMove.cpp:291-297
 CCIncludes.push_back("#include \"" + Spec.NewHeader + "\"\n");
 }
 
 void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
-  std::string FullyQualifiedName = "::" + Spec.Name;
+  SmallVector ClassNames;
+  llvm::StringRef(Spec.Names).split(ClassNames, ',');
+  Optional> InMovedClassNames;

Spamming.

Test phabricator.


https://reviews.llvm.org/D25309



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


[libcxxabi] r283531 - Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

2016-10-07 Thread Igor Kudrin via cfe-commits
Author: ikudrin
Date: Fri Oct  7 03:48:28 2016
New Revision: 283531

URL: http://llvm.org/viewvc/llvm-project?rev=283531&view=rev
Log:
Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals 
in case of dynamic memory exhaustion.

Throwing an exception for the first time may lead to call calloc to
allocate memory for __cxa_eh_globals. If the memory pool is exhausted
at that moment, it results in abnormal termination of the program.

This patch addresses the issue by using fallback_malloc in that case.

In this revision, some restrictions were added into the test to not
run it in unsuitable environments.

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


Added:
libcxxabi/trunk/src/fallback_malloc.cpp
libcxxabi/trunk/src/fallback_malloc.h
libcxxabi/trunk/test/test_exception_storage_nodynmem.pass.cpp
Removed:
libcxxabi/trunk/src/fallback_malloc.ipp
Modified:
libcxxabi/trunk/src/CMakeLists.txt
libcxxabi/trunk/src/cxa_exception.cpp
libcxxabi/trunk/src/cxa_exception_storage.cpp
libcxxabi/trunk/test/test_fallback_malloc.pass.cpp

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=283531&r1=283530&r2=283531&view=diff
==
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Fri Oct  7 03:48:28 2016
@@ -12,6 +12,7 @@ set(LIBCXXABI_SOURCES
   cxa_vector.cpp
   cxa_virtual.cpp
   exception.cpp
+  fallback_malloc.cpp
   private_typeinfo.cpp
   stdexcept.cpp
   typeinfo.cpp

Modified: libcxxabi/trunk/src/cxa_exception.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=283531&r1=283530&r2=283531&view=diff
==
--- libcxxabi/trunk/src/cxa_exception.cpp (original)
+++ libcxxabi/trunk/src/cxa_exception.cpp Fri Oct  7 03:48:28 2016
@@ -15,13 +15,10 @@
 #include "cxxabi.h"
 
 #include // for std::terminate
-#include   // for malloc, free
 #include   // for memset
-#ifndef _LIBCXXABI_HAS_NO_THREADS
-#  include   // for fallback_malloc.ipp's mutexes
-#endif
 #include "cxa_exception.hpp"
 #include "cxa_handlers.hpp"
+#include "fallback_malloc.h"
 
 // +---+-+---+
 // | __cxa_exception   | _Unwind_Exception CLNGC++\0 | thrown object |
@@ -104,20 +101,6 @@ static inline  int decrementHandlerCount
 return --exception->handlerCount;
 }
 
-#include "fallback_malloc.ipp"
-
-//  Allocate some memory from _somewhere_
-static void *do_malloc(size_t size) {
-void *ptr = std::malloc(size);
-if (NULL == ptr) // if malloc fails, fall back to emergency stash
-ptr = fallback_malloc(size);
-return ptr;
-}
-
-static void do_free(void *ptr) {
-is_fallback_ptr(ptr) ? fallback_free(ptr) : std::free(ptr);
-}
-
 /*
 If reason isn't _URC_FOREIGN_EXCEPTION_CAUGHT, then the terminateHandler
 stored in exc is called.  Otherwise the exceptionDestructor stored in 
@@ -158,7 +141,8 @@ extern "C" {
 //  user's exception object.
 _LIBCXXABI_FUNC_VIS void *__cxa_allocate_exception(size_t thrown_size) throw() 
{
 size_t actual_size = 
cxa_exception_size_from_exception_thrown_size(thrown_size);
-__cxa_exception* exception_header = 
static_cast<__cxa_exception*>(do_malloc(actual_size));
+__cxa_exception *exception_header =
+static_cast<__cxa_exception *>(__malloc_with_fallback(actual_size));
 if (NULL == exception_header)
 std::terminate();
 std::memset(exception_header, 0, actual_size);
@@ -168,7 +152,7 @@ _LIBCXXABI_FUNC_VIS void *__cxa_allocate
 
 //  Free a __cxa_exception object allocated with __cxa_allocate_exception.
 _LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() {
-do_free(cxa_exception_from_thrown_object(thrown_object));
+__free_with_fallback(cxa_exception_from_thrown_object(thrown_object));
 }
 
 
@@ -177,7 +161,7 @@ _LIBCXXABI_FUNC_VIS void __cxa_free_exce
 //  Otherwise, it will work like __cxa_allocate_exception.
 void * __cxa_allocate_dependent_exception () {
 size_t actual_size = sizeof(__cxa_dependent_exception);
-void *ptr = do_malloc(actual_size);
+void *ptr = __malloc_with_fallback(actual_size);
 if (NULL == ptr)
 std::terminate();
 std::memset(ptr, 0, actual_size);
@@ -188,7 +172,7 @@ void * __cxa_allocate_dependent_exceptio
 //  This function shall free a dependent_exception.
 //  It does not affect the reference count of the primary exception.
 void __cxa_free_dependent_exception (void * dependent_exception) {
-do_free(dependent_exception);
+__free_with_fallback(dependent_exception);
 }
 
 

Modified: libcxxabi/trunk/src/cxa_exception_storage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception_storage.cpp?rev=283531&r1=28

[PATCH] D25309: [clang-move] Support moving multiple classes in one run.

2016-10-07 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283526: [clang-move] Support moving multiple classes in one 
run. (authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D25309?vs=73888&id=73890#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25309

Files:
  clang-tools-extra/trunk/clang-move/ClangMove.cpp
  clang-tools-extra/trunk/clang-move/ClangMove.h
  clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
  clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
  clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.cpp
  clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.h
  clang-tools-extra/trunk/test/clang-move/move-class.cpp
  clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
  clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp

Index: clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
===
--- clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
+++ clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
@@ -0,0 +1,58 @@
+// RUN: mkdir -p %T/clang-move/build
+// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json
+// RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
+// RUN: cd %T/clang-move
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp
+// RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
+// RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s
+// RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
+// RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s
+//
+// CHECK-OLD-TEST-H: namespace c {
+// CHECK-OLD-TEST-H: class NoMove {
+// CHECK-OLD-TEST-H: public:
+// CHECK-OLD-TEST-H:   int f();
+// CHECK-OLD-TEST-H: };
+// CHECK-OLD-TEST-H: } // namespace c
+
+// CHECK-OLD-TEST-CPP: #include "{{.*}}multiple_class_test.h"
+// CHECK-OLD-TEST-CPP: namespace c {
+// CHECK-OLD-TEST-CPP: int NoMove::f() {
+// CHECK-OLD-TEST-CPP:   return 0;
+// CHECK-OLD-TEST-CPP: }
+// CHECK-OLD-TEST-CPP: } // namespace c
+
+// CHECK-NEW-TEST-H: namespace a {
+// CHECK-NEW-TEST-H: class Move1 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: } // namespace a
+// CHECK-NEW-TEST-H: namespace b {
+// CHECK-NEW-TEST-H: class Move2 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: } // namespace b
+// CHECK-NEW-TEST-H: namespace c {
+// CHECK-NEW-TEST-H: class Move3 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: class Move4 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   int f();
+// CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: } // namespace c
+
+// CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h"
+// CHECK-NEW-TEST-CPP: namespace a {
+// CHECK-NEW-TEST-CPP: int Move1::f() { return 0; }
+// CHECK-NEW-TEST-CPP: } // namespace a
+// CHECK-NEW-TEST-CPP: namespace b {
+// CHECK-NEW-TEST-CPP: int Move2::f() { return 0; }
+// CHECK-NEW-TEST-CPP: } // namespace b
+// CHECK-NEW-TEST-CPP: namespace c {
+// CHECK-NEW-TEST-CPP: int Move3::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int Move4::f() { return 0; }
+// CHECK-NEW-TEST-CPP: } // namespace c
Index: clang-tools-extra/trunk/test/clang-move/move-class.cpp
===
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp
@@ -3,15 +3,15 @@
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: touch %T/clang-move/test2.h
 // RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp
+// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}'
 //
 // RUN: cp %S/Inputs/

[PATCH] D17815: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

2016-10-07 Thread Igor Kudrin via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283531: Recommit r282692: [libc++abi] Use fallback_malloc to 
allocate __cxa_eh_globals… (authored by ikudrin).

Changed prior to commit:
  https://reviews.llvm.org/D17815?vs=72951&id=73893#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D17815

Files:
  libcxxabi/trunk/src/CMakeLists.txt
  libcxxabi/trunk/src/cxa_exception.cpp
  libcxxabi/trunk/src/cxa_exception_storage.cpp
  libcxxabi/trunk/src/fallback_malloc.cpp
  libcxxabi/trunk/src/fallback_malloc.h
  libcxxabi/trunk/src/fallback_malloc.ipp
  libcxxabi/trunk/test/test_exception_storage_nodynmem.pass.cpp
  libcxxabi/trunk/test/test_fallback_malloc.pass.cpp

Index: libcxxabi/trunk/src/cxa_exception.cpp
===
--- libcxxabi/trunk/src/cxa_exception.cpp
+++ libcxxabi/trunk/src/cxa_exception.cpp
@@ -15,13 +15,10 @@
 #include "cxxabi.h"
 
 #include // for std::terminate
-#include   // for malloc, free
 #include   // for memset
-#ifndef _LIBCXXABI_HAS_NO_THREADS
-#  include   // for fallback_malloc.ipp's mutexes
-#endif
 #include "cxa_exception.hpp"
 #include "cxa_handlers.hpp"
+#include "fallback_malloc.h"
 
 // +---+-+---+
 // | __cxa_exception   | _Unwind_Exception CLNGC++\0 | thrown object |
@@ -104,20 +101,6 @@
 return --exception->handlerCount;
 }
 
-#include "fallback_malloc.ipp"
-
-//  Allocate some memory from _somewhere_
-static void *do_malloc(size_t size) {
-void *ptr = std::malloc(size);
-if (NULL == ptr) // if malloc fails, fall back to emergency stash
-ptr = fallback_malloc(size);
-return ptr;
-}
-
-static void do_free(void *ptr) {
-is_fallback_ptr(ptr) ? fallback_free(ptr) : std::free(ptr);
-}
-
 /*
 If reason isn't _URC_FOREIGN_EXCEPTION_CAUGHT, then the terminateHandler
 stored in exc is called.  Otherwise the exceptionDestructor stored in 
@@ -158,7 +141,8 @@
 //  user's exception object.
 _LIBCXXABI_FUNC_VIS void *__cxa_allocate_exception(size_t thrown_size) throw() {
 size_t actual_size = cxa_exception_size_from_exception_thrown_size(thrown_size);
-__cxa_exception* exception_header = static_cast<__cxa_exception*>(do_malloc(actual_size));
+__cxa_exception *exception_header =
+static_cast<__cxa_exception *>(__malloc_with_fallback(actual_size));
 if (NULL == exception_header)
 std::terminate();
 std::memset(exception_header, 0, actual_size);
@@ -168,16 +152,16 @@
 
 //  Free a __cxa_exception object allocated with __cxa_allocate_exception.
 _LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() {
-do_free(cxa_exception_from_thrown_object(thrown_object));
+__free_with_fallback(cxa_exception_from_thrown_object(thrown_object));
 }
 
 
 //  This function shall allocate a __cxa_dependent_exception and
 //  return a pointer to it. (Really to the object, not past its' end).
 //  Otherwise, it will work like __cxa_allocate_exception.
 void * __cxa_allocate_dependent_exception () {
 size_t actual_size = sizeof(__cxa_dependent_exception);
-void *ptr = do_malloc(actual_size);
+void *ptr = __malloc_with_fallback(actual_size);
 if (NULL == ptr)
 std::terminate();
 std::memset(ptr, 0, actual_size);
@@ -188,7 +172,7 @@
 //  This function shall free a dependent_exception.
 //  It does not affect the reference count of the primary exception.
 void __cxa_free_dependent_exception (void * dependent_exception) {
-do_free(dependent_exception);
+__free_with_fallback(dependent_exception);
 }
 
 
Index: libcxxabi/trunk/src/fallback_malloc.cpp
===
--- libcxxabi/trunk/src/fallback_malloc.cpp
+++ libcxxabi/trunk/src/fallback_malloc.cpp
@@ -0,0 +1,226 @@
+//=== fallback_malloc.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 "fallback_malloc.h"
+
+#include "config.h"
+
+#include  // for malloc, calloc, free
+#include  // for memset
+
+#ifndef _LIBCXXABI_HAS_NO_THREADS
+#include  // for mutexes
+#endif
+
+//  A small, simple heap manager based (loosely) on
+//  the startup heap manager from FreeBSD, optimized for space.
+//
+//  Manages a fixed-size memory pool, supports malloc and free only.
+//  No support for realloc.
+//
+//  Allocates chunks in multiples of four bytes, with a four byte header
+//  for each chunk. The overhead of each chunk is kept low by keeping pointers
+//  as two byte offsets within the heap, rather than (4 or 8 byte) pointers.
+
+namespace {
+
+// When POSIX threads are not available, make the mu

[PATCH] D25316: [clang-tidy] Fix PR25499: Enhance modernize-use-auto to casts

2016-10-07 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added a comment.

In https://reviews.llvm.org/D25316#563930, @Prazek wrote:

> Please add tests with
>
>   long long p = static_cast(4);
>   
>
> and the same with const at beginning. I remember I had problems with this 
> last time (Type->SourceRange was returning only source range for the first 
> token.


BuiltinTypeLoc only returns the first token:

  SourceRange getLocalSourceRange() const {
return SourceRange(getBuiltinLoc(), getBuiltinLoc());
  }

The existing check fails too:

  -long long *ll = new long long();
  +auto long *ll = new long long();


https://reviews.llvm.org/D25316



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


[clang-tools-extra] r283534 - Fix buildbot error.

2016-10-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Oct  7 04:23:28 2016
New Revision: 283534

URL: http://llvm.org/viewvc/llvm-project?rev=283534&view=rev
Log:
Fix buildbot error.

The error maybe caused by the mixed environment of the two lint tests.
Cleanup the environment before running each test.

Modified:
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp

Modified: clang-tools-extra/trunk/test/clang-move/move-class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-class.cpp?rev=283534&r1=283533&r2=283534&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp Fri Oct  7 04:23:28 
2016
@@ -1,3 +1,4 @@
+// RUN: rm -rf %T/clang-move
 // RUN: mkdir -p %T/clang-move/build
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
 // RUN: cp %S/Inputs/test*  %T/clang-move/

Modified: clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp?rev=283534&r1=283533&r2=283534&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp Fri Oct  
7 04:23:28 2016
@@ -1,3 +1,4 @@
+// RUN: rm -rf %T/clang-move
 // RUN: mkdir -p %T/clang-move/build
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/


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


[PATCH] D25321: Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

2016-10-07 Thread Alex Lorenz via cfe-commits
arphaman updated this revision to Diff 73898.
arphaman marked an inline comment as done.
arphaman added a comment.

The updated patch uses Adrian's suggestion.


Repository:
  rL LLVM

https://reviews.llvm.org/D25321

Files:
  lib/Analysis/ReachableCode.cpp
  test/Sema/warn-unreachable.c


Index: test/Sema/warn-unreachable.c
===
--- test/Sema/warn-unreachable.c
+++ test/Sema/warn-unreachable.c
@@ -396,3 +396,40 @@
   else
 calledFun();
 }
+
+int pr13910_foo(int x) {
+  if (x == 1)
+return 0;
+  else
+return x;
+  __builtin_unreachable(); // expected no warning
+}
+
+int pr13910_bar(int x) {
+  switch (x) {
+  default:
+return x + 1;
+  }
+  pr13910_foo(x); // expected-warning {{code will never be executed}}
+}
+
+int pr13910_bar2(int x) {
+  if (x == 1)
+return 0;
+  else
+return x;
+  pr13910_foo(x);  // expected-warning {{code will never be executed}}
+  __builtin_unreachable(); // expected no warning
+  pr13910_foo(x);  // expected-warning {{code will never be executed}}
+}
+
+void pr13910_noreturn() {
+  raze();
+  __builtin_unreachable(); // expected no warning
+}
+
+void pr13910_assert() {
+  myassert(0 && "unreachable");
+  return;
+  __builtin_unreachable(); // expected no warning
+}
Index: lib/Analysis/ReachableCode.cpp
===
--- lib/Analysis/ReachableCode.cpp
+++ lib/Analysis/ReachableCode.cpp
@@ -58,6 +58,14 @@
   return false;
 }
 
+static bool isBuiltinUnreachable(const Stmt *S) {
+  if (const auto *DRE = dyn_cast(S))
+if (const auto *FDecl = dyn_cast(DRE->getDecl()))
+  return FDecl->getIdentifier() &&
+ FDecl->getBuiltinID() == Builtin::BI__builtin_unreachable;
+  return false;
+}
+
 static bool isDeadReturn(const CFGBlock *B, const Stmt *S) {
   // Look to see if the current control flow ends with a 'return', and see if
   // 'S' is a substatement. The 'return' may not be the last element in the
@@ -574,8 +582,7 @@
 
   if (isa(S)) {
 UK = reachable_code::UK_Break;
-  }
-  else if (isTrivialDoWhile(B, S)) {
+  } else if (isTrivialDoWhile(B, S) || isBuiltinUnreachable(S)) {
 return;
   }
   else if (isDeadReturn(B, S)) {


Index: test/Sema/warn-unreachable.c
===
--- test/Sema/warn-unreachable.c
+++ test/Sema/warn-unreachable.c
@@ -396,3 +396,40 @@
   else
 calledFun();
 }
+
+int pr13910_foo(int x) {
+  if (x == 1)
+return 0;
+  else
+return x;
+  __builtin_unreachable(); // expected no warning
+}
+
+int pr13910_bar(int x) {
+  switch (x) {
+  default:
+return x + 1;
+  }
+  pr13910_foo(x); // expected-warning {{code will never be executed}}
+}
+
+int pr13910_bar2(int x) {
+  if (x == 1)
+return 0;
+  else
+return x;
+  pr13910_foo(x);  // expected-warning {{code will never be executed}}
+  __builtin_unreachable(); // expected no warning
+  pr13910_foo(x);  // expected-warning {{code will never be executed}}
+}
+
+void pr13910_noreturn() {
+  raze();
+  __builtin_unreachable(); // expected no warning
+}
+
+void pr13910_assert() {
+  myassert(0 && "unreachable");
+  return;
+  __builtin_unreachable(); // expected no warning
+}
Index: lib/Analysis/ReachableCode.cpp
===
--- lib/Analysis/ReachableCode.cpp
+++ lib/Analysis/ReachableCode.cpp
@@ -58,6 +58,14 @@
   return false;
 }
 
+static bool isBuiltinUnreachable(const Stmt *S) {
+  if (const auto *DRE = dyn_cast(S))
+if (const auto *FDecl = dyn_cast(DRE->getDecl()))
+  return FDecl->getIdentifier() &&
+ FDecl->getBuiltinID() == Builtin::BI__builtin_unreachable;
+  return false;
+}
+
 static bool isDeadReturn(const CFGBlock *B, const Stmt *S) {
   // Look to see if the current control flow ends with a 'return', and see if
   // 'S' is a substatement. The 'return' may not be the last element in the
@@ -574,8 +582,7 @@
 
   if (isa(S)) {
 UK = reachable_code::UK_Break;
-  }
-  else if (isTrivialDoWhile(B, S)) {
+  } else if (isTrivialDoWhile(B, S) || isBuiltinUnreachable(S)) {
 return;
   }
   else if (isDeadReturn(B, S)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25316: [clang-tidy] Fix PR25499: Enhance modernize-use-auto to casts

2016-10-07 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

In https://reviews.llvm.org/D25316#564217, @malcolm.parsons wrote:

> In https://reviews.llvm.org/D25316#563930, @Prazek wrote:
>
> > Please add tests with
> >
> >   long long p = static_cast(4);
> >   
> >
> > and the same with const at beginning. I remember I had problems with this 
> > last time (Type->SourceRange was returning only source range for the first 
> > token.
>
>
> BuiltinTypeLoc only returns the first token:
>
>   SourceRange getLocalSourceRange() const {
> return SourceRange(getBuiltinLoc(), getBuiltinLoc());
>   }
>   
>
> The existing check fails too:
>
>   -long long *ll = new long long();
>   +auto long *ll = new long long();


Interesting! I remember checking it half year ago, and it was working 
(SourceRange was returning all tokens from first one
to asterisk). I remember there was some small features introduced, like instead 
of
auto p = long long new;
to produce
auto *p = long long new;

Maybe it was introduced in that patch. Anyway I think this have to be fixed 
somehow. Either by playing with lexer, or by fixing sourceRange


https://reviews.llvm.org/D25316



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


[PATCH] D25210: [ARM] Add Cortex-R52 target to CLANG

2016-10-07 Thread Javed Absar via cfe-commits
javed.absar updated this revision to Diff 73896.
javed.absar added a comment.

This patch changes the default cpu for armv8-r from 'generic' to cortex-r52. 
This is also to reflect the equivalent changes made in llvm, based on review 
comments.


https://reviews.llvm.org/D25210

Files:
  lib/Basic/Targets.cpp
  test/Driver/arm-cortex-cpus.c
  test/Preprocessor/arm-target-features.c


Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -9,6 +9,15 @@
 // CHECK-V8A: #define __ARM_FP16_ARGS 1
 // CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
 
+// RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V8R %s
+// CHECK-V8R: #define __ARMEL__ 1
+// CHECK-V8R: #define __ARM_ARCH 8
+// CHECK-V8R: #define __ARM_ARCH_8R__ 1
+// CHECK-V8R: #define __ARM_FEATURE_CRC32 1
+// CHECK-V8R: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
+// CHECK-V8R: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
+// CHECK-V8R: #define __ARM_FP 0xE
+
 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V7 %s
 // CHECK-V7: #define __ARMEL__ 1
 // CHECK-V7: #define __ARM_ARCH 7
Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -146,6 +146,27 @@
 // RUN: %clang -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s
 // CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "cortex-a53"
 
+// RUN: %clang -target armv8r-linux-gnueabi -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// RUN: %clang -target arm -march=armv8r -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// RUN: %clang -target arm -march=armv8-r -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// CHECK-V8R: "-cc1"{{.*}} "-triple" "armv8r-{{.*}} "-target-cpu" "cortex-r52"
+
+// RUN: %clang -target armv8r-linux-gnueabi -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// RUN: %clang -target arm -march=armv8r -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// RUN: %clang -target arm -march=armv8-r -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// CHECK-V8R-BIG: "-cc1"{{.*}} "-triple" "armebv8r-{{.*}} "-target-cpu" 
"cortex-r52"
+
+// RUN: %clang -target armv8r-linux-gnueabi -mthumb -### -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB %s
+// RUN: %clang -target arm -march=armv8r -mthumb -### -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB %s
+// CHECK-V8R-THUMB: "-cc1"{{.*}} "-triple" "thumbv8r-{{.*}} "-target-cpu" 
"cortex-r52"
+// RUN: %clang -target armv8r-linux-gnueabi -mthumb -mbig-endian -### -c %s 
2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
+// RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 
| \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
+// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu
+
 // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target armv8a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
@@ -502,6 +523,9 @@
 // RUN: %clang -target arm -mcpu=exynos-m2 -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r52 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8R %s
+// CHECK-CPUV8R: "-cc1"{{.*}} "-triple" "armv8r-{{.*}}
+
 // RUN: %clang -target arm -mcpu=cortex-a32 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4929,6 +4929,8 @@
   return "8M_BASE";
 case llvm::ARM::AK_ARMV8MMainline:
   return "8M_MAIN";
+case llvm::ARM::AK_ARMV8R:
+  return "8R";
 }
   }
 


Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -9,6 +9,15 @@
 // CHECK-V8A: #define __ARM_FP16_ARGS 1
 // CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
 
+// RUN: %clang -target armv

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

ok. As far as I see it's not trivial to know which ReturnStmt there was when 
CallExitBegin is created. Do you suggest that I move it or that I try to lookup 
the ReturnStmt? I guess it can be looked up by looking in the predecessors in 
the ExplodedGraph?

> Finally, i'm not quite sure why CallExitBegin is at all necessary. I wonder 
> if we could just remove it and jump straight to Bind Return Value, also need 
> to think.

.. unless that is better apprach


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25210: [ARM] Add Cortex-R52 target to CLANG

2016-10-07 Thread James Molloy via cfe-commits
jmolloy added a comment.

Still LGTM.


https://reviews.llvm.org/D25210



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


[PATCH] D25361: [libcxx] Add the missing limits.h header

2016-10-07 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: EricWF, mclow.lists, rsmith.
rmaprath added a subscriber: cfe-commits.

The implementation of [depr.c.headers] in https://reviews.llvm.org/D12747 
introduced the necessary
C headers into libc++. This patch adds one more missing headers: limits.h

We spotted this due to a failing C++03 test [limits_h.pass.cpp] in our libc++
configuration; when the limits.h header is included from a C++ program, it now
bypassed the __config header and went directly into the underlying C library's
limits.h header, which is problematic for us because we use __config header to
configure the underlying C library's behaviour when used from a C++ context.


https://reviews.llvm.org/D25361

Files:
  include/limits.h


Index: include/limits.h
===
--- /dev/null
+++ include/limits.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===--- limits.h 
-===//
+//
+// 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.
+//
+//===--===//
+
+#ifndef _LIBCPP_LIMITS_H
+#define _LIBCPP_LIMITS_H
+
+/*
+limits.h synopsis
+
+Macros:
+
+CHAR_BIT
+SCHAR_MIN
+SCHAR_MAX
+UCHAR_MAX
+CHAR_MIN
+CHAR_MAX
+MB_LEN_MAX
+SHRT_MIN
+SHRT_MAX
+USHRT_MAX
+INT_MIN
+INT_MAX
+UINT_MAX
+LONG_MIN
+LONG_MAX
+ULONG_MAX
+LLONG_MIN   // C99
+LLONG_MAX   // C99
+ULLONG_MAX  // C99
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next 
+
+#endif  // _LIBCPP_LIMITS_H


Index: include/limits.h
===
--- /dev/null
+++ include/limits.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===--- limits.h -===//
+//
+// 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.
+//
+//===--===//
+
+#ifndef _LIBCPP_LIMITS_H
+#define _LIBCPP_LIMITS_H
+
+/*
+limits.h synopsis
+
+Macros:
+
+CHAR_BIT
+SCHAR_MIN
+SCHAR_MAX
+UCHAR_MAX
+CHAR_MIN
+CHAR_MAX
+MB_LEN_MAX
+SHRT_MIN
+SHRT_MAX
+USHRT_MAX
+INT_MIN
+INT_MAX
+UINT_MAX
+LONG_MIN
+LONG_MAX
+ULONG_MAX
+LLONG_MIN   // C99
+LLONG_MAX   // C99
+ULLONG_MAX  // C99
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next 
+
+#endif  // _LIBCPP_LIMITS_H
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D25326#564239, @danielmarjamaki wrote:

> ok. As far as I see it's not trivial to know which ReturnStmt there was when 
> CallExitBegin is created.


We're in `HandleBlockEdge`, just pass down the statement from CFG here?

In https://reviews.llvm.org/D25326#564239, @danielmarjamaki wrote:

> .. unless that is better apprach


It seems to have something to do with separation of duties between CoreEngine 
and ExprEngine. Kind of, CoreEngine explores the CFG, ExprEngine models effects 
of statements, and noticing end of function is CoreEngine's duty, while binding 
the return value is ExprEngine's duty, and CallExitBegin acts like a message 
from CoreEngine to ExprEngine so that they could work together. That's how it 
seems to me, but i'm not sure of the original intention here.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

In https://reviews.llvm.org/D25326#564283, @NoQ wrote:

> In https://reviews.llvm.org/D25326#564239, @danielmarjamaki wrote:
>
> > ok. As far as I see it's not trivial to know which ReturnStmt there was 
> > when CallExitBegin is created.
>
>
> We're in `HandleBlockEdge`, just pass down the statement from CFG here?


I don't directly see how you mean. Code is:

  void CoreEngine::HandleBlockEdge(const BlockEdge &L, ExplodedNode *Pred) {
  
const CFGBlock *Blk = L.getDst();

The Blk->dump() says:

  [B0 (EXIT)]
 Preds (2): B1 B2


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


r283536 - [analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 05:44:09 2016
New Revision: 283536

URL: http://llvm.org/viewvc/llvm-project?rev=283536&view=rev
Log:
[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

Replace SmallVector with a vector of plain pointers.
Would insignificantly increase memory usage.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283536&r1=283535&r2=283536&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Oct  7 
05:44:09 2016
@@ -266,6 +266,9 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;
 
+  /// \sa shouldDisplayNotesAsEvents
+  Optional DisplayNotesAsEvents;
+
   /// A helper function that retrieves option for a given full-qualified
   /// checker name.
   /// Options for checkers can be specified via 'analyzer-config' command-line
@@ -534,6 +537,14 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();
 
+  /// Returns true if the bug reporter should transparently treat extra note
+  /// diagnostic pieces as event diagnostic pieces. Useful when the diagnostic
+  /// consumer doesn't support the extra note pieces.
+  ///
+  /// This is controlled by the 'extra-notes-as-events' option, which defaults
+  /// to false when unset.
+  bool shouldDisplayNotesAsEvents();
+
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283536&r1=283535&r2=283536&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 05:44:09 2016
@@ -67,6 +67,11 @@ public:
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
 
+  // FIXME: We could have used a
+  // SmallVector>
+  // as NoteList, however MSVC 2013 crashes on reading this.
+  typedef SmallVector NoteList;
+
 protected:
   friend class BugReporter;
   friend class BugReportEquivClass;
@@ -82,7 +87,8 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  
+  NoteList Notes;
+
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 
@@ -177,6 +183,18 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
+  /// \brief True when the report has an execution path associated with it.
+  ///
+  /// A report is said to be path-sensitive if it was thrown against a
+  /// particular exploded node in the path-sensitive analysis graph.
+  /// Path-sensitive reports have their intermediate path diagnostics
+  /// auto-generated, perhaps with the help of checker-defined visitors,
+  /// and may contain extra notes.
+  /// Path-insensitive reports consist only of a single warning message
+  /// in a specific location, and perhaps extra notes.
+  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
+  bool isPathSensitive() const { return ErrorNode != nullptr; }
+
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -245,7 +263,26 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-  
+
+  /// Add new item to the list of additional notes that need to be attached to
+  /// this path-insensitive report. If you want to add extra notes to a
+  /// path-sensitive report, you need to use a BugReporterVisitor because it
+  /// allows you to specify where exactly in the auto-generated path diagnostic
+  /// the extra note should appear.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
+ArrayRef Ranges = {}) {
+auto *P = new PathDiagnosticNotePiece(Pos, Msg);
+
+for (const auto &R : Ranges)
+  P->addRange(R);
+
+Notes.push_ba

[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D25326#564291, @danielmarjamaki wrote:

> The Blk->dump() says:
>
>   [B0 (EXIT)]
>  Preds (2): B1 B2
>


What about the source block?


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

In https://reviews.llvm.org/D25326#564291, @danielmarjamaki wrote:

> In https://reviews.llvm.org/D25326#564283, @NoQ wrote:
>
> > In https://reviews.llvm.org/D25326#564239, @danielmarjamaki wrote:
> >
> > > ok. As far as I see it's not trivial to know which ReturnStmt there was 
> > > when CallExitBegin is created.
> >
> >
> > We're in `HandleBlockEdge`, just pass down the statement from CFG here?
>
>
> I don't directly see how you mean. Code is:
>
>   void CoreEngine::HandleBlockEdge(const BlockEdge &L, ExplodedNode *Pred) {
>  
> const CFGBlock *Blk = L.getDst();
>
>
> The Blk->dump() says:
>
>   [B0 (EXIT)]
>  Preds (2): B1 B2
>


Sorry... I think I see.   L.getSrc()  will give me the cfg block I am 
interested in.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


[clang-tools-extra] r283538 - Revert "fix buildbot error" since it is not right fix.

2016-10-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Oct  7 05:59:03 2016
New Revision: 283538

URL: http://llvm.org/viewvc/llvm-project?rev=283538&view=rev
Log:
Revert "fix buildbot error" since it is not right fix.

Modified:
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp

Modified: clang-tools-extra/trunk/test/clang-move/move-class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-class.cpp?rev=283538&r1=283537&r2=283538&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp Fri Oct  7 05:59:03 
2016
@@ -1,4 +1,3 @@
-// RUN: rm -rf %T/clang-move
 // RUN: mkdir -p %T/clang-move/build
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
 // RUN: cp %S/Inputs/test*  %T/clang-move/

Modified: clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp?rev=283538&r1=283537&r2=283538&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp Fri Oct  
7 05:59:03 2016
@@ -1,4 +1,3 @@
-// RUN: rm -rf %T/clang-move
 // RUN: mkdir -p %T/clang-move/build
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/


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


r283537 - Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 05:56:44 2016
New Revision: 283537

URL: http://llvm.org/viewvc/llvm-project?rev=283537&view=rev
Log:
Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

Vector of smart pointers wasn't the thing that caused msvc crash.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283537&r1=283536&r2=283537&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Oct  7 
05:56:44 2016
@@ -266,9 +266,6 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;
 
-  /// \sa shouldDisplayNotesAsEvents
-  Optional DisplayNotesAsEvents;
-
   /// A helper function that retrieves option for a given full-qualified
   /// checker name.
   /// Options for checkers can be specified via 'analyzer-config' command-line
@@ -537,14 +534,6 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();
 
-  /// Returns true if the bug reporter should transparently treat extra note
-  /// diagnostic pieces as event diagnostic pieces. Useful when the diagnostic
-  /// consumer doesn't support the extra note pieces.
-  ///
-  /// This is controlled by the 'extra-notes-as-events' option, which defaults
-  /// to false when unset.
-  bool shouldDisplayNotesAsEvents();
-
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283537&r1=283536&r2=283537&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 05:56:44 2016
@@ -67,11 +67,6 @@ public:
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
 
-  // FIXME: We could have used a
-  // SmallVector>
-  // as NoteList, however MSVC 2013 crashes on reading this.
-  typedef SmallVector NoteList;
-
 protected:
   friend class BugReporter;
   friend class BugReportEquivClass;
@@ -87,8 +82,7 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  NoteList Notes;
-
+  
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 
@@ -183,18 +177,6 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
-  /// \brief True when the report has an execution path associated with it.
-  ///
-  /// A report is said to be path-sensitive if it was thrown against a
-  /// particular exploded node in the path-sensitive analysis graph.
-  /// Path-sensitive reports have their intermediate path diagnostics
-  /// auto-generated, perhaps with the help of checker-defined visitors,
-  /// and may contain extra notes.
-  /// Path-insensitive reports consist only of a single warning message
-  /// in a specific location, and perhaps extra notes.
-  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
-  bool isPathSensitive() const { return ErrorNode != nullptr; }
-
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -263,26 +245,7 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-
-  /// Add new item to the list of additional notes that need to be attached to
-  /// this path-insensitive report. If you want to add extra notes to a
-  /// path-sensitive report, you need to use a BugReporterVisitor because it
-  /// allows you to specify where exactly in the auto-generated path diagnostic
-  /// the extra note should appear.
-  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
-ArrayRef Ranges = {}) {
-auto *P = new PathDiagnosticNotePiece(Pos, Msg);
-
-for (const auto &R : Ranges)
-  P->addRange(R);
-
-Notes.push_back(P);
-  }
-
-  virtual con

r283540 - [analyzer] Re-apply r283092, attempt no.3, in small chunks this time.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 06:26:15 2016
New Revision: 283540

URL: http://llvm.org/viewvc/llvm-project?rev=283540&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.3, in small chunks this time.


Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283540&r1=283539&r2=283540&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 06:26:15 2016
@@ -66,6 +66,7 @@ public:
   typedef SmallVector, 8> VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
+  typedef SmallVector NoteList;
 
 protected:
   friend class BugReporter;
@@ -82,7 +83,8 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  
+  NoteList Notes;
+
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 
@@ -177,6 +179,18 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
+  /// \brief True when the report has an execution path associated with it.
+  ///
+  /// A report is said to be path-sensitive if it was thrown against a
+  /// particular exploded node in the path-sensitive analysis graph.
+  /// Path-sensitive reports have their intermediate path diagnostics
+  /// auto-generated, perhaps with the help of checker-defined visitors,
+  /// and may contain extra notes.
+  /// Path-insensitive reports consist only of a single warning message
+  /// in a specific location, and perhaps extra notes.
+  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
+  bool isPathSensitive() const { return ErrorNode != nullptr; }
+
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -245,7 +259,26 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-  
+
+  /// Add new item to the list of additional notes that need to be attached to
+  /// this path-insensitive report. If you want to add extra notes to a
+  /// path-sensitive report, you need to use a BugReporterVisitor because it
+  /// allows you to specify where exactly in the auto-generated path diagnostic
+  /// the extra note should appear.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
+ArrayRef Ranges = {}) {
+auto *P = new PathDiagnosticNotePiece(Pos, Msg);
+
+for (const auto &R : Ranges)
+  P->addRange(R);
+
+Notes.push_back(P);
+  }
+
+  virtual const NoteList &getNotes() {
+return Notes;
+  }
+
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 


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


r283541 - Revert "[analyzer] Re-apply r283092, attempt no.3, in small chunks this time."

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 06:29:32 2016
New Revision: 283541

URL: http://llvm.org/viewvc/llvm-project?rev=283541&view=rev
Log:
Revert "[analyzer] Re-apply r283092, attempt no.3, in small chunks this time."

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283541&r1=283540&r2=283541&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 06:29:32 2016
@@ -66,7 +66,6 @@ public:
   typedef SmallVector, 8> VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
-  typedef SmallVector NoteList;
 
 protected:
   friend class BugReporter;
@@ -83,8 +82,7 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  NoteList Notes;
-
+  
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 
@@ -179,18 +177,6 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
-  /// \brief True when the report has an execution path associated with it.
-  ///
-  /// A report is said to be path-sensitive if it was thrown against a
-  /// particular exploded node in the path-sensitive analysis graph.
-  /// Path-sensitive reports have their intermediate path diagnostics
-  /// auto-generated, perhaps with the help of checker-defined visitors,
-  /// and may contain extra notes.
-  /// Path-insensitive reports consist only of a single warning message
-  /// in a specific location, and perhaps extra notes.
-  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
-  bool isPathSensitive() const { return ErrorNode != nullptr; }
-
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -259,26 +245,7 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-
-  /// Add new item to the list of additional notes that need to be attached to
-  /// this path-insensitive report. If you want to add extra notes to a
-  /// path-sensitive report, you need to use a BugReporterVisitor because it
-  /// allows you to specify where exactly in the auto-generated path diagnostic
-  /// the extra note should appear.
-  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
-ArrayRef Ranges = {}) {
-auto *P = new PathDiagnosticNotePiece(Pos, Msg);
-
-for (const auto &R : Ranges)
-  P->addRange(R);
-
-Notes.push_back(P);
-  }
-
-  virtual const NoteList &getNotes() {
-return Notes;
-  }
-
+  
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 


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


[PATCH] D25363: Store a SourceRange for multi-token builtin types

2016-10-07 Thread Malcolm Parsons via cfe-commits
malcolm.parsons created this revision.
malcolm.parsons added a reviewer: Prazek.
malcolm.parsons added a subscriber: cfe-commits.

clang-tidy's modernize-use-auto check uses the SourceRange of a
TypeLoc when replacing the type with auto.
This was producing the wrong result for multi-token builtin types
like long long:

-long long *ll = new long long();
+auto long *ll = new long long();


https://reviews.llvm.org/D25363

Files:
  include/clang/AST/TypeLoc.h
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaType.cpp


Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -4920,10 +4920,10 @@
 // Try to have a meaningful source location.
 if (TL.getWrittenSignSpec() != TSS_unspecified)
   // Sign spec loc overrides the others (e.g., 'unsigned long').
-  TL.setBuiltinLoc(DS.getTypeSpecSignLoc());
+  TL.setBuiltinLocStart(DS.getTypeSpecSignLoc());
 else if (TL.getWrittenWidthSpec() != TSW_unspecified)
   // Width spec loc overrides type spec loc (e.g., 'short int').
-  TL.setBuiltinLoc(DS.getTypeSpecWidthLoc());
+  TL.setBuiltinLocStart(DS.getTypeSpecWidthLoc());
   }
 }
 void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
Index: lib/Sema/DeclSpec.cpp
===
--- lib/Sema/DeclSpec.cpp
+++ lib/Sema/DeclSpec.cpp
@@ -618,6 +618,8 @@
   else if (W != TSW_longlong || TypeSpecWidth != TSW_long)
 return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID);
   TypeSpecWidth = W;
+  // Remember location of the last 'long'
+  TSTLoc = Loc;
   return false;
 }
 
Index: include/clang/AST/TypeLoc.h
===
--- include/clang/AST/TypeLoc.h
+++ include/clang/AST/TypeLoc.h
@@ -510,7 +510,7 @@
 
 
 struct BuiltinLocInfo {
-  SourceLocation BuiltinLoc;
+  SourceRange BuiltinRange;
 };
 
 /// \brief Wrapper for source info for builtin types.
@@ -520,10 +520,17 @@
   BuiltinLocInfo> {
 public:
   SourceLocation getBuiltinLoc() const {
-return getLocalData()->BuiltinLoc;
+return getLocalData()->BuiltinRange.getBegin();
   }
   void setBuiltinLoc(SourceLocation Loc) {
-getLocalData()->BuiltinLoc = Loc;
+getLocalData()->BuiltinRange = {Loc, Loc};
+  }
+  void setBuiltinLocStart(SourceLocation Loc) {
+if (getLocalData()->BuiltinRange.getEnd().isValid()) {
+  getLocalData()->BuiltinRange.setBegin(Loc);
+} else {
+  setBuiltinLoc(Loc);
+}
   }
 
   SourceLocation getNameLoc() const { return getBuiltinLoc(); }
@@ -552,7 +559,7 @@
   }
 
   SourceRange getLocalSourceRange() const {
-return SourceRange(getBuiltinLoc(), getBuiltinLoc());
+return getLocalData()->BuiltinRange;
   }
 
   TypeSpecifierSign getWrittenSignSpec() const {


Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -4920,10 +4920,10 @@
 // Try to have a meaningful source location.
 if (TL.getWrittenSignSpec() != TSS_unspecified)
   // Sign spec loc overrides the others (e.g., 'unsigned long').
-  TL.setBuiltinLoc(DS.getTypeSpecSignLoc());
+  TL.setBuiltinLocStart(DS.getTypeSpecSignLoc());
 else if (TL.getWrittenWidthSpec() != TSW_unspecified)
   // Width spec loc overrides type spec loc (e.g., 'short int').
-  TL.setBuiltinLoc(DS.getTypeSpecWidthLoc());
+  TL.setBuiltinLocStart(DS.getTypeSpecWidthLoc());
   }
 }
 void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
Index: lib/Sema/DeclSpec.cpp
===
--- lib/Sema/DeclSpec.cpp
+++ lib/Sema/DeclSpec.cpp
@@ -618,6 +618,8 @@
   else if (W != TSW_longlong || TypeSpecWidth != TSW_long)
 return BadSpecifier(W, (TSW)TypeSpecWidth, PrevSpec, DiagID);
   TypeSpecWidth = W;
+  // Remember location of the last 'long'
+  TSTLoc = Loc;
   return false;
 }
 
Index: include/clang/AST/TypeLoc.h
===
--- include/clang/AST/TypeLoc.h
+++ include/clang/AST/TypeLoc.h
@@ -510,7 +510,7 @@
 
 
 struct BuiltinLocInfo {
-  SourceLocation BuiltinLoc;
+  SourceRange BuiltinRange;
 };
 
 /// \brief Wrapper for source info for builtin types.
@@ -520,10 +520,17 @@
   BuiltinLocInfo> {
 public:
   SourceLocation getBuiltinLoc() const {
-return getLocalData()->BuiltinLoc;
+return getLocalData()->BuiltinRange.getBegin();
   }
   void setBuiltinLoc(SourceLocation Loc) {
-getLocalData()->BuiltinLoc = Loc;
+getLocalData()->BuiltinRange = {Loc, Loc};
+  }
+  void setBuiltinLocStart(SourceLocation Loc) {
+if (getLocalData()->BuiltinRange.getEnd().isValid()) {
+  getLocalData()->BuiltinRange.setBegin(Loc);
+} e

[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-07 Thread Steve O'Brien via cfe-commits
elsteveogrande updated this revision to Diff 73916.
elsteveogrande added a comment.

Dropped escaping function, adds logic to this diff which isn't 100% necessary 
at this time.  See updated description, under test plan, for details.  The 
output already does hint at the path which was used to resolve that include.


https://reviews.llvm.org/D25153

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/PreprocessorOutputOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/PrintPreprocessedOutput.cpp
  test/Preprocessor/dump_import.h
  test/Preprocessor/dump_import.m
  test/Preprocessor/dump_include.c
  test/Preprocessor/dump_include.h

Index: test/Preprocessor/dump_include.h
===
--- /dev/null
+++ test/Preprocessor/dump_include.h
@@ -0,0 +1,2 @@
+#pragma once
+#define DUMP_INCLUDE_TESTVAL 1
Index: test/Preprocessor/dump_include.c
===
--- /dev/null
+++ test/Preprocessor/dump_include.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -w -E -dI -isystem %S %s -o - | grep '^#include *
+#include "dump_include.h"
+#include_next "dump_include.h"
Index: test/Preprocessor/dump_import.m
===
--- /dev/null
+++ test/Preprocessor/dump_import.m
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -E -dI %s -o - | grep '^#import'
+
+// See also `dump_include.c` which tests other inclusion cases with `-dI`.
+
+#import "dump_import.h"
Index: test/Preprocessor/dump_import.h
===
--- /dev/null
+++ test/Preprocessor/dump_import.h
@@ -0,0 +1 @@
+#define DUMP_IMPORT_TESTVAL 1
Index: lib/Frontend/PrintPreprocessedOutput.cpp
===
--- lib/Frontend/PrintPreprocessedOutput.cpp
+++ lib/Frontend/PrintPreprocessedOutput.cpp
@@ -93,13 +93,16 @@
   bool Initialized;
   bool DisableLineMarkers;
   bool DumpDefines;
+  bool DumpIncludeDirectives;
   bool UseLineDirectives;
   bool IsFirstFileEntered;
 public:
   PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers,
-   bool defines, bool UseLineDirectives)
+   bool defines, bool DumpIncludeDirectives,
+   bool UseLineDirectives)
   : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os),
 DisableLineMarkers(lineMarkers), DumpDefines(defines),
+DumpIncludeDirectives(DumpIncludeDirectives),
 UseLineDirectives(UseLineDirectives) {
 CurLine = 0;
 CurFilename += "";
@@ -320,20 +323,20 @@
   StringRef SearchPath,
   StringRef RelativePath,
   const Module *Imported) {
-  // When preprocessing, turn implicit imports into @imports.
-  // FIXME: This is a stop-gap until a more comprehensive "preprocessing with
-  // modules" solution is introduced.
   if (Imported) {
+// When preprocessing, turn implicit imports into @imports.
+// FIXME: This is a stop-gap until a more comprehensive "preprocessing with
+// modules" solution is introduced.
 startNewLineIfNeeded();
 MoveToLine(HashLoc);
 if (PP.getLangOpts().ObjC2) {
   OS << "@import " << Imported->getFullModuleName() << ";"
  << " /* clang -E: implicit import for \"" << File->getName()
  << "\" */";
 } else {
-  // FIXME: Preseve whether this was a
-  // #include/#include_next/#include_macros/#import.
-  OS << "#include "
+  const std::string TokenText = PP.getSpelling(IncludeTok);
+  assert(!TokenText.empty());
+  OS << "#" << TokenText << " "
  << (IsAngled ? '<' : '"')
  << FileName
  << (IsAngled ? '>' : '"')
@@ -344,6 +347,18 @@
 // line immediately.
 EmittedTokensOnThisLine = true;
 startNewLineIfNeeded();
+  } else {
+// Not a module import; it's a more vanilla inclusion of some file using one
+// of: #include, #import, #include_next, #include_macros.
+if (DumpIncludeDirectives) {
+  const std::string TokenText = PP.getSpelling(IncludeTok);
+  assert(!TokenText.empty());
+  OS << "#" << TokenText << " "
+ << (IsAngled ? '<' : '"') << FileName << (IsAngled ? '>' : '"')
+ << " /* clang -E -dI */";
+  setEmittedDirectiveOnThisLine();
+  startNewLineIfNeeded();
+}
   }
 }
 
@@ -751,7 +766,8 @@
   PP.SetCommentRetentionState(Opts.ShowComments, Opts.ShowMacroComments);
 
   PrintPPOutputPPCallbacks *Callbacks = new PrintPPOutputPPCallbacks(
-  PP, *OS, !Opts.ShowLineMarkers, Opts.ShowMacros, Opts.UseLineDirectives);
+  PP, *OS, !Opts.ShowLineMarkers, Opts.ShowMacros,
+  Opts.ShowIncludeDirectives, Opts.UseLineDirectives);
 
   // Expand macros in pragmas with -fms-extensions.  The assumption is that
 

[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-07 Thread Steve O'Brien via cfe-commits
elsteveogrande updated this revision to Diff 73917.
elsteveogrande updated the summary for this revision.
elsteveogrande added a comment.

update description w/ `arc diff --verbatim`


https://reviews.llvm.org/D25153

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/PreprocessorOutputOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/PrintPreprocessedOutput.cpp
  test/Preprocessor/dump_import.h
  test/Preprocessor/dump_import.m
  test/Preprocessor/dump_include.c
  test/Preprocessor/dump_include.h

Index: test/Preprocessor/dump_include.h
===
--- /dev/null
+++ test/Preprocessor/dump_include.h
@@ -0,0 +1,2 @@
+#pragma once
+#define DUMP_INCLUDE_TESTVAL 1
Index: test/Preprocessor/dump_include.c
===
--- /dev/null
+++ test/Preprocessor/dump_include.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -w -E -dI -isystem %S %s -o - | grep '^#include *
+#include "dump_include.h"
+#include_next "dump_include.h"
Index: test/Preprocessor/dump_import.m
===
--- /dev/null
+++ test/Preprocessor/dump_import.m
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -E -dI %s -o - | grep '^#import'
+
+// See also `dump_include.c` which tests other inclusion cases with `-dI`.
+
+#import "dump_import.h"
Index: test/Preprocessor/dump_import.h
===
--- /dev/null
+++ test/Preprocessor/dump_import.h
@@ -0,0 +1 @@
+#define DUMP_IMPORT_TESTVAL 1
Index: lib/Frontend/PrintPreprocessedOutput.cpp
===
--- lib/Frontend/PrintPreprocessedOutput.cpp
+++ lib/Frontend/PrintPreprocessedOutput.cpp
@@ -93,13 +93,16 @@
   bool Initialized;
   bool DisableLineMarkers;
   bool DumpDefines;
+  bool DumpIncludeDirectives;
   bool UseLineDirectives;
   bool IsFirstFileEntered;
 public:
   PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers,
-   bool defines, bool UseLineDirectives)
+   bool defines, bool DumpIncludeDirectives,
+   bool UseLineDirectives)
   : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os),
 DisableLineMarkers(lineMarkers), DumpDefines(defines),
+DumpIncludeDirectives(DumpIncludeDirectives),
 UseLineDirectives(UseLineDirectives) {
 CurLine = 0;
 CurFilename += "";
@@ -320,20 +323,20 @@
   StringRef SearchPath,
   StringRef RelativePath,
   const Module *Imported) {
-  // When preprocessing, turn implicit imports into @imports.
-  // FIXME: This is a stop-gap until a more comprehensive "preprocessing with
-  // modules" solution is introduced.
   if (Imported) {
+// When preprocessing, turn implicit imports into @imports.
+// FIXME: This is a stop-gap until a more comprehensive "preprocessing with
+// modules" solution is introduced.
 startNewLineIfNeeded();
 MoveToLine(HashLoc);
 if (PP.getLangOpts().ObjC2) {
   OS << "@import " << Imported->getFullModuleName() << ";"
  << " /* clang -E: implicit import for \"" << File->getName()
  << "\" */";
 } else {
-  // FIXME: Preseve whether this was a
-  // #include/#include_next/#include_macros/#import.
-  OS << "#include "
+  const std::string TokenText = PP.getSpelling(IncludeTok);
+  assert(!TokenText.empty());
+  OS << "#" << TokenText << " "
  << (IsAngled ? '<' : '"')
  << FileName
  << (IsAngled ? '>' : '"')
@@ -344,6 +347,18 @@
 // line immediately.
 EmittedTokensOnThisLine = true;
 startNewLineIfNeeded();
+  } else {
+// Not a module import; it's a more vanilla inclusion of some file using one
+// of: #include, #import, #include_next, #include_macros.
+if (DumpIncludeDirectives) {
+  const std::string TokenText = PP.getSpelling(IncludeTok);
+  assert(!TokenText.empty());
+  OS << "#" << TokenText << " "
+ << (IsAngled ? '<' : '"') << FileName << (IsAngled ? '>' : '"')
+ << " /* clang -E -dI */";
+  setEmittedDirectiveOnThisLine();
+  startNewLineIfNeeded();
+}
   }
 }
 
@@ -751,7 +766,8 @@
   PP.SetCommentRetentionState(Opts.ShowComments, Opts.ShowMacroComments);
 
   PrintPPOutputPPCallbacks *Callbacks = new PrintPPOutputPPCallbacks(
-  PP, *OS, !Opts.ShowLineMarkers, Opts.ShowMacros, Opts.UseLineDirectives);
+  PP, *OS, !Opts.ShowLineMarkers, Opts.ShowMacros,
+  Opts.ShowIncludeDirectives, Opts.UseLineDirectives);
 
   // Expand macros in pragmas with -fms-extensions.  The assumption is that
   // the majority of pragmas in such a file will be Microsoft pragmas.
Index: lib/Frontend/CompilerInvocation.cpp

[PATCH] D25316: [clang-tidy] Fix PR25499: Enhance modernize-use-auto to casts

2016-10-07 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 73918.
malcolm.parsons added a comment.

Add more tests.


https://reviews.llvm.org/D25316

Files:
  clang-tidy/modernize/UseAutoCheck.cpp
  clang-tidy/modernize/UseAutoCheck.h
  docs/clang-tidy/checks/modernize-use-auto.rst
  test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
  test/clang-tidy/modernize-use-auto-cast.cpp
  test/clang-tidy/modernize-use-auto-new.cpp

Index: test/clang-tidy/modernize-use-auto-new.cpp
===
--- test/clang-tidy/modernize-use-auto-new.cpp
+++ test/clang-tidy/modernize-use-auto-new.cpp
@@ -15,6 +15,10 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use auto when initializing with new
   // CHECK-FIXES: static auto *a_static = new MyType();
 
+  long long *ll = new long long();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
+  // CHECK-FIXES: auto *ll = new long long();
+
   MyType *derived = new MyDerivedType();
 
   void *vd = new MyType();
Index: test/clang-tidy/modernize-use-auto-cast.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-auto-cast.cpp
@@ -0,0 +1,113 @@
+// RUN: %check_clang_tidy %s modernize-use-auto %t -- -- \
+// RUN:   -std=c++11 -I %S/Inputs/modernize-use-auto
+
+struct A {
+  virtual ~A() {}
+};
+
+struct B : public A {};
+
+struct C {};
+
+void f_static_cast() {
+  long l = 1;
+  int i1 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto i1 = static_cast(l);
+
+  const int i2 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto i2 = static_cast(l);
+
+  long long ll = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ll = static_cast(l);
+  unsigned long long ull = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ull = static_cast(l);
+  unsigned int ui = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ui = static_cast(l);
+  long double ld = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ld = static_cast(l);
+
+  A *a = new B();
+  B *b1 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *b1 = static_cast(a);
+
+  B *const b2 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *const b2 = static_cast(a);
+
+  const B *b3 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto *b3 = static_cast(a);
+
+  B &b4 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b4 = static_cast(*a);
+
+  const B &b5 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto &b5 = static_cast(*a);
+  
+  // Don't warn when auto is already being used.
+  auto i3 = static_cast(l);
+  auto *b6 = static_cast(a);
+  auto &b7 = static_cast(*a);
+}
+
+void f_dynamic_cast() {
+  A *a = new B();
+  B *b1 = dynamic_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *b1 = dynamic_cast(a);
+
+  B &b2 = dynamic_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b2 = dynamic_cast(*a);
+}
+
+void f_reinterpret_cast() {
+  auto *a = new A();
+  C *c1 = reinterpret_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *c1 = reinterpret_cast(a);
+
+  C &c2 = reinterpret_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &c2 = reinterpret_cast(*a);
+}
+
+void f_const_cast() {
+  const A *a1 = new A();
+  A *a2 = const_cast(a1);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK

Re: [clang-tools-extra] r283534 - Fix buildbot error.

2016-10-07 Thread Renato Golin via cfe-commits
On 7 October 2016 at 10:23, Haojian Wu via cfe-commits
 wrote:
> Author: hokein
> Date: Fri Oct  7 04:23:28 2016
> New Revision: 283534
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283534&view=rev
> Log:
> Fix buildbot error.
>
> The error maybe caused by the mixed environment of the two lint tests.
> Cleanup the environment before running each test.

Hi,

Can you revert all changes and test it again on your machine before
pushing it upstream?

Your changes and reverts are really upsetting all our buildbots and
making them completely unstable.

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


r283543 - [ARM]: Add Cortex-R52 target

2016-10-07 Thread Javed Absar via cfe-commits
Author: javed.absar
Date: Fri Oct  7 07:08:41 2016
New Revision: 283543

URL: http://llvm.org/viewvc/llvm-project?rev=283543&view=rev
Log:
[ARM]: Add Cortex-R52 target

This patch adds Cortex-R52, the new ARM real-time processor.
Cortex-R52 implements the ARMv8-R architecture.


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=283543&r1=283542&r2=283543&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Oct  7 07:08:41 2016
@@ -4929,6 +4929,8 @@ class ARMTargetInfo : public TargetInfo
   return "8M_BASE";
 case llvm::ARM::AK_ARMV8MMainline:
   return "8M_MAIN";
+case llvm::ARM::AK_ARMV8R:
+  return "8R";
 }
   }
 

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=283543&r1=283542&r2=283543&view=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Fri Oct  7 07:08:41 2016
@@ -146,6 +146,27 @@
 // RUN: %clang -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### 
-c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s
 // CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "cortex-a53"
 
+// RUN: %clang -target armv8r-linux-gnueabi -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// RUN: %clang -target arm -march=armv8r -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// RUN: %clang -target arm -march=armv8-r -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8R %s
+// CHECK-V8R: "-cc1"{{.*}} "-triple" "armv8r-{{.*}} "-target-cpu" "cortex-r52"
+
+// RUN: %clang -target armv8r-linux-gnueabi -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// RUN: %clang -target arm -march=armv8r -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// RUN: %clang -target arm -march=armv8-r -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8R-BIG %s
+// CHECK-V8R-BIG: "-cc1"{{.*}} "-triple" "armebv8r-{{.*}} "-target-cpu" 
"cortex-r52"
+
+// RUN: %clang -target armv8r-linux-gnueabi -mthumb -### -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB %s
+// RUN: %clang -target arm -march=armv8r -mthumb -### -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB %s
+// CHECK-V8R-THUMB: "-cc1"{{.*}} "-triple" "thumbv8r-{{.*}} "-target-cpu" 
"cortex-r52"
+// RUN: %clang -target armv8r-linux-gnueabi -mthumb -mbig-endian -### -c %s 
2>&1 | \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
+// RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 
| \
+// RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
+// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu
+
 // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target armv8a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
@@ -502,6 +523,9 @@
 // RUN: %clang -target arm -mcpu=exynos-m2 -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-CPUV8A %s
 // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r52 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8R %s
+// CHECK-CPUV8R: "-cc1"{{.*}} "-triple" "armv8r-{{.*}}
+
 // RUN: %clang -target arm -mcpu=cortex-a32 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s
 // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s

Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=283543&r1=283542&r2=283543&view=diff
==
--- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
+++ cfe/trunk/test/Preprocessor/arm-target-features.c Fri Oct  7 07:08:41 2016
@@ -9,6 +9,15 @@
 // CHECK-V8A: #define __ARM_FP16_ARGS 1
 // CHECK-V8A: #define __ARM_FP16_FORMAT_IEEE 1
 
+// RUN: %clang -target armv8r-none-linux-gnu -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V8R %s
+// CHECK-V8R: #define __ARMEL__ 1
+// CHECK-V8R: #define __ARM_ARCH 8
+// CHECK-V8R: #define __ARM_ARCH_8R__ 1
+// CHECK-V8R: #define __ARM_FEATURE_

[clang-tools-extra] r283545 - [clang-move] Simplify lint tests

2016-10-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Oct  7 07:35:37 2016
New Revision: 283545

URL: http://llvm.org/viewvc/llvm-project?rev=283545&view=rev
Log:
[clang-move] Simplify lint tests

No need to use compilation database.

Removed:
clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
Modified:
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp

Removed: clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json?rev=283544&view=auto
==
--- clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json 
(original)
+++ clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json 
(removed)
@@ -1,12 +0,0 @@
-[
-{
-  "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/test.cpp",
-  "file": "$test_dir/test.cpp"
-},
-{
-  "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/multiple_class_test.cpp",
-  "file": "$test_dir/multiple_class_test.cpp"
-}
-]

Modified: clang-tools-extra/trunk/test/clang-move/move-class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-class.cpp?rev=283545&r1=283544&r2=283545&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp Fri Oct  7 07:35:37 
2016
@@ -1,9 +1,8 @@
-// RUN: mkdir -p %T/clang-move/build
-// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
+// RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: touch %T/clang-move/test2.h
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp 
-old_header=../clang-move/test.h %T/clang-move/test.cpp
+// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp 
-old_header=../clang-move/test.h %T/clang-move/test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp 
-check-prefix=CHECK-OLD-TEST-CPP %s
@@ -11,7 +10,7 @@
 //
 // RUN: cp %S/Inputs/test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp 
-old_header=%T/clang-move/test.h %T/clang-move/test.cpp
+// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp 
-old_header=%T/clang-move/test.h %T/clang-move/test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp 
-check-prefix=CHECK-OLD-TEST-CPP %s

Modified: clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp?rev=283545&r1=283544&r2=283545&view=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp Fri Oct  
7 07:35:37 2016
@@ -1,8 +1,7 @@
-// RUN: mkdir -p %T/clang-move/build
-// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
+// RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" 
-new_cc=%T/clang-move/new_multiple_class_test.cpp 
-new_header=%T/clang-move/new_multiple_class_test.h 
-old_cc=%T/clang-move/multiple_class_test.cpp 
-old_header=../clang-move/multiple_class_test.h 
%T/clang-move/multiple_class_test.cpp
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" 
-new_cc=%T/clang-move/new_multiple_class_test.cpp 
-new_header=%T/clang-move/new_multiple_class_test.h 
-old_cc=%T/clang-move/multiple_class_test.cpp 
-old_header=../clang-move/multiple_class_test.h 
%T/clang-move/multiple_class_test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCh

r283549 - Wdocumentation fix

2016-10-07 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Oct  7 08:25:41 2016
New Revision: 283549

URL: http://llvm.org/viewvc/llvm-project?rev=283549&view=rev
Log:
Wdocumentation fix

Modified:
cfe/trunk/include/clang/Sema/Sema.h

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283549&r1=283548&r2=283549&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct  7 08:25:41 2016
@@ -8837,16 +8837,16 @@ public:
 
   /// Check assignment constraints for an assignment of RHS to LHSType.
   ///
-  /// \brief LHSType The destination type for the assignment.
-  /// \brief RHS The source expression for the assignment.
-  /// \brief Diagnose If \c true, diagnostics may be produced when checking
+  /// \param LHSType The destination type for the assignment.
+  /// \param RHS The source expression for the assignment.
+  /// \param Diagnose If \c true, diagnostics may be produced when checking
   ///for assignability. If a diagnostic is produced, \p RHS will be
   ///set to ExprError(). Note that this function may still return
   ///without producing a diagnostic, even for an invalid assignment.
-  /// \brief DiagnoseCFAudited If \c true, the target is a function parameter
+  /// \param DiagnoseCFAudited If \c true, the target is a function parameter
   ///in an audited Core Foundation API and does not need to be checked
   ///for ARC retain issues.
-  /// \brief ConvertRHS If \c true, \p RHS will be updated to model the
+  /// \param ConvertRHS If \c true, \p RHS will be updated to model the
   ///conversions necessary to perform the assignment. If \c false,
   ///\p Diagnose must also be \c false.
   AssignConvertType CheckSingleAssignmentConstraints(


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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki removed rL LLVM as the repository for this revision.
danielmarjamaki updated this revision to Diff 73926.
danielmarjamaki added a comment.

Refactoring.


https://reviews.llvm.org/D25326

Files:
  include/clang/Analysis/ProgramPoint.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/inlining/InlineObjCClassMethod.m
  test/Analysis/unreachable-code-path.c

Index: test/Analysis/unreachable-code-path.c
===
--- test/Analysis/unreachable-code-path.c
+++ test/Analysis/unreachable-code-path.c
@@ -194,3 +194,15 @@
 break;
   }
 }
+
+// Don't merge return nodes in ExplodedGraph unless they are same.
+extern int table[];
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;
+  return 0;
+}
+void test13(int i) {
+  int x = inlineFunction(i);
+  x && x < 10; // no-warning
+}
Index: test/Analysis/inlining/InlineObjCClassMethod.m
===
--- test/Analysis/inlining/InlineObjCClassMethod.m
+++ test/Analysis/inlining/InlineObjCClassMethod.m
@@ -174,12 +174,12 @@
 @implementation MyClassSelf
 + (int)testClassMethodByKnownVarDecl {
   int y = [MyParentSelf testSelf];
-  return 5/y; // Should warn here.
+  return 5/y; // expected-warning{{Division by zero}}
 }
 @end
 int foo2() {
   int y = [MyParentSelf testSelf];
-  return 5/y; // Should warn here.
+  return 5/y; // expected-warning{{Division by zero}}
 }
 
 // TODO: We do not inline 'getNum' in the following case, where the value of 
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1766,7 +1766,8 @@
 /// ProcessEndPath - Called by CoreEngine.  Used to generate end-of-path
 ///  nodes when the control reaches the end of a function.
 void ExprEngine::processEndOfFunction(NodeBuilderContext& BC,
-  ExplodedNode *Pred) {
+  ExplodedNode *Pred,
+  const ReturnStmt *RS) {
   // FIXME: Assert that stackFrameDoesNotContainInitializedTemporaries(*Pred)).
   // We currently cannot enable this assert, as lifetime extended temporaries
   // are not modelled correctly.
@@ -1788,7 +1789,7 @@
 getCheckerManager().runCheckersForEndFunction(BC, Dst, Pred, *this);
   }
 
-  Engine.enqueueEndOfFunction(Dst);
+  Engine.enqueueEndOfFunction(Dst,RS);
 }
 
 /// ProcessSwitch - Called by CoreEngine.  Used to generate successor
Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -309,8 +309,19 @@
 assert (L.getLocationContext()->getCFG()->getExit().size() == 0
 && "EXIT block cannot contain Stmts.");
 
+// Get return statement..
+const ReturnStmt *RS = nullptr;
+if (!L.getSrc()->empty()) {
+  if (Optional LastStmt = L.getSrc()->back().getAs()) {
+if (RS = dyn_cast(LastStmt->getStmt())) {
+  if (!RS->getRetValue())
+RS = nullptr;
+}
+  }
+}
+
 // Process the final state transition.
-SubEng.processEndOfFunction(BuilderCtx, Pred);
+SubEng.processEndOfFunction(BuilderCtx, Pred, RS);
 
 // This path is done. Don't enqueue any more nodes.
 return;
@@ -589,13 +600,14 @@
 WList->enqueue(Succ, Block, Idx+1);
 }
 
-ExplodedNode *CoreEngine::generateCallExitBeginNode(ExplodedNode *N) {
+ExplodedNode *CoreEngine::generateCallExitBeginNode(ExplodedNode *N,
+const ReturnStmt *RS) {
   // Create a CallExitBegin node and enqueue it.
   const StackFrameContext *LocCtx
  = cast(N->getLocationContext());
 
   // Use the callee location context.
-  CallExitBegin Loc(LocCtx);
+  CallExitBegin Loc(LocCtx,RS);
 
   bool isNew;
   ExplodedNode *Node = G.getNode(Loc, N->getState(), false, &isNew);
@@ -619,12 +631,12 @@
   }
 }
 
-void CoreEngine::enqueueEndOfFunction(ExplodedNodeSet &Set) {
+void CoreEngine::enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS) {
   for (ExplodedNodeSet::iterator I = Set.begin(), E = Set.end(); I != E; ++I) {
 ExplodedNode *N = *I;
 // If we are in an inlined call, generate CallExitBegin node.
 if (N->getLocationContext()->getParent()) {
-  N = generateCallExitBeginNode(N);
+  N = generateCallExitBeginNode(N,RS);
   if (N)
 WList->enqueue(N);
 } else {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h

[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: ioeric.
hokein added a subscriber: cfe-commits.

- When moving an outermost enclosing class, all its nested classes should also 
be moved together.
- Add a test for not moving nested class.


https://reviews.llvm.org/D25369

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/multiple_class_test.cpp
  test/clang-move/Inputs/multiple_class_test.h
  test/clang-move/move-multiple-classes.cpp

Index: test/clang-move/move-multiple-classes.cpp
===
--- test/clang-move/move-multiple-classes.cpp
+++ test/clang-move/move-multiple-classes.cpp
@@ -1,12 +1,15 @@
 // RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
+// RUN: clang-move -names="c::EnclosingMove5::Nested" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h -dump_result %T/clang-move/multiple_class_test.cpp -- | FileCheck %s -check-prefix=CHECK-EMPTY
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4,c::EnclosingMove5" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s
 //
+// CHECK-EMPTY: [{{[[:space:]]*}}]
+//
 // CHECK-OLD-TEST-H: namespace c {
 // CHECK-OLD-TEST-H: class NoMove {
 // CHECK-OLD-TEST-H: public:
@@ -42,6 +45,12 @@
 // CHECK-NEW-TEST-H: public:
 // CHECK-NEW-TEST-H:   int f();
 // CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: class EnclosingMove5 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   class Nested {
+// CHECK-NEW-TEST-H: int f();
+// CHECK-NEW-TEST-H:   };
+// CHECK-NEW-TEST-H: };
 // CHECK-NEW-TEST-H: } // namespace c
 
 // CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h"
@@ -54,4 +63,5 @@
 // CHECK-NEW-TEST-CPP: namespace c {
 // CHECK-NEW-TEST-CPP: int Move3::f() { return 0; }
 // CHECK-NEW-TEST-CPP: int Move4::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::Nested::f() { return 0; }
 // CHECK-NEW-TEST-CPP: } // namespace c
Index: test/clang-move/Inputs/multiple_class_test.h
===
--- test/clang-move/Inputs/multiple_class_test.h
+++ test/clang-move/Inputs/multiple_class_test.h
@@ -23,6 +23,13 @@
   int f();
 };
 
+class EnclosingMove5 {
+public:
+  class Nested {
+int f();
+  };
+};
+
 class NoMove {
 public:
   int f();
Index: test/clang-move/Inputs/multiple_class_test.cpp
===
--- test/clang-move/Inputs/multiple_class_test.cpp
+++ test/clang-move/Inputs/multiple_class_test.cpp
@@ -21,6 +21,10 @@
   return 0;
 }
 
+int EnclosingMove5::Nested::f() {
+  return 0;
+}
+
 int NoMove::f() {
   return 0;
 }
Index: clang-move/ClangMove.cpp
===
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -24,6 +24,17 @@
 namespace move {
 namespace {
 
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  const CXXRecordDecl *Parent = Node.getParent();
+  while (const auto *NextParent =
+ dyn_cast(Parent->getParent())) {
+Parent = NextParent;
+  }
+
+  return Parent && (InnerMatcher.matches(*Parent, Finder, Builder));
+}
+
 // Make the Path absolute using the CurrentDir if the Path is not an absolute
 // path. An empty Path will result in an empty string.
 std::string MakeAbsolutePath(StringRef CurrentDir, StringRef Path) {
@@ -322,11 +333,11 @@
 
   // Match moved class methods (static methods included) which are defined
   // outside moved class declaration.
-  Finder->addMatcher(cxxMethodDecl(InOldFiles,
-   ofClass(*InMovedClassNames),
-   isDefinition())
- .bind("class_method"),
- this);
+  Finder->addMatcher(
+  cxxMethodDecl(InOldFiles, ofOutermostEnclosingClass(*InMovedClassNa

[PATCH] D25244: [clang-tidy] Add a whitelist option in google-runtime-references.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein added a comment.

friendly ping. Aaron, could you take a look on this patch?


https://reviews.llvm.org/D25244



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


[clang-tools-extra] r283553 - Revert "[clang-move] Support moving multiple classes in one run."

2016-10-07 Thread Renato Golin via cfe-commits
Author: rengolin
Date: Fri Oct  7 08:58:10 2016
New Revision: 283553

URL: http://llvm.org/viewvc/llvm-project?rev=283553&view=rev
Log:
Revert "[clang-move] Support moving multiple classes in one run."

This reverts commit r283526 et al as it keeps randomly breaking bots, even after
the commit has gone, on other people's commit ranges.

Revert "[clang-move] Simplify lint tests" (r283545).
Revert "Fix buildbot error." (r283534).
Revert "Revert "fix buildbot error" since it is not right fix." (r283538).

Added:
clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
Removed:
clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.cpp
clang-tools-extra/trunk/test/clang-move/Inputs/multiple_class_test.h
clang-tools-extra/trunk/test/clang-move/move-multiple-classes.cpp
Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp
clang-tools-extra/trunk/clang-move/ClangMove.h
clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
clang-tools-extra/trunk/test/clang-move/move-class.cpp
clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=283553&r1=283552&r2=283553&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Fri Oct  7 08:58:10 2016
@@ -287,43 +287,31 @@ ClangMoveTool::ClangMoveTool(
 : Spec(MoveSpec), FileToReplacements(FileToReplacements),
   OriginalRunningDirectory(OriginalRunningDirectory),
   FallbackStyle(FallbackStyle) {
+  Spec.Name = llvm::StringRef(Spec.Name).ltrim(':');
   if (!Spec.NewHeader.empty())
 CCIncludes.push_back("#include \"" + Spec.NewHeader + "\"\n");
 }
 
 void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
-  SmallVector ClassNames;
-  llvm::StringRef(Spec.Names).split(ClassNames, ',');
-  Optional> InMovedClassNames;
-  for (StringRef ClassName : ClassNames) {
-llvm::StringRef GlobalClassName = ClassName.trim().ltrim(':');
-const auto HasName = hasName(("::" + GlobalClassName).str());
-InMovedClassNames =
-InMovedClassNames ? anyOf(*InMovedClassNames, HasName) : HasName;
-  }
-  if (!InMovedClassNames) {
-llvm::errs() << "No classes being moved.\n";
-return;
-  }
-
+  std::string FullyQualifiedName = "::" + Spec.Name;
   auto InOldHeader = isExpansionInFile(
   MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader));
   auto InOldCC = isExpansionInFile(
   MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC));
   auto InOldFiles = anyOf(InOldHeader, InOldCC);
   auto InMovedClass =
-  hasDeclContext(cxxRecordDecl(*InMovedClassNames));
+  hasDeclContext(cxxRecordDecl(hasName(FullyQualifiedName)));
 
   // Match moved class declarations.
   auto MovedClass = cxxRecordDecl(
-  InOldFiles, *InMovedClassNames, isDefinition(),
+  InOldFiles, hasName(FullyQualifiedName), isDefinition(),
   hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl(;
   Finder->addMatcher(MovedClass.bind("moved_class"), this);
 
   // Match moved class methods (static methods included) which are defined
   // outside moved class declaration.
   Finder->addMatcher(cxxMethodDecl(InOldFiles,
-   ofClass(*InMovedClassNames),
+   ofClass(hasName(FullyQualifiedName)),
isDefinition())
  .bind("class_method"),
  this);

Modified: clang-tools-extra/trunk/clang-move/ClangMove.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.h?rev=283553&r1=283552&r2=283553&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.h (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.h Fri Oct  7 08:58:10 2016
@@ -37,9 +37,8 @@ public:
   };
 
   struct MoveDefinitionSpec {
-// A comma-separated list of fully qualified names, e.g. "Foo",
-// "a::Foo, b::Foo".
-std::string Names;
+// A fully qualified name, e.g. "X", "a::X".
+std::string Name;
 // The file path of old header, can be relative path and absolute path.
 std::string OldHeader;
 // The file path of old cc, can be relative path and absolute path.

Modified: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp?rev=283553&r1=283552&r2=283553&view=diff
==
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp (original)
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp Fri Oct  7 
08:58:10 2016
@@ -37,10 +

Re: [clang-tools-extra] r283534 - Fix buildbot error.

2016-10-07 Thread Renato Golin via cfe-commits
On 7 October 2016 at 13:06, Renato Golin  wrote:
> On 7 October 2016 at 10:23, Haojian Wu via cfe-commits
>  wrote:
>> Author: hokein
>> Date: Fri Oct  7 04:23:28 2016
>> New Revision: 283534
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=283534&view=rev
>> Log:
>> Fix buildbot error.
>>
>> The error maybe caused by the mixed environment of the two lint tests.
>> Cleanup the environment before running each test.
>
> Hi,
>
> Can you revert all changes and test it again on your machine before
> pushing it upstream?
>
> Your changes and reverts are really upsetting all our buildbots and
> making them completely unstable.

Right, your tests were breaking all over the place on ranges that had
nothing to do with your commits, so I reverted on r283553.

Please let me know if you need help with tests before you commit it again.

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


[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Eric Liu via cfe-commits
ioeric added inline comments.



Comment at: clang-move/ClangMove.cpp:27
 
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {

I'm not sure if we really need to limit this to the `outer-most` class. In the 
future, we might want to support moving nested class, so I guess this can 
simply be `ofClass`? Not sure if the name is right though.



Comment at: clang-move/ClangMove.cpp:343
   // Match static member variable definition of the moved class.
   Finder->addMatcher(varDecl(InMovedClass, InOldCC, isDefinition())
  .bind("class_static_var_decl"),

What about static variable of the nested class?


https://reviews.llvm.org/D25369



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Yay, this is great. Thanks for investigating all those loss of coverage issues!




Comment at: lib/StaticAnalyzer/Core/CoreEngine.cpp:610
   // Use the callee location context.
-  CallExitBegin Loc(LocCtx);
+  CallExitBegin Loc(LocCtx,RS);
 

Space after ",".



Comment at: lib/StaticAnalyzer/Core/CoreEngine.cpp:639
 if (N->getLocationContext()->getParent()) {
-  N = generateCallExitBeginNode(N);
+  N = generateCallExitBeginNode(N,RS);
   if (N)

Space after ",".



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1792
 
-  Engine.enqueueEndOfFunction(Dst);
+  Engine.enqueueEndOfFunction(Dst,RS);
 }

Space after ",".


https://reviews.llvm.org/D25326



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


r283554 - [analyzer] Don't merge different return nodes in ExplodedGraph

2016-10-07 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Fri Oct  7 09:21:08 2016
New Revision: 283554

URL: http://llvm.org/viewvc/llvm-project?rev=283554&view=rev
Log:
[analyzer] Don't merge different return nodes in ExplodedGraph

Returns when calling an inline function should not be merged in the 
ExplodedGraph unless they are same.

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

Modified:
cfe/trunk/include/clang/Analysis/ProgramPoint.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
cfe/trunk/test/Analysis/unreachable-code-path.c

Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
+++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Fri Oct  7 09:21:08 2016
@@ -622,8 +622,8 @@ private:
 class CallExitBegin : public ProgramPoint {
 public:
   // CallExitBegin uses the callee's location context.
-  CallExitBegin(const StackFrameContext *L)
-: ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
+  CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
+: ProgramPoint(RS, CallExitBeginKind, L, nullptr) { }
 
 private:
   friend class ProgramPoint;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h Fri 
Oct  7 09:21:08 2016
@@ -109,7 +109,8 @@ private:
   CoreEngine(const CoreEngine &) = delete;
   void operator=(const CoreEngine &) = delete;
 
-  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
+  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
+  const ReturnStmt *RS);
 
 public:
   /// Construct a CoreEngine object to analyze the provided CFG.
@@ -172,7 +173,7 @@ public:
 
   /// \brief enqueue the nodes corresponding to the end of function onto the
   /// end of path / work list.
-  void enqueueEndOfFunction(ExplodedNodeSet &Set);
+  void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS);
 
   /// \brief Enqueue a single node created as a result of statement processing.
   void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned Idx);

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Fri 
Oct  7 09:21:08 2016
@@ -262,7 +262,8 @@ public:
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) override;
+ExplodedNode *Pred,
+const ReturnStmt *RS=nullptr) override;
 
   /// Remove dead bindings/symbols before exiting a function.
   void removeDeadOnEndOfFunction(NodeBuilderContext& BC,

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h?rev=283554&r1=283553&r2=283554&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h Fri 
Oct  7 09:21:08 2016
@@ -109,7 +109,8 @@ public:
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   virtual void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) = 0;
+ExplodedNode *Pred,
+const ReturnStmt *RS = nullptr) = 0;
 
   // Genera

[PATCH] D25343: [OpenCL] Mark group functions as noduplicate in opencl-c.h

2016-10-07 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D25343#564092, @arsenm wrote:

> These should be convergent instead


Unfortunately convergent is not supported as Clang attribute. There was patch 
to add it but the author withdrew it.

Anastasia/Alexey,

Do you think it is a good idea to add __attribute__((convergent)) to clang and 
mark these group functions with it?

convergent put more restrictions on what transformations are allowed, whereas 
noduplicate only forbids duplicate of the function calls.

Thanks.


https://reviews.llvm.org/D25343



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


[PATCH] D20428: Tracking exception specification source locations

2016-10-07 Thread Stanisław Barzowski via cfe-commits
sbarzowski added a comment.

What's happening here? It's accepted, but not merged and the last activity is 3 
months old while my change is waiting for it. Can I help somehow?


https://reviews.llvm.org/D20428



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


r283564 - Update clang test to accomendate discriminator change in https://reviews.llvm.org/D25132

2016-10-07 Thread Dehao Chen via cfe-commits
Author: dehao
Date: Fri Oct  7 10:21:29 2016
New Revision: 283564

URL: http://llvm.org/viewvc/llvm-project?rev=283564&view=rev
Log:
Update clang test to accomendate discriminator change in 
https://reviews.llvm.org/D25132

Summary: https://reviews.llvm.org/D25132 added discriminator even add -g0. This 
leads to test fail which is addressed in thie patch.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=283564&r1=283563&r2=283564&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Fri Oct  7 10:21:29 2016
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple %itanium_abi_triple 
| FileCheck %s
-// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | 
FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - 
-triple %itanium_abi_triple | FileCheck %s
+// RUN: %clang_cc1 -w -debug-info-kind=line-tables-only -std=c++11 
-fexceptions -fcxx-exceptions -S -mllvm -no-discriminators -emit-llvm %s -o - 
-triple i686-linux-gnu | FileCheck %s
 
 int &src();
 int *sink();

Modified: cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m?rev=283564&r1=283563&r2=283564&view=diff
==
--- cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Fri Oct  7 10:21:29 
2016
@@ -30,10 +30,11 @@ NSRect NSMakeRect(CGFloat x, CGFloat y,
   // CHECK: define {{.*}}_createBezierPathWithWidth
   // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]]
   // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]]
-  // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]]
+  // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg 
![[ARC1:[0-9]+]]
   // CHECK: ret {{.*}} !dbg ![[ARC]]
   // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
   return path;
-  // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
+  // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+2]], scope: !{{.*}})
+  // CHECK: ![[ARC1]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}})
 }
 @end


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


r283566 - [analyzer] Re-apply r283092, attempt no.4, a small chunk.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 10:23:02 2016
New Revision: 283566

URL: http://llvm.org/viewvc/llvm-project?rev=283566&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, a small chunk.

Define PathDiagnosticNotePiece. The next commit would be able to address the
BugReport class code that is pointed to by the msvc crash message.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=283566&r1=283565&r2=283566&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h 
Fri Oct  7 10:23:02 2016
@@ -336,7 +336,7 @@ public:
 
 class PathDiagnosticPiece : public RefCountedBaseVPTR {
 public:
-  enum Kind { ControlFlow, Event, Macro, Call };
+  enum Kind { ControlFlow, Event, Macro, Call, Note };
   enum DisplayHint { Above, Below };
 
 private:
@@ -452,7 +452,8 @@ public:
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 
   static bool classof(const PathDiagnosticPiece *P) {
-return P->getKind() == Event || P->getKind() == Macro;
+return P->getKind() == Event || P->getKind() == Macro ||
+   P->getKind() == Note;
   }
 };
 
@@ -706,6 +707,23 @@ public:
   }
 
   void dump() const override;
+
+  void Profile(llvm::FoldingSetNodeID &ID) const override;
+};
+
+class PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
+public:
+  PathDiagnosticNotePiece(const PathDiagnosticLocation &Pos, StringRef S,
+   bool AddPosRange = true)
+  : PathDiagnosticSpotPiece(Pos, S, Note, AddPosRange) {}
+
+  ~PathDiagnosticNotePiece() override;
+
+  static inline bool classof(const PathDiagnosticPiece *P) {
+return P->getKind() == Note;
+  }
+
+  void dump() const override;
 
   void Profile(llvm::FoldingSetNodeID &ID) const override;
 };

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=283566&r1=283565&r2=283566&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Fri Oct  7 10:23:02 2016
@@ -114,15 +114,15 @@ static void removeRedundantMsgs(PathPiec
 path.pop_front();
 
 switch (piece->getKind()) {
-  case clang::ento::PathDiagnosticPiece::Call:
+  case PathDiagnosticPiece::Call:
 removeRedundantMsgs(cast(piece)->path);
 break;
-  case clang::ento::PathDiagnosticPiece::Macro:
+  case PathDiagnosticPiece::Macro:
 removeRedundantMsgs(cast(piece)->subPieces);
 break;
-  case clang::ento::PathDiagnosticPiece::ControlFlow:
+  case PathDiagnosticPiece::ControlFlow:
 break;
-  case clang::ento::PathDiagnosticPiece::Event: {
+  case PathDiagnosticPiece::Event: {
 if (i == N-1)
   break;
 
@@ -142,6 +142,8 @@ static void removeRedundantMsgs(PathPiec
 }
 break;
   }
+  case PathDiagnosticPiece::Note:
+break;
 }
 path.push_back(piece);
   }
@@ -199,6 +201,9 @@ static bool removeUnneededCalls(PathPiec
   }
   case PathDiagnosticPiece::ControlFlow:
 break;
+
+  case PathDiagnosticPiece::Note:
+break;
 }
 
 pieces.push_back(piece);
@@ -3520,6 +3525,13 @@ LLVM_DUMP_METHOD void PathDiagnosticMacr
   // FIXME: Print which macro is being invoked.
 }
 
+LLVM_DUMP_METHOD void PathDiagnosticNotePiece::dump() const {
+  llvm::errs() << "NOTE\n--\n";
+  llvm::errs() << getString() << "\n";
+  llvm::errs() << "  at \n";
+  getLocation().dump();
+}
+
 LLVM_DUMP_METHOD void PathDiagnosticLocation::dump() const {
   if (!isValid()) {
 llvm::errs() << "\n";

Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=283566&r1=283565&r2=283566&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Fri Oct  7 10:23:02 
2016
@@ -60,6 +60,7 @@ PathDiagnosticEventPiece::~PathDiagnosti
 PathDiagnosticCallPiece::~PathDiagnosticCallPiece() {}
 PathDiagnosticControlFlowPiece::~PathDiagnosticControlFlowPiece() {}
 PathDiagnosticMacroPiece::~PathDiagnosticMacroPiece() {}
+PathDiagnosticNotePiece::~PathDiagnosticNotePiece() {}
 
 void PathPieces::flatt

r283568 - [analyzer] Re-apply r283092, attempt no.4, chunk no.2.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 10:55:18 2016
New Revision: 283568

URL: http://llvm.org/viewvc/llvm-project?rev=283568&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.2.

Define the list of pieces in BugReport class. This is half of the changes
in the BugReport class code, which is pointed to by the msvc crash message.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283568&r1=283567&r2=283568&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 10:55:18 2016
@@ -66,6 +66,8 @@ public:
   typedef SmallVector, 8> VisitorList;
   typedef VisitorList::iterator visitor_iterator;
   typedef SmallVector ExtraTextList;
+  typedef SmallVector, 4>
+  NoteList;
 
 protected:
   friend class BugReporter;
@@ -82,7 +84,8 @@ protected:
   const ExplodedNode *ErrorNode;
   SmallVector Ranges;
   ExtraTextList ExtraText;
-  
+  NoteList Notes;
+
   typedef llvm::DenseSet Symbols;
   typedef llvm::DenseSet Regions;
 


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


[PATCH] D25321: Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

2016-10-07 Thread Adrian Prantl via cfe-commits
aprantl accepted this revision.
aprantl added a reviewer: aprantl.
aprantl added a comment.
This revision is now accepted and ready to land.

Thanks, LGTM!


Repository:
  rL LLVM

https://reviews.llvm.org/D25321



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.

Please, fix the style issues before committing.




Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:266
+ExplodedNode *Pred,
+const ReturnStmt *RS=nullptr) override;
 

Add spaces around '=.'


https://reviews.llvm.org/D25326



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D25338



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


[PATCH] D25343: [OpenCL] Mark group functions as noduplicate in opencl-c.h

2016-10-07 Thread Brian Sumner via cfe-commits
b-sumner added a comment.

clang does not recognize convergent as a valid attribute.  There was an attempt 
to add this, see 
https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg22271.html but it 
hasn't had any result.  Matt do you see "real uses" for this now?


https://reviews.llvm.org/D25343



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Can you also add a test that tests this more directly (i.e., with 
clang_analyzer_warnIfReached). I don't think it is good to have the only test 
for this core coverage issue to be in tests for an alpha checker. Adding the 
direct test would also make it easier to track down any regression if it 
happens. The 'func.c' test file might be a good place for such a test.


https://reviews.llvm.org/D25326



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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Artem Dergachev via cfe-commits
NoQ added inline comments.



Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;

a.sidorin wrote:
> I have a small question. Is it possible to simplify this sample with removing 
> of table[] array? Like putting something like `i != 0` into condition. As I 
> understand, the problem is not array-related.
Any `UnknownVal` in the condition would trigger this issue.


https://reviews.llvm.org/D25326



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny added a comment.

Thanks for the review.


https://reviews.llvm.org/D25338



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


r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Fri Oct  7 12:08:06 2016
New Revision: 283572

URL: http://llvm.org/viewvc/llvm-project?rev=283572&view=rev
Log:
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

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

Added:
cfe/trunk/test/Driver/print-libgcc-file-name.c
Modified:
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283572&r1=283571&r2=283572&view=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Fri Oct  7 12:08:06 2016
@@ -394,7 +394,8 @@ Driver Options
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283572&r1=283571&r2=283572&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct  7 12:08:06 2016
@@ -1861,7 +1861,8 @@ def print_file_name_EQ : Joined<["-", "-
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283572&r1=283571&r2=283572&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  7 12:08:06 2016
@@ -994,7 +994,15 @@ bool Driver::HandleImmediateArgs(const C
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 

Added: cfe/trunk/test/Driver/print-libgcc-file-name.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name.c?rev=283572&view=auto
==
--- cfe/trunk/test/Driver/print-libgcc-file-name.c (added)
+++ cfe/trunk/test/Driver/print-libgcc-file-name.c Fri Oct  7 12:08:06 2016
@@ -0,0 +1,15 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=.
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a


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


r283573 - [analyzer] Re-apply r283092, attempt no.4, chunk no.3.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 12:12:05 2016
New Revision: 283573

URL: http://llvm.org/viewvc/llvm-project?rev=283573&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.3.

This is the primary suspect for causing the msvc crash, now that vector of
smart pointers was proven to be safe. Probably the default {}-initializer
is the problem.




Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283573&r1=283572&r2=283573&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 12:12:05 2016
@@ -248,7 +248,23 @@ public:
   void setDeclWithIssue(const Decl *declWithIssue) {
 DeclWithIssue = declWithIssue;
   }
-  
+
+  /// Add new item to the list of additional notes that need to be attached to
+  /// this path-insensitive report. If you want to add extra notes to a
+  /// path-sensitive report, you need to use a BugReporterVisitor because it
+  /// allows you to specify where exactly in the auto-generated path diagnostic
+  /// the extra note should appear.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
+ArrayRef Ranges = {}) {
+PathDiagnosticNotePiece *P =
+new PathDiagnosticNotePiece(Pos, Msg);
+
+for (const auto &R : Ranges)
+  P->addRange(R);
+
+Notes.push_back(P);
+  }
+
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 


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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Aleksei Sidorin via cfe-commits
a.sidorin added inline comments.



Comment at: test/Analysis/unreachable-code-path.c:201
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;

I have a small question. Is it possible to simplify this sample with removing 
of table[] array? Like putting something like `i != 0` into condition. As I 
understand, the problem is not array-related.


https://reviews.llvm.org/D25326



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


r283574 - [analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 12:24:06 2016
New Revision: 283574

URL: http://llvm.org/viewvc/llvm-project?rev=283574&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.

Remove the brace default initializer to see if this is what's causing
the msvc crash.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283574&r1=283573&r2=283574&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 12:24:06 2016
@@ -255,7 +255,7 @@ public:
   /// allows you to specify where exactly in the auto-generated path diagnostic
   /// the extra note should appear.
   void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
-ArrayRef Ranges = {}) {
+   ArrayRef Ranges) {
 PathDiagnosticNotePiece *P =
 new PathDiagnosticNotePiece(Pos, Msg);
 


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


Re: [PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Bill Seurer via cfe-commits

On 10/07/16 08:39, Daniel Marjamäki via cfe-commits wrote:

danielmarjamaki removed rL LLVM as the repository for this revision.
danielmarjamaki updated this revision to Diff 73926.
danielmarjamaki added a comment.

Refactoring.


https://reviews.llvm.org/D25326

Files:
  include/clang/Analysis/ProgramPoint.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/inlining/InlineObjCClassMethod.m
  test/Analysis/unreachable-code-path.c



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



The changes in CoreEngine.cpp cause issues with the sanitizer buildbots 
which compile with -Werror


[ 80%] Building CXX object 
tools/clang/lib/StaticAnalyzer/Core/CMakeFiles/clangStaticAnalyzerCore.dir/CoreEngine.cpp.o
cd /home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
&& /home/seurer/llvm/build/llvm-test2/bin/clang++   -DCLANG_ENABLE_ARCMT 
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER 
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/include 
-I/home/seurer/llvm/llvm-test/include  -gmlt -fPIC 
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Werror -Werror=date-time -std=c++11 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3-UNDEBUG  -fno-exceptions -fno-rtti -o 
CMakeFiles/clangStaticAnalyzerCore.dir/CoreEngine.cpp.o -c 
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16: 
error: using the result of an assignment as a condition without parentheses

  [-Werror,-Wparentheses]
if (RS = dyn_cast(LastStmt->getStmt())) {
~~~^~~
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16: 
note: place parentheses around the assignment to silence this warning

if (RS = dyn_cast(LastStmt->getStmt())) {
   ^
( )
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16: 
note: use '==' to turn this assignment into an equality comparison

if (RS = dyn_cast(LastStmt->getStmt())) {
   ^
   ==
1 error generated.

--

-Bill Seurer

--

-Bill Seurer

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


[PATCH] D25326: [StaticAnalyser] Don't merge different returns in ExplodedGraph

2016-10-07 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283554: [analyzer] Don't merge different return nodes in 
ExplodedGraph (authored by danielmarjamaki).

Changed prior to commit:
  https://reviews.llvm.org/D25326?vs=73926&id=73947#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25326

Files:
  cfe/trunk/include/clang/Analysis/ProgramPoint.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
  cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
  cfe/trunk/test/Analysis/unreachable-code-path.c

Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -109,7 +109,8 @@
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   virtual void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) = 0;
+ExplodedNode *Pred,
+const ReturnStmt *RS = nullptr) = 0;
 
   // Generate the entry node of the callee.
   virtual void processCallEnter(NodeBuilderContext& BC, CallEnter CE,
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -262,7 +262,8 @@
   /// Called by CoreEngine.  Used to notify checkers that processing a
   /// function has ended. Called for both inlined and and top-level functions.
   void processEndOfFunction(NodeBuilderContext& BC,
-ExplodedNode *Pred) override;
+ExplodedNode *Pred,
+const ReturnStmt *RS=nullptr) override;
 
   /// Remove dead bindings/symbols before exiting a function.
   void removeDeadOnEndOfFunction(NodeBuilderContext& BC,
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
===
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -109,7 +109,8 @@
   CoreEngine(const CoreEngine &) = delete;
   void operator=(const CoreEngine &) = delete;
 
-  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
+  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
+  const ReturnStmt *RS);
 
 public:
   /// Construct a CoreEngine object to analyze the provided CFG.
@@ -172,7 +173,7 @@
 
   /// \brief enqueue the nodes corresponding to the end of function onto the
   /// end of path / work list.
-  void enqueueEndOfFunction(ExplodedNodeSet &Set);
+  void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS);
 
   /// \brief Enqueue a single node created as a result of statement processing.
   void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned Idx);
Index: cfe/trunk/include/clang/Analysis/ProgramPoint.h
===
--- cfe/trunk/include/clang/Analysis/ProgramPoint.h
+++ cfe/trunk/include/clang/Analysis/ProgramPoint.h
@@ -622,8 +622,8 @@
 class CallExitBegin : public ProgramPoint {
 public:
   // CallExitBegin uses the callee's location context.
-  CallExitBegin(const StackFrameContext *L)
-: ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
+  CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
+: ProgramPoint(RS, CallExitBeginKind, L, nullptr) { }
 
 private:
   friend class ProgramPoint;
Index: cfe/trunk/test/Analysis/unreachable-code-path.c
===
--- cfe/trunk/test/Analysis/unreachable-code-path.c
+++ cfe/trunk/test/Analysis/unreachable-code-path.c
@@ -194,3 +194,15 @@
 break;
   }
 }
+
+// Don't merge return nodes in ExplodedGraph unless they are same.
+extern int table[];
+static int inlineFunction(const int i) {
+  if (table[i] != 0)
+return 1;
+  return 0;
+}
+void test13(int i) {
+  int x = inlineFunction(i);
+  x && x < 10; // no-warning
+}
Index: cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
===
--- cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
+++ cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m

[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283572: [Driver] Make -print-libgcc-file-name print 
compiler-rt lib when used (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D25338?vs=73887&id=73953#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25338

Files:
  cfe/trunk/docs/CommandGuide/clang.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/test/Driver/print-libgcc-file-name.c


Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: cfe/trunk/docs/CommandGuide/clang.rst
===
--- cfe/trunk/docs/CommandGuide/clang.rst
+++ cfe/trunk/docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
Index: cfe/trunk/test/Driver/print-libgcc-file-name.c
===
--- cfe/trunk/test/Driver/print-libgcc-file-name.c
+++ cfe/trunk/test/Driver/print-libgcc-file-name.c
@@ -0,0 +1,15 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=.
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a


Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << "\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: cfe/trunk/docs/CommandGuide/clang.rst
===
--- cfe/trunk/docs/CommandGuide/clang.rst
+++ cfe/trunk/docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "-

[PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-10-07 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a reviewer: bruno.
bruno added inline comments.



Comment at: llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td:2306
+  "vector operands do not have the same elements sizes (%0 and %1)">,
+  InGroup>, DefaultError;
 def err_ext_vector_component_exceeds_length : Error<

Although the motivation is to support the same warning present in GCC, I think 
this is helpful enough anyway so that we might skip calling it 
"gnu-vec-elem-size" and have a more generic name instead? How about plain 
"vec-elem-size"?



Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8787
 }
+if (!S.LangOpts.OpenCL && !S.LangOpts.ZVector) {
+  const BuiltinType *LHSBT = LHSEleType->getAs();

Besides `__ext_vector_type__`, would this also trigger for `vector_size`? Right 
now this is an error for `vector_size` primarily because the number of elements 
is different, can you confirm this won't change?


https://reviews.llvm.org/D24669



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny added a comment.

It seems that my test doesn't work on Darwin, and I should exclude the libgcc 
part there. Do you happen to have any suggestion how to do that?

I'm going to wait for other buildbots to finish to see if I haven't broken any 
other platform, then revert it and look for a proper way to restrict the tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D25338



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


[PATCH] D25244: [clang-tidy] Add a whitelist option in google-runtime-references.

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

LGTM with a small nit.




Comment at: clang-tidy/google/NonConstReferences.cpp:71-75
+  for (const auto &WhiteListType: WhiteListTypes) {
+if (ReferencedType.getCanonicalType().getAsString(
+Result.Context->getPrintingPolicy()) == WhiteListType)
+  return;
+  }

I think this would be a bit easier to read with std::find_if rather than a 
manual loop. If you decide to stick with the manual loop, the colon in the 
range-based for loop needs a preceding space.


https://reviews.llvm.org/D25244



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


Re: r283554 - [analyzer] Don't merge different return nodes in ExplodedGraph

2016-10-07 Thread Galina Kistanova via cfe-commits
Hi Daniel,

This revision introduced warnings on one our of builders:
http://lab.llvm.org:8011/builders/clang-3stage-ubuntu/builds/4719

The warnings:

/home/buildbot/Buildbot/Slave1a/clang-3stage-ubuntu/llvm.src/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:59:
warning: suggest parentheses around assignment used as truth value
[-Wparentheses]
/home/buildbot/Buildbot/Slave1a/clang-3stage-ubuntu/llvm.src/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16:
warning: using the result of an assignment as a condition without
parentheses [-Wparentheses]
1 warning generated.
/home/buildbot/Buildbot/Slave1a/clang-3stage-ubuntu/llvm.src/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:316:16:
warning: using the result of an assignment as a condition without
parentheses [-Wparentheses]
1 warning generated.

Please have a look?

Thanks

Galina



On Fri, Oct 7, 2016 at 7:21 AM, Daniel Marjamaki via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: danielmarjamaki
> Date: Fri Oct  7 09:21:08 2016
> New Revision: 283554
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283554&view=rev
> Log:
> [analyzer] Don't merge different return nodes in ExplodedGraph
>
> Returns when calling an inline function should not be merged in the
> ExplodedGraph unless they are same.
>
> Differential Revision: https://reviews.llvm.org/D25326
>
> Modified:
> cfe/trunk/include/clang/Analysis/ProgramPoint.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
> cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
> cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
> cfe/trunk/test/Analysis/unreachable-code-path.c
>
> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Analysis/ProgramPoint.h?rev=283554&r1=283553&r2=283554&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Fri Oct  7 09:21:08
> 2016
> @@ -622,8 +622,8 @@ private:
>  class CallExitBegin : public ProgramPoint {
>  public:
>// CallExitBegin uses the callee's location context.
> -  CallExitBegin(const StackFrameContext *L)
> -: ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
> +  CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
> +: ProgramPoint(RS, CallExitBeginKind, L, nullptr) { }
>
>  private:
>friend class ProgramPoint;
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/
> PathSensitive/CoreEngine.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h?
> rev=283554&r1=283553&r2=283554&view=diff
> 
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
> Fri Oct  7 09:21:08 2016
> @@ -109,7 +109,8 @@ private:
>CoreEngine(const CoreEngine &) = delete;
>void operator=(const CoreEngine &) = delete;
>
> -  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N);
> +  ExplodedNode *generateCallExitBeginNode(ExplodedNode *N,
> +  const ReturnStmt *RS);
>
>  public:
>/// Construct a CoreEngine object to analyze the provided CFG.
> @@ -172,7 +173,7 @@ public:
>
>/// \brief enqueue the nodes corresponding to the end of function onto
> the
>/// end of path / work list.
> -  void enqueueEndOfFunction(ExplodedNodeSet &Set);
> +  void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS);
>
>/// \brief Enqueue a single node created as a result of statement
> processing.
>void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned
> Idx);
>
> Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/
> PathSensitive/ExprEngine.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?
> rev=283554&r1=283553&r2=283554&view=diff
> 
> ==
> --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
> (original)
> +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
> Fri Oct  7 09:21:08 2016
> @@ -262,7 +262,8 @@ public:
>/// Called by CoreEngine.  Used to notify checkers that processing a
>/// function has ended. Called for both inlined and and top-level
> functions.
>void processEndOfFunction(NodeBuilderContext& BC,
> -ExplodedNode *Pred) override;
> +ExplodedNode *Pr

[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Erich Keane via cfe-commits
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }
 
Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }
 
Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S -emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread David Blaikie via cfe-commits
Could you explain how/why there's a null size expr? I would've thought it
must have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane  wrote:

> erichkeane created this revision.
> erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
> erichkeane set the repository for this revision to rL LLVM.
>
> OpenMP creates a variable array type with a a null size-expr.  The Debug
> generation failed to properly consider this case.  This patch adds a null
> check to prevent a null dereference seg-fault in this case, plus adds a
> test.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D25373
>
> Files:
>   lib/CodeGen/CGDebugInfo.cpp
>   test/CodeGenCXX/debug-info-openmp-array.cpp
>
>
> Index: lib/CodeGen/CGDebugInfo.cpp
> ===
> --- lib/CodeGen/CGDebugInfo.cpp
> +++ lib/CodeGen/CGDebugInfo.cpp
> @@ -2181,7 +2181,8 @@
>Count = CAT->getSize().getZExtValue();
>  else if (const auto *VAT = dyn_cast(Ty)) {
>llvm::APSInt V;
> -  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
> +  if (VAT->getSizeExpr() &&
> +  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
>  Count = V.getExtValue();
>  }
>
> Index: test/CodeGenCXX/debug-info-openmp-array.cpp
> ===
> --- test/CodeGenCXX/debug-info-openmp-array.cpp
> +++ test/CodeGenCXX/debug-info-openmp-array.cpp
> @@ -0,0 +1,17 @@
> +// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g
> -O0 -S -emit-llvm %s -o - | FileCheck %s
> +
> +
> +void f(int m) {
> +  int i;
> +  int cen[m];
> +#pragma omp parallel for
> +  for (i = 0; i < m; ++i) {
> +cen[i] = i;
> +  }
> +}
> +
> +// CHECK: !DICompositeType(tag: DW_TAG_array_type,
> +// CHECK-NOT: size:
> +// CHECK-SAME: align: 32
> +// CHECK-SAME:  elements:
> [[ELEM_TYPE:![0-9]+]]
> +// CHECK: !DISubrange(count: -1)
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Keane, Erich via cfe-commits
I cannot personally right now, though I will dig into OpenMP implementation to 
see how intentional that is.  The size is seemingly determined by the OMP code 
generation as far as I can tell.

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Friday, October 7, 2016 11:51 AM
To: reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org; Keane, Erich 
; cfe-commits@lists.llvm.org; david.majne...@gmail.com; 
guy.ben...@intel.com
Cc: junb...@codeaurora.org
Subject: Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Could you explain how/why there's a null size expr? I would've thought it must 
have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane 
mailto:erich.ke...@intel.com>> wrote:
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }

Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)

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


RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Keane, Erich via cfe-commits
Added Alexey to the list, he’s the OMP Maintainer, so hopefully he knows better 
☺

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Friday, October 7, 2016 11:51 AM
To: reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org; Keane, Erich 
; cfe-commits@lists.llvm.org; david.majne...@gmail.com; 
guy.ben...@intel.com
Cc: junb...@codeaurora.org
Subject: Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Could you explain how/why there's a null size expr? I would've thought it must 
have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane 
mailto:erich.ke...@intel.com>> wrote:
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }

Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)

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


[libcxx] r283580 - Remove MSVC workarounds. Patch from s...@microsoft.com

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 13:51:33 2016
New Revision: 283580

URL: http://llvm.org/viewvc/llvm-project?rev=283580&view=rev
Log:
Remove MSVC workarounds. Patch from s...@microsoft.com

Modified:
libcxx/trunk/test/support/test_allocator.h

Modified: libcxx/trunk/test/support/test_allocator.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=283580&r1=283579&r2=283580&view=diff
==
--- libcxx/trunk/test/support/test_allocator.h (original)
+++ libcxx/trunk/test/support/test_allocator.h Fri Oct  7 13:51:33 2016
@@ -88,10 +88,7 @@ public:
 {::new(static_cast(p)) T(std::forward(val));}
 #endif
 void destroy(pointer p)
-{
-p->~T();
-((void)p); // Prevent MSVC's spurious unused warning
-}
+{p->~T();}
 friend bool operator==(const test_allocator& x, const test_allocator& y)
 {return x.data_ == y.data_;}
 friend bool operator!=(const test_allocator& x, const test_allocator& y)
@@ -291,10 +288,7 @@ public:
 
 template
 void destroy(U* p)
-{
-p->~U();
-((void)p); // Prevent MSVC's spurious unused warning
-}
+{ p->~U(); }
 };
 
 template


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


[PATCH] D25141: [libcxx] [test] Remove MSVC workarounds

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r283580.


https://reviews.llvm.org/D25141



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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-07 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

Hi @rsmith -- now this simply reports the `#include` line (or whatever token) 
without fiddly path escaping.  So this is simplified and there's less room for 
error and such.


https://reviews.llvm.org/D25153



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


r283583 - Silence Warning. NFC.

2016-10-07 Thread Nirav Dave via cfe-commits
Author: niravd
Date: Fri Oct  7 14:11:33 2016
New Revision: 283583

URL: http://llvm.org/viewvc/llvm-project?rev=283583&view=rev
Log:
Silence Warning. NFC.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp?rev=283583&r1=283582&r2=283583&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp Fri Oct  7 14:11:33 2016
@@ -313,7 +313,7 @@ void CoreEngine::HandleBlockEdge(const B
 const ReturnStmt *RS = nullptr;
 if (!L.getSrc()->empty()) {
   if (Optional LastStmt = L.getSrc()->back().getAs()) {
-if (RS = dyn_cast(LastStmt->getStmt())) {
+if ((RS = dyn_cast(LastStmt->getStmt( {
   if (!RS->getRetValue())
 RS = nullptr;
 }


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


r283584 - [analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)

2016-10-07 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Fri Oct  7 14:25:10 2016
New Revision: 283584

URL: http://llvm.org/viewvc/llvm-project?rev=283584&view=rev
Log:
[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)

The problem that caused the msvc crash has been indentified and fixed
in the previous commit. This patch contains the rest of r283092.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=283584&r1=283583&r2=283584&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Oct  7 
14:25:10 2016
@@ -266,6 +266,9 @@ private:
   /// \sa shouldWidenLoops
   Optional WidenLoops;
 
+  /// \sa shouldDisplayNotesAsEvents
+  Optional DisplayNotesAsEvents;
+
   /// A helper function that retrieves option for a given full-qualified
   /// checker name.
   /// Options for checkers can be specified via 'analyzer-config' command-line
@@ -534,6 +537,14 @@ public:
   /// This is controlled by the 'widen-loops' config option.
   bool shouldWidenLoops();
 
+  /// Returns true if the bug reporter should transparently treat extra note
+  /// diagnostic pieces as event diagnostic pieces. Useful when the diagnostic
+  /// consumer doesn't support the extra note pieces.
+  ///
+  /// This is controlled by the 'extra-notes-as-events' option, which defaults
+  /// to false when unset.
+  bool shouldDisplayNotesAsEvents();
+
 public:
   AnalyzerOptions() :
 AnalysisStoreOpt(RegionStoreModel),

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=283584&r1=283583&r2=283584&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Fri 
Oct  7 14:25:10 2016
@@ -180,6 +180,18 @@ public:
   const BugType& getBugType() const { return BT; }
   BugType& getBugType() { return BT; }
 
+  /// \brief True when the report has an execution path associated with it.
+  ///
+  /// A report is said to be path-sensitive if it was thrown against a
+  /// particular exploded node in the path-sensitive analysis graph.
+  /// Path-sensitive reports have their intermediate path diagnostics
+  /// auto-generated, perhaps with the help of checker-defined visitors,
+  /// and may contain extra notes.
+  /// Path-insensitive reports consist only of a single warning message
+  /// in a specific location, and perhaps extra notes.
+  /// Path-sensitive checkers are allowed to throw path-insensitive reports.
+  bool isPathSensitive() const { return ErrorNode != nullptr; }
+
   const ExplodedNode *getErrorNode() const { return ErrorNode; }
 
   StringRef getDescription() const { return Description; }
@@ -256,8 +268,7 @@ public:
   /// the extra note should appear.
   void addNote(StringRef Msg, const PathDiagnosticLocation &Pos,
ArrayRef Ranges) {
-PathDiagnosticNotePiece *P =
-new PathDiagnosticNotePiece(Pos, Msg);
+PathDiagnosticNotePiece *P = new PathDiagnosticNotePiece(Pos, Msg);
 
 for (const auto &R : Ranges)
   P->addRange(R);
@@ -265,6 +276,17 @@ public:
 Notes.push_back(P);
   }
 
+  // FIXME: Instead of making an override, we could have default-initialized
+  // Ranges with {}, however it crashes the MSVC 2013 compiler.
+  void addNote(StringRef Msg, const PathDiagnosticLocation &Pos) {
+std::vector Ranges;
+addNote(Msg, Pos, Ranges);
+  }
+
+  virtual const NoteList &getNotes() {
+return Notes;
+  }
+
   /// \brief This allows for addition of meta data to the diagnostic.
   ///
   /// Currently, only the HTMLDiagnosticClient knows how to display it. 

Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=283584&r1=283583&r2=283584&view=diff
==
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Fri Oct  7 14:25:10 2016
@@ -324,6 +324,7 @@ void html::AddHeaderFooterInternalBuilti
   " .msgT { padding:

RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-07 Thread Keane, Erich via cfe-commits
Ok, I dug into this deeper.  ASTContext.cpp:2811 (getVariableArrayDecayedType) 
intentionaly sets size to nullptr in this case for the purpose of turning it 
into a [*] type.  OpenMP.cpp:236 
(CodeGenFunction::GenerateOpenMPCapturedStmtFunction) calls this to replace 
variably modified type with this one.  It definitely looks like this is on 
purpose as far as I can tell.



From: Keane, Erich
Sent: Friday, October 7, 2016 11:56 AM
To: 'David Blaikie' ; 
reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org; 
cfe-commits@lists.llvm.org; david.majne...@gmail.com; 'Alexey Bataev' 

Cc: junb...@codeaurora.org
Subject: RE: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Added Alexey to the list, he’s the OMP Maintainer, so hopefully he knows better 
☺

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Friday, October 7, 2016 11:51 AM
To: 
reviews+d25373+public+d8ec2a4bb41b1...@reviews.llvm.org;
 Keane, Erich mailto:erich.ke...@intel.com>>; 
cfe-commits@lists.llvm.org; 
david.majne...@gmail.com; 
guy.ben...@intel.com
Cc: junb...@codeaurora.org
Subject: Re: [PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference 
with OpenMP array access

Could you explain how/why there's a null size expr? I would've thought it must 
have /some/ size for code generation purposes...

On Fri, Oct 7, 2016 at 11:33 AM Erich Keane 
mailto:erich.ke...@intel.com>> wrote:
erichkeane created this revision.
erichkeane added reviewers: cfe-commits, dblaikie, majnemer, gbenyei.
erichkeane set the repository for this revision to rL LLVM.

OpenMP creates a variable array type with a a null size-expr.  The Debug 
generation failed to properly consider this case.  This patch adds a null check 
to prevent a null dereference seg-fault in this case, plus adds a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D25373

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-openmp-array.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2181,7 +2181,8 @@
   Count = CAT->getSize().getZExtValue();
 else if (const auto *VAT = dyn_cast(Ty)) {
   llvm::APSInt V;
-  if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
+  if (VAT->getSizeExpr() &&
+  VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext()))
 Count = V.getExtValue();
 }

Index: test/CodeGenCXX/debug-info-openmp-array.cpp
===
--- test/CodeGenCXX/debug-info-openmp-array.cpp
+++ test/CodeGenCXX/debug-info-openmp-array.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S 
-emit-llvm %s -o - | FileCheck %s
+
+
+void f(int m) {
+  int i;
+  int cen[m];
+#pragma omp parallel for
+  for (i = 0; i < m; ++i) {
+cen[i] = i;
+  }
+}
+
+// CHECK: !DICompositeType(tag: DW_TAG_array_type,
+// CHECK-NOT: size:
+// CHECK-SAME: align: 32
+// CHECK-SAME:  elements: [[ELEM_TYPE:![0-9]+]]
+// CHECK: !DISubrange(count: -1)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 73976.
hokein marked 2 inline comments as done.
hokein added a comment.

support moving static member of nested class when moving its enclosing class.


https://reviews.llvm.org/D25369

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/multiple_class_test.cpp
  test/clang-move/Inputs/multiple_class_test.h
  test/clang-move/move-multiple-classes.cpp

Index: test/clang-move/move-multiple-classes.cpp
===
--- test/clang-move/move-multiple-classes.cpp
+++ test/clang-move/move-multiple-classes.cpp
@@ -1,12 +1,15 @@
 // RUN: mkdir -p %T/clang-move
 // RUN: cp %S/Inputs/multiple_class_test*  %T/clang-move/
 // RUN: cd %T/clang-move
-// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
+// RUN: clang-move -names="c::EnclosingMove5::Nested" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h -dump_result %T/clang-move/multiple_class_test.cpp -- | FileCheck %s -check-prefix=CHECK-EMPTY
+// RUN: clang-move -names="a::Move1, b::Move2,c::Move3,c::Move4,c::EnclosingMove5" -new_cc=%T/clang-move/new_multiple_class_test.cpp -new_header=%T/clang-move/new_multiple_class_test.h -old_cc=%T/clang-move/multiple_class_test.cpp -old_header=../clang-move/multiple_class_test.h %T/clang-move/multiple_class_test.cpp --
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_multiple_class_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/multiple_class_test.h -check-prefix=CHECK-OLD-TEST-H %s
 //
+// CHECK-EMPTY: [{{[[:space:]]*}}]
+//
 // CHECK-OLD-TEST-H: namespace c {
 // CHECK-OLD-TEST-H: class NoMove {
 // CHECK-OLD-TEST-H: public:
@@ -42,6 +45,14 @@
 // CHECK-NEW-TEST-H: public:
 // CHECK-NEW-TEST-H:   int f();
 // CHECK-NEW-TEST-H: };
+// CHECK-NEW-TEST-H: class EnclosingMove5 {
+// CHECK-NEW-TEST-H: public:
+// CHECK-NEW-TEST-H:   class Nested {
+// CHECK-NEW-TEST-H: int f();
+// CHECK-NEW-TEST-H: static int b;
+// CHECK-NEW-TEST-H:   };
+// CHECK-NEW-TEST-H:   static int a;
+// CHECK-NEW-TEST-H: };
 // CHECK-NEW-TEST-H: } // namespace c
 
 // CHECK-NEW-TEST-CPP: #include "{{.*}}new_multiple_class_test.h"
@@ -54,4 +65,7 @@
 // CHECK-NEW-TEST-CPP: namespace c {
 // CHECK-NEW-TEST-CPP: int Move3::f() { return 0; }
 // CHECK-NEW-TEST-CPP: int Move4::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::a = 1;
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::Nested::f() { return 0; }
+// CHECK-NEW-TEST-CPP: int EnclosingMove5::Nested::b = 1;
 // CHECK-NEW-TEST-CPP: } // namespace c
Index: test/clang-move/Inputs/multiple_class_test.h
===
--- test/clang-move/Inputs/multiple_class_test.h
+++ test/clang-move/Inputs/multiple_class_test.h
@@ -23,6 +23,15 @@
   int f();
 };
 
+class EnclosingMove5 {
+public:
+  class Nested {
+int f();
+static int b;
+  };
+  static int a;
+};
+
 class NoMove {
 public:
   int f();
Index: test/clang-move/Inputs/multiple_class_test.cpp
===
--- test/clang-move/Inputs/multiple_class_test.cpp
+++ test/clang-move/Inputs/multiple_class_test.cpp
@@ -21,6 +21,14 @@
   return 0;
 }
 
+int EnclosingMove5::a = 1;
+
+int EnclosingMove5::Nested::f() {
+  return 0;
+}
+
+int EnclosingMove5::Nested::b = 1;
+
 int NoMove::f() {
   return 0;
 }
Index: clang-move/ClangMove.cpp
===
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -24,6 +24,32 @@
 namespace move {
 namespace {
 
+AST_MATCHER_P(Decl, hasOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  const auto* Context = Node.getDeclContext();
+  if (!Context) return false;
+  while (const auto *NextContext = Context->getParent()) {
+if (isa(NextContext) ||
+isa(NextContext))
+  break;
+Context = NextContext;
+  }
+  return InnerMatcher.matches(*Decl::castFromDeclContext(Context), Finder,
+  Builder);
+}
+
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {
+  const CXXRecordDecl *Parent = Node.getParent();
+  if (!Parent) return false;
+  while (const auto *NextParent =
+ dyn_cast(Parent->getParent())) {
+Parent = NextParent;
+  }
+
+  return InnerMa

[PATCH] D25369: [clang-move] Better support enclosing class.

2016-10-07 Thread Haojian Wu via cfe-commits
hokein added inline comments.



Comment at: clang-move/ClangMove.cpp:27
 
+AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
+  ast_matchers::internal::Matcher, InnerMatcher) {

ioeric wrote:
> I'm not sure if we really need to limit this to the `outer-most` class. In 
> the future, we might want to support moving nested class, so I guess this can 
> simply be `ofClass`? Not sure if the name is right though.
`clang-move` can't handle nested classes well enough currently, and supporting 
nested class requires more stuff there, like changing the qualifiers of the 
method definitions in the nested class  (`int A::B::f()` should be `int B::f()` 
when moving nested class `A::B`). So we'd better to only allow `outer-most` 
class at least for now .


https://reviews.llvm.org/D25369



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


r283586 - Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Fri Oct  7 15:04:00 2016
New Revision: 283586

URL: http://llvm.org/viewvc/llvm-project?rev=283586&view=rev
Log:
Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib 
when used

Revert the -print-libgcc-file-name change as the new test fails
on Darwin. It needs to be updated to run the libgcc part only on systems
supporting that rtlib.

Removed:
cfe/trunk/test/Driver/print-libgcc-file-name.c
Modified:
cfe/trunk/docs/CommandGuide/clang.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/docs/CommandGuide/clang.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283586&r1=283585&r2=283586&view=diff
==
--- cfe/trunk/docs/CommandGuide/clang.rst (original)
+++ cfe/trunk/docs/CommandGuide/clang.rst Fri Oct  7 15:04:00 2016
@@ -394,8 +394,7 @@ Driver Options
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for the currently used compiler runtime library
-  ("libgcc.a" or "libclang_rt.builtins.*.a").
+  Print the library path for "libgcc.a".
 
 .. option:: -print-prog-name=
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283586&r1=283585&r2=283586&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct  7 15:04:00 2016
@@ -1861,8 +1861,7 @@ def print_file_name_EQ : Joined<["-", "-
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for the currently used compiler runtime "
-   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
+  HelpText<"Print the library path for \"libgcc.a\"">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283586&r1=283585&r2=283586&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  7 15:04:00 2016
@@ -994,15 +994,7 @@ bool Driver::HandleImmediateArgs(const C
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
-switch (RLT) {
-case ToolChain::RLT_CompilerRT:
-  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
-  break;
-case ToolChain::RLT_Libgcc:
-  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
-  break;
-}
+llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
 return false;
   }
 

Removed: cfe/trunk/test/Driver/print-libgcc-file-name.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name.c?rev=283585&view=auto
==
--- cfe/trunk/test/Driver/print-libgcc-file-name.c (original)
+++ cfe/trunk/test/Driver/print-libgcc-file-name.c (removed)
@@ -1,15 +0,0 @@
-// Test that -print-libgcc-file-name correctly respects -rtlib=.
-
-// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
-// CHECK-LIBGCC: libgcc.a
-
-// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
-// RUN: --target=x86_64-pc-linux \
-// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
-// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
-
-// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
-// RUN: --target=i686-pc-linux \
-// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
-// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a


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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny planned changes to this revision.
mgorny added a comment.

Reverted, I need to update it to run libgcc part of the test only on platforms 
supporting that.


Repository:
  rL LLVM

https://reviews.llvm.org/D25338



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


[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny removed rL LLVM as the repository for this revision.
mgorny updated this revision to Diff 73979.
This revision is now accepted and ready to land.

https://reviews.llvm.org/D25338

Files:
  docs/CommandGuide/clang.rst
  include/clang/Driver/Options.td
  lib/Driver/Driver.cpp
  test/Driver/print-libgcc-file-name-clangrt.c
  test/Driver/print-libgcc-file-name-libgcc.c
  test/lit.cfg


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -375,6 +375,11 @@
 if platform.system() not in ['Windows']:
 config.available_features.add('utf8-capable-terminal')
 
+# Support for libgcc runtime. Used to rule out tests that require
+# clang to run with -rtlib=libgcc.
+if platform.system() not in ['Darwin', 'Fuchsia']:
+config.available_features.add('libgcc')
+
 # Native compilation: Check if triples match.
 # FIXME: Consider cases that target can be executed
 # even if host_triple were different from target_triple.
Index: test/Driver/print-libgcc-file-name-libgcc.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-libgcc.c
@@ -0,0 +1,7 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=libgcc.
+
+// REQUIRES: libgcc
+
+// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-LIBGCC %s
+// CHECK-LIBGCC: libgcc.a
Index: test/Driver/print-libgcc-file-name-clangrt.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-clangrt.c
@@ -0,0 +1,11 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=compiler-rt.
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=x86_64-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
+// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+// RUN: --target=i686-pc-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -994,7 +994,15 @@
   }
 
   if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
-llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
+switch (RLT) {
+case ToolChain::RLT_CompilerRT:
+  llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << 
"\n";
+  break;
+case ToolChain::RLT_Libgcc:
+  llvm::outs() << GetFilePath("libgcc.a", TC) << "\n";
+  break;
+}
 return false;
   }
 
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1861,7 +1861,8 @@
 def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
-  HelpText<"Print the library path for \"libgcc.a\"">;
+  HelpText<"Print the library path for the currently used compiler runtime "
+   "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">;
 def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
Index: docs/CommandGuide/clang.rst
===
--- docs/CommandGuide/clang.rst
+++ docs/CommandGuide/clang.rst
@@ -394,7 +394,8 @@
 
 .. option:: -print-libgcc-file-name
 
-  Print the library path for "libgcc.a".
+  Print the library path for the currently used compiler runtime library
+  ("libgcc.a" or "libclang_rt.builtins.*.a").
 
 .. option:: -print-prog-name=
 


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -375,6 +375,11 @@
 if platform.system() not in ['Windows']:
 config.available_features.add('utf8-capable-terminal')
 
+# Support for libgcc runtime. Used to rule out tests that require
+# clang to run with -rtlib=libgcc.
+if platform.system() not in ['Darwin', 'Fuchsia']:
+config.available_features.add('libgcc')
+
 # Native compilation: Check if triples match.
 # FIXME: Consider cases that target can be executed
 # even if host_triple were different from target_triple.
Index: test/Driver/print-libgcc-file-name-libgcc.c
===
--- /dev/null
+++ test/Driver/print-libgcc-file-name-libgcc.c
@@ -0,0 +1,7 @@
+// Test that -print-libgcc-file-name correctly respects -rtlib=libgcc.
+
+// REQUIRES: libgcc
+
+// RUN: 

[PATCH] D25338: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

2016-10-07 Thread Michał Górny via cfe-commits
mgorny requested a review of this revision.
mgorny added a comment.

I have updated the patch to include a feature check for platforms rejecting 
`-rtlib=libgcc` and split the test appropriately. Could you re-review, please?


https://reviews.llvm.org/D25338



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


Re: r283537 - Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

2016-10-07 Thread Bill Seurer via cfe-commits

On 10/07/16 05:56, Artem Dergachev via cfe-commits wrote:
> Author: dergachev
> Date: Fri Oct  7 05:56:44 2016
> New Revision: 283537
>
> URL: http://llvm.org/viewvc/llvm-project?rev=283537&view=rev

One of these recent changes introduced a problem in sanitizer testing.


/home/seurer/llvm/build/llvm-test2/bin/clang++   -DCLANG_ENABLE_ARCMT 
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER 
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/seurer/llvm/build/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core 
-I/home/seurer/llvm/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/tools/clang/include 
-I/home/seurer/llvm/build/llvm-test/include 
-I/home/seurer/llvm/llvm-test/include  -gmlt -fPIC 
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Werror -Werror=date-time -std=c++11 
-ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual 
-Wno-nested-anon-types -O3-UNDEBUG  -fno-exceptions -fno-rtti -o 
CMakeFiles/clangStaticAnalyzerCore.dir/HTMLDiagnostics.cpp.o -c 
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
/home/seurer/llvm/llvm-test/tools/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp:388:11: 
error: enumeration value 'Note' not handled in switch [-Werror,-Wswitch]

  switch (P.getKind()) {
  ^
1 error generated.

--

-Bill Seurer

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


r283601 - Visually align table def with respective enum. NFC

2016-10-07 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Fri Oct  7 16:02:38 2016
New Revision: 283601

URL: http://llvm.org/viewvc/llvm-project?rev=283601&view=rev
Log:
Visually align table def with respective enum. NFC

'warn_attribute_wrong_decl_type' has to stay in sync with
'enum AttributeDeclKind' which is much easier when they line up.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=283601&r1=283600&r2=283601&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct  7 16:02:38 
2016
@@ -2567,25 +2567,49 @@ def err_ifunc_resolver_return : Error<
 def err_ifunc_resolver_params : Error<
   "ifunc resolver function must have no parameters">;
 def warn_attribute_wrong_decl_type : Warning<
-  "%0 attribute only applies to %select{functions|unions|"
-  "variables and functions|"
-  "functions, variables, and Objective-C interfaces|"
-  "functions and methods|parameters|"
-  "functions, methods and blocks|functions, methods, and classes|"
-  "functions, methods, and parameters|classes|enums|variables|methods|"
-  "fields and global variables|structs|parameters and typedefs|variables and 
typedefs|"
-  "thread-local variables|variables and fields|variables, data members and tag 
types|"
-  "types and namespaces|Objective-C interfaces|methods and properties|"
-  "struct or union|struct, union or class|types|"
-  "Objective-C instance methods|init methods of interface or class extension 
declarations|"
-  "variables, functions and classes|"
-  "functions, variables, classes, and Objective-C interfaces|"
-  "Objective-C protocols|variables with static or thread storage duration|"
-  "functions and global variables|structs, unions, and typedefs|structs and 
typedefs|"
-  "interface or protocol declarations|kernel functions|non-K&R-style 
functions|"
-  "variables, enums, fields and typedefs|functions, methods, enums, and 
classes|"
-  "structs, classes, variables, functions, and inline namespaces|"
-  "variables, functions, methods, types, enumerations, enumerators, labels, 
and non-static data members}1">,
+  "%0 attribute only applies to %select{"
+  "functions"
+  "|unions"
+  "|variables and functions"
+  "|functions, variables, and Objective-C interfaces"
+  "|functions and methods"
+  "|parameters"
+  "|functions, methods and blocks"
+  "|functions, methods, and classes"
+  "|functions, methods, and parameters"
+  "|classes"
+  "|enums"
+  "|variables"
+  "|methods"
+  "|fields and global variables"
+  "|structs"
+  "|parameters and typedefs"
+  "|variables and typedefs"
+  "|thread-local variables"
+  "|variables and fields"
+  "|variables, data members and tag types"
+  "|types and namespaces"
+  "|Objective-C interfaces"
+  "|methods and properties"
+  "|struct or union"
+  "|struct, union or class"
+  "|types"
+  "|Objective-C instance methods"
+  "|init methods of interface or class extension declarations"
+  "|variables, functions and classes"
+  "|functions, variables, classes, and Objective-C interfaces"
+  "|Objective-C protocols"
+  "|variables with static or thread storage duration"
+  "|functions and global variables"
+  "|structs, unions, and typedefs"
+  "|structs and typedefs"
+  "|interface or protocol declarations"
+  "|kernel functions"
+  "|non-K&R-style functions"
+  "|variables, enums, fields and typedefs"
+  "|functions, methods, enums, and classes"
+  "|structs, classes, variables, functions, and inline namespaces"
+  "|variables, functions, methods, types, enumerations, enumerators, labels, 
and non-static data members}1">,
   InGroup;
 def err_attribute_wrong_decl_type : Error;
 def warn_type_attribute_wrong_type : Warning<


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


[libcxx] r283606 - Fix various issues in std::any and the related tests.

2016-10-07 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct  7 16:27:45 2016
New Revision: 283606

URL: http://llvm.org/viewvc/llvm-project?rev=283606&view=rev
Log:
Fix various issues in std::any and the related tests.

* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.

Added:

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/rvalue_any_cast_request_lvalue.fail.cpp
Modified:
libcxx/trunk/include/any
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/any/any.class/any.assign/move.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.assign/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/copy.pass.cpp

libcxx/trunk/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/move.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.cons/value.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
libcxx/trunk/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp

libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
libcxx/trunk/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
libcxx/trunk/test/support/any_helpers.h
libcxx/trunk/test/support/test_macros.h

Modified: libcxx/trunk/include/any
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/any?rev=283606&r1=283605&r2=283606&view=diff
==
--- libcxx/trunk/include/any (original)
+++ libcxx/trunk/include/any Fri Oct  7 16:27:45 2016
@@ -197,30 +197,33 @@ public:
 
   template <
   class _ValueType
+, class _Tp = decay_t<_ValueType>
 , class = enable_if_t<
-!is_same, any>::value &&
+!is_same<_Tp, any>::value &&
 !__is_inplace_type<_ValueType>::value &&
-is_copy_constructible<_ValueType>::value>
+is_copy_constructible<_Tp>::value>
 >
   _LIBCPP_INLINE_VISIBILITY
   any(_ValueType && __value);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, _Args...>::value &&
 is_copy_constructible<_Tp>::value
 >
   >
   _LIBCPP_INLINE_VISIBILITY
-  explicit any(in_place_type_t<_Tp>, _Args&&... __args);
+  explicit any(in_place_type_t<_ValueType>, _Args&&... __args);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
 is_copy_constructible<_Tp>::value>
   >
   _LIBCPP_INLINE_VISIBILITY
-  explicit any(in_place_type_t<_Tp>, initializer_list<_Up>, _Args&&... __args);
+  explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... 
__args);
 
   _LIBCPP_INLINE_VISIBILITY
   ~any() { this->reset(); }
@@ -242,15 +245,17 @@ public:
   // ValueType constructor?
   template <
   class _ValueType
+, class _Tp = decay_t<_ValueType>
 , class = enable_if_t<
-  !is_same, any>::value
-  && is_copy_constructible<_ValueType>::value
+  !is_same<_Tp, any>::value
+  && is_copy_constructible<_Tp>::value
   && !__is_inplace_type<_ValueType>::value>
 >
   _LIBCPP_INLINE_VISIBILITY
   any & operator=(_ValueType && __rhs);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, _Args...>::value &&
 is_copy_constructible<_Tp>::value>
@@ -258,7 +263,8 @@ public:
   _LIBCPP_INLINE_VISIBILITY
   void emplace(_Args&&... args);
 
-  template ,
 class = enable_if_t<
 is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
 is_copy_constructible<_Tp>::value>
@@ -490,60 +496,49 @@ namespace __any_imp
 } // namespace __any_imp
 
 
-template 
+template 
 any::any(_ValueType && __v) : __h(nullptr)
 {
-  typedef typename decay<_ValueType>::type _Tp;
-  static_assert(is_copy_constructible<_Tp>::value,
-"_ValueType must be CopyConstructible.");
-  using _ForwardTp = conditional_t<
-  is_move_constructible<_Tp>::value, _ValueType, _ValueType&>;
-  typedef __any_imp::_Handler<_Tp> _HandlerType;
-  _HandlerType::__create(*this, _VSTD::forward<_ForwardTp>(__v));
+  __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_ValueType>(__v));
 }
 
-template 
-any::any(in_place_type_t<_Tp>, _Args&&... __args) {
-  using _Hp = __any_imp::_Handler<_Tp>;
-  _Hp::__create(*this, _VSTD::

r283605 - Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 16:27:26 2016
New Revision: 283605

URL: http://llvm.org/viewvc/llvm-project?rev=283605&view=rev
Log:
Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/include/clang/Driver/Compilation.h
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/Compilation.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Fri Oct  7 16:27:26 2016
@@ -190,12 +190,12 @@ class BindArchAction : public Action {
   virtual void anchor();
   /// The architecture to bind, or 0 if the default architecture
   /// should be bound.
-  const char *ArchName;
+  StringRef ArchName;
 
 public:
-  BindArchAction(Action *Input, const char *ArchName);
+  BindArchAction(Action *Input, StringRef ArchName);
 
-  const char *getArchName() const { return ArchName; }
+  StringRef getArchName() const { return ArchName; }
 
   static bool classof(const Action *A) {
 return A->getKind() == BindArchClass;

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Fri Oct  7 16:27:26 2016
@@ -69,8 +69,9 @@ class Compilation {
 
   /// Cache of translated arguments for a particular tool chain and bound
   /// architecture.
-  llvm::DenseMap,
- llvm::opt::DerivedArgList *> TCArgs;
+  llvm::DenseMap,
+ llvm::opt::DerivedArgList *>
+  TCArgs;
 
   /// Temporary files which should be removed on exit.
   llvm::opt::ArgStringList TempFiles;
@@ -184,7 +185,7 @@ public:
   ///
   /// \param BoundArch - The bound architecture name, or 0.
   const llvm::opt::DerivedArgList &getArgsForToolChain(const ToolChain *TC,
-   const char *BoundArch);
+   StringRef BoundArch);
 
   /// addTempFile - Add a file to remove on exit, and returns its
   /// argument.

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=283605&r1=283604&r2=283605&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Fri Oct  7 16:27:26 2016
@@ -397,7 +397,7 @@ public:
   /// jobs for a given (Action, ToolChain, BoundArch) tuple once.
   InputInfo
   BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC,
- const char *BoundArch, bool AtTopLevel, bool 
MultipleArchs,
+ StringRef BoundArch, bool AtTopLevel, bool MultipleArchs,
  const char *LinkingOutput,
  std::map, 
InputInfo>
  &CachedResults,
@@ -419,7 +419,7 @@ public:
   /// \param MultipleArchs - Whether multiple -arch options were supplied.
   /// \param NormalizedTriple - The normalized triple of the relevant target.
   const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
- const char *BaseInput, const char *BoundArch,
+ const char *BaseInput, StringRef BoundArch,
  bool AtTopLevel, bool MultipleArchs,
  StringRef NormalizedTriple) const;
 
@@ -468,9 +468,8 @@ private:
   /// jobs specifically for the given action, but will use the cache when
   /// building jobs for the Action's inputs.
   InputInfo BuildJobsForActionNoCache(
-  Compilation &C, const Action *A, const ToolChain *TC,
-  const char *BoundArch, bool AtTopLevel, bool MultipleArchs,
-  const char *LinkingOutput,
+  Compilation &C, const Action *A, const ToolChain *TC, StringRef 
BoundArch,
+  bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
   std::map, InputInfo>
   &CachedResults,
   bool BuildForOffloadDevice) const;

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283605&r1=283604&r2=283605&view=diff
=

[PATCH] D25249: [libc++] Many any test fixes

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@CaseyCarter Thank you for the patch. I fixed most of your issues in r283606 
{as well as a bunch of libc++ bugs).

I'm still deciding what to do about the `in_place` SFINAE tests, but I'll 
follow up on that shortly. As for this patch please update it if there are any 
fixes I missed, otherwise please close it.




Comment at: test/libcxx/utilities/any/any.class/any.assign/value.pass.cpp:25
+// Test that any& operator=(ValueType&&) is *never* selected for:
+// * std::in_place type.
+{

CaseyCarter wrote:
> This behavior is not required by N4606, so I moved this test to the libcxx 
> tree.
I thought this behavior was subject to a LWG PR, but I can't seem to find one.

I'll either create a LWG issue to standardize this behavior or remove the tests 
and fix libc++.



Comment at: test/libcxx/utilities/any/any.class/any.cons/value.pass.cpp:23
+int main() {
+// test construction from INSANE copy-but-not-movable types.
+using Type = deleted_move;

CaseyCarter wrote:
> Again, not required behavior (I am, of course, totally unbiased about whether 
> this behavior is a good idea.)
I'm removing these tests all together.



Comment at: 
test/libcxx/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp:34
+
+// Test that I can retrieve INSANE copy-but-not-movable type from an any
+void test_cast_to_value_deleted_move()

CaseyCarter wrote:
> ibid.
I'm removing these tests all together.



Comment at: test/std/utilities/any/any.class/any.assign/value.pass.cpp:172
 void test_sfinae_constraints() {
-{
-using Tag = std::in_place_type_t;

CaseyCarter wrote:
> I split out these non-portable tests into 
> test/libcxx/utilities/any.class/any.assign/value.pass.cpp
Same comment as above in regards to the `in_place` SFINAE tests.





Comment at: test/std/utilities/any/any.class/any.cons/copy.pass.cpp:74
 assertContains(a, 42);
-assertContains(a, 42);
+assertContains(a2, 42);
 

CaseyCarter wrote:
> Typo in the original test.
Ack. Fixing.



Comment at: 
test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp:146
-// Check getting a type by reference from a non-const rvalue
-{
-Type& v = any_cast(std::move(a));

CaseyCarter wrote:
> This code becomes ill-formed with the above proposed change.
I'm removing these tests.


https://reviews.llvm.org/D25249



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


r283611 - Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 16:41:00 2016
New Revision: 283611

URL: http://llvm.org/viewvc/llvm-project?rev=283611&view=rev
Log:
Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct  7 16:41:00 2016
@@ -233,7 +233,7 @@ public:
 
   /// LookupTypeForExtension - Return the default language type to use for the
   /// given extension.
-  virtual types::ID LookupTypeForExtension(const char *Ext) const;
+  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
 
   /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
   virtual bool IsBlocksDefault() const { return false; }

Modified: cfe/trunk/include/clang/Driver/Types.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/include/clang/Driver/Types.h (original)
+++ cfe/trunk/include/clang/Driver/Types.h Fri Oct  7 16:41:00 2016
@@ -13,6 +13,9 @@
 #include "clang/Driver/Phases.h"
 #include "llvm/ADT/SmallVector.h"
 
+namespace llvm {
+class StringRef;
+}
 namespace clang {
 namespace driver {
 namespace types {
@@ -79,7 +82,7 @@ namespace types {
 
   /// lookupTypeForExtension - Lookup the type to use for the file
   /// extension \p Ext.
-  ID lookupTypeForExtension(const char *Ext);
+  ID lookupTypeForExtension(llvm::StringRef Ext);
 
   /// lookupTypeForTypSpecifier - Lookup the type to use for a user
   /// specified type name.

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct  7 16:41:00 2016
@@ -370,7 +370,7 @@ std::string ToolChain::GetLinkerPath() c
   return GetProgramPath(DefaultLinker);
 }
 
-types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {
+types::ID ToolChain::LookupTypeForExtension(StringRef Ext) const {
   return types::lookupTypeForExtension(Ext);
 }
 

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct  7 16:41:00 2016
@@ -54,7 +54,7 @@ MachO::MachO(const Driver &D, const llvm
 Darwin::Darwin(const Driver &D, const llvm::Triple &Triple, const ArgList 
&Args)
 : MachO(D, Triple, Args), TargetInitialized(false) {}
 
-types::ID MachO::LookupTypeForExtension(const char *Ext) const {
+types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
   types::ID Ty = types::lookupTypeForExtension(Ext);
 
   // Darwin always preprocesses assembly files (unless -x is used explicitly).

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Oct  7 16:41:00 2016
@@ -312,7 +312,7 @@ public:
   /// @name ToolChain Implementation
   /// {
 
-  types::ID LookupTypeForExtension(const char *Ext) const override;
+  types::ID LookupTypeForExtension(StringRef Ext) const override;
 
   bool HasNativeLLVMSupport() const override;
 

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=283611&r1=283610&r2=283611&view=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Oct  7 16:41:00 2016
@@ -170,7 +170,7 @@ bool types::isCuda(ID Id) {
   }
 }
 
-types::ID types::lookupTypeForExtension(const char *Ext) {
+types::ID types::lookupTypeForExtension(llvm::StringRef Ext) {
   return llvm::StringSwitch(Ext)
.Case("c", TY_C)
.Case("C", TY_CXX)


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

[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Why do you want to build `libc++.so` with hidden visibility? What's wrong with 
the existing way  we build `libc++.so`?


https://reviews.llvm.org/D25208



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


[PATCH] D25248: [libcxx] [test] Fix shadow warnings.

2016-10-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

Thanks Marshall. Can either you or Eric commit this?


https://reviews.llvm.org/D25248



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


[PATCH] D25001: [Module] Merge function prototype with a non-prototype function declaration

2016-10-07 Thread Richard Smith via cfe-commits
rsmith added a comment.

I'm concerned that name lookup will find an inappropriate declaration after 
this merging. If we have two visible declarations of a function in the same 
scope, and one has a prototype but the other does not, the user should be able 
to rely on the prototype being used. `isPreferredLookupResult` in 
SemaLookup.cpp picks the most recent declaration in an attempt to handle this, 
but that won't do the right thing here, so you should also teach it to prefer a 
prototyped function over an unprototyped one.

You should be able to test for this case by trying to pass a pointer to the 
wrong type to `func1`. (You may need a different testcase that provides the 
prototype in the .c file and the declaration without prototype in the header in 
order to hit this, depending on which result name lookup ends up preferring.)




Comment at: lib/Serialization/ASTReaderDecl.cpp:2715
 return (FuncX->getLinkageInternal() == FuncY->getLinkageInternal()) &&
   FuncX->getASTContext().hasSameType(FuncX->getType(), FuncY->getType());
   }

Instead of your change, can we change this to use `typesAreCompatible` instead 
of `hasSameType`?


https://reviews.llvm.org/D25001



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


[PATCH] D22221: Decide whether to enable plugin tests based on cmake variables

2016-10-07 Thread Philip Reames via cfe-commits
reames resigned from this revision.
reames removed a reviewer: reames.
reames added a comment.

I know very little about our cmake infrastructure.


Repository:
  rL LLVM

https://reviews.llvm.org/D1



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


r283616 - Rename variable to not use C++ reserved name (leading underscore + capital) (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 17:03:03 2016
New Revision: 283616

URL: http://llvm.org/viewvc/llvm-project?rev=283616&view=rev
Log:
Rename variable to not use C++ reserved name (leading underscore + capital) 
(NFC)

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

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=283616&r1=283615&r2=283616&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct  7 17:03:03 2016
@@ -125,8 +125,8 @@ InputAction::InputAction(const Arg &_Inp
 
 void BindArchAction::anchor() {}
 
-BindArchAction::BindArchAction(Action *Input, llvm::StringRef _ArchName)
-: Action(BindArchClass, Input), ArchName(_ArchName) {}
+BindArchAction::BindArchAction(Action *Input, llvm::StringRef ArchName)
+: Action(BindArchClass, Input), ArchName(ArchName) {}
 
 void OffloadAction::anchor() {}
 


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


r283615 - Fix MSVC build: requires namespace in front of StringRef (NFC)

2016-10-07 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct  7 17:02:59 2016
New Revision: 283615

URL: http://llvm.org/viewvc/llvm-project?rev=283615&view=rev
Log:
Fix MSVC build: requires namespace in front of StringRef (NFC)

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

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=283615&r1=283614&r2=283615&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct  7 17:02:59 2016
@@ -125,7 +125,7 @@ InputAction::InputAction(const Arg &_Inp
 
 void BindArchAction::anchor() {}
 
-BindArchAction::BindArchAction(Action *Input, StringRef _ArchName)
+BindArchAction::BindArchAction(Action *Input, llvm::StringRef _ArchName)
 : Action(BindArchClass, Input), ArchName(_ArchName) {}
 
 void OffloadAction::anchor() {}


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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

> Why does test_stack_allocator.pass.cpp line 11 have a commented-out path?

Typically tests name the header they test in a comment.

> Why is 
> test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp 
> 84-85 gaining totally empty braces?

Mass-translation fatigue. I've removed the empty braces.

All of the comments have been addressed.


https://reviews.llvm.org/D25154



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


[PATCH] D25154: [libc++] Fix stack_allocator

2016-10-07 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 73995.
EricWF added a comment.

Address @STL_MSFT's comments.


https://reviews.llvm.org/D25154

Files:
  
test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
  
test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
  test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
  test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
  test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
  test/std/containers/sequences/deque/deque.cons/default.pass.cpp
  test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
  test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
  test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
  test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
  test/std/containers/sequences/list/list.cons/size_type.pass.cpp
  test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
  
test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
  
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
  
test/std/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
  test/std/containers/stack_allocator.h
  test/support/stack_allocator.h
  test/support/test.support/test_stack_allocator.pass.cpp
  test/support/test_macros.h

Index: test/support/test_macros.h
===
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -120,6 +120,25 @@
 #define TEST_NORETURN [[noreturn]]
 #endif
 
+#if TEST_STD_VER < 11
+#ifdef __clang__
+#define TEST_ALIGNOF(X) __alignof(X)
+#define TEST_ALIGNAS(X) __attribute__((__aligned__(X)))
+#elif defined(__GNUC__)
+#define TEST_ALIGNOF(X) __alignof(X)
+#define TEST_ALIGNAS(X) __attribute__((__aligned__(X)))
+#elif defined(_MSC_VER)
+#define TEST_ALIGNOF(X) __alignof__(X)
+#define TEST_ALIGNAS(X) __declspec(align(X))
+#else
+#error Unsupported compiler
+#endif
+#else // TEST_STD_VER >= 11
+#define TEST_ALIGNOF(X) alignof(X)
+#define TEST_ALIGNAS(X) alignas(X)
+#endif
+
+
 /* Macros for testing libc++ specific behavior and extensions */
 #if defined(_LIBCPP_VERSION)
 #define LIBCPP_ASSERT(...) assert(__VA_ARGS__)
Index: test/support/test.support/test_stack_allocator.pass.cpp
===
--- /dev/null
+++ test/support/test.support/test_stack_allocator.pass.cpp
@@ -0,0 +1,87 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// "support/stack_allocator.h"
+
+#include "stack_allocator.h"
+
+#include "test_macros.h"
+
+template 
+struct TEST_ALIGNAS(A) AlignedType {
+  char buff[S];
+};
+
+static const size_t MA = TEST_ALIGNOF(std::max_align_t);
+
+typedef AlignedType<1, 1>  S1;
+typedef AlignedType<2, 2>  S2;
+typedef AlignedType<17, 1>  S17;
+typedef AlignedType  SPtr;
+typedef AlignedType  SMA;
+typedef AlignedType  SMA2;
+
+template 
+void test_basic() {
+  typedef stack_buffer BuffT;
+  typedef typename BuffT::allocator_type AllocT;
+  typedef std::allocator_traits ATraits;
+  BuffT SB;
+  AllocT SA(SB);
+  uintptr_t lastVal = 0;
+  for (size_t i=0; i <

  1   2   >