[PATCH] D16718: Add an optional ToolName argument to runToolOnCodeWithArgs/buildASTFromCodeWithArgs.

2016-01-29 Thread Benjamin Kramer via cfe-commits
bkramer created this revision.
bkramer added a reviewer: klimek.
bkramer added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

This can be used as a way to modify argv[0] for a clang tool.

http://reviews.llvm.org/D16718

Files:
  include/clang/Tooling/Tooling.h
  lib/Tooling/Tooling.cpp
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -79,9 +79,9 @@
   // Some tests need rtti/exceptions on
   Args.push_back("-frtti");
   Args.push_back("-fexceptions");
-  if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, Filename,
- std::make_shared(),
- VirtualMappedFiles)) {
+  if (!runToolOnCodeWithArgs(
+  Factory->create(), Code, Args, Filename, "clang-tool",
+  std::make_shared(), VirtualMappedFiles)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
   }
   if (Found != DynamicFound) {
Index: lib/Tooling/Tooling.cpp
===
--- lib/Tooling/Tooling.cpp
+++ lib/Tooling/Tooling.cpp
@@ -103,14 +103,15 @@
const Twine &FileName,
std::shared_ptr PCHContainerOps) {
   return runToolOnCodeWithArgs(ToolAction, Code, std::vector(),
-   FileName, PCHContainerOps);
+   FileName, "clang-tool", PCHContainerOps);
 }
 
 static std::vector
-getSyntaxOnlyToolArgs(const std::vector &ExtraArgs,
+getSyntaxOnlyToolArgs(const Twine &ToolName,
+  const std::vector &ExtraArgs,
   StringRef FileName) {
   std::vector Args;
-  Args.push_back("clang-tool");
+  Args.push_back(ToolName.str());
   Args.push_back("-fsyntax-only");
   Args.insert(Args.end(), ExtraArgs.begin(), ExtraArgs.end());
   Args.push_back(FileName.str());
@@ -120,6 +121,7 @@
 bool runToolOnCodeWithArgs(
 clang::FrontendAction *ToolAction, const Twine &Code,
 const std::vector &Args, const Twine &FileName,
+const Twine &ToolName,
 std::shared_ptr PCHContainerOps,
 const FileContentMappings &VirtualMappedFiles) {
 
@@ -132,7 +134,7 @@
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef),
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
 ToolAction, Files.get(), PCHContainerOps);
 
   SmallString<1024> CodeStorage;
@@ -470,12 +472,12 @@
 buildASTFromCode(const Twine &Code, const Twine &FileName,
  std::shared_ptr PCHContainerOps) {
   return buildASTFromCodeWithArgs(Code, std::vector(), FileName,
-  PCHContainerOps);
+  "clang-tool", PCHContainerOps);
 }
 
 std::unique_ptr buildASTFromCodeWithArgs(
 const Twine &Code, const std::vector &Args,
-const Twine &FileName,
+const Twine &FileName, const Twine &ToolName,
 std::shared_ptr PCHContainerOps) {
   SmallString<16> FileNameStorage;
   StringRef FileNameRef = FileName.toNullTerminatedStringRef(FileNameStorage);
@@ -489,8 +491,8 @@
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), &Action,
-Files.get(), PCHContainerOps);
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
+&Action, Files.get(), PCHContainerOps);
 
   SmallString<1024> CodeStorage;
   InMemoryFileSystem->addFile(FileNameRef, 0,
Index: include/clang/Tooling/Tooling.h
===
--- include/clang/Tooling/Tooling.h
+++ include/clang/Tooling/Tooling.h
@@ -143,6 +143,8 @@
 /// \param ToolAction The action to run over the code.
 /// \param Code C++ code.
 /// \param FileName The file name which 'Code' will be mapped as.
+/// \param ToolName The name of the binary running the tool. Standard library
+/// header paths will be resolved relative to this.
 /// \param PCHContainerOps  The PCHContainerOperations for loading and creating
 /// clang modules.
 ///
@@ -163,13 +165,16 @@
 /// \param Code C++ code.
 /// \param Args Additional flags to pass on.
 /// \param FileName The file name which 'Code' will be mapped as.
+/// \param ToolName The name of the binary running the tool. Standard library
+/// header paths will be resolved relative to this.
 /// \param PCHContainerOps   The PCHContainerOperations for loading and creating
 ///

Re: [PATCH] D16718: Add an optional ToolName argument to runToolOnCodeWithArgs/buildASTFromCodeWithArgs.

2016-01-29 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 46370.
bkramer added a comment.

Fix comment.


http://reviews.llvm.org/D16718

Files:
  include/clang/Tooling/Tooling.h
  lib/Tooling/Tooling.cpp
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -79,9 +79,9 @@
   // Some tests need rtti/exceptions on
   Args.push_back("-frtti");
   Args.push_back("-fexceptions");
-  if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, Filename,
- std::make_shared(),
- VirtualMappedFiles)) {
+  if (!runToolOnCodeWithArgs(
+  Factory->create(), Code, Args, Filename, "clang-tool",
+  std::make_shared(), VirtualMappedFiles)) {
 return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
   }
   if (Found != DynamicFound) {
Index: lib/Tooling/Tooling.cpp
===
--- lib/Tooling/Tooling.cpp
+++ lib/Tooling/Tooling.cpp
@@ -103,14 +103,15 @@
const Twine &FileName,
std::shared_ptr PCHContainerOps) {
   return runToolOnCodeWithArgs(ToolAction, Code, std::vector(),
-   FileName, PCHContainerOps);
+   FileName, "clang-tool", PCHContainerOps);
 }
 
 static std::vector
-getSyntaxOnlyToolArgs(const std::vector &ExtraArgs,
+getSyntaxOnlyToolArgs(const Twine &ToolName,
+  const std::vector &ExtraArgs,
   StringRef FileName) {
   std::vector Args;
-  Args.push_back("clang-tool");
+  Args.push_back(ToolName.str());
   Args.push_back("-fsyntax-only");
   Args.insert(Args.end(), ExtraArgs.begin(), ExtraArgs.end());
   Args.push_back(FileName.str());
@@ -120,6 +121,7 @@
 bool runToolOnCodeWithArgs(
 clang::FrontendAction *ToolAction, const Twine &Code,
 const std::vector &Args, const Twine &FileName,
+const Twine &ToolName,
 std::shared_ptr PCHContainerOps,
 const FileContentMappings &VirtualMappedFiles) {
 
@@ -132,7 +134,7 @@
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef),
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
 ToolAction, Files.get(), PCHContainerOps);
 
   SmallString<1024> CodeStorage;
@@ -470,12 +472,12 @@
 buildASTFromCode(const Twine &Code, const Twine &FileName,
  std::shared_ptr PCHContainerOps) {
   return buildASTFromCodeWithArgs(Code, std::vector(), FileName,
-  PCHContainerOps);
+  "clang-tool", PCHContainerOps);
 }
 
 std::unique_ptr buildASTFromCodeWithArgs(
 const Twine &Code, const std::vector &Args,
-const Twine &FileName,
+const Twine &FileName, const Twine &ToolName,
 std::shared_ptr PCHContainerOps) {
   SmallString<16> FileNameStorage;
   StringRef FileNameRef = FileName.toNullTerminatedStringRef(FileNameStorage);
@@ -489,8 +491,8 @@
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), &Action,
-Files.get(), PCHContainerOps);
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
+&Action, Files.get(), PCHContainerOps);
 
   SmallString<1024> CodeStorage;
   InMemoryFileSystem->addFile(FileNameRef, 0,
Index: include/clang/Tooling/Tooling.h
===
--- include/clang/Tooling/Tooling.h
+++ include/clang/Tooling/Tooling.h
@@ -163,13 +163,16 @@
 /// \param Code C++ code.
 /// \param Args Additional flags to pass on.
 /// \param FileName The file name which 'Code' will be mapped as.
+/// \param ToolName The name of the binary running the tool. Standard library
+/// header paths will be resolved relative to this.
 /// \param PCHContainerOps   The PCHContainerOperations for loading and creating
 ///  clang modules.
 ///
 /// \return - True if 'ToolAction' was successfully executed.
 bool runToolOnCodeWithArgs(
 clang::FrontendAction *ToolAction, const Twine &Code,
 const std::vector &Args, const Twine &FileName = "input.cc",
+const Twine &ToolName = "clang-tool",
 std::shared_ptr PCHContainerOps =
 std::make_shared(),
 const FileContentMappings &VirtualMappedFiles = FileContentMappings());
@@ -192,13 +195,15 @@
 /// \param Code C++ code.
 /// \param Args Additional flags to pass on.
 /// \param FileName The file name which 

r259183 - Add target triple to CodeGenOpenCL/pipe_types.cl test case

2016-01-29 Thread Ulrich Weigand via cfe-commits
Author: uweigand
Date: Fri Jan 29 04:45:23 2016
New Revision: 259183

URL: http://llvm.org/viewvc/llvm-project?rev=259183&view=rev
Log:
Add target triple to CodeGenOpenCL/pipe_types.cl test case

The test is failing on SystemZ since different IR is being
generated due to platform ABI differences.  Add a target triple.

Fix suggested by Anastasia Stulova.


Modified:
cfe/trunk/test/CodeGenOpenCL/pipe_types.cl

Modified: cfe/trunk/test/CodeGenOpenCL/pipe_types.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/pipe_types.cl?rev=259183&r1=259182&r2=259183&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/pipe_types.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/pipe_types.cl Fri Jan 29 04:45:23 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 
-cl-std=CL2.0 -o - %s | FileCheck %s
 
 // CHECK: %opencl.pipe_t = type opaque
 typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;


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


Re: [PATCH] D16718: Add an optional ToolName argument to runToolOnCodeWithArgs/buildASTFromCodeWithArgs.

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

lg


http://reviews.llvm.org/D16718



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


Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-01-29 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

Is this okay to commit with the updated changes?


http://reviews.llvm.org/D16613



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


r259187 - Add an optional ToolName argument to runToolOnCodeWithArgs/buildASTFromCodeWithArgs.

2016-01-29 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri Jan 29 05:29:02 2016
New Revision: 259187

URL: http://llvm.org/viewvc/llvm-project?rev=259187&view=rev
Log:
Add an optional ToolName argument to 
runToolOnCodeWithArgs/buildASTFromCodeWithArgs.

This can be used as a way to modify argv[0] for a clang tool.

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

Modified:
cfe/trunk/include/clang/Tooling/Tooling.h
cfe/trunk/lib/Tooling/Tooling.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Modified: cfe/trunk/include/clang/Tooling/Tooling.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Tooling.h?rev=259187&r1=259186&r2=259187&view=diff
==
--- cfe/trunk/include/clang/Tooling/Tooling.h (original)
+++ cfe/trunk/include/clang/Tooling/Tooling.h Fri Jan 29 05:29:02 2016
@@ -163,6 +163,8 @@ typedef std::vector &Args, const Twine &FileName = "input.cc",
+const Twine &ToolName = "clang-tool",
 std::shared_ptr PCHContainerOps =
 std::make_shared(),
 const FileContentMappings &VirtualMappedFiles = FileContentMappings());
@@ -192,13 +195,15 @@ buildASTFromCode(const Twine &Code, cons
 /// \param Code C++ code.
 /// \param Args Additional flags to pass on.
 /// \param FileName The file name which 'Code' will be mapped as.
+/// \param ToolName The name of the binary running the tool. Standard library
+/// header paths will be resolved relative to this.
 /// \param PCHContainerOps The PCHContainerOperations for loading and creating
 /// clang modules.
 ///
 /// \return The resulting AST or null if an error occurred.
 std::unique_ptr buildASTFromCodeWithArgs(
 const Twine &Code, const std::vector &Args,
-const Twine &FileName = "input.cc",
+const Twine &FileName = "input.cc", const Twine &ToolName = "clang-tool",
 std::shared_ptr PCHContainerOps =
 std::make_shared());
 

Modified: cfe/trunk/lib/Tooling/Tooling.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=259187&r1=259186&r2=259187&view=diff
==
--- cfe/trunk/lib/Tooling/Tooling.cpp (original)
+++ cfe/trunk/lib/Tooling/Tooling.cpp Fri Jan 29 05:29:02 2016
@@ -103,14 +103,15 @@ bool runToolOnCode(clang::FrontendAction
const Twine &FileName,
std::shared_ptr PCHContainerOps) {
   return runToolOnCodeWithArgs(ToolAction, Code, std::vector(),
-   FileName, PCHContainerOps);
+   FileName, "clang-tool", PCHContainerOps);
 }
 
 static std::vector
-getSyntaxOnlyToolArgs(const std::vector &ExtraArgs,
+getSyntaxOnlyToolArgs(const Twine &ToolName,
+  const std::vector &ExtraArgs,
   StringRef FileName) {
   std::vector Args;
-  Args.push_back("clang-tool");
+  Args.push_back(ToolName.str());
   Args.push_back("-fsyntax-only");
   Args.insert(Args.end(), ExtraArgs.begin(), ExtraArgs.end());
   Args.push_back(FileName.str());
@@ -120,6 +121,7 @@ getSyntaxOnlyToolArgs(const std::vector<
 bool runToolOnCodeWithArgs(
 clang::FrontendAction *ToolAction, const Twine &Code,
 const std::vector &Args, const Twine &FileName,
+const Twine &ToolName,
 std::shared_ptr PCHContainerOps,
 const FileContentMappings &VirtualMappedFiles) {
 
@@ -132,7 +134,7 @@ bool runToolOnCodeWithArgs(
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef),
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
 ToolAction, Files.get(), PCHContainerOps);
 
   SmallString<1024> CodeStorage;
@@ -470,12 +472,12 @@ std::unique_ptr
 buildASTFromCode(const Twine &Code, const Twine &FileName,
  std::shared_ptr PCHContainerOps) {
   return buildASTFromCodeWithArgs(Code, std::vector(), FileName,
-  PCHContainerOps);
+  "clang-tool", PCHContainerOps);
 }
 
 std::unique_ptr buildASTFromCodeWithArgs(
 const Twine &Code, const std::vector &Args,
-const Twine &FileName,
+const Twine &FileName, const Twine &ToolName,
 std::shared_ptr PCHContainerOps) {
   SmallString<16> FileNameStorage;
   StringRef FileNameRef = FileName.toNullTerminatedStringRef(FileNameStorage);
@@ -489,8 +491,8 @@ std::unique_ptr buildASTFromCod
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), &Action,
-Files.get(), PCHContainerOps);
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
+   

Re: [PATCH] D16718: Add an optional ToolName argument to runToolOnCodeWithArgs/buildASTFromCodeWithArgs.

2016-01-29 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259187: Add an optional ToolName argument to… (authored by 
d0k).

Changed prior to commit:
  http://reviews.llvm.org/D16718?vs=46370&id=46372#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16718

Files:
  cfe/trunk/include/clang/Tooling/Tooling.h
  cfe/trunk/lib/Tooling/Tooling.cpp
  cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h

Index: cfe/trunk/include/clang/Tooling/Tooling.h
===
--- cfe/trunk/include/clang/Tooling/Tooling.h
+++ cfe/trunk/include/clang/Tooling/Tooling.h
@@ -163,13 +163,16 @@
 /// \param Code C++ code.
 /// \param Args Additional flags to pass on.
 /// \param FileName The file name which 'Code' will be mapped as.
+/// \param ToolName The name of the binary running the tool. Standard library
+/// header paths will be resolved relative to this.
 /// \param PCHContainerOps   The PCHContainerOperations for loading and creating
 ///  clang modules.
 ///
 /// \return - True if 'ToolAction' was successfully executed.
 bool runToolOnCodeWithArgs(
 clang::FrontendAction *ToolAction, const Twine &Code,
 const std::vector &Args, const Twine &FileName = "input.cc",
+const Twine &ToolName = "clang-tool",
 std::shared_ptr PCHContainerOps =
 std::make_shared(),
 const FileContentMappings &VirtualMappedFiles = FileContentMappings());
@@ -192,13 +195,15 @@
 /// \param Code C++ code.
 /// \param Args Additional flags to pass on.
 /// \param FileName The file name which 'Code' will be mapped as.
+/// \param ToolName The name of the binary running the tool. Standard library
+/// header paths will be resolved relative to this.
 /// \param PCHContainerOps The PCHContainerOperations for loading and creating
 /// clang modules.
 ///
 /// \return The resulting AST or null if an error occurred.
 std::unique_ptr buildASTFromCodeWithArgs(
 const Twine &Code, const std::vector &Args,
-const Twine &FileName = "input.cc",
+const Twine &FileName = "input.cc", const Twine &ToolName = "clang-tool",
 std::shared_ptr PCHContainerOps =
 std::make_shared());
 
Index: cfe/trunk/lib/Tooling/Tooling.cpp
===
--- cfe/trunk/lib/Tooling/Tooling.cpp
+++ cfe/trunk/lib/Tooling/Tooling.cpp
@@ -103,14 +103,15 @@
const Twine &FileName,
std::shared_ptr PCHContainerOps) {
   return runToolOnCodeWithArgs(ToolAction, Code, std::vector(),
-   FileName, PCHContainerOps);
+   FileName, "clang-tool", PCHContainerOps);
 }
 
 static std::vector
-getSyntaxOnlyToolArgs(const std::vector &ExtraArgs,
+getSyntaxOnlyToolArgs(const Twine &ToolName,
+  const std::vector &ExtraArgs,
   StringRef FileName) {
   std::vector Args;
-  Args.push_back("clang-tool");
+  Args.push_back(ToolName.str());
   Args.push_back("-fsyntax-only");
   Args.insert(Args.end(), ExtraArgs.begin(), ExtraArgs.end());
   Args.push_back(FileName.str());
@@ -120,6 +121,7 @@
 bool runToolOnCodeWithArgs(
 clang::FrontendAction *ToolAction, const Twine &Code,
 const std::vector &Args, const Twine &FileName,
+const Twine &ToolName,
 std::shared_ptr PCHContainerOps,
 const FileContentMappings &VirtualMappedFiles) {
 
@@ -132,7 +134,7 @@
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef),
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
 ToolAction, Files.get(), PCHContainerOps);
 
   SmallString<1024> CodeStorage;
@@ -470,12 +472,12 @@
 buildASTFromCode(const Twine &Code, const Twine &FileName,
  std::shared_ptr PCHContainerOps) {
   return buildASTFromCodeWithArgs(Code, std::vector(), FileName,
-  PCHContainerOps);
+  "clang-tool", PCHContainerOps);
 }
 
 std::unique_ptr buildASTFromCodeWithArgs(
 const Twine &Code, const std::vector &Args,
-const Twine &FileName,
+const Twine &FileName, const Twine &ToolName,
 std::shared_ptr PCHContainerOps) {
   SmallString<16> FileNameStorage;
   StringRef FileNameRef = FileName.toNullTerminatedStringRef(FileNameStorage);
@@ -489,8 +491,8 @@
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
   llvm::IntrusiveRefCntPtr Files(
   new FileManager(FileSystemOptions(), OverlayFileSystem));
-  ToolInvocation Invocation(getSyntaxOnlyToolArgs(Args, FileNameRef), &Action,
-Files.get(), PCHContainerOps);
+  ToolInvocation Invocation(getSyntaxOnlyToolArgs(ToolName, Args, FileNameRef),
+&A

Re: [PATCH] D15603: [OpenCL] Pipe type support

2016-01-29 Thread Ulrich Weigand via cfe-commits
uweigand added a comment.

In http://reviews.llvm.org/D15603#338593, @Anastasia wrote:

> Yes, I see that it happens only for some vector types. The CodeGen follows 
> quite different paths for both targets. And in the case of s390x-linux-gnu it 
> ends up in ABIArgInfo::Indirect case of the second switch statement where an 
> additional pointer will be added here:
>
>   ArgTypes[FirstIRArg] = LTy->getPointerTo();
>
> I don't have enough knowledge at the moment of this ABI to tell whether it's 
> Ok, but the generated code appears to be completely wrong.


Well, yes, on SystemZ we pass 16-byte vector types via implicit reference 
(using ABIArgInfo::Indirect) in the default case, i.e. when targeting an older 
CPU without SIMD.  But the code generated for OpenCL pipes doesn't actually 
seem to correctly implement that convention either ...  (It does work for 
normal calls via C/C++/...)

> As a temporary workaround to fix your build bot, I suggest you to add 
> '-triple x86_64-linux-gnu' into RUN line of the test:

> 

>   -// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s

>   +// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - -triple 
> x86_64-linux-gnu %s | FileCheck %s

> 

> It has already been done before in OpenCL tests as we don't support most of 
> targets anyways.


OK, I've checked this in as rev. 259183.  Thanks!


http://reviews.llvm.org/D15603



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


Re: [PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

2016-01-29 Thread Benjamin Kramer via cfe-commits
bkramer added a subscriber: bkramer.
bkramer added a comment.

Why are you re-adding all those Makefiles?


http://reviews.llvm.org/D16529



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


r259192 - Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().

2016-01-29 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Jan 29 07:46:15 2016
New Revision: 259192

URL: http://llvm.org/viewvc/llvm-project?rev=259192&view=rev
Log:
Implement TemplateArgument::dump() method for debugging, patterned after 
TemplateName::dump().


Modified:
cfe/trunk/include/clang/AST/TemplateBase.h
cfe/trunk/lib/AST/TemplateBase.cpp

Modified: cfe/trunk/include/clang/AST/TemplateBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=259192&r1=259191&r2=259192&view=diff
==
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)
+++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Jan 29 07:46:15 2016
@@ -354,6 +354,12 @@ public:
   /// \brief Print this template argument to the given output stream.
   void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
  
+  /// \brief Debugging aid that dumps the template argument.
+  void dump(raw_ostream &Out) const;
+
+  /// \brief Debugging aid that dumps the template argument to standard error.
+  void dump() const;
+ 
   /// \brief Used to insert TemplateArguments into FoldingSets.
   void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const;
 };

Modified: cfe/trunk/lib/AST/TemplateBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259192&r1=259191&r2=259192&view=diff
==
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 07:46:15 2016
@@ -415,6 +415,15 @@ void TemplateArgument::print(const Print
   }
 }
 
+void TemplateArgument::dump(raw_ostream &Out) const {
+  LangOptions LO; // FIXME! see also TemplateName::dump().
+  LO.CPlusPlus = true;
+  LO.Bool = true;
+  print(PrintingPolicy(LO), Out);
+}
+
+void TemplateArgument::dump() const { dump(llvm::errs()); }
+
 
//===--===//
 // TemplateArgumentLoc Implementation
 
//===--===//


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


r259194 - Removing unnecessary casts; NFC.

2016-01-29 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Fri Jan 29 07:53:26 2016
New Revision: 259194

URL: http://llvm.org/viewvc/llvm-project?rev=259194&view=rev
Log:
Removing unnecessary casts; NFC.

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

Modified: cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=259194&r1=259193&r2=259194&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp Fri Jan 29 07:53:26 2016
@@ -1406,9 +1406,9 @@ void BlockDataRegion::LazyInitializeRefe
   BumpVectorContext BC(A);
 
   typedef BumpVector VarVec;
-  VarVec *BV = (VarVec*) A.Allocate();
+  VarVec *BV = A.Allocate();
   new (BV) VarVec(BC, NumBlockVars);
-  VarVec *BVOriginal = (VarVec*) A.Allocate();
+  VarVec *BVOriginal = A.Allocate();
   new (BVOriginal) VarVec(BC, NumBlockVars);
 
   for (const VarDecl *VD : ReferencedBlockVars) {


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


[libcxx] r259193 - [libcxx] Whitelist inclusion of sysctl.h instead of blacklisting

2016-01-29 Thread Ben Craig via cfe-commits
Author: bcraig
Date: Fri Jan 29 07:53:23 2016
New Revision: 259193

URL: http://llvm.org/viewvc/llvm-project?rev=259193&view=rev
Log:
[libcxx] Whitelist inclusion of sysctl.h instead of blacklisting

Instead of excluding all known operating systems that are not derived from BSD,
I now include all operating systems that claim to be derived from BSD.
Hopefully, that will make it so that this check doesn't need to change for
every new operating system that comes along.

http://reviews.llvm.org/D16634

Modified:
libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/src/thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=259193&r1=259192&r2=259193&view=diff
==
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Fri Jan 29 07:53:23 2016
@@ -16,10 +16,15 @@
 #include "future"
 #include "limits"
 #include 
-#if !defined(_WIN32)
-# if !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && 
!defined(__native_client__) && !defined(__CloudABI__)
+
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+# include 
+# if defined(BSD)
 #   include 
-# endif // !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && 
!defined(__native_client__) && !defined(__CloudABI__)
+# endif // defined(BSD)
+#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+
+#if !defined(_WIN32)
 # include 
 #endif // !_WIN32
 


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


Re: [PATCH] D16708: Add a new attribute CFNoRelease.

2016-01-29 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

It's a bit strange to add an attribute that has absolutely no semantic effect 
whatsoever. Where is this attribute intended to be queried within the compiler? 
Are there additional functionality patches coming for this?



Comment at: include/clang/Basic/Attr.td:540
@@ +539,3 @@
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
+}

Please, no undocumented new attributes. You should modify AttrDocs.td and 
include that reference here.


Comment at: test/SemaObjC/attr-cf_no_release.m:31
@@ +30,2 @@
+  void *d CF_NO_RELEASE, // expected-warning{{'cf_no_release' 
attribute only applies to functions}}
+  CFFooRef e CF_NO_RELEASE); // 
expected-warning{{'cf_no_release' attribute only applies to functions}}

Not that lots of test are bad, but a lot of these tests are duplicates and can 
be removed. For instance, really only need one test for ObjC methods, one for 
properties, one for params, etc. It would be good to add a test ensuring that 
the attribute accepts no arguments.


http://reviews.llvm.org/D16708



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


Re: [PATCH] D8149: Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes

2016-01-29 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

LGTM! Thank you for working on this!


http://reviews.llvm.org/D8149



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


Re: [PATCH] D16721: [clang-tidy] Move implicit-cast-in-loop check to upstream.

2016-01-29 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with one nit. I'll fix and commit the patch.

Thank you!



Comment at: clang-tidy/performance/ImplicitCastInLoopCheck.cpp:79
@@ +78,3 @@
+  // code at the end).
+  if (IsNonTrivialImplicitCast(Materialized->getTemporary())) {
+ReportAndFix(Result.Context, VD, OperatorCall);

No braces needed around single-line `if` bodies.


Repository:
  rL LLVM

http://reviews.llvm.org/D16721



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


Re: [PATCH] D16721: [clang-tidy] Move implicit-cast-in-loop check to upstream.

2016-01-29 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: test/clang-tidy/performance_implicit_cast_in_loop.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s performance-implicit-cast-in-loop %t
+

Also, the name should use dashes, not underscores. I'll fix this as well.


Repository:
  rL LLVM

http://reviews.llvm.org/D16721



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


Re: [PATCH] D16587: Fixed function params comparison. Updated docs and tests.

2016-01-29 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good! I'll commit the patch for you.


http://reviews.llvm.org/D16587



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


[clang-tools-extra] r259195 - [clang-tidy] Move implicit-cast-in-loop check to upstream.

2016-01-29 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jan 29 09:21:32 2016
New Revision: 259195

URL: http://llvm.org/viewvc/llvm-project?rev=259195&view=rev
Log:
[clang-tidy] Move implicit-cast-in-loop check to upstream.

Summary: This is implemented originally by Alex Pilkiewicz (pi...@google.com).

Reviewers: alexfh

Subscribers: cfe-commits

Patch by Haojian Wu!

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

Added:
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-implicit-cast-in-loop.rst

clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt?rev=259195&r1=259194&r2=259195&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt Fri Jan 29 
09:21:32 2016
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyPerformanceModule
+  ImplicitCastInLoopCheck.cpp
   PerformanceTidyModule.cpp
   UnnecessaryCopyInitialization.cpp
 

Added: 
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp?rev=259195&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp 
(added)
+++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp 
Fri Jan 29 09:21:32 2016
@@ -0,0 +1,106 @@
+//===--- ImplicitCastInLoopCheck.cpp - 
clang-tidy--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ImplicitCastInLoopCheck.h"
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Decl.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Lex/Lexer.h"
+
+namespace clang {
+
+using namespace ast_matchers;
+
+namespace tidy {
+namespace performance {
+
+namespace {
+// Checks if the stmt is a ImplicitCastExpr with a CastKind that is not a NoOp.
+// The subtelty is that in some cases (user defined conversions), we can
+// get to ImplicitCastExpr inside each other, with the outer one a NoOp. In 
this
+// case we skip the first cast expr.
+bool IsNonTrivialImplicitCast(const Stmt* ST) {
+  if (const auto* ICE = dyn_cast(ST)) {
+return (ICE->getCastKind() != CK_NoOp) ||
+IsNonTrivialImplicitCast(ICE->getSubExpr());
+  }
+  return false;
+}
+} // namespace
+
+void ImplicitCastInLoopCheck::registerMatchers(
+ast_matchers::MatchFinder* Finder) {
+  // We look for const ref loop variables that (optionally inside an
+  // ExprWithCleanup) materialize a temporary, and contain a implicit cast. The
+  // check on the implicit cast is done in check() because we can't access
+  // implicit cast subnode via matchers: has() skips casts and materialize!
+  // We also bind on the call to operator* to get the proper type in the
+  // diagnostic message.
+  // Note that when the implicit cast is done through a user defined cast
+  // operator, the node is a CXXMemberCallExpr, not a CXXOperatorCallExpr, so
+  // it should not get caught by the cxxOperatorCallExpr() matcher.
+  Finder->addMatcher(
+  cxxForRangeStmt(hasLoopVariable(
+  varDecl(hasType(qualType(references(qualType(isConstQualified(),
+  hasInitializer(expr(hasDescendant(cxxOperatorCallExpr().bind(
+  "operator-call")))
+ .bind("init")))
+  .bind("faulty-var"))),
+  this);
+}
+
+void ImplicitCastInLoopCheck::check(
+const ast_matchers::MatchFinder::MatchResult &Result) {
+  const auto* VD = Result.Nodes.getNodeAs("faulty-var");
+  const auto* Init = Result.Nodes.getNodeAs("init");
+  const auto* OperatorCall =
+  Result.Nodes.getNodeAs("operator-call");
+
+  if (const auto* Cleanup = dyn_cast(Init)) {
+Init = Cleanup->getSubExpr();
+  }
+  const auto* Materialized = dyn_cast(Init);
+  if (!Materialized) {
+return;
+  }
+
+  // We ignore NoOp casts. Those are generated if the * operator on the
+  // iterator re

[clang-tools-extra] r259197 - Fixed function params comparison. Updated docs and tests.

2016-01-29 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jan 29 09:22:10 2016
New Revision: 259197

URL: http://llvm.org/viewvc/llvm-project?rev=259197&view=rev
Log:
Fixed function params comparison. Updated docs and tests.

Summary: "checkParamTypes" may fail if the the type of some parameter is not 
canonical. Fixed it by comparing canonical types. And added 
"getCanonicalType()" and "getCanonicalDecl()" on more places to prevent 
potential fail.

Reviewers: alexfh

Subscribers: cfe-commits

Patch by Cong Liu!

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

Modified:
clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-virtual-near-miss.rst
clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp?rev=259197&r1=259196&r2=259197&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp Fri Jan 29 
09:22:10 2016
@@ -19,6 +19,12 @@ namespace clang {
 namespace tidy {
 namespace misc {
 
+AST_MATCHER(CXXMethodDecl, isStatic) { return Node.isStatic(); }
+
+AST_MATCHER(CXXMethodDecl, isOverloadedOperator) {
+  return Node.isOverloadedOperator();
+}
+
 /// Finds out if the given method overrides some method.
 static bool isOverrideMethod(const CXXMethodDecl *MD) {
   return MD->size_overridden_methods() > 0 || MD->hasAttr();
@@ -32,10 +38,14 @@ static bool isOverrideMethod(const CXXMe
 static bool checkOverridingFunctionReturnType(const ASTContext *Context,
   const CXXMethodDecl *BaseMD,
   const CXXMethodDecl *DerivedMD) {
-  QualType BaseReturnTy =
-  BaseMD->getType()->getAs()->getReturnType();
-  QualType DerivedReturnTy =
-  DerivedMD->getType()->getAs()->getReturnType();
+  QualType BaseReturnTy = BaseMD->getType()
+  ->getAs()
+  ->getReturnType()
+  .getCanonicalType();
+  QualType DerivedReturnTy = DerivedMD->getType()
+ ->getAs()
+ ->getReturnType()
+ .getCanonicalType();
 
   if (DerivedReturnTy->isDependentType() || BaseReturnTy->isDependentType())
 return false;
@@ -54,8 +64,8 @@ static bool checkOverridingFunctionRetur
   /// BTy is the class type in return type of BaseMD. For example,
   ///B* Base::md()
   /// While BRD is the declaration of B.
-  QualType DTy = DerivedReturnTy->getPointeeType();
-  QualType BTy = BaseReturnTy->getPointeeType();
+  QualType DTy = DerivedReturnTy->getPointeeType().getCanonicalType();
+  QualType BTy = BaseReturnTy->getPointeeType().getCanonicalType();
 
   const CXXRecordDecl *DRD = DTy->getAsCXXRecordDecl();
   const CXXRecordDecl *BRD = BTy->getAsCXXRecordDecl();
@@ -81,7 +91,8 @@ static bool checkOverridingFunctionRetur
 // Check accessibility.
 // FIXME: We currently only support checking if B is accessible base class
 // of D, or D is the same class which DerivedMD is in.
-bool IsItself = DRD == DerivedMD->getParent();
+bool IsItself =
+DRD->getCanonicalDecl() == DerivedMD->getParent()->getCanonicalDecl();
 bool HasPublicAccess = false;
 for (const auto &Path : Paths) {
   if (Path.Access == AS_public)
@@ -121,8 +132,9 @@ static bool checkParamTypes(const CXXMet
 return false;
 
   for (unsigned I = 0; I < NumParamA; I++) {
-if (getDecayedType(BaseMD->getParamDecl(I)->getType()) !=
-getDecayedType(DerivedMD->getParamDecl(I)->getType()))
+if (getDecayedType(BaseMD->getParamDecl(I)->getType().getCanonicalType()) 
!=
+getDecayedType(
+DerivedMD->getParamDecl(I)->getType().getCanonicalType()))
   return false;
   }
   return true;
@@ -152,27 +164,21 @@ static bool checkOverrideWithoutName(con
 /// DerivedMD is in.
 static bool checkOverrideByDerivedMethod(const CXXMethodDecl *BaseMD,
  const CXXMethodDecl *DerivedMD) {
-  if (BaseMD->getNameAsString() != DerivedMD->getNameAsString())
-return false;
-
-  if (!checkParamTypes(BaseMD, DerivedMD))
-return false;
-
-  return true;
-}
+  for (CXXMethodDecl::method_iterator I = 
DerivedMD->begin_overridden_methods(),
+  E = DerivedMD->end_overridden_methods();
+   I != E; ++I) {
+const CXXMethodDecl *OverriddenMD = *I;
+if (BaseMD->getCanonicalDecl() == OverriddenMD->getCanonicalDecl()) {
+  return true;
+}
+  }
 
-/// Generate unique ID for given MethodDecl.
-///
-/// The 

Re: [PATCH] D16587: Fixed function params comparison. Updated docs and tests.

2016-01-29 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259197: Fixed function params comparison. Updated docs and 
tests. (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D16587?vs=46360&id=46382#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16587

Files:
  clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
  clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.h
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-virtual-near-miss.rst
  clang-tools-extra/trunk/test/clang-tidy/misc-virtual-near-miss.cpp

Index: clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
@@ -19,6 +19,12 @@
 namespace tidy {
 namespace misc {
 
+AST_MATCHER(CXXMethodDecl, isStatic) { return Node.isStatic(); }
+
+AST_MATCHER(CXXMethodDecl, isOverloadedOperator) {
+  return Node.isOverloadedOperator();
+}
+
 /// Finds out if the given method overrides some method.
 static bool isOverrideMethod(const CXXMethodDecl *MD) {
   return MD->size_overridden_methods() > 0 || MD->hasAttr();
@@ -32,10 +38,14 @@
 static bool checkOverridingFunctionReturnType(const ASTContext *Context,
   const CXXMethodDecl *BaseMD,
   const CXXMethodDecl *DerivedMD) {
-  QualType BaseReturnTy =
-  BaseMD->getType()->getAs()->getReturnType();
-  QualType DerivedReturnTy =
-  DerivedMD->getType()->getAs()->getReturnType();
+  QualType BaseReturnTy = BaseMD->getType()
+  ->getAs()
+  ->getReturnType()
+  .getCanonicalType();
+  QualType DerivedReturnTy = DerivedMD->getType()
+ ->getAs()
+ ->getReturnType()
+ .getCanonicalType();
 
   if (DerivedReturnTy->isDependentType() || BaseReturnTy->isDependentType())
 return false;
@@ -54,8 +64,8 @@
   /// BTy is the class type in return type of BaseMD. For example,
   ///B* Base::md()
   /// While BRD is the declaration of B.
-  QualType DTy = DerivedReturnTy->getPointeeType();
-  QualType BTy = BaseReturnTy->getPointeeType();
+  QualType DTy = DerivedReturnTy->getPointeeType().getCanonicalType();
+  QualType BTy = BaseReturnTy->getPointeeType().getCanonicalType();
 
   const CXXRecordDecl *DRD = DTy->getAsCXXRecordDecl();
   const CXXRecordDecl *BRD = BTy->getAsCXXRecordDecl();
@@ -81,7 +91,8 @@
 // Check accessibility.
 // FIXME: We currently only support checking if B is accessible base class
 // of D, or D is the same class which DerivedMD is in.
-bool IsItself = DRD == DerivedMD->getParent();
+bool IsItself =
+DRD->getCanonicalDecl() == DerivedMD->getParent()->getCanonicalDecl();
 bool HasPublicAccess = false;
 for (const auto &Path : Paths) {
   if (Path.Access == AS_public)
@@ -121,8 +132,9 @@
 return false;
 
   for (unsigned I = 0; I < NumParamA; I++) {
-if (getDecayedType(BaseMD->getParamDecl(I)->getType()) !=
-getDecayedType(DerivedMD->getParamDecl(I)->getType()))
+if (getDecayedType(BaseMD->getParamDecl(I)->getType().getCanonicalType()) !=
+getDecayedType(
+DerivedMD->getParamDecl(I)->getType().getCanonicalType()))
   return false;
   }
   return true;
@@ -152,42 +164,35 @@
 /// DerivedMD is in.
 static bool checkOverrideByDerivedMethod(const CXXMethodDecl *BaseMD,
  const CXXMethodDecl *DerivedMD) {
-  if (BaseMD->getNameAsString() != DerivedMD->getNameAsString())
-return false;
-
-  if (!checkParamTypes(BaseMD, DerivedMD))
-return false;
-
-  return true;
-}
+  for (CXXMethodDecl::method_iterator I = DerivedMD->begin_overridden_methods(),
+  E = DerivedMD->end_overridden_methods();
+   I != E; ++I) {
+const CXXMethodDecl *OverriddenMD = *I;
+if (BaseMD->getCanonicalDecl() == OverriddenMD->getCanonicalDecl()) {
+  return true;
+}
+  }
 
-/// Generate unique ID for given MethodDecl.
-///
-/// The Id is used as key for 'PossibleMap'.
-/// Typical Id: "Base::func void (void)"
-static std::string generateMethodId(const CXXMethodDecl *MD) {
-  return MD->getQualifiedNameAsString() + " " + MD->getType().getAsString();
+  return false;
 }
 
 bool VirtualNearMissCheck::isPossibleToBeOverridden(
 const CXXMethodDecl *BaseMD) {
-  std::string Id = generateMethodId(BaseMD);
-  auto Iter = PossibleMap.find(Id);
+  auto Iter = PossibleMap.find(BaseMD);
   if (Iter != PossibleMap.end())
 return Iter->second;
 
   bool IsPossible = !BaseMD->isImplicit() && !isa(BaseMD) &&
 !isa(BaseMD) && BaseMD->isVirtual() &&
 

Re: [PATCH] D16721: [clang-tidy] Move implicit-cast-in-loop check to upstream.

2016-01-29 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259195: [clang-tidy] Move implicit-cast-in-loop check to 
upstream. (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D16721?vs=46377&id=46381#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16721

Files:
  clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
  clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h
  clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/performance-implicit-cast-in-loop.rst
  clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp

Index: clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
@@ -0,0 +1,161 @@
+// RUN: %check_clang_tidy %s performance-implicit-cast-in-loop %t
+
+// -- Classes used in the tests --
+
+// Iterator returning by value.
+template 
+struct Iterator {
+  void operator++();
+  T operator*();
+  bool operator!=(const Iterator& other);
+};
+
+// Iterator returning by reference.
+template 
+struct RefIterator {
+  void operator++();
+  T& operator*();
+  bool operator!=(const RefIterator& other);
+};
+
+// The template argument is an iterator type, and a view is an object you can
+// run a for loop on.
+template 
+struct View {
+  T begin();
+  T end();
+};
+
+// With this class, the implicit cast is a call to the (implicit) constructor of
+// the class.
+template 
+class ImplicitWrapper {
+ public:
+  // Implicit!
+  ImplicitWrapper(const T& t);
+};
+
+// With this class, the implicit cast is a call to the conversion operators of
+// SimpleClass and ComplexClass.
+template 
+class OperatorWrapper {
+ public:
+  explicit OperatorWrapper(const T& t);
+};
+
+struct SimpleClass {
+  int foo;
+  operator OperatorWrapper();
+};
+
+// The materialize expression is not the same when the class has a destructor,
+// so we make sure we cover that case too.
+class ComplexClass {
+ public:
+  ComplexClass();
+  ~ComplexClass();
+  operator OperatorWrapper();
+};
+
+typedef View> SimpleView;
+typedef View> SimpleRefView;
+typedef View> ComplexView;
+typedef View> ComplexRefView;
+
+// -- The test themselves --
+// For each test we do, in the same order, const ref, non const ref, const
+// value, non const value.
+
+void SimpleClassIterator() {
+  for (const SimpleClass& foo : SimpleView()) {}
+  // This line does not compile because a temporary cannot be assigned to a non
+  // const reference.
+  // for (SimpleClass& foo : SimpleView()) {}
+  for (const SimpleClass foo : SimpleView()) {}
+  for (SimpleClass foo : SimpleView()) {}
+}
+
+void SimpleClassRefIterator() {
+  for (const SimpleClass& foo : SimpleRefView()) {}
+  for (SimpleClass& foo : SimpleRefView()) {}
+  for (const SimpleClass foo : SimpleRefView()) {}
+  for (SimpleClass foo : SimpleRefView()) {}
+}
+
+void ComplexClassIterator() {
+  for (const ComplexClass& foo : ComplexView()) {}
+  // for (ComplexClass& foo : ComplexView()) {}
+  for (const ComplexClass foo : ComplexView()) {}
+  for (ComplexClass foo : ComplexView()) {}
+}
+
+void ComplexClassRefIterator() {
+  for (const ComplexClass& foo : ComplexRefView()) {}
+  for (ComplexClass& foo : ComplexRefView()) {}
+  for (const ComplexClass foo : ComplexRefView()) {}
+  for (ComplexClass foo : ComplexRefView()) {}
+}
+
+void ImplicitSimpleClassIterator() {
+  for (const ImplicitWrapper& foo : SimpleView()) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:{{[0-9]*}}: warning: the type of the loop variable 'foo' is different from the one returned by the iterator and generates an implicit cast; you can either change the type to the correct one ('const SimpleClass &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [performance-implicit-cast-in-loop]
+  // for (ImplicitWrapper& foo : SimpleView()) {}
+  for (const ImplicitWrapper foo : SimpleView()) {}
+  for (ImplicitWrapperfoo : SimpleView()) {}
+}
+
+void ImplicitSimpleClassRefIterator() {
+  for (const ImplicitWrapper& foo : SimpleRefView()) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:{{[0-9]*}}: warning: the type of the{{.*'const SimpleClass &'.*}}
+  // for (ImplicitWrapper& foo : SimpleRefView()) {}
+  for (const ImplicitWrapper foo : SimpleRefView()) {}
+  for (ImplicitWrapperfoo : SimpleRefView()) {}
+}
+
+void ImplicitComplexClassIterator() {
+  for (const ImplicitWrapper& foo : ComplexView()) {}
+  // CHECK-MESSAGES: [[@LINE-1]]:{{[0-9]*}}: warning: the type of the{{.*'const ComplexClass 

[clang-tools-extra] r259198 - [clang-tidy] Fix minor style issues. NFC

2016-01-29 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jan 29 09:22:20 2016
New Revision: 259198

URL: http://llvm.org/viewvc/llvm-project?rev=259198&view=rev
Log:
[clang-tidy] Fix minor style issues. NFC

Modified:
clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp?rev=259198&r1=259197&r2=259198&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/VirtualNearMissCheck.cpp Fri Jan 29 
09:22:20 2016
@@ -168,9 +168,8 @@ static bool checkOverrideByDerivedMethod
   E = DerivedMD->end_overridden_methods();
I != E; ++I) {
 const CXXMethodDecl *OverriddenMD = *I;
-if (BaseMD->getCanonicalDecl() == OverriddenMD->getCanonicalDecl()) {
+if (BaseMD->getCanonicalDecl() == OverriddenMD->getCanonicalDecl())
   return true;
-}
   }
 
   return false;

Modified: 
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp?rev=259198&r1=259197&r2=259198&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp 
Fri Jan 29 09:22:20 2016
@@ -27,8 +27,8 @@ namespace {
 // The subtelty is that in some cases (user defined conversions), we can
 // get to ImplicitCastExpr inside each other, with the outer one a NoOp. In 
this
 // case we skip the first cast expr.
-bool IsNonTrivialImplicitCast(const Stmt* ST) {
-  if (const auto* ICE = dyn_cast(ST)) {
+bool IsNonTrivialImplicitCast(const Stmt *ST) {
+  if (const auto *ICE = dyn_cast(ST)) {
 return (ICE->getCastKind() != CK_NoOp) ||
 IsNonTrivialImplicitCast(ICE->getSubExpr());
   }
@@ -57,15 +57,15 @@ void ImplicitCastInLoopCheck::registerMa
 }
 
 void ImplicitCastInLoopCheck::check(const MatchFinder::MatchResult &Result) {
-  const auto* VD = Result.Nodes.getNodeAs("faulty-var");
-  const auto* Init = Result.Nodes.getNodeAs("init");
-  const auto* OperatorCall =
+  const auto *VD = Result.Nodes.getNodeAs("faulty-var");
+  const auto *Init = Result.Nodes.getNodeAs("init");
+  const auto *OperatorCall =
   Result.Nodes.getNodeAs("operator-call");
 
-  if (const auto* Cleanup = dyn_cast(Init))
+  if (const auto *Cleanup = dyn_cast(Init))
 Init = Cleanup->getSubExpr();
 
-  const auto* Materialized = dyn_cast(Init);
+  const auto *Materialized = dyn_cast(Init);
   if (!Materialized)
 return;
 


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


[clang-tools-extra] r259196 - [clang-tidy] Fix style issues. NFC

2016-01-29 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jan 29 09:21:43 2016
New Revision: 259196

URL: http://llvm.org/viewvc/llvm-project?rev=259196&view=rev
Log:
[clang-tidy] Fix style issues. NFC

Added:

clang-tools-extra/trunk/test/clang-tidy/performance-implicit-cast-in-loop.cpp
  - copied, changed from r259195, 
clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
Removed:

clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp?rev=259196&r1=259195&r2=259196&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.cpp 
Fri Jan 29 09:21:43 2016
@@ -36,8 +36,7 @@ bool IsNonTrivialImplicitCast(const Stmt
 }
 } // namespace
 
-void ImplicitCastInLoopCheck::registerMatchers(
-ast_matchers::MatchFinder* Finder) {
+void ImplicitCastInLoopCheck::registerMatchers(MatchFinder *Finder) {
   // We look for const ref loop variables that (optionally inside an
   // ExprWithCleanup) materialize a temporary, and contain a implicit cast. The
   // check on the implicit cast is done in check() because we can't access
@@ -57,28 +56,25 @@ void ImplicitCastInLoopCheck::registerMa
   this);
 }
 
-void ImplicitCastInLoopCheck::check(
-const ast_matchers::MatchFinder::MatchResult &Result) {
+void ImplicitCastInLoopCheck::check(const MatchFinder::MatchResult &Result) {
   const auto* VD = Result.Nodes.getNodeAs("faulty-var");
   const auto* Init = Result.Nodes.getNodeAs("init");
   const auto* OperatorCall =
   Result.Nodes.getNodeAs("operator-call");
 
-  if (const auto* Cleanup = dyn_cast(Init)) {
+  if (const auto* Cleanup = dyn_cast(Init))
 Init = Cleanup->getSubExpr();
-  }
+
   const auto* Materialized = dyn_cast(Init);
-  if (!Materialized) {
+  if (!Materialized)
 return;
-  }
 
   // We ignore NoOp casts. Those are generated if the * operator on the
   // iterator returns a value instead of a reference, and the loop variable
   // is a reference. This situation is fine (it probably produces the same
   // code at the end).
-  if (IsNonTrivialImplicitCast(Materialized->getTemporary())) {
+  if (IsNonTrivialImplicitCast(Materialized->getTemporary()))
 ReportAndFix(Result.Context, VD, OperatorCall);
-  }
 }
 
 void ImplicitCastInLoopCheck::ReportAndFix(

Copied: 
clang-tools-extra/trunk/test/clang-tidy/performance-implicit-cast-in-loop.cpp 
(from r259195, 
clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-implicit-cast-in-loop.cpp?p2=clang-tools-extra/trunk/test/clang-tidy/performance-implicit-cast-in-loop.cpp&p1=clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp&r1=259195&r2=259196&rev=259196&view=diff
==
(empty)

Removed: 
clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp?rev=259195&view=auto
==
--- 
clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance_implicit_cast_in_loop.cpp 
(removed)
@@ -1,161 +0,0 @@
-// RUN: %check_clang_tidy %s performance-implicit-cast-in-loop %t
-
-// -- Classes used in the tests --
-
-// Iterator returning by value.
-template 
-struct Iterator {
-  void operator++();
-  T operator*();
-  bool operator!=(const Iterator& other);
-};
-
-// Iterator returning by reference.
-template 
-struct RefIterator {
-  void operator++();
-  T& operator*();
-  bool operator!=(const RefIterator& other);
-};
-
-// The template argument is an iterator type, and a view is an object you can
-// run a for loop on.
-template 
-struct View {
-  T begin();
-  T end();
-};
-
-// With this class, the implicit cast is a call to the (implicit) constructor 
of
-// the class.
-template 
-class ImplicitWrapper {
- public:
-  // Implicit!
-  ImplicitWrapper(const T& t);
-};
-
-// With this class, the implicit cast is a call to the conversion operators of
-// SimpleClass and ComplexClass.
-template 
-class OperatorWrapper {
- public:
-  explicit OperatorWrapper(const T& t);
-};
-
-struct SimpleClass {
-  int foo;
-  operator OperatorWrapper();
-};
-
-// The materialize expression is not the same when the class has a destructor,
-/

[clang-tools-extra] r259199 - [clang-tidy] ForRangeCopyCheck that warns on and fixes unnecessary copies of loop variables.

2016-01-29 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jan 29 09:54:26 2016
New Revision: 259199

URL: http://llvm.org/viewvc/llvm-project?rev=259199&view=rev
Log:
[clang-tidy] ForRangeCopyCheck that warns on and fixes unnecessary copies of 
loop variables.

Patch by Felix Berger!

Differential revision: http://reviews.llvm.org/D13849

Added:
clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/performance-for-range-copy.rst

clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy-warn-on-all-auto-copies.cpp
clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py
clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=259199&r1=259198&r2=259199&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Fri Jan 29 09:54:26 2016
@@ -214,8 +214,8 @@ void awesome_f2();
 """ % {"check_name_dashes" : check_name_dashes})
 
 # Recreates the list of checks in the docs/clang-tidy/checks directory.
-def update_checks_list(module_path):
-  docs_dir = os.path.join(module_path, '../../docs/clang-tidy/checks')
+def update_checks_list(clang_tidy_path):
+  docs_dir = os.path.join(clang_tidy_path, '../docs/clang-tidy/checks')
   filename = os.path.normpath(os.path.join(docs_dir, 'list.rst'))
   with open(filename, 'r') as f:
 lines = f.readlines()
@@ -262,9 +262,17 @@ FIXME: Describe what patterns does the c
"underline" : "=" * len(check_name_dashes)})
 
 def main():
+  if len(sys.argv) == 2 and sys.argv[1] == '--update-docs':
+update_checks_list(os.path.dirname(sys.argv[0]))
+return
+
   if len(sys.argv) != 3:
-print 'Usage: add_new_check.py  , e.g.\n'
-print 'add_new_check.py misc awesome-functions\n'
+print """\
+Usage: add_new_check.py  , e.g.
+  add_new_check.py misc awesome-functions
+
+Alternatively, run 'add_new_check.py --update-docs' to just update the list of
+documentation files."""
 return
 
   module = sys.argv[1]
@@ -281,7 +289,7 @@ def main():
   adapt_module(module_path, module, check_name, check_name_camel)
   write_test(module_path, module, check_name)
   write_docs(module_path, module, check_name)
-  update_checks_list(module_path)
+  update_checks_list(clang_tidy_path)
   print('Done. Now it\'s your turn!')
 
 if __name__ == '__main__':

Modified: clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt?rev=259199&r1=259198&r2=259199&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/CMakeLists.txt Fri Jan 29 
09:54:26 2016
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyPerformanceModule
+  ForRangeCopyCheck.cpp
   ImplicitCastInLoopCheck.cpp
   PerformanceTidyModule.cpp
   UnnecessaryCopyInitialization.cpp

Added: clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp?rev=259199&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp Fri 
Jan 29 09:54:26 2016
@@ -0,0 +1,177 @@
+//===--- ForRangeCopyCheck.cpp - 
clang-tidy===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ForRangeCopyCheck.h"
+#include "../utils/LexerUtils.h"
+#include "../utils/TypeTraits.h"
+#include "clang/Lex/Lexer.h"
+#include "llvm/ADT/SmallPtrSet.h"
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+using namespace ::clang::ast_matchers;
+using llvm::SmallPtrSet;
+
+namespace {
+
+template  bool isSetDifferenceEmpty(const S &S1, const S &S2) {
+  for (const auto &E : S1)
+if (S2.count(E) == 0)
+  return false;
+  return true;
+}
+
+// Extracts all Nodes keyed by ID from Matches and inserts them into Nodes.
+template 
+void extractNodesById

Re: [PATCH] D8149: Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes

2016-01-29 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

If someone could commit this for me, that would be great.  I do not have commit 
access.

Patch by Richard Thomson


http://reviews.llvm.org/D8149



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


Re: [PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

2016-01-29 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

In http://reviews.llvm.org/D16529#339192, @bkramer wrote:

> Why are you re-adding all those Makefiles?


Ugh, I didn't even notice they were in there.  It must have errantly slipped in 
from rebasing.


http://reviews.llvm.org/D16529



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


Re: [PATCH] D8149: Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes

2016-01-29 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thanks! I've commit as r259210.


http://reviews.llvm.org/D8149



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


r259210 - Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes.

2016-01-29 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Fri Jan 29 11:03:11 2016
New Revision: 259210

URL: http://llvm.org/viewvc/llvm-project?rev=259210&view=rev
Log:
Extend hasType narrowing matcher for TypedefDecls, add functionProtoType 
matcher for FunctionProtoType nodes, extend parameterCountIs to 
FunctionProtoType nodes.

Patch by Richard Thomson

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

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=259210&r1=259209&r2=259210&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Fri Jan 29 11:03:11 2016
@@ -1308,6 +1308,18 @@ c and d.
 
 
 
+MatcherType>functionProtoTypeMatcherFunctionProtoType>...
+Matches 
FunctionProtoType nodes.
+
+Given
+  int (*f)(int);
+  void g();
+functionProtoType()
+  matches "int (*f)(int)" and the type of "g" in C++ mode.
+  In C mode, "g" is not matched because it does not contain a prototype.
+
+
+
 MatcherType>functionTypeMatcherFunctionType>...
 Matches FunctionType 
nodes.
 
@@ -2335,13 +2347,40 @@ compiled in C mode.
 
 
 MatcherFunctionDecl>parameterCountIsunsigned N
-Matches 
FunctionDecls that have a specific parameter count.
+Matches 
FunctionDecls and FunctionProtoTypes that have a
+specific parameter count.
+
+Given
+  void f(int i) {}
+  void g(int i, int j) {}
+  void h(int i, int j);
+  void j(int i);
+  void k(int x, int y, int z, ...);
+functionDecl(parameterCountIs(2))
+  matches void g(int i, int j) {}
+functionProtoType(parameterCountIs(2))
+  matches void h(int i, int j)
+functionProtoType(parameterCountIs(3))
+  matches void k(int x, int y, int z, ...);
+
+
+
+MatcherFunctionProtoType>parameterCountIsunsigned N
+Matches 
FunctionDecls and FunctionProtoTypes that have a
+specific parameter count.
 
 Given
   void f(int i) {}
   void g(int i, int j) {}
+  void h(int i, int j);
+  void j(int i);
+  void k(int x, int y, int z, ...);
 functionDecl(parameterCountIs(2))
-  matches g(int i, int j) {}
+  matches void g(int i, int j) {}
+functionProtoType(parameterCountIs(2))
+  matches void h(int i, int j)
+functionProtoType(parameterCountIs(3))
+  matches void k(int x, int y, int z, ...);
 
 
 
@@ -3995,8 +4034,8 @@ actual casts "explicit" casts.)
 
 
 
-MatcherExpr>hasTypeMatcherDecl> 
InnerMatcher
-Overloaded to match the 
declaration of the expression's or value
+MatcherExpr>hasTypeMatcherDecl> 
InnerMatcher
+Overloaded to match the 
declaration of the expression's or value
 declaration's type.
 
 In case of a value declaration (for example a variable declaration),
@@ -4020,8 +4059,10 @@ matcher.
 
 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")
 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")
+and U (matcher = typedefDecl(hasType(asString("int")))
  class X {};
  void y(X &x) { x; X z; }
+ typedef int U;
 
 
 
@@ -4796,6 +4837,19 @@ Usable as: Any Matcher
 
 
 
+MatcherTypedefDecl>hasTypeMatcherQualType>
 InnerMatcher
+Matches if the expression's 
or declaration's type matches a type
+matcher.
+
+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")
+and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")
+and U (matcher = typedefDecl(hasType(asString("int")))
+ class X {};
+ void y(X &x) { x; X z; }
+ typedef int U;
+
+
+
 MatcherTypedefType>hasDeclarationMatcherDecl>  
InnerMatcher
 Matches a node if 
the declaration associated with that node
 matches the given matcher.
@@ -4881,8 +4935,8 @@ usingDecl(hasAnyUsingShadowDecl(hasTarge
   matches using X::b but not using X::a 
 
 
-MatcherValueDecl>hasTypeMatcher

Re: [PATCH] D16692: [OpenCL] Eliminate warning when declaring OpenCL builtin functions

2016-01-29 Thread Yaxun Liu via cfe-commits
yaxunl updated the summary for this revision.
yaxunl updated this revision to Diff 46390.
yaxunl added a comment.

revised as Xiuli suggested.


http://reviews.llvm.org/D16692

Files:
  lib/Sema/SemaLookup.cpp
  test/SemaOpenCL/builtin.cl

Index: test/SemaOpenCL/builtin.cl
===
--- /dev/null
+++ test/SemaOpenCL/builtin.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+float __attribute__((overloadable)) acos(float); // expected-no-diagnostics
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -690,6 +690,12 @@
 S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
   return false;

+// By OpenCL spec v1.2 s6.9.f, the library functions defined in the
+// C99 standard headers are not available.
+if (S.getLangOpts().OpenCL &&
+S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
+  return false;
+
 if (NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II,
  BuiltinID, S.TUScope,
  R.isForRedeclaration(),


Index: test/SemaOpenCL/builtin.cl
===
--- /dev/null
+++ test/SemaOpenCL/builtin.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+float __attribute__((overloadable)) acos(float); // expected-no-diagnostics
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -690,6 +690,12 @@
 S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
   return false;

+// By OpenCL spec v1.2 s6.9.f, the library functions defined in the
+// C99 standard headers are not available.
+if (S.getLangOpts().OpenCL &&
+S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
+  return false;
+
 if (NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II,
  BuiltinID, S.TUScope,
  R.isForRedeclaration(),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15829: [PGO] Clang Option that enables IR level PGO instrumentation

2016-01-29 Thread Rong Xu via cfe-commits
xur updated this revision to Diff 46389.
xur added a comment.

This new patch adds the change the clang test cases (cc1 option 
-fprofile-instr-generate to -fprofile-instrument=Clang).

It also replaces cc1 option -fprofile-instr-generate= to 
-fprofile-instrument-path=, as suggested by David.

Thanks,

-Rong


http://reviews.llvm.org/D15829

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CGStmt.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenPGO.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/Inputs/pgotest.profraw
  test/CodeGen/pgo-instrumentation.c
  test/CoverageMapping/block-storage-starts-region.m
  test/CoverageMapping/break.c
  test/CoverageMapping/builtinmacro.c
  test/CoverageMapping/casts.c
  test/CoverageMapping/classtemplate.cpp
  test/CoverageMapping/comment-in-macro.c
  test/CoverageMapping/continue.c
  test/CoverageMapping/control-flow-macro.c
  test/CoverageMapping/decl.c
  test/CoverageMapping/header.cpp
  test/CoverageMapping/if.c
  test/CoverageMapping/implicit-def-in-macro.m
  test/CoverageMapping/includehell.cpp
  test/CoverageMapping/ir.c
  test/CoverageMapping/label.cpp
  test/CoverageMapping/lambda.cpp
  test/CoverageMapping/logical.cpp
  test/CoverageMapping/loopmacro.c
  test/CoverageMapping/loops.cpp
  test/CoverageMapping/macro-expansion.c
  test/CoverageMapping/macro-expressions.cpp
  test/CoverageMapping/macroception.c
  test/CoverageMapping/macroparams.c
  test/CoverageMapping/macroparams2.c
  test/CoverageMapping/macros.c
  test/CoverageMapping/macroscopes.cpp
  test/CoverageMapping/md.cpp
  test/CoverageMapping/moremacros.c
  test/CoverageMapping/nestedclass.cpp
  test/CoverageMapping/objc.m
  test/CoverageMapping/preprocessor.c
  test/CoverageMapping/return.c
  test/CoverageMapping/switch.c
  test/CoverageMapping/switchmacro.c
  test/CoverageMapping/system_macro.c
  test/CoverageMapping/templates.cpp
  test/CoverageMapping/test.c
  test/CoverageMapping/trycatch.cpp
  test/CoverageMapping/trymacro.cpp
  test/CoverageMapping/unreachable-macro.c
  test/CoverageMapping/unused_names.c
  test/CoverageMapping/while.c
  test/Driver/clang_f_opts.c
  test/Profile/c-captured.c
  test/Profile/c-general.c
  test/Profile/c-generate.c
  test/Profile/c-indirect-call.c
  test/Profile/c-linkage-available_externally.c
  test/Profile/c-linkage.c
  test/Profile/c-unreachable-after-switch.c
  test/Profile/cxx-implicit.cpp
  test/Profile/cxx-lambda.cpp
  test/Profile/cxx-linkage.cpp
  test/Profile/cxx-rangefor.cpp
  test/Profile/cxx-structors.cpp
  test/Profile/cxx-templates.cpp
  test/Profile/cxx-virtual-destructor-calls.cpp
  test/Profile/objc-general.m

Index: test/Profile/objc-general.m
===
--- test/Profile/objc-general.m
+++ test/Profile/objc-general.m
@@ -1,6 +1,6 @@
 // Test instrumentation of general constructs in objective C.
 
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instrument=Clang | FileCheck -check-prefix=PGOGEN %s
 
 // RUN: llvm-profdata merge %S/Inputs/objc-general.proftext -o %t.profdata
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE %s
Index: test/Profile/cxx-virtual-destructor-calls.cpp
===
--- test/Profile/cxx-virtual-destructor-calls.cpp
+++ test/Profile/cxx-virtual-destructor-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -main-file-name cxx-virtual-destructor-calls.cpp %s -o - -fprofile-instr-generate | FileCheck %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -main-file-name cxx-virtual-destructor-calls.cpp %s -o - -fprofile-instrument=Clang | FileCheck %s
 
 struct Member {
   ~Member();
Index: test/Profile/cxx-templates.cpp
===
--- test/Profile/cxx-templates.cpp
+++ test/Profile/cxx-templates.cpp
@@ -1,7 +1,7 @@
 // Tests for instrumentation of templated code. Each instantiation of a template
 // should be instrumented separately.
 
-// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-templates.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-generate > %tgen
+// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-templates.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument=Clang > %tgen
 // RUN: Fil

Re: [PATCH] D16692: [OpenCL] Eliminate warning when declaring OpenCL builtin functions

2016-01-29 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Sema/SemaLookup.cpp:698
@@ +697,3 @@
+// tgmath.h, time.h, wchar.h and wctype.h are not available and cannot
+// be included by a program.
+if (S.getLangOpts().OpenCL &&

pxli168 wrote:
> I think the  
> > C99 standard headers
> can cover those
> > ...
> >  // ctype.h, complex.h, errno.h, fenv.h, float.h, inttypes.h, limits.h,
> >  // locale.h, setjmp.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h,
> >  // tgmath.h, time.h, wchar.h and wctype.h
> The comment shuold not be copy and paste as Anastasia will say.
> 
Absolutely! Just a reference to the section in spec and a short summary 
sentence should be enough.

However, could we also combine this with CPP comment above (see another 
comment).


Comment at: lib/Sema/SemaLookup.cpp:699
@@ +698,3 @@
+// be included by a program.
+if (S.getLangOpts().OpenCL &&
+S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))

I think we could combine this with the CPP check above?


http://reviews.llvm.org/D16692



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


Re: [PATCH] D16686: [OpenCL] Generate metadata for opencl_unroll_hint attribute

2016-01-29 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: include/clang/Basic/Attr.td:661
@@ +660,3 @@
+  let Args = [UnsignedArgument<"UnrollHint">];
+  let Documentation = [Undocumented];
+}

I think undocumented is not allowed any longer.

I suggest you to check OpenCLGenericAddressSpace here and also 
OpenCLAddressSpaceGenericDocs in AttrDocs.td for an example how it can be done!


Comment at: lib/CodeGen/CGLoopInfo.cpp:126
@@ -122,2 +125,3 @@
 
-auto *ValueExpr = LH->getValue();
+LoopHintAttr::OptionType Option = LoopHintAttr::Unroll;
+LoopHintAttr::LoopHintState State = LoopHintAttr::Disable;

I would like to see a bit of comments here and may be reference to spec if 
possible!


Comment at: lib/Parse/ParseStmt.cpp:111
@@ -110,1 +110,3 @@
 
+  if (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 120) {
+bool wasAttribute = Tok.is(tok::kw___attribute);

May be it's better to wrap in into MaybeParseOpenCLAttributes function to be 
consistent with the rest?


Comment at: lib/Parse/ParseStmt.cpp:117
@@ +116,3 @@
+  if (!(Tok.is(tok::kw_for) || Tok.is(tok::kw_while) || 
Tok.is(tok::kw_do))) {
+AttributeList *attrList = Attrs.getList();
+assert(attrList != NULL);

I am just thinking could we avoid checks on line 115 that are a bit complicated 
to read.

Could we just try to check if the attrList is empty or not. And if not NULL 
check the name of the attribute etc...


Comment at: lib/Parse/ParseStmt.cpp:118
@@ +117,3 @@
+AttributeList *attrList = Attrs.getList();
+assert(attrList != NULL);
+if (attrList->getName()->getName() == "opencl_unroll_hint") {

Assertion should have a message!

NULL -> nullptr


Comment at: lib/Sema/SemaStmtAttr.cpp:210
@@ +209,3 @@
+
+  // opencl_unroll_hint can have 0 arguments (compiler determines unrolling
+  // factor) or 1 argument (the unroll factor provided by the user).

Could you put a reference to spec here?


Comment at: lib/Sema/SemaStmtAttr.cpp:213
@@ +212,3 @@
+
+  unsigned numArgs = A.getNumArgs();
+

Variable names are not inline with the coding style.

Please, see:
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly


Comment at: lib/Sema/SemaStmtAttr.cpp:224
@@ +223,3 @@
+Expr *E = A.getArgAsExpr(0);
+assert(E != NULL);
+llvm::APSInt ArgVal(32);

Assert should have a message!


Comment at: lib/Sema/SemaStmtAttr.cpp:227
@@ +226,3 @@
+
+if (E->isTypeDependent() || E->isValueDependent() ||
+!E->isIntegerConstantExpr(ArgVal, S.Context)) {

Do we need these two checks? Seems C++ related.


Comment at: lib/Sema/SemaStmtAttr.cpp:230
@@ +229,3 @@
+  S.Diag(A.getLoc(), diag::err_attribute_argument_type)
+<< A.getName()->getName() << AANT_ArgumentIntegerConstant << 
E->getSourceRange();
+  return 0;

This line is too long. Please make sure to format your code correctly.

Run clang-format on the final patch:
  http://clang.llvm.org/docs/ClangFormat.html


Comment at: lib/Sema/SemaStmtAttr.cpp:234
@@ +233,3 @@
+
+int64_t val = ArgVal.getSExtValue();
+

could it be just an int type?


Comment at: test/Parser/opencl-unroll-hint.cl:20
@@ +19,3 @@
+  int i;
+
+  __attribute__((opencl_unroll_hint))

could we remove an empty line here please?


Comment at: test/Parser/opencl-unroll-hint.cl:23
@@ +22,3 @@
+  do {
+i = counter();
+x[i] = i;

I think similarly to the test kernel below, we don't really need anything in 
the loop body... just to make the test simpler to understand. :)


http://reviews.llvm.org/D16686



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


Re: r259192 - Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().

2016-01-29 Thread Richard Smith via cfe-commits
On 29 Jan 2016 5:50 a.m., "Yaron Keren via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:
>
> Author: yrnkrn
> Date: Fri Jan 29 07:46:15 2016
> New Revision: 259192
>
> URL: http://llvm.org/viewvc/llvm-project?rev=259192&view=rev
> Log:
> Implement TemplateArgument::dump() method for debugging, patterned after
TemplateName::dump().
>
>
> Modified:
> cfe/trunk/include/clang/AST/TemplateBase.h
> cfe/trunk/lib/AST/TemplateBase.cpp
>
> Modified: cfe/trunk/include/clang/AST/TemplateBase.h
> URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=259192&r1=259191&r2=259192&view=diff
>
==
> --- cfe/trunk/include/clang/AST/TemplateBase.h (original)
> +++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Jan 29 07:46:15 2016
> @@ -354,6 +354,12 @@ public:
>/// \brief Print this template argument to the given output stream.
>void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
>
> +  /// \brief Debugging aid that dumps the template argument.
> +  void dump(raw_ostream &Out) const;
> +
> +  /// \brief Debugging aid that dumps the template argument to standard
error.
> +  void dump() const;
> +
>/// \brief Used to insert TemplateArguments into FoldingSets.
>void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
const;
>  };
>
> Modified: cfe/trunk/lib/AST/TemplateBase.cpp
> URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259192&r1=259191&r2=259192&view=diff
>
==
> --- cfe/trunk/lib/AST/TemplateBase.cpp (original)
> +++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 07:46:15 2016
> @@ -415,6 +415,15 @@ void TemplateArgument::print(const Print
>}
>  }
>
> +void TemplateArgument::dump(raw_ostream &Out) const {
> +  LangOptions LO; // FIXME! see also TemplateName::dump().
> +  LO.CPlusPlus = true;
> +  LO.Bool = true;
> +  print(PrintingPolicy(LO), Out);
> +}
> +
> +void TemplateArgument::dump() const { dump(llvm::errs()); }

This should be annotated with LLVM_DUMP_METHOD.

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


[clang-tools-extra] r259214 - [clang-tidy] Don't use delegating constructors, since they are not supported by MSVC 2013

2016-01-29 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jan 29 11:35:53 2016
New Revision: 259214

URL: http://llvm.org/viewvc/llvm-project?rev=259214&view=rev
Log:
[clang-tidy] Don't use delegating constructors, since they are not supported by 
MSVC 2013

Modified:
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h

Modified: 
clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h?rev=259214&r1=259213&r2=259214&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h 
(original)
+++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitCastInLoopCheck.h 
Fri Jan 29 11:35:53 2016
@@ -21,9 +21,10 @@ namespace performance {
 // isn't any implicit conversion).
 class ImplicitCastInLoopCheck : public ClangTidyCheck {
  public:
-  using ClangTidyCheck::ClangTidyCheck;
-  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
-  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+   ImplicitCastInLoopCheck(StringRef Name, ClangTidyContext *Context)
+   : ClangTidyCheck(Name, Context) {}
+   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
  private:
   void ReportAndFix(const ASTContext *Context, const VarDecl *VD,


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


Re: [PATCH] D16697: Updating .debug_line section version information to match DWARF version.

2016-01-29 Thread Adrian Prantl via cfe-commits
> 
> There is now a public bot that runs the LLDB testsuite on Darwin 
> (http://lab.llvm.org:8080/green/job/LLDB/) so you’ll find out immediately :-)
> LLDB can be fixed, I’m not too worried about it.
> 
> There are, however, also DWARF consumers that are not debuggers that will 
> read the line table, such as CoreSymbolication (atos(1)). I’ll investigate 
> whether it can digest the newer version and follow up here.

CoreSymbolication (which produces symbolicated crash traces) does not yet 
support the version 4 header. It would be great if we could have a separate 
option to control the version of the line table independently from the debug 
info version. We are in the process of making DWARF 4 the default on Darwin and 
being able to upgrade the debug info independently from the line table 
independently would make staging this a lot easier.

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


Re: [PATCH] D16692: [OpenCL] Eliminate warning when declaring OpenCL builtin functions

2016-01-29 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 46395.
yaxunl marked an inline comment as done.
yaxunl added a comment.

revised as Anastasia suggested.


http://reviews.llvm.org/D16692

Files:
  lib/Sema/SemaLookup.cpp
  test/SemaOpenCL/builtin.cl

Index: test/SemaOpenCL/builtin.cl
===
--- /dev/null
+++ test/SemaOpenCL/builtin.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+float __attribute__((overloadable)) acos(float); // expected-no-diagnostics
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -684,9 +684,9 @@

   // If this is a builtin on this (or all) targets, create the decl.
   if (unsigned BuiltinID = II->getBuiltinID()) {
-// In C++, we don't have any predefined library functions like
-// 'malloc'. Instead, we'll just error.
-if (S.getLangOpts().CPlusPlus &&
+// In C++ and OpenCL (spec v1.2 s6.9.f), we don't have any predefined
+// library functions like 'malloc'. Instead, we'll just error.
+if ((S.getLangOpts().CPlusPlus || S.getLangOpts().OpenCL) &&
 S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
   return false;



Index: test/SemaOpenCL/builtin.cl
===
--- /dev/null
+++ test/SemaOpenCL/builtin.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+float __attribute__((overloadable)) acos(float); // expected-no-diagnostics
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -684,9 +684,9 @@

   // If this is a builtin on this (or all) targets, create the decl.
   if (unsigned BuiltinID = II->getBuiltinID()) {
-// In C++, we don't have any predefined library functions like
-// 'malloc'. Instead, we'll just error.
-if (S.getLangOpts().CPlusPlus &&
+// In C++ and OpenCL (spec v1.2 s6.9.f), we don't have any predefined
+// library functions like 'malloc'. Instead, we'll just error.
+if ((S.getLangOpts().CPlusPlus || S.getLangOpts().OpenCL) &&
 S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
   return false;

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


r259218 - Revert r259210 "Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes."

2016-01-29 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Fri Jan 29 12:24:34 2016
New Revision: 259218

URL: http://llvm.org/viewvc/llvm-project?rev=259218&view=rev
Log:
Revert r259210 "Extend hasType narrowing matcher for TypedefDecls, add 
functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs 
to FunctionProtoType nodes."

It didn't pass check-clang.

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

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=259218&r1=259217&r2=259218&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Fri Jan 29 12:24:34 2016
@@ -1308,18 +1308,6 @@ c and d.
 
 
 
-MatcherType>functionProtoTypeMatcherFunctionProtoType>...
-Matches 
FunctionProtoType nodes.
-
-Given
-  int (*f)(int);
-  void g();
-functionProtoType()
-  matches "int (*f)(int)" and the type of "g" in C++ mode.
-  In C mode, "g" is not matched because it does not contain a prototype.
-
-
-
 MatcherType>functionTypeMatcherFunctionType>...
 Matches FunctionType 
nodes.
 
@@ -2347,40 +2335,13 @@ compiled in C mode.
 
 
 MatcherFunctionDecl>parameterCountIsunsigned N
-Matches 
FunctionDecls and FunctionProtoTypes that have a
-specific parameter count.
-
-Given
-  void f(int i) {}
-  void g(int i, int j) {}
-  void h(int i, int j);
-  void j(int i);
-  void k(int x, int y, int z, ...);
-functionDecl(parameterCountIs(2))
-  matches void g(int i, int j) {}
-functionProtoType(parameterCountIs(2))
-  matches void h(int i, int j)
-functionProtoType(parameterCountIs(3))
-  matches void k(int x, int y, int z, ...);
-
-
-
-MatcherFunctionProtoType>parameterCountIsunsigned N
-Matches 
FunctionDecls and FunctionProtoTypes that have a
-specific parameter count.
+Matches 
FunctionDecls that have a specific parameter count.
 
 Given
   void f(int i) {}
   void g(int i, int j) {}
-  void h(int i, int j);
-  void j(int i);
-  void k(int x, int y, int z, ...);
 functionDecl(parameterCountIs(2))
-  matches void g(int i, int j) {}
-functionProtoType(parameterCountIs(2))
-  matches void h(int i, int j)
-functionProtoType(parameterCountIs(3))
-  matches void k(int x, int y, int z, ...);
+  matches g(int i, int j) {}
 
 
 
@@ -4034,8 +3995,8 @@ actual casts "explicit" casts.)
 
 
 
-MatcherExpr>hasTypeMatcherDecl> 
InnerMatcher
-Overloaded to match the 
declaration of the expression's or value
+MatcherExpr>hasTypeMatcherDecl> 
InnerMatcher
+Overloaded to match the 
declaration of the expression's or value
 declaration's type.
 
 In case of a value declaration (for example a variable declaration),
@@ -4059,10 +4020,8 @@ matcher.
 
 Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")
 and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")
-and U (matcher = typedefDecl(hasType(asString("int")))
  class X {};
  void y(X &x) { x; X z; }
- typedef int U;
 
 
 
@@ -4837,19 +4796,6 @@ Usable as: Any Matcher
 
 
 
-MatcherTypedefDecl>hasTypeMatcherQualType>
 InnerMatcher
-Matches if the expression's 
or declaration's type matches a type
-matcher.
-
-Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")
-and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")
-and U (matcher = typedefDecl(hasType(asString("int")))
- class X {};
- void y(X &x) { x; X z; }
- typedef int U;
-
-
-
 MatcherTypedefType>hasDeclarationMatcherDecl>  
InnerMatcher
 Matches a node if 
the declaration associated with that node
 matches the given matcher.
@@ -4935,8 +4881,8 @@ usingDecl(hasAnyUsingShadowDecl(hasTarge
   matches using X::b but not using X::a 
 
 
-MatcherValueDecl>hasTypeMatcher

Re: r259210 - Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes.

2016-01-29 Thread Hans Wennborg via cfe-commits
This broke tests:

http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/44018/steps/test_clang/logs/Clang-Unit%20%3A%3A%20ASTMatchers__Dynamic__DynamicASTMatchersTests__RegistryTest.Errors

I've reverted it in r259218.

Thanks,
Hans


On Fri, Jan 29, 2016 at 9:03 AM, Aaron Ballman via cfe-commits
 wrote:
> Author: aaronballman
> Date: Fri Jan 29 11:03:11 2016
> New Revision: 259210
>
> URL: http://llvm.org/viewvc/llvm-project?rev=259210&view=rev
> Log:
> Extend hasType narrowing matcher for TypedefDecls, add functionProtoType 
> matcher for FunctionProtoType nodes, extend parameterCountIs to 
> FunctionProtoType nodes.
>
> Patch by Richard Thomson
>
> Modified:
> cfe/trunk/docs/LibASTMatchersReference.html
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
> cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r259210 - Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes.

2016-01-29 Thread Aaron Ballman via cfe-commits
On Fri, Jan 29, 2016 at 1:28 PM, Hans Wennborg  wrote:
> This broke tests:
>
> http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/44018/steps/test_clang/logs/Clang-Unit%20%3A%3A%20ASTMatchers__Dynamic__DynamicASTMatchersTests__RegistryTest.Errors
>
> I've reverted it in r259218.

Strange, I did not get an email notification about that failure. Thank
you for reverting to green. Richard, can you look into this? I'm
happy to re-commit whenever you resolve the issue.

~Aaron

>
> Thanks,
> Hans
>
>
> On Fri, Jan 29, 2016 at 9:03 AM, Aaron Ballman via cfe-commits
>  wrote:
>> Author: aaronballman
>> Date: Fri Jan 29 11:03:11 2016
>> New Revision: 259210
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=259210&view=rev
>> Log:
>> Extend hasType narrowing matcher for TypedefDecls, add functionProtoType 
>> matcher for FunctionProtoType nodes, extend parameterCountIs to 
>> FunctionProtoType nodes.
>>
>> Patch by Richard Thomson
>>
>> Modified:
>> cfe/trunk/docs/LibASTMatchersReference.html
>> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
>> cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
>> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
>> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r259221 - [analyzer] Improve Nullability checker diagnostics

2016-01-29 Thread Anna Zaks via cfe-commits
Author: zaks
Date: Fri Jan 29 12:43:15 2016
New Revision: 259221

URL: http://llvm.org/viewvc/llvm-project?rev=259221&view=rev
Log:
[analyzer] Improve Nullability checker diagnostics

- Include the position of the argument on which the nullability is violated
- Differentiate between a 'method' and a 'function' in the message wording
- Test for the error message text in the tests
- Fix a bug with setting 'IsDirectDereference' which resulted in regular 
dereferences assumed to have call context.

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CheckerContext.cpp
cfe/trunk/test/Analysis/nullability.mm
cfe/trunk/test/Analysis/nullability_nullonly.mm

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=259221&r1=259220&r2=259221&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h 
Fri Jan 29 12:43:15 2016
@@ -263,6 +263,10 @@ public:
 Eng.getBugReporter().emitReport(std::move(R));
   }
 
+  /// \brief Returns the word that should be used to refer to the declaration
+  /// in the report.
+  StringRef getDeclDescription(const Decl *D);
+
   /// \brief Get the declaration of the called function (path-sensitive).
   const FunctionDecl *getCalleeDecl(const CallExpr *CE) const;
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp?rev=259221&r1=259220&r2=259221&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp Fri Jan 29 
12:43:15 2016
@@ -230,7 +230,7 @@ void DereferenceChecker::checkLocation(S
 // dereference.
 if (ExplodedNode *N = C.generateSink(nullState, C.getPredecessor())) {
   ImplicitNullDerefEvent event = {l, isLoad, N, &C.getBugReporter(),
-  /*IsDirectDereference=*/false};
+  /*IsDirectDereference=*/true};
   dispatchEvent(event);
 }
   }
@@ -272,7 +272,7 @@ void DereferenceChecker::checkBind(SVal
 if (ExplodedNode *N = C.generateSink(StNull, C.getPredecessor())) {
   ImplicitNullDerefEvent event = {V, /*isLoad=*/true, N,
   &C.getBugReporter(),
-  /*IsDirectDereference=*/false};
+  /*IsDirectDereference=*/true};
   dispatchEvent(event);
 }
   }

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp?rev=259221&r1=259220&r2=259221&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp Fri Jan 29 
12:43:15 2016
@@ -26,13 +26,16 @@
 
//===--===//
 
 #include "ClangSACheckers.h"
-#include "llvm/Support/Path.h"
+
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Path.h"
+
 using namespace clang;
 using namespace ento;
 
@@ -89,18 +92,6 @@ enum class ErrorKind : int {
   NullablePassedToNonnull
 };
 
-const char *const ErrorMessages[] = {
-"Null is assigned to a pointer which is expected to have non-null value",
-"Null passed to a callee that requires a non-null argument",
-"Null is returned from a function that is expected to return a non-null "
-"value",
-"Nullable pointer is assigned to a pointer which is expected to have "
-"non-null value",
-"Nullable pointer is returned from a function that is expected to return a 
"
-"non-null value",
-"Nullable pointer is dereferenced",
-"Nullable pointer is passed to a callee that requires a non-null 
argument"};
-
 class NullabilityChecker
 : public Checker,
  check::PostCall, check::PostStmt,
@@ -169,17 +160,19 @@ private:
   ///
   /// When \p SuppressPath is set 

r259222 - [analyzer] Suppress null reports from defensive checks in function-like macros.

2016-01-29 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Fri Jan 29 12:47:13 2016
New Revision: 259222

URL: http://llvm.org/viewvc/llvm-project?rev=259222&view=rev
Log:
[analyzer] Suppress null reports from defensive checks in function-like macros.

We already do this for case splits introduced as a result of defensive null
checks in functions and methods, so do the same for function-like macros.

rdar://problem/19640441

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
cfe/trunk/test/Analysis/inlining/false-positive-suppression.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=259222&r1=259221&r2=259222&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Fri Jan 29 
12:47:13 2016
@@ -828,8 +828,33 @@ SuppressInlineDefensiveChecksVisitor::Vi
 // Check if this is inlined defensive checks.
 const LocationContext *CurLC =Succ->getLocationContext();
 const LocationContext *ReportLC = BR.getErrorNode()->getLocationContext();
-if (CurLC != ReportLC && !CurLC->isParentOf(ReportLC))
+if (CurLC != ReportLC && !CurLC->isParentOf(ReportLC)) {
   BR.markInvalid("Suppress IDC", CurLC);
+  return nullptr;
+}
+
+// Treat defensive checks in function-like macros as if they were an 
inlined
+// defensive check.
+auto CurPoint = Succ->getLocation().getAs();
+auto BugPoint = BR.getErrorNode()->getLocation().getAs();
+
+if (!CurPoint || !BugPoint)
+  return nullptr;
+
+SourceLocation CurLoc =
+CurPoint->getSrc()->getTerminator().getStmt()->getLocStart();
+SourceLocation BugLoc = BugPoint->getStmt()->getLocStart();
+
+if (CurLoc.isMacroID() && !BugLoc.isMacroID()) {
+  const SourceManager &SMgr = BRC.getSourceManager();
+  std::pair CLInfo = SMgr.getDecomposedLoc(CurLoc);
+  SrcMgr::SLocEntry SE = SMgr.getSLocEntry(CLInfo.first);
+  const SrcMgr::ExpansionInfo &EInfo = SE.getExpansion();
+  if (EInfo.isFunctionMacroExpansion()) {
+BR.markInvalid("Suppress Macro IDC", CurLC);
+return nullptr;
+  }
+}
   }
   return nullptr;
 }

Modified: cfe/trunk/test/Analysis/inlining/false-positive-suppression.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inlining/false-positive-suppression.c?rev=259222&r1=259221&r2=259222&view=diff
==
--- cfe/trunk/test/Analysis/inlining/false-positive-suppression.c (original)
+++ cfe/trunk/test/Analysis/inlining/false-positive-suppression.c Fri Jan 29 
12:47:13 2016
@@ -93,6 +93,74 @@ int triggerDivZero () {
   return 5/y; // expected-warning {{Division by zero}}
 }
 
+// Treat a function-like macro similarly to an inlined function, so suppress
+// warnings along paths resulting from inlined checks.
+#define MACRO_WITH_CHECK(a) ( ((a) != 0) ? *a : 17)
+void testInlineCheckInMacro(int *p) {
+  int i = MACRO_WITH_CHECK(p);
+  (void)i;
+
+  *p = 1; // no-warning
+}
+
+#define MACRO_WITH_NESTED_CHECK(a) ( { int j = MACRO_WITH_CHECK(a); j; } )
+void testInlineCheckInNestedMacro(int *p) {
+  int i = MACRO_WITH_NESTED_CHECK(p);
+  (void)i;
+
+  *p = 1; // no-warning
+}
+
+// If there is a check in a macro that is not function-like, don't treat
+// it like a function so don't suppress.
+#define NON_FUNCTION_MACRO_WITH_CHECK ( ((p) != 0) ? *p : 17)
+void testNonFunctionMacro(int *p) {
+  int i = NON_FUNCTION_MACRO_WITH_CHECK ;
+  (void)i;
+
+  *p = 1; // expected-warning {{Dereference of null pointer (loaded from 
variable 'p')}}
+}
+
+
+// This macro will dereference its argument if the argument is NULL.
+#define MACRO_WITH_ERROR(a) ( ((a) != 0) ? 0 : *a)
+void testErrorInMacro(int *p) {
+  int i = MACRO_WITH_ERROR(p); // expected-warning {{Dereference of null 
pointer (loaded from variable 'p')}}
+  (void)i;
+}
+
+// Here the check (the "if") is not in a macro, so we should still warn.
+#define MACRO_IN_GUARD(a) (!(a))
+void testMacroUsedAsGuard(int *p) {
+  if (MACRO_IN_GUARD(p))
+*p = 1; // expected-warning {{Dereference of null pointer (loaded from 
variable 'p')}}
+}
+
+// When a nil case split is introduced in a macro and the macro is in a guard,
+// we still shouldn't warn.
+int isNull(int *p);
+int isEqual(int *p, int *q);
+#define ISNULL(ptr)((ptr) == 0 || isNull(ptr))
+#define ISEQUAL(a, b)((int *)(a) == (int *)(b) || (ISNULL(a) && ISNULL(b)) 
|| isEqual(a,b))
+#define ISNOTEQUAL(a, b)   (!ISEQUAL(a, b))
+void testNestedDisjunctiveMacro(int *p, int *q) {
+  if (ISNOTEQUAL(p,q)) {
+(void)*p; // no-warning
+(void)*q; // no-warning
+  }
+
+  (void)*p; // no-warning
+  (void)*q; // no-warning
+}
+
+// Here the check is entirely in non-macro code even though the code itself
+// is a macro 

Re: [PATCH] D15450: Avoid double deletion in Clang driver.

2016-01-29 Thread Serge Pavlov via cfe-commits
Can somebody have a look at this fix?
Thank you!

--Serge

2016-01-11 23:50 GMT+06:00 Serge Pavlov :

> Any feedback?
>
> Thanks,
> --Serge
>
> 2015-12-11 20:24 GMT+06:00 Serge Pavlov :
>
>> sepavloff created this revision.
>> sepavloff added a subscriber: cfe-commits.
>>
>> Llvm module object is shared between CodeGenerator and BackendConsumer,
>> in both classes it is stored as std::unique_ptr, which is not a good
>> design solution and can cause double deletion error. Usually it does
>> not occur because in BackendConsumer::HandleTranslationUnit the
>> ownership of CodeGenerator over the module is taken away. If however
>> this method is not called, the module is deleted twice and compiler
>> crashes.
>>
>> As the module owned by BackendConsumer is always the same as CodeGenerator
>> has, local copy of llvm module can be removed from BackendGenerator.
>>
>> http://reviews.llvm.org/D15450
>>
>> Files:
>>   lib/CodeGen/CodeGenAction.cpp
>>
>> Index: lib/CodeGen/CodeGenAction.cpp
>> ===
>> --- lib/CodeGen/CodeGenAction.cpp
>> +++ lib/CodeGen/CodeGenAction.cpp
>> @@ -73,7 +73,6 @@
>>
>>  std::unique_ptr Gen;
>>
>> -std::unique_ptr TheModule;
>>  SmallVector>, 4>
>>  LinkModules;
>>
>> @@ -97,7 +96,10 @@
>>  this->LinkModules.push_back(
>>  std::make_pair(I.first,
>> std::unique_ptr(I.second)));
>>  }
>> -std::unique_ptr takeModule() { return
>> std::move(TheModule); }
>> +llvm::Module *getModule() const { return Gen->GetModule(); }
>> +std::unique_ptr takeModule() {
>> +  return std::unique_ptr(Gen->ReleaseModule());
>> +}
>>  void releaseLinkModules() {
>>for (auto &I : LinkModules)
>>  I.second.release();
>> @@ -117,8 +119,6 @@
>>
>>Gen->Initialize(Ctx);
>>
>> -  TheModule.reset(Gen->GetModule());
>> -
>>if (llvm::TimePassesIsEnabled)
>>  LLVMIRGeneration.stopTimer();
>>  }
>> @@ -165,27 +165,14 @@
>>}
>>
>>// Silently ignore if we weren't initialized for some reason.
>> -  if (!TheModule)
>> -return;
>> -
>> -  // Make sure IR generation is happy with the module. This is
>> released by
>> -  // the module provider.
>> -  llvm::Module *M = Gen->ReleaseModule();
>> -  if (!M) {
>> -// The module has been released by IR gen on failures, do not
>> double
>> -// free.
>> -TheModule.release();
>> +  if (!getModule())
>>  return;
>> -  }
>> -
>> -  assert(TheModule.get() == M &&
>> - "Unexpected module change during IR generation");
>>
>>// Link LinkModule into this module if present, preserving its
>> validity.
>>for (auto &I : LinkModules) {
>>  unsigned LinkFlags = I.first;
>>  llvm::Module *LinkModule = I.second.get();
>> -if (Linker::linkModules(*M, *LinkModule,
>> +if (Linker::linkModules(*getModule(), *LinkModule,
>>  [=](const DiagnosticInfo &DI) {
>>linkerDiagnosticHandler(DI,
>> LinkModule, Diags);
>>  },
>> @@ -195,7 +182,7 @@
>>
>>// Install an inline asm handler so that diagnostics get printed
>> through
>>// our diagnostics hooks.
>> -  LLVMContext &Ctx = TheModule->getContext();
>> +  LLVMContext &Ctx = getModule()->getContext();
>>LLVMContext::InlineAsmDiagHandlerTy OldHandler =
>>  Ctx.getInlineAsmDiagnosticHandler();
>>void *OldContext = Ctx.getInlineAsmDiagnosticContext();
>> @@ -208,7 +195,7 @@
>>
>>EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
>>  C.getTargetInfo().getDataLayoutString(),
>> -TheModule.get(), Action, AsmOutStream);
>> +getModule(), Action, AsmOutStream);
>>
>>Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);
>>
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15450: Avoid double deletion in Clang driver.

2016-01-29 Thread Jonathan Roelofs via cfe-commits



On 1/29/16 11:51 AM, Serge Pavlov via cfe-commits wrote:

Can somebody have a look at this fix?
Thank you!


Testcase?



--Serge

2016-01-11 23:50 GMT+06:00 Serge Pavlov mailto:sepavl...@gmail.com>>:

Any feedback?

Thanks,
--Serge

2015-12-11 20:24 GMT+06:00 Serge Pavlov mailto:sepavl...@gmail.com>>:

sepavloff created this revision.
sepavloff added a subscriber: cfe-commits.

Llvm module object is shared between CodeGenerator and
BackendConsumer,
in both classes it is stored as std::unique_ptr, which is not a good
design solution and can cause double deletion error. Usually it does
not occur because in BackendConsumer::HandleTranslationUnit the
ownership of CodeGenerator over the module is taken away. If however
this method is not called, the module is deleted twice and
compiler crashes.

As the module owned by BackendConsumer is always the same as
CodeGenerator
has, local copy of llvm module can be removed from BackendGenerator.

http://reviews.llvm.org/D15450

Files:
   lib/CodeGen/CodeGenAction.cpp

Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -73,7 +73,6 @@

  std::unique_ptr Gen;

-std::unique_ptr TheModule;
  SmallVector>, 4>
  LinkModules;

@@ -97,7 +96,10 @@
  this->LinkModules.push_back(
  std::make_pair(I.first,
std::unique_ptr(I.second)));
  }
-std::unique_ptr takeModule() { return
std::move(TheModule); }
+llvm::Module *getModule() const { return Gen->GetModule(); }
+std::unique_ptr takeModule() {
+  return std::unique_ptr(Gen->ReleaseModule());
+}
  void releaseLinkModules() {
for (auto &I : LinkModules)
  I.second.release();
@@ -117,8 +119,6 @@

Gen->Initialize(Ctx);

-  TheModule.reset(Gen->GetModule());
-
if (llvm::TimePassesIsEnabled)
  LLVMIRGeneration.stopTimer();
  }
@@ -165,27 +165,14 @@
}

// Silently ignore if we weren't initialized for some
reason.
-  if (!TheModule)
-return;
-
-  // Make sure IR generation is happy with the module. This
is released by
-  // the module provider.
-  llvm::Module *M = Gen->ReleaseModule();
-  if (!M) {
-// The module has been released by IR gen on failures,
do not double
-// free.
-TheModule.release();
+  if (!getModule())
  return;
-  }
-
-  assert(TheModule.get() == M &&
- "Unexpected module change during IR generation");

// Link LinkModule into this module if present,
preserving its validity.
for (auto &I : LinkModules) {
  unsigned LinkFlags = I.first;
  llvm::Module *LinkModule = I.second.get();
-if (Linker::linkModules(*M, *LinkModule,
+if (Linker::linkModules(*getModule(), *LinkModule,
  [=](const DiagnosticInfo &DI) {
linkerDiagnosticHandler(DI,
LinkModule, Diags);
  },
@@ -195,7 +182,7 @@

// Install an inline asm handler so that diagnostics get
printed through
// our diagnostics hooks.
-  LLVMContext &Ctx = TheModule->getContext();
+  LLVMContext &Ctx = getModule()->getContext();
LLVMContext::InlineAsmDiagHandlerTy OldHandler =
  Ctx.getInlineAsmDiagnosticHandler();
void *OldContext = Ctx.getInlineAsmDiagnosticContext();
@@ -208,7 +195,7 @@

EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
  C.getTargetInfo().getDataLayoutString(),
-TheModule.get(), Action, AsmOutStream);
+getModule(), Action, AsmOutStream);

Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);







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



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

r259224 - Class Property: parse @dynamic (class).

2016-01-29 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Jan 29 13:05:57 2016
New Revision: 259224

URL: http://llvm.org/viewvc/llvm-project?rev=259224&view=rev
Log:
Class Property: parse @dynamic (class).

rdar://23891898

Modified:
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/test/SemaObjC/objc-class-property.m

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=259224&r1=259223&r2=259224&view=diff
==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Jan 29 13:05:57 2016
@@ -2353,6 +2353,31 @@ Decl *Parser::ParseObjCPropertyDynamic(S
   assert(Tok.isObjCAtKeyword(tok::objc_dynamic) &&
  "ParseObjCPropertyDynamic(): Expected '@dynamic'");
   ConsumeToken(); // consume dynamic
+
+  bool isClassProperty = false;
+  if (Tok.is(tok::l_paren)) {
+ConsumeParen();
+const IdentifierInfo *II = Tok.getIdentifierInfo();
+
+if (!II) {
+  Diag(Tok, diag::err_objc_expected_property_attr) << II;
+  SkipUntil(tok::r_paren, StopAtSemi);
+} else {
+  SourceLocation AttrName = ConsumeToken(); // consume attribute name
+  if (II->isStr("class")) {
+isClassProperty = true;
+if (Tok.isNot(tok::r_paren)) {
+  Diag(Tok, diag::err_expected) << tok::r_paren;
+  SkipUntil(tok::r_paren, StopAtSemi);
+} else
+  ConsumeParen();
+  } else {
+Diag(AttrName, diag::err_objc_expected_property_attr) << II;
+SkipUntil(tok::r_paren, StopAtSemi);
+  }
+}
+  }
+
   while (true) {
 if (Tok.is(tok::code_completion)) {
   Actions.CodeCompleteObjCPropertyDefinition(getCurScope());
@@ -2371,6 +2396,7 @@ Decl *Parser::ParseObjCPropertyDynamic(S
 Actions.ActOnPropertyImplDecl(
 getCurScope(), atLoc, propertyLoc, false,
 propertyId, nullptr, SourceLocation(),
+isClassProperty ? ObjCPropertyQueryKind::OBJC_PR_query_class :
 ObjCPropertyQueryKind::OBJC_PR_query_unknown);
 
 if (Tok.isNot(tok::comma))

Modified: cfe/trunk/test/SemaObjC/objc-class-property.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-class-property.m?rev=259224&r1=259223&r2=259224&view=diff
==
--- cfe/trunk/test/SemaObjC/objc-class-property.m (original)
+++ cfe/trunk/test/SemaObjC/objc-class-property.m Fri Jan 29 13:05:57 2016
@@ -20,9 +20,10 @@
 @end
 
 @implementation A
-@dynamic x;
+@dynamic x; // refers to the instance property
+@dynamic (class) x; // refers to the class property
 @synthesize z;
-@dynamic c;
+@dynamic c; // refers to the class property
 @end
 
 int test() {


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


Re: r259192 - Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().

2016-01-29 Thread Yaron Keren via cfe-commits
OK.  There are more un-annotated dump() methods such
as TemplateName::dump(),
NestedNameSpecifier::dump(), ASTReader::dump(), ModuleMap::dump(),
MacroInfo::dump(),
...

Annotate all dump() methods LLVM_DUMP_METHOD ?



2016-01-29 19:37 GMT+02:00 Richard Smith :

> On 29 Jan 2016 5:50 a.m., "Yaron Keren via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
> >
> > Author: yrnkrn
> > Date: Fri Jan 29 07:46:15 2016
> > New Revision: 259192
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=259192&view=rev
> > Log:
> > Implement TemplateArgument::dump() method for debugging, patterned after
> TemplateName::dump().
> >
> >
> > Modified:
> > cfe/trunk/include/clang/AST/TemplateBase.h
> > cfe/trunk/lib/AST/TemplateBase.cpp
> >
> > Modified: cfe/trunk/include/clang/AST/TemplateBase.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=259192&r1=259191&r2=259192&view=diff
> >
> ==
> > --- cfe/trunk/include/clang/AST/TemplateBase.h (original)
> > +++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Jan 29 07:46:15 2016
> > @@ -354,6 +354,12 @@ public:
> >/// \brief Print this template argument to the given output stream.
> >void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
> >
> > +  /// \brief Debugging aid that dumps the template argument.
> > +  void dump(raw_ostream &Out) const;
> > +
> > +  /// \brief Debugging aid that dumps the template argument to standard
> error.
> > +  void dump() const;
> > +
> >/// \brief Used to insert TemplateArguments into FoldingSets.
> >void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
> const;
> >  };
> >
> > Modified: cfe/trunk/lib/AST/TemplateBase.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259192&r1=259191&r2=259192&view=diff
> >
> ==
> > --- cfe/trunk/lib/AST/TemplateBase.cpp (original)
> > +++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 07:46:15 2016
> > @@ -415,6 +415,15 @@ void TemplateArgument::print(const Print
> >}
> >  }
> >
> > +void TemplateArgument::dump(raw_ostream &Out) const {
> > +  LangOptions LO; // FIXME! see also TemplateName::dump().
> > +  LO.CPlusPlus = true;
> > +  LO.Bool = true;
> > +  print(PrintingPolicy(LO), Out);
> > +}
> > +
> > +void TemplateArgument::dump() const { dump(llvm::errs()); }
>
> This should be annotated with LLVM_DUMP_METHOD.
>
> > +
> >
>  
> //===--===//
> >  // TemplateArgumentLoc Implementation
> >
>  
> //===--===//
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r259226 - Class Property: warn for synthesize on a class property.

2016-01-29 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Jan 29 13:16:39 2016
New Revision: 259226

URL: http://llvm.org/viewvc/llvm-project?rev=259226&view=rev
Log:
Class Property: warn for synthesize on a class property.

rdar://23891898

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/objc-class-property.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=259226&r1=259225&r2=259226&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jan 29 13:16:39 
2016
@@ -974,6 +974,8 @@ def note_property_synthesize : Note<
   "property synthesized here">;
 def error_synthesize_category_decl : Error<
   "@synthesize not allowed in a category's implementation">;
+def error_synthesize_on_class_property : Error<
+  "@synthesize not allowed on a class property %0">;
 def error_reference_property : Error<
   "property of reference type is not supported">;
 def error_missing_property_interface : Error<

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=259226&r1=259225&r2=259226&view=diff
==
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Jan 29 13:16:39 2016
@@ -933,6 +933,10 @@ Decl *Sema::ActOnPropertyImplDecl(Scope
   Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName();
   return nullptr;
 }
+if (property->isClassProperty() && Synthesize) {
+  Diag(PropertyLoc, diag::error_synthesize_on_class_property) << 
PropertyId;
+  return nullptr;
+}
 unsigned PIkind = property->getPropertyAttributesAsWritten();
 if ((PIkind & (ObjCPropertyDecl::OBJC_PR_atomic |
ObjCPropertyDecl::OBJC_PR_nonatomic) ) == 0) {

Modified: cfe/trunk/test/SemaObjC/objc-class-property.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-class-property.m?rev=259226&r1=259225&r2=259226&view=diff
==
--- cfe/trunk/test/SemaObjC/objc-class-property.m (original)
+++ cfe/trunk/test/SemaObjC/objc-class-property.m Fri Jan 29 13:16:39 2016
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
 
 @interface Root
 -(id) alloc;
@@ -22,7 +21,7 @@
 @implementation A
 @dynamic x; // refers to the instance property
 @dynamic (class) x; // refers to the class property
-@synthesize z;
+@synthesize z, c2; // expected-error {{@synthesize not allowed on a class 
property 'c2'}}
 @dynamic c; // refers to the class property
 @end
 


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


Re: r259192 - Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().

2016-01-29 Thread Richard Smith via cfe-commits
On Fri, Jan 29, 2016 at 11:13 AM, Yaron Keren  wrote:
> OK.  There are more un-annotated dump() methods such as
> TemplateName::dump(), NestedNameSpecifier::dump(), ASTReader::dump(),
> ModuleMap::dump(), MacroInfo::dump(), ...
>
> Annotate all dump() methods LLVM_DUMP_METHOD ?

SGTM

> 2016-01-29 19:37 GMT+02:00 Richard Smith :
>>
>> On 29 Jan 2016 5:50 a.m., "Yaron Keren via cfe-commits"
>>  wrote:
>> >
>> > Author: yrnkrn
>> > Date: Fri Jan 29 07:46:15 2016
>> > New Revision: 259192
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=259192&view=rev
>> > Log:
>> > Implement TemplateArgument::dump() method for debugging, patterned after
>> > TemplateName::dump().
>> >
>> >
>> > Modified:
>> > cfe/trunk/include/clang/AST/TemplateBase.h
>> > cfe/trunk/lib/AST/TemplateBase.cpp
>> >
>> > Modified: cfe/trunk/include/clang/AST/TemplateBase.h
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=259192&r1=259191&r2=259192&view=diff
>> >
>> > ==
>> > --- cfe/trunk/include/clang/AST/TemplateBase.h (original)
>> > +++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Jan 29 07:46:15 2016
>> > @@ -354,6 +354,12 @@ public:
>> >/// \brief Print this template argument to the given output stream.
>> >void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
>> >
>> > +  /// \brief Debugging aid that dumps the template argument.
>> > +  void dump(raw_ostream &Out) const;
>> > +
>> > +  /// \brief Debugging aid that dumps the template argument to standard
>> > error.
>> > +  void dump() const;
>> > +
>> >/// \brief Used to insert TemplateArguments into FoldingSets.
>> >void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
>> > const;
>> >  };
>> >
>> > Modified: cfe/trunk/lib/AST/TemplateBase.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259192&r1=259191&r2=259192&view=diff
>> >
>> > ==
>> > --- cfe/trunk/lib/AST/TemplateBase.cpp (original)
>> > +++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 07:46:15 2016
>> > @@ -415,6 +415,15 @@ void TemplateArgument::print(const Print
>> >}
>> >  }
>> >
>> > +void TemplateArgument::dump(raw_ostream &Out) const {
>> > +  LangOptions LO; // FIXME! see also TemplateName::dump().
>> > +  LO.CPlusPlus = true;
>> > +  LO.Bool = true;
>> > +  print(PrintingPolicy(LO), Out);
>> > +}
>> > +
>> > +void TemplateArgument::dump() const { dump(llvm::errs()); }
>>
>> This should be annotated with LLVM_DUMP_METHOD.
>>
>> > +
>> >
>> > //===--===//
>> >  // TemplateArgumentLoc Implementation
>> >
>> > //===--===//
>> >
>> >
>> > ___
>> > cfe-commits mailing list
>> > cfe-commits@lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r259229 - Class Property: generate metadata for class properties in classes.

2016-01-29 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Jan 29 13:22:54 2016
New Revision: 259229

URL: http://llvm.org/viewvc/llvm-project?rev=259229&view=rev
Log:
Class Property: generate metadata for class properties in classes.

The list of class properties is saved in
Old ABI: cls->isa->ext->properties
New ABI: cls->isa->ro->properties

rdar://23891898

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

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=259229&r1=259228&r2=259229&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Jan 29 13:22:54 2016
@@ -967,7 +967,8 @@ protected:
   llvm::Constant *EmitPropertyList(Twine Name,
const Decl *Container,
const ObjCContainerDecl *OCD,
-   const ObjCCommonTypesHelper &ObjCTypes);
+   const ObjCCommonTypesHelper &ObjCTypes,
+   bool IsClassProperty);
 
   /// EmitProtocolMethodTypes - Generate the array of extended method type 
   /// strings. The return value has type Int8PtrPtrTy.
@@ -981,7 +982,8 @@ protected:
 SmallVectorImpl &Properties,
 const Decl *Container,
 const ObjCProtocolDecl *Proto,
-const ObjCCommonTypesHelper &ObjCTypes);
+const ObjCCommonTypesHelper &ObjCTypes,
+bool IsClassProperty);
 
   /// GetProtocolRef - Return a reference to the internal protocol
   /// description, creating an empty one if it has not been
@@ -1079,7 +1081,8 @@ private:
   /// has type ClassExtensionPtrTy.
   llvm::Constant *EmitClassExtension(const ObjCImplementationDecl *ID,
  CharUnits instanceSize,
- bool hasMRCWeakIvars);
+ bool hasMRCWeakIvars,
+ bool isClassProperty);
 
   /// EmitClassRef - Return a Value*, of type ObjCTypes.ClassPtrTy,
   /// for the given class.
@@ -2816,7 +2819,7 @@ CGObjCMac::EmitProtocolExtension(const O
  "__OBJC,__cat_cls_meth,regular,no_dead_strip",
  OptClassMethods),
   EmitPropertyList("OBJC_$_PROP_PROTO_LIST_" + PD->getName(), nullptr, PD,
-   ObjCTypes),
+   ObjCTypes, false),
   EmitProtocolMethodTypes("OBJC_PROTOCOL_METHOD_TYPES_" + PD->getName(),
   MethodTypesExt, ObjCTypes)};
 
@@ -2878,10 +2881,15 @@ PushProtocolProperties(llvm::SmallPtrSet
SmallVectorImpl &Properties,
const Decl *Container,
const ObjCProtocolDecl *Proto,
-   const ObjCCommonTypesHelper &ObjCTypes) {
+   const ObjCCommonTypesHelper &ObjCTypes,
+   bool IsClassProperty) {
   for (const auto *P : Proto->protocols()) 
-PushProtocolProperties(PropertySet, Properties, Container, P, ObjCTypes);
-  for (const auto *PD : Proto->instance_properties()) {
+PushProtocolProperties(PropertySet, Properties, Container, P, ObjCTypes,
+   IsClassProperty);
+
+  for (const auto *PD : Proto->properties()) {
+if (IsClassProperty != PD->isClassProperty())
+  continue;
 if (!PropertySet.insert(PD->getIdentifier()).second)
   continue;
 llvm::Constant *Prop[] = {
@@ -2907,7 +2915,8 @@ PushProtocolProperties(llvm::SmallPtrSet
 llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine Name,
const Decl *Container,
const ObjCContainerDecl *OCD,
-   const ObjCCommonTypesHelper &ObjCTypes) 
{
+   const ObjCCommonTypesHelper &ObjCTypes,
+   bool IsClassProperty) {
   SmallVector Properties;
   llvm::SmallPtrSet PropertySet;
 
@@ -2918,11 +2927,16 @@ llvm::Constant *CGObjCCommonMac::EmitPro
   };
   if (const ObjCInterfaceDecl *OID = dyn_cast(OCD))
 for (const ObjCCategoryDecl *ClassExt : OID->known_extensions())
-  for (auto *PD : ClassExt->instance_properties()) {
+  for (auto *PD : ClassExt->properties()) {
+if (IsClassProperty != PD->isClassProperty())
+  continue;
 PropertySet.insert(PD->getIdentifier());
 AddProperty(PD);
   }
-  for (const auto *PD : OCD->instance_properties()) {
+
+  for (const auto *PD : OCD->properties()) {
+if (IsClassProperty != PD->isClassProperty())
+  continue;
 // Don't emit duplicate metadata for properties that were already in a
 // class extension.
 if (!PropertySet.insert(PD->getIdentifier()).second)
@@ -2932,11 +2946,13 @@ llvm::Constant *CGObjCCommonMac::EmitPro
 
   if (const ObjCInterfaceDecl *

Re: [PATCH] D15829: [PGO] Clang Option that enables IR level PGO instrumentation

2016-01-29 Thread Rong Xu via cfe-commits
xur added a comment.

To make the review easier, I split the cc1 names change part into a new NFC 
patch here.
http://reviews.llvm.org/D16730


http://reviews.llvm.org/D15829



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


r259232 - Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment.

2016-01-29 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Jan 29 13:38:18 2016
New Revision: 259232

URL: http://llvm.org/viewvc/llvm-project?rev=259232&view=rev
Log:
Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 
post commit comment.


Modified:
cfe/trunk/lib/AST/APValue.cpp
cfe/trunk/lib/AST/DeclarationName.cpp
cfe/trunk/lib/AST/NestedNameSpecifier.cpp
cfe/trunk/lib/AST/TemplateBase.cpp
cfe/trunk/lib/AST/TemplateName.cpp
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/Analysis/CallGraph.cpp
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Frontend/LayoutOverrideSource.cpp
cfe/trunk/lib/Lex/HeaderMap.cpp
cfe/trunk/lib/Lex/MacroInfo.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/lib/Sema/Scope.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
cfe/trunk/lib/Serialization/Module.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
cfe/trunk/lib/StaticAnalyzer/Core/SVals.cpp
cfe/trunk/lib/StaticAnalyzer/Core/SymbolManager.cpp

Modified: cfe/trunk/lib/AST/APValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/APValue.cpp?rev=259232&r1=259231&r2=259232&view=diff
==
--- cfe/trunk/lib/AST/APValue.cpp (original)
+++ cfe/trunk/lib/AST/APValue.cpp Fri Jan 29 13:38:18 2016
@@ -255,7 +255,7 @@ void APValue::swap(APValue &RHS) {
   memcpy(RHS.Data.buffer, TmpData, DataSize);
 }
 
-void APValue::dump() const {
+LLVM_DUMP_METHOD void APValue::dump() const {
   dump(llvm::errs());
   llvm::errs() << '\n';
 }

Modified: cfe/trunk/lib/AST/DeclarationName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=259232&r1=259231&r2=259232&view=diff
==
--- cfe/trunk/lib/AST/DeclarationName.cpp (original)
+++ cfe/trunk/lib/AST/DeclarationName.cpp Fri Jan 29 13:38:18 2016
@@ -333,7 +333,7 @@ DeclarationName DeclarationName::getUsin
   return DeclarationName(Ptr);
 }
 
-void DeclarationName::dump() const {
+LLVM_DUMP_METHOD void DeclarationName::dump() const {
   llvm::errs() << *this << '\n';
 }
 

Modified: cfe/trunk/lib/AST/NestedNameSpecifier.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=259232&r1=259231&r2=259232&view=diff
==
--- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original)
+++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Fri Jan 29 13:38:18 2016
@@ -322,7 +322,7 @@ void NestedNameSpecifier::dump(const Lan
   print(llvm::errs(), PrintingPolicy(LO));
 }
 
-void NestedNameSpecifier::dump() const {
+LLVM_DUMP_METHOD void NestedNameSpecifier::dump() const {
   LangOptions LO;
   print(llvm::errs(), PrintingPolicy(LO));
 }

Modified: cfe/trunk/lib/AST/TemplateBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259232&r1=259231&r2=259232&view=diff
==
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 13:38:18 2016
@@ -422,7 +422,7 @@ void TemplateArgument::dump(raw_ostream
   print(PrintingPolicy(LO), Out);
 }
 
-void TemplateArgument::dump() const { dump(llvm::errs()); }
+LLVM_DUMP_METHOD void TemplateArgument::dump() const { dump(llvm::errs()); }
 
 
//===--===//
 // TemplateArgumentLoc Implementation

Modified: cfe/trunk/lib/AST/TemplateName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateName.cpp?rev=259232&r1=259231&r2=259232&view=diff
==
--- cfe/trunk/lib/AST/TemplateName.cpp (original)
+++ cfe/trunk/lib/AST/TemplateName.cpp Fri Jan 29 13:38:18 2016
@@ -227,6 +227,6 @@ void TemplateName::dump(raw_ostream &OS)
   print(OS, PrintingPolicy(LO));
 }
 
-void TemplateName::dump() const {
+LLVM_DUMP_METHOD void TemplateName::dump() const {
   dump(llvm::errs());
 }

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=259232&r1=259231&r2=259232&view=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Fri Jan 29 13:38:18 2016
@@ -4514,7 +4514,7 @@ void CFGBlock::dump(const CFG* cfg, cons
   print(llvm::errs(), cfg, LO, ShowColors);
 }
 
-void CFGBlock::dump() cons

Re: [PATCH] D15450: Avoid double deletion in Clang driver.

2016-01-29 Thread Serge Pavlov via cfe-commits
Crash is observed when HandleTranslation unit is not called, clang always
calls this method but a clang based project may don't call it if it is not
needed. I saw the crash in such project and used this patch to fix it. I do
not know how to make a regression test, I am not even sure such test would
be practical. The fact that an object is owned by two unique_ptr's may be
enought to change implementation. However any thoughts how to test this
behavior are wellcome.

Thanks,
--Serge

2016-01-30 0:54 GMT+06:00 Jonathan Roelofs :

>
>
> On 1/29/16 11:51 AM, Serge Pavlov via cfe-commits wrote:
>
>> Can somebody have a look at this fix?
>> Thank you!
>>
>
> Testcase?
>
>
>> --Serge
>>
>> 2016-01-11 23:50 GMT+06:00 Serge Pavlov > >:
>>
>> Any feedback?
>>
>> Thanks,
>> --Serge
>>
>> 2015-12-11 20:24 GMT+06:00 Serge Pavlov > >:
>>
>>
>> sepavloff created this revision.
>> sepavloff added a subscriber: cfe-commits.
>>
>> Llvm module object is shared between CodeGenerator and
>> BackendConsumer,
>> in both classes it is stored as std::unique_ptr, which is not a
>> good
>> design solution and can cause double deletion error. Usually it
>> does
>> not occur because in BackendConsumer::HandleTranslationUnit the
>> ownership of CodeGenerator over the module is taken away. If
>> however
>> this method is not called, the module is deleted twice and
>> compiler crashes.
>>
>> As the module owned by BackendConsumer is always the same as
>> CodeGenerator
>> has, local copy of llvm module can be removed from
>> BackendGenerator.
>>
>> http://reviews.llvm.org/D15450
>>
>> Files:
>>lib/CodeGen/CodeGenAction.cpp
>>
>> Index: lib/CodeGen/CodeGenAction.cpp
>>
>> ===
>> --- lib/CodeGen/CodeGenAction.cpp
>> +++ lib/CodeGen/CodeGenAction.cpp
>> @@ -73,7 +73,6 @@
>>
>>   std::unique_ptr Gen;
>>
>> -std::unique_ptr TheModule;
>>   SmallVector> std::unique_ptr>, 4>
>>   LinkModules;
>>
>> @@ -97,7 +96,10 @@
>>   this->LinkModules.push_back(
>>   std::make_pair(I.first,
>> std::unique_ptr(I.second)));
>>   }
>> -std::unique_ptr takeModule() { return
>> std::move(TheModule); }
>> +llvm::Module *getModule() const { return Gen->GetModule(); }
>> +std::unique_ptr takeModule() {
>> +  return std::unique_ptr(Gen->ReleaseModule());
>> +}
>>   void releaseLinkModules() {
>> for (auto &I : LinkModules)
>>   I.second.release();
>> @@ -117,8 +119,6 @@
>>
>> Gen->Initialize(Ctx);
>>
>> -  TheModule.reset(Gen->GetModule());
>> -
>> if (llvm::TimePassesIsEnabled)
>>   LLVMIRGeneration.stopTimer();
>>   }
>> @@ -165,27 +165,14 @@
>> }
>>
>> // Silently ignore if we weren't initialized for some
>> reason.
>> -  if (!TheModule)
>> -return;
>> -
>> -  // Make sure IR generation is happy with the module. This
>> is released by
>> -  // the module provider.
>> -  llvm::Module *M = Gen->ReleaseModule();
>> -  if (!M) {
>> -// The module has been released by IR gen on failures,
>> do not double
>> -// free.
>> -TheModule.release();
>> +  if (!getModule())
>>   return;
>> -  }
>> -
>> -  assert(TheModule.get() == M &&
>> - "Unexpected module change during IR generation");
>>
>> // Link LinkModule into this module if present,
>> preserving its validity.
>> for (auto &I : LinkModules) {
>>   unsigned LinkFlags = I.first;
>>   llvm::Module *LinkModule = I.second.get();
>> -if (Linker::linkModules(*M, *LinkModule,
>> +if (Linker::linkModules(*getModule(), *LinkModule,
>>   [=](const DiagnosticInfo &DI) {
>> linkerDiagnosticHandler(DI,
>> LinkModule, Diags);
>>   },
>> @@ -195,7 +182,7 @@
>>
>> // Install an inline asm handler so that diagnostics get
>> printed through
>> // our diagnostics hooks.
>> -  LLVMContext &Ctx = TheModule->getContext();
>> +  LLVMContext &Ctx = getModule()->getContext();
>> LLVMContext::InlineAsmDiagHandlerTy OldHandler =
>>  

Re: [PATCH] D15450: Avoid double deletion in Clang driver.

2016-01-29 Thread Jonathan Roelofs via cfe-commits



On 1/29/16 12:50 PM, Serge Pavlov wrote:

Crash is observed when HandleTranslation unit is not called, clang
always calls this method but a clang based project may don't call it if
it is not needed. I saw the crash in such project and used this patch to
fix it. I do not know how to make a regression test, I am not even sure
such test would be practical. The fact that an object is owned by two
unique_ptr's may be enought to change implementation. However any
thoughts how to test this behavior are wellcome.


This is what the clang/unittests is for (i.e. you can write a testcase 
that doesn't have to go through the clang driver).



Jon



Thanks,
--Serge

2016-01-30 0:54 GMT+06:00 Jonathan Roelofs mailto:jonat...@codesourcery.com>>:



On 1/29/16 11:51 AM, Serge Pavlov via cfe-commits wrote:

Can somebody have a look at this fix?
Thank you!


Testcase?


--Serge

2016-01-11 23:50 GMT+06:00 Serge Pavlov mailto:sepavl...@gmail.com>
>>:

 Any feedback?

 Thanks,
 --Serge

 2015-12-11 20:24 GMT+06:00 Serge Pavlov
mailto:sepavl...@gmail.com>
 >>:


 sepavloff created this revision.
 sepavloff added a subscriber: cfe-commits.

 Llvm module object is shared between CodeGenerator and
 BackendConsumer,
 in both classes it is stored as std::unique_ptr, which
is not a good
 design solution and can cause double deletion error.
Usually it does
 not occur because in
BackendConsumer::HandleTranslationUnit the
 ownership of CodeGenerator over the module is taken
away. If however
 this method is not called, the module is deleted twice and
 compiler crashes.

 As the module owned by BackendConsumer is always the
same as
 CodeGenerator
 has, local copy of llvm module can be removed from
BackendGenerator.

http://reviews.llvm.org/D15450

 Files:
lib/CodeGen/CodeGenAction.cpp

 Index: lib/CodeGen/CodeGenAction.cpp

===
 --- lib/CodeGen/CodeGenAction.cpp
 +++ lib/CodeGen/CodeGenAction.cpp
 @@ -73,7 +73,6 @@

   std::unique_ptr Gen;

 -std::unique_ptr TheModule;
   SmallVector>, 4>
   LinkModules;

 @@ -97,7 +96,10 @@
   this->LinkModules.push_back(
   std::make_pair(I.first,
 std::unique_ptr(I.second)));
   }
 -std::unique_ptr takeModule() { return
 std::move(TheModule); }
 +llvm::Module *getModule() const { return
Gen->GetModule(); }
 +std::unique_ptr takeModule() {
 +  return
std::unique_ptr(Gen->ReleaseModule());
 +}
   void releaseLinkModules() {
 for (auto &I : LinkModules)
   I.second.release();
 @@ -117,8 +119,6 @@

 Gen->Initialize(Ctx);

 -  TheModule.reset(Gen->GetModule());
 -
 if (llvm::TimePassesIsEnabled)
   LLVMIRGeneration.stopTimer();
   }
 @@ -165,27 +165,14 @@
 }

 // Silently ignore if we weren't initialized
for some
 reason.
 -  if (!TheModule)
 -return;
 -
 -  // Make sure IR generation is happy with the
module. This
 is released by
 -  // the module provider.
 -  llvm::Module *M = Gen->ReleaseModule();
 -  if (!M) {
 -// The module has been released by IR gen on
failures,
 do not double
 -// free.
 -TheModule.release();
 +  if (!getModule())
   return;
 -  }
 -
 -  assert(TheModule.get() == M &&
 - "Unexpected module change during IR
generation");

 // Link LinkModule into this module if present,
 preserving its validity.
 for (auto &I : LinkModules) {
   unsigned LinkF

r259239 - This patch adds doxygen comments for the intrinsincs in the header file __wmmintrin_pclmul.h. The doxygen comments are automatically generated based on Sony's intrinsics document.

2016-01-29 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Fri Jan 29 14:37:14 2016
New Revision: 259239

URL: http://llvm.org/viewvc/llvm-project?rev=259239&view=rev
Log:
This patch adds doxygen comments for the intrinsincs in the header file 
__wmmintrin_pclmul.h. The doxygen comments are automatically generated based on 
Sony's intrinsics document.

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

Modified:
cfe/trunk/lib/Headers/__wmmintrin_pclmul.h

Modified: cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__wmmintrin_pclmul.h?rev=259239&r1=259238&r2=259239&view=diff
==
--- cfe/trunk/lib/Headers/__wmmintrin_pclmul.h (original)
+++ cfe/trunk/lib/Headers/__wmmintrin_pclmul.h Fri Jan 29 14:37:14 2016
@@ -23,6 +23,34 @@
 #ifndef _WMMINTRIN_PCLMUL_H
 #define _WMMINTRIN_PCLMUL_H
 
+/// \brief Multiplies two 64-bit integer values, which are selected from source
+///operands using the immediate-value operand. The multiplication is a 
+///carry-less multiplication, and the 128-bit integer product is stored in
+///the destination.
+///
+/// \headerfile 
+///
+/// \code 
+/// __m128i _mm_clmulepi64_si128(__m128i __X, __m128i __Y, const int __I);
+/// \endcode 
+///
+/// This intrinsic corresponds to the \c VPCLMULQDQ instruction.
+///
+/// \param __X
+///A 128-bit vector of [2 x i64] containing one of the source operands.
+/// \param __Y
+///A 128-bit vector of [2 x i64] containing one of the source operands.
+/// \param __I
+///An immediate value specifying which 64-bit values to select from the
+///operands.
+///Bit 0 is used to select a value from operand __X,
+///and bit 4 is used to select a value from operand __Y:
+///Bit[0]=0 indicates that bits[63:0] of operand __X are used.
+///Bit[0]=1 indicates that bits[127:64] of operand __X are used.
+///Bit[4]=0 indicates that bits[63:0] of operand __Y are used.
+///Bit[4]=1 indicates that bits[127:64] of operand __Y are used.
+/// \returns The 128-bit integer vector containing the result of the carry-less
+///multiplication of the selected 64-bit values.
 #define _mm_clmulepi64_si128(__X, __Y, __I) \
   ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
 (__v2di)(__m128i)(__Y), (char)(__I)))


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


Re: [PATCH] D15999: Adding doxygen comments to the LLVM intrinsics (part 2, _wmmintrin_pclmul.h)

2016-01-29 Thread Katya Romanova via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259239: This patch adds doxygen comments for the intrinsincs 
in the header file… (authored by kromanova).

Changed prior to commit:
  http://reviews.llvm.org/D15999?vs=45902&id=46411#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15999

Files:
  cfe/trunk/lib/Headers/__wmmintrin_pclmul.h

Index: cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
===
--- cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
+++ cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
@@ -23,6 +23,34 @@
 #ifndef _WMMINTRIN_PCLMUL_H
 #define _WMMINTRIN_PCLMUL_H
 
+/// \brief Multiplies two 64-bit integer values, which are selected from source
+///operands using the immediate-value operand. The multiplication is a 
+///carry-less multiplication, and the 128-bit integer product is stored in
+///the destination.
+///
+/// \headerfile 
+///
+/// \code 
+/// __m128i _mm_clmulepi64_si128(__m128i __X, __m128i __Y, const int __I);
+/// \endcode 
+///
+/// This intrinsic corresponds to the \c VPCLMULQDQ instruction.
+///
+/// \param __X
+///A 128-bit vector of [2 x i64] containing one of the source operands.
+/// \param __Y
+///A 128-bit vector of [2 x i64] containing one of the source operands.
+/// \param __I
+///An immediate value specifying which 64-bit values to select from the
+///operands.
+///Bit 0 is used to select a value from operand __X,
+///and bit 4 is used to select a value from operand __Y:
+///Bit[0]=0 indicates that bits[63:0] of operand __X are used.
+///Bit[0]=1 indicates that bits[127:64] of operand __X are used.
+///Bit[4]=0 indicates that bits[63:0] of operand __Y are used.
+///Bit[4]=1 indicates that bits[127:64] of operand __Y are used.
+/// \returns The 128-bit integer vector containing the result of the carry-less
+///multiplication of the selected 64-bit values.
 #define _mm_clmulepi64_si128(__X, __Y, __I) \
   ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
 (__v2di)(__m128i)(__Y), (char)(__I)))


Index: cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
===
--- cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
+++ cfe/trunk/lib/Headers/__wmmintrin_pclmul.h
@@ -23,6 +23,34 @@
 #ifndef _WMMINTRIN_PCLMUL_H
 #define _WMMINTRIN_PCLMUL_H
 
+/// \brief Multiplies two 64-bit integer values, which are selected from source
+///operands using the immediate-value operand. The multiplication is a 
+///carry-less multiplication, and the 128-bit integer product is stored in
+///the destination.
+///
+/// \headerfile 
+///
+/// \code 
+/// __m128i _mm_clmulepi64_si128(__m128i __X, __m128i __Y, const int __I);
+/// \endcode 
+///
+/// This intrinsic corresponds to the \c VPCLMULQDQ instruction.
+///
+/// \param __X
+///A 128-bit vector of [2 x i64] containing one of the source operands.
+/// \param __Y
+///A 128-bit vector of [2 x i64] containing one of the source operands.
+/// \param __I
+///An immediate value specifying which 64-bit values to select from the
+///operands.
+///Bit 0 is used to select a value from operand __X,
+///and bit 4 is used to select a value from operand __Y:
+///Bit[0]=0 indicates that bits[63:0] of operand __X are used.
+///Bit[0]=1 indicates that bits[127:64] of operand __X are used.
+///Bit[4]=0 indicates that bits[63:0] of operand __Y are used.
+///Bit[4]=1 indicates that bits[127:64] of operand __Y are used.
+/// \returns The 128-bit integer vector containing the result of the carry-less
+///multiplication of the selected 64-bit values.
 #define _mm_clmulepi64_si128(__X, __Y, __I) \
   ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
 (__v2di)(__m128i)(__Y), (char)(__I)))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15120: Add support for __float128 type to be used by targets that support it

2016-01-29 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

In http://reviews.llvm.org/D15120#337144, @nemanjai wrote:

> Do you suggest that we need to allow operations (or at least assignments) 
> between the two types and take away the diagnostics that are part of this 
> patch?


It appears that the conclusion is that operations between the two types will be 
allowed. The common type between `__float128` and `long double` will be 
`__float128` at this time, based on the observation that `__float128` is not 
yet available in cases where the choice of common type is still unclear.
It appears that at some point, interoperability issues with GCC will change 
that, and the choice of common type may need to be a target-based property 
(which may be implemented by the rank being target-based). For the purposes of 
this patch, I think we are deferring that issue.


Repository:
  rL LLVM

http://reviews.llvm.org/D15120



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


Re: [PATCH] D15977: [Clang] Supporting all entities declared in lexical scope in LLVM debug info

2016-01-29 Thread David Blaikie via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Looks good to me. Test case could be simplified a bit further, but feel free to 
commit after that.



Comment at: lib/CodeGen/CGDebugInfo.cpp:1479
@@ +1478,3 @@
+void CGDebugInfo::recordDeclarationLexicalScope(const Decl &D) {
+  assert(LexicalBlockMap.find(&D) == LexicalBlockMap.end() &&
+ "D is already mapped to lexical block scope");

aaboud wrote:
> dblaikie wrote:
> > Dose this assert not fire if there are two decls in the same lexical scope?
> Why two decls would have the same object instance "Decl"?
> I am not sure even that you can declare two decls with same name at same 
> lexical-scope, but even if they are defined in the same lexical scope, they 
> will have different line numbers, right?
Right, I think I'm following now. I had some other ideas in my head that were 
wrong.


Comment at: lib/CodeGen/CGDebugInfo.cpp:1481
@@ +1480,3 @@
+ "D is already mapped to lexical block scope");
+  if (!LexicalBlockStack.empty())
+LexicalBlockMap[&D] = LexicalBlockStack.back();

aaboud wrote:
> dblaikie wrote:
> > Should we assert that LexicalBlockStack isn't empty?
> It might be empty, if the declaration is in the program scope, right?
> So, we do not want to assert, just to check.
Yep, it's starting to make more sense to me now... 


Comment at: lib/CodeGen/CGDebugInfo.cpp:1489
@@ +1488,3 @@
+  if (I != LexicalBlockMap.end()) {
+RetainedTypes.push_back(Ty.getAsOpaquePtr());
+return I->second;

aaboud wrote:
> dblaikie wrote:
> > Why does the type need to be added to the retained types list?
> Excellent question :)
> This was your suggestion few months ago.
> The reason is that backend will need to know what types are declared in 
> lexical blocks.
> Imported entities are collected in the import entity list, while types are 
> collected in the retained types.
> 
> Check line 518 at DwarfDebug.cpp (http://reviews.llvm.org/D15976#51cfb106)
Not quite following - could we discover the types lazily as we're generating 
DWARF in the backend - if we happen to emit a variable of that type & generate 
the DIE* for the type, etc? (so that if a type becomes unused it's able to be 
dropped - rather than being preserved only when the type is local)

I suppose that would make it difficult to choose which scopes we had to 
preserve when emitting debug info in the backend (if we didn't see a type until 
after the scope was created - we wouldn't've known whether to emit/create that 
scope or collapse it into its parent, etc) - so this probably isn't 
possible/practical.


Comment at: lib/CodeGen/CGDebugInfo.cpp:2066
@@ -2045,3 +2065,3 @@
   if (isImportedFromModule || !ED->getDefinition()) {
-llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
+llvm::DIScope *EDContext = getDeclarationLexicalScope(*ED, QualType(Ty, 
0));
 llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());

aaboud wrote:
> dblaikie wrote:
> > Would it be reasonable/possible to do these changes one at a time & 
> > demonstrate the different situations in which types were not correctly 
> > nested in lexical scopes? Or are they all necessary for some 
> > correctness/invariant that must hold?
> Clang changes cannot be committed before the LLVM changes, otherwise we would 
> crash in backend.
> Regarding splitting Clang changes into several comments it is possible with 
> the following splits:
> 1. Static variable (lines 2508-2517)
> 2. Types (all the others)
> 
> Now types can be split into several comments as well: Records and Typedef
> But the infrastructure of recording lexical-scope declarations and getting 
> the lexical-scope context should be committed with the first patch 
> (nevertheless what one it would be, Records or Typedef).
> 
> Regarding the test, I used to have 3 (even 4) separate tests, but I was asked 
> to merged them.
> Now, if we do commit patches in steps, I suggest that I still end up with one 
> final test, but I will need to modify it with each patch (I will be building 
> it step by step).
> 
> Now, what is your call? do you want me to commit the this patch in 3 steps? 
> Or just go with it as one piece?
Right, incremental patches that update the test case (test case could be 
committed as-is with CHECK-NOTs in places where the expected output didn't 
match the desired result, or with them removed & the types that are incorrect 
omitted until the functionality was added)

But I think I'm understanding this mostly well enough for it go in as-is/in one 
go.


Comment at: test/CodeGenCXX/debug-info-lb.cpp:7
@@ +6,3 @@
+  {
+class X {
+public:

Could just make this a struct.

It probably doesn't need any members either. (simply "struct X { }")


Comment at: test/CodeGenCXX/debug-info-lb.cpp:14
@@ 

Re: r259192 - Implement TemplateArgument::dump() method for debugging, patterned after TemplateName::dump().

2016-01-29 Thread Yaron Keren via cfe-commits
Committed clang part in r259232, LLVM part in r259240.


2016-01-29 21:22 GMT+02:00 Richard Smith :

> On Fri, Jan 29, 2016 at 11:13 AM, Yaron Keren 
> wrote:
> > OK.  There are more un-annotated dump() methods such as
> > TemplateName::dump(), NestedNameSpecifier::dump(), ASTReader::dump(),
> > ModuleMap::dump(), MacroInfo::dump(), ...
> >
> > Annotate all dump() methods LLVM_DUMP_METHOD ?
>
> SGTM
>
> > 2016-01-29 19:37 GMT+02:00 Richard Smith :
> >>
> >> On 29 Jan 2016 5:50 a.m., "Yaron Keren via cfe-commits"
> >>  wrote:
> >> >
> >> > Author: yrnkrn
> >> > Date: Fri Jan 29 07:46:15 2016
> >> > New Revision: 259192
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=259192&view=rev
> >> > Log:
> >> > Implement TemplateArgument::dump() method for debugging, patterned
> after
> >> > TemplateName::dump().
> >> >
> >> >
> >> > Modified:
> >> > cfe/trunk/include/clang/AST/TemplateBase.h
> >> > cfe/trunk/lib/AST/TemplateBase.cpp
> >> >
> >> > Modified: cfe/trunk/include/clang/AST/TemplateBase.h
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=259192&r1=259191&r2=259192&view=diff
> >> >
> >> >
> ==
> >> > --- cfe/trunk/include/clang/AST/TemplateBase.h (original)
> >> > +++ cfe/trunk/include/clang/AST/TemplateBase.h Fri Jan 29 07:46:15
> 2016
> >> > @@ -354,6 +354,12 @@ public:
> >> >/// \brief Print this template argument to the given output stream.
> >> >void print(const PrintingPolicy &Policy, raw_ostream &Out) const;
> >> >
> >> > +  /// \brief Debugging aid that dumps the template argument.
> >> > +  void dump(raw_ostream &Out) const;
> >> > +
> >> > +  /// \brief Debugging aid that dumps the template argument to
> standard
> >> > error.
> >> > +  void dump() const;
> >> > +
> >> >/// \brief Used to insert TemplateArguments into FoldingSets.
> >> >void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
> >> > const;
> >> >  };
> >> >
> >> > Modified: cfe/trunk/lib/AST/TemplateBase.cpp
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=259192&r1=259191&r2=259192&view=diff
> >> >
> >> >
> ==
> >> > --- cfe/trunk/lib/AST/TemplateBase.cpp (original)
> >> > +++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Jan 29 07:46:15 2016
> >> > @@ -415,6 +415,15 @@ void TemplateArgument::print(const Print
> >> >}
> >> >  }
> >> >
> >> > +void TemplateArgument::dump(raw_ostream &Out) const {
> >> > +  LangOptions LO; // FIXME! see also TemplateName::dump().
> >> > +  LO.CPlusPlus = true;
> >> > +  LO.Bool = true;
> >> > +  print(PrintingPolicy(LO), Out);
> >> > +}
> >> > +
> >> > +void TemplateArgument::dump() const { dump(llvm::errs()); }
> >>
> >> This should be annotated with LLVM_DUMP_METHOD.
> >>
> >> > +
> >> >
> >> >
> //===--===//
> >> >  // TemplateArgumentLoc Implementation
> >> >
> >> >
> //===--===//
> >> >
> >> >
> >> > ___
> >> > cfe-commits mailing list
> >> > cfe-commits@lists.llvm.org
> >> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16562: Adding doxygen comments to the LLVM intrinsics (part 3, __wmmintrin_aes.h)

2016-01-29 Thread Katya Romanova via cfe-commits
kromanova added a comment.

Hi Eric,
Could you please accept this revision also?
I have already added missing article "the" in "This intrinsic corresponds to 
 instruction" (as you requested in the other doxygen comments 
review).

Thank you!
Katya.


Repository:
  rL LLVM

http://reviews.llvm.org/D16562



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


Re: [PATCH] D16562: Adding doxygen comments to the LLVM intrinsics (part 3, __wmmintrin_aes.h)

2016-01-29 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a reviewer: echristo.
echristo added a comment.
This revision is now accepted and ready to land.

Yep. :)


Repository:
  rL LLVM

http://reviews.llvm.org/D16562



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


Re: [PATCH] D16514: Add -stop-on-failure driver option, and enable it by default for CUDA compiles.

2016-01-29 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Eric, are you OK with this going in, or do you want to consider alternatives?


http://reviews.llvm.org/D16514



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


Re: [PATCH] D16694: [llvmlab] Enable clang tests that output to the console when we are on the buildbots

2016-01-29 Thread Galina via cfe-commits
gkistanova added a comment.

LGTM

Thanks

Galina


http://reviews.llvm.org/D16694



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


Re: [PATCH] D15305: [CUDA] Do not allow dynamic initialization of global device side variables.

2016-01-29 Thread Justin Lebar via cfe-commits
jlebar added a comment.

jingyue/jpienaar/rsmith - friendly ping?  Without this, -O0 builds don't work, 
because they emit empty global initializers that don't get optimized out.


http://reviews.llvm.org/D15305



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


Re: [PATCH] D16694: [llvmlab] Enable clang tests that output to the console when we are on the buildbots

2016-01-29 Thread Yunzhong Gao via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259248: [llvmlab] Enable clang tests that output to the 
console when we are on the… (authored by ygao).

Changed prior to commit:
  http://reviews.llvm.org/D16694?vs=46313&id=46431#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16694

Files:
  zorg/trunk/zorg/buildbot/builders/ClangBuilder.py

Index: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
===
--- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
+++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
@@ -1367,15 +1367,15 @@
 # Save artifacts of this build for use by other builders.
 f = artifacts.uploadArtifacts(f)
 # Run the LLVM and Clang regression tests.
-cmd_str = r"""make VERBOSE=1 LIT_ARGS="-v --param run_long_tests=true 
--filter='^(?!.*debuginfo-tests)'" check-all"""
+cmd_str = r"""make VERBOSE=1 LIT_ARGS="-v --param run_long_tests=true 
--param enable_console=1 --filter='^(?!.*debuginfo-tests)'" check-all"""
 f.addStep(lit_test_command.LitTestCommand(name='run.llvm.tests', 
haltOnFailure=True,
   command=cmd_str,
   description=['all', 'tests'],
   workdir=clang_build_dir))
 # Work around for lldb issue rdar://14929651
 # The crazy filter regex is to remove static-member[2].cpp, which requires 
xcode5 or later.
 # radar://16295455 tracks the removal of this regex.
-cmd_str = r"""make VERBOSE=1 LIT_ARGS="-j 1 -v --param run_long_tests=true 
 --filter='debuginfo-tests.(?!static-member)'" check-all"""
+cmd_str = r"""make VERBOSE=1 LIT_ARGS="-j 1 -v --param run_long_tests=true 
--param enable_console=1 --filter='debuginfo-tests.(?!static-member)'" 
check-all"""
 f.addStep(lit_test_command.LitTestCommand(name='run.llvm.debuginfo-tests', 
haltOnFailure=True,
   command=cmd_str,
   description=['all', 'tests'],


Index: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
===
--- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
+++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
@@ -1367,15 +1367,15 @@
 # Save artifacts of this build for use by other builders.
 f = artifacts.uploadArtifacts(f)
 # Run the LLVM and Clang regression tests.
-cmd_str = r"""make VERBOSE=1 LIT_ARGS="-v --param run_long_tests=true --filter='^(?!.*debuginfo-tests)'" check-all"""
+cmd_str = r"""make VERBOSE=1 LIT_ARGS="-v --param run_long_tests=true --param enable_console=1 --filter='^(?!.*debuginfo-tests)'" check-all"""
 f.addStep(lit_test_command.LitTestCommand(name='run.llvm.tests', haltOnFailure=True,
   command=cmd_str,
   description=['all', 'tests'],
   workdir=clang_build_dir))
 # Work around for lldb issue rdar://14929651
 # The crazy filter regex is to remove static-member[2].cpp, which requires xcode5 or later.
 # radar://16295455 tracks the removal of this regex.
-cmd_str = r"""make VERBOSE=1 LIT_ARGS="-j 1 -v --param run_long_tests=true  --filter='debuginfo-tests.(?!static-member)'" check-all"""
+cmd_str = r"""make VERBOSE=1 LIT_ARGS="-j 1 -v --param run_long_tests=true --param enable_console=1 --filter='debuginfo-tests.(?!static-member)'" check-all"""
 f.addStep(lit_test_command.LitTestCommand(name='run.llvm.debuginfo-tests', haltOnFailure=True,
   command=cmd_str,
   description=['all', 'tests'],
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15705: Adding a scripted test for PR25717

2016-01-29 Thread Yunzhong Gao via cfe-commits
ygao closed this revision.
ygao added a comment.

The test is commited in http://reviews.llvm.org/rL258898 and 
http://reviews.llvm.org/rL258902, and it is enabled on buildbot in 
http://reviews.llvm.org/rL259248.
Thanks!


http://reviews.llvm.org/D15705



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


Re: [PATCH] D16686: [OpenCL] Generate metadata for opencl_unroll_hint attribute

2016-01-29 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 46434.
yaxunl marked 17 inline comments as done.
yaxunl added a comment.

Revised as Anastasia and Xiuli suggested.


http://reviews.llvm.org/D16686

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Parse/Parser.h
  lib/CodeGen/CGLoopInfo.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseStmt.cpp
  lib/Sema/SemaStmtAttr.cpp
  test/CodeGenOpenCL/unroll-hint.cl
  test/Parser/opencl-unroll-hint.cl
  test/SemaOpenCL/unroll-hint.cl

Index: test/SemaOpenCL/unroll-hint.cl
===
--- /dev/null
+++ test/SemaOpenCL/unroll-hint.cl
@@ -0,0 +1,22 @@
+//RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify %s
+
+kernel void C (global int *x) {
+  int I = 3;
+  __attribute__((opencl_unroll_hint(I))) // expected-error {{opencl_unroll_hint attribute requires an integer constant}}
+  while (I--);
+}
+
+kernel void D (global int *x) {
+  int i = 10;
+  __attribute__((opencl_unroll_hint))
+  do {
+  } while(i--);
+}
+
+// ToDo: enable this test after fixing assertion
+#if 0 
+kernel void E() {
+  __attribute__((opencl_unroll_hint(2,4))) // expected-error {{opencl_unroll_hint attribute takes no more than 1 argument}}
+  for(int i=0; i<100; i++);
+}
+#endif
Index: test/Parser/opencl-unroll-hint.cl
===
--- /dev/null
+++ test/Parser/opencl-unroll-hint.cl
@@ -0,0 +1,8 @@
+//RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify %s
+
+kernel void B (global int *x) {
+  __attribute__((opencl_unroll_hint(42)))
+  if (x[0]) // expected-error {{OpenCL only supports opencl_unroll_hint on for, while, and do statements}}
+x[0] = 15;
+}
+
Index: test/CodeGenOpenCL/unroll-hint.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/unroll-hint.cl
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s
+
+/*** for ***/
+void for_count(int* sum)
+{
+// CHECK-LABEL: for_count
+__attribute__((opencl_unroll_hint(8)))
+for( int i = 0; i < 1000; ++i) {
+*sum += i;
+}
+// CHECK: br label %{{.*}}, !llvm.loop ![[FOR_COUNT:.*]]
+}
+
+void for_disable(int* sum)
+{
+// CHECK-LABEL: for_disable
+__attribute__((opencl_unroll_hint(1)))
+for( int i = 0; i < 1000; ++i) {
+*sum += i;
+}
+// CHECK: br label %{{.*}}, !llvm.loop ![[FOR_DISABLE:.*]]
+}
+
+void for_full(int* sum)
+{
+// CHECK-LABEL: for_full
+__attribute__((opencl_unroll_hint))
+for( int i = 0; i < 1000; ++i) {
+*sum += i;
+}
+// CHECK: br label %{{.*}}, !llvm.loop ![[FOR_FULL:.*]]
+}
+
+/*** while ***/
+void while_count(int* sum)
+{
+// CHECK-LABEL: while_count
+int i = 1000;
+__attribute__((opencl_unroll_hint(8)))
+while(i-->0) {
+*sum += i;
+}
+// CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_COUNT:.*]]
+}
+
+void while_disable(int* sum)
+{
+// CHECK-LABEL: while_disable
+int i = 1000;
+__attribute__((opencl_unroll_hint(1)))
+while(i-->0) {
+*sum += i;
+}
+// CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_DISABLE:.*]]
+}
+
+void while_full(int* sum)
+{
+// CHECK-LABEL: while_full
+int i = 1000;
+__attribute__((opencl_unroll_hint))
+while(i-->0) {
+*sum += i;
+}
+// CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_FULL:.*]]
+}
+
+/*** do ***/
+void do_count(int* sum)
+{
+// CHECK-LABEL: do_count
+int i = 1000;
+__attribute__((opencl_unroll_hint(8)))
+do {
+*sum += i;
+} while(i--> 0);
+// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_COUNT:.*]]
+}
+
+void do_disable(int* sum)
+{
+// CHECK-LABEL: do_disable
+int i = 1000;
+__attribute__((opencl_unroll_hint(1)))
+do {
+*sum += i;
+} while(i--> 0);
+// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_DISABLE:.*]]
+}
+
+void do_full(int* sum)
+{
+// CHECK-LABEL: do_full
+int i = 1000;
+__attribute__((opencl_unroll_hint))
+do {
+*sum += i;
+} while(i--> 0);
+// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_FULL:.*]]
+}
+
+
+// CHECK: ![[FOR_COUNT]] =  distinct !{![[FOR_COUNT]],  ![[COUNT:.*]]}
+// CHECK: ![[COUNT]] =  !{!"llvm.loop.unroll.count", i32 8}
+// CHECK: ![[FOR_DISABLE]]   =  distinct !{![[FOR_DISABLE]],  ![[DISABLE:.*]]}
+// CHECK: ![[DISABLE]]   =  !{!"llvm.loop.unroll.disable"}
+// CHECK: ![[FOR_FULL]]  =  distinct !{![[FOR_FULL]],  ![[FULL:.*]]}
+// CHECK: ![[FULL]]  =  !{!"llvm.loop.unroll.full"}
+// CHECK: ![[WHILE_COUNT]]   =  distinct !{![[WHILE_COUNT]],![[COUNT]]}
+// CHECK: ![[WHILE_DISABLE]] =  distinct !{![[WHILE_DISABLE]],  ![[DISABLE]]}
+// CHECK: ![[WHILE_FULL]]   

Re: r259210 - Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes.

2016-01-29 Thread Richard via cfe-commits

In article ,
Aaron Ballman  writes:

> On Fri, Jan 29, 2016 at 1:28 PM, Hans Wennborg  wrote:
> > This broke tests:
> >
> > http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/44018/steps/test_
clang/logs/Clang-Unit%20%3A%3A%20ASTMatchers__Dynamic__DynamicASTMatchersTests_
_RegistryTest.Errors
> >
> > I've reverted it in r259218.
> 
> Strange, I did not get an email notification about that failure. Thank
> you for reverting to green. Richard, can you look into this? I'm
> happy to re-commit whenever you resolve the issue.

I looked at the error, but I don't understand what to do about it.

There's too much macro-crazy overload junk in ASTMatchers.h for me to
know what the fix is based on the error.
-- 
"The Direct3D Graphics Pipeline" free book 
 The Computer Graphics Museum 
 The Terminals Wiki 
  Legalize Adulthood! (my blog) 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D16738: Fix invalid casts in .

2016-01-29 Thread Evgeniy Stepanov via cfe-commits
eugenis created this revision.
eugenis added reviewers: EricWF, mclow.lists.
eugenis added subscribers: cfe-commits, pcc.
eugenis set the repository for this revision to rL LLVM.

static_cast of a pointer to object before the start of the object's
lifetime has undefined behavior (c++14 p3.8)

This code triggers CFI warnings.

This also could be fixed in a different way by replacing C-style
casts with reinterpret_cast<>, which, from my reading of the
standard, is allowed in this context. That would not help with CFI
though, which still flags such casts as invalid (yes, it is stricter
that the standard).

Repository:
  rL LLVM

http://reviews.llvm.org/D16738

Files:
  include/functional

Index: include/functional
===
--- include/functional
+++ include/functional
@@ -1440,7 +1440,7 @@
 _LIBCPP_INLINE_VISIBILITY __base() {}
 _LIBCPP_INLINE_VISIBILITY virtual ~__base() {}
 virtual __base* __clone() const = 0;
-virtual void __clone(__base*) const = 0;
+virtual void __clone(void*) const = 0;
 virtual void destroy() _NOEXCEPT = 0;
 virtual void destroy_deallocate() _NOEXCEPT = 0;
 virtual _Rp operator()(_ArgTypes&& ...) = 0;
@@ -1477,7 +1477,7 @@
 : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
 _VSTD::forward_as_tuple(_VSTD::move(__a))) {}
 virtual __base<_Rp(_ArgTypes...)>* __clone() const;
-virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
+virtual void __clone(void*) const;
 virtual void destroy() _NOEXCEPT;
 virtual void destroy_deallocate() _NOEXCEPT;
 virtual _Rp operator()(_ArgTypes&& ... __arg);
@@ -1502,7 +1502,7 @@
 
 template
 void
-__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(void* __p) const
 {
 ::new (__p) __func(__f_.first(), __f_.second());
 }
@@ -1660,10 +1660,10 @@
 {
 if (__f.__f_ == 0)
 __f_ = 0;
-else if (__f.__f_ == (const __base*)&__f.__buf_)
+else if ((void *)__f.__f_ == &__f.__buf_)
 {
+__f.__f_->__clone(&__buf_);
 __f_ = (__base*)&__buf_;
-__f.__f_->__clone(__f_);
 }
 else
 __f_ = __f.__f_->__clone();
@@ -1676,10 +1676,10 @@
 {
 if (__f.__f_ == 0)
 __f_ = 0;
-else if (__f.__f_ == (const __base*)&__f.__buf_)
+else if ((void *)__f.__f_ == &__f.__buf_)
 {
+__f.__f_->__clone(&__buf_);
 __f_ = (__base*)&__buf_;
-__f.__f_->__clone(__f_);
 }
 else
 __f_ = __f.__f_->__clone();
@@ -1690,10 +1690,10 @@
 {
 if (__f.__f_ == 0)
 __f_ = 0;
-else if (__f.__f_ == (__base*)&__f.__buf_)
+else if ((void *)__f.__f_ == &__f.__buf_)
 {
+__f.__f_->__clone(&__buf_);
 __f_ = (__base*)&__buf_;
-__f.__f_->__clone(__f_);
 }
 else
 {
@@ -1709,10 +1709,10 @@
 {
 if (__f.__f_ == 0)
 __f_ = 0;
-else if (__f.__f_ == (__base*)&__f.__buf_)
+else if ((void *)__f.__f_ == &__f.__buf_)
 {
+__f.__f_->__clone(&__buf_);
 __f_ = (__base*)&__buf_;
-__f.__f_->__clone(__f_);
 }
 else
 {
@@ -1736,8 +1736,8 @@
 typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF;
 if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
 {
+::new (&__buf_) _FF(_VSTD::move(__f));
 __f_ = (__base*)&__buf_;
-::new (__f_) _FF(_VSTD::move(__f));
 }
 else
 {
@@ -1791,17 +1791,17 @@
 function<_Rp(_ArgTypes...)>&
 function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
 {
-if (__f_ == (__base*)&__buf_)
+if ((void *)__f_ == &__buf_)
 __f_->destroy();
 else if (__f_)
 __f_->destroy_deallocate();
 __f_ = 0;
 if (__f.__f_ == 0)
 __f_ = 0;
-else if (__f.__f_ == (__base*)&__f.__buf_)
+else if ((void *)__f.__f_ == &__f.__buf_)
 {
+__f.__f_->__clone(&__buf_);
 __f_ = (__base*)&__buf_;
-__f.__f_->__clone(__f_);
 }
 else
 {
@@ -1815,7 +1815,7 @@
 function<_Rp(_ArgTypes...)>&
 function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
 {
-if (__f_ == (__base*)&__buf_)
+if ((void *)__f_ == &__buf_)
 __f_->destroy();
 else if (__f_)
 __f_->destroy_deallocate();
@@ -1840,7 +1840,7 @@
 template
 function<_Rp(_ArgTypes...)>::~function()
 {
-if (__f_ == (__base*)&__buf_)
+if ((void *)__f_ == &__buf_)
 __f_->destroy();
 else if (__f_)
 __f_->destroy_deallocate();
@@ -1850,31 +1850,31 @@
 void
 function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
 {
-if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
+if ((void *)__f_ == &__buf_ && (void *)__f.__f_ == &__f.__buf_)
 {
 typename aligned_storage::type __tempbuf;
+__f_->__clone(&_

Re: [PATCH] D16738: Fix invalid casts in .

2016-01-29 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

> This code triggers CFI warnings.


What are CFI warnings? Sorry if that's a dumb question, I just don't recognize 
"CFI".


Repository:
  rL LLVM

http://reviews.llvm.org/D16738



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


Re: [PATCH] D16738: Fix invalid casts in .

2016-01-29 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

http://clang.llvm.org/docs/ControlFlowIntegrity.html
Basically it says that the cast to __base is done on a memory that does not 
contain an object of type __base (based on the vptr value).


Repository:
  rL LLVM

http://reviews.llvm.org/D16738



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


r259260 - [UBSan] Add documentation for runtime issue suppression.

2016-01-29 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Fri Jan 29 17:07:14 2016
New Revision: 259260

URL: http://llvm.org/viewvc/llvm-project?rev=259260&view=rev
Log:
[UBSan] Add documentation for runtime issue suppression.

Modified:
cfe/trunk/docs/UndefinedBehaviorSanitizer.rst

Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=259260&r1=259259&r2=259260&view=diff
==
--- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
+++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Fri Jan 29 17:07:14 2016
@@ -168,6 +168,38 @@ UndefinedBehaviorSanitizer supports ``sr
 :doc:`SanitizerSpecialCaseList`, that can be used to suppress error reports
 in the specified source files or functions.
 
+Runtime suppressions
+
+
+Sometimes you can suppress UBSan error reports for specific files, functions,
+or libraries without recompiling the code. You need to pass a path to
+suppression file in a ``UBSAN_OPTIONS`` environment variable.
+
+.. code-block:: bash
+
+UBSAN_OPTIONS=suppressions=MyUBSan.supp
+
+You need to specify a :ref:`check ` you are suppressing and the
+bug location. For example:
+
+.. code-block:: bash
+
+  signed-integer-overflow:file-with-known-overflow.cpp
+  alignment:function_doing_unaligned_access
+  vptr:shared_object_with_vptr_failures.so
+
+There are several limitations:
+
+* Sometimes your binary must have enough debug info and/or symbol table, so
+  that the runtime could figure out source file or function name to match
+  against the suppression.
+* It is only possible to suppress recoverable checks. For the example above,
+  you can additionally pass
+  ``-fsanitize-recover=signed-integer-overflow,alignment,vptr``, although
+  most of UBSan checks are recoverable by default.
+* Check groups (like ``undefined``) can't be used in suppressions file, only
+  fine-grained checks are supported.
+
 Supported Platforms
 ===
 


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


Re: r259260 - [UBSan] Add documentation for runtime issue suppression.

2016-01-29 Thread Alexey Samsonov via cfe-commits
Hans, do you think it makes sense to merge this patch into 3.8?

On Fri, Jan 29, 2016 at 3:07 PM, Alexey Samsonov via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: samsonov
> Date: Fri Jan 29 17:07:14 2016
> New Revision: 259260
>
> URL: http://llvm.org/viewvc/llvm-project?rev=259260&view=rev
> Log:
> [UBSan] Add documentation for runtime issue suppression.
>
> Modified:
> cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
>
> Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=259260&r1=259259&r2=259260&view=diff
>
> ==
> --- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
> +++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Fri Jan 29 17:07:14 2016
> @@ -168,6 +168,38 @@ UndefinedBehaviorSanitizer supports ``sr
>  :doc:`SanitizerSpecialCaseList`, that can be used to suppress error
> reports
>  in the specified source files or functions.
>
> +Runtime suppressions
> +
> +
> +Sometimes you can suppress UBSan error reports for specific files,
> functions,
> +or libraries without recompiling the code. You need to pass a path to
> +suppression file in a ``UBSAN_OPTIONS`` environment variable.
> +
> +.. code-block:: bash
> +
> +UBSAN_OPTIONS=suppressions=MyUBSan.supp
> +
> +You need to specify a :ref:`check ` you are suppressing and
> the
> +bug location. For example:
> +
> +.. code-block:: bash
> +
> +  signed-integer-overflow:file-with-known-overflow.cpp
> +  alignment:function_doing_unaligned_access
> +  vptr:shared_object_with_vptr_failures.so
> +
> +There are several limitations:
> +
> +* Sometimes your binary must have enough debug info and/or symbol table,
> so
> +  that the runtime could figure out source file or function name to match
> +  against the suppression.
> +* It is only possible to suppress recoverable checks. For the example
> above,
> +  you can additionally pass
> +  ``-fsanitize-recover=signed-integer-overflow,alignment,vptr``, although
> +  most of UBSan checks are recoverable by default.
> +* Check groups (like ``undefined``) can't be used in suppressions file,
> only
> +  fine-grained checks are supported.
> +
>  Supported Platforms
>  ===
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>



-- 
Alexey Samsonov
vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r259260 - [UBSan] Add documentation for runtime issue suppression.

2016-01-29 Thread Hans Wennborg via cfe-commits
Yes, that seems like a good idea. Go ahead and merge (or let me know
if you'd prefer me to do it).

On Fri, Jan 29, 2016 at 3:14 PM, Alexey Samsonov  wrote:
> Hans, do you think it makes sense to merge this patch into 3.8?
>
> On Fri, Jan 29, 2016 at 3:07 PM, Alexey Samsonov via cfe-commits
>  wrote:
>>
>> Author: samsonov
>> Date: Fri Jan 29 17:07:14 2016
>> New Revision: 259260
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=259260&view=rev
>> Log:
>> [UBSan] Add documentation for runtime issue suppression.
>>
>> Modified:
>> cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
>>
>> Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=259260&r1=259259&r2=259260&view=diff
>>
>> ==
>> --- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
>> +++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Fri Jan 29 17:07:14 2016
>> @@ -168,6 +168,38 @@ UndefinedBehaviorSanitizer supports ``sr
>>  :doc:`SanitizerSpecialCaseList`, that can be used to suppress error
>> reports
>>  in the specified source files or functions.
>>
>> +Runtime suppressions
>> +
>> +
>> +Sometimes you can suppress UBSan error reports for specific files,
>> functions,
>> +or libraries without recompiling the code. You need to pass a path to
>> +suppression file in a ``UBSAN_OPTIONS`` environment variable.
>> +
>> +.. code-block:: bash
>> +
>> +UBSAN_OPTIONS=suppressions=MyUBSan.supp
>> +
>> +You need to specify a :ref:`check ` you are suppressing and
>> the
>> +bug location. For example:
>> +
>> +.. code-block:: bash
>> +
>> +  signed-integer-overflow:file-with-known-overflow.cpp
>> +  alignment:function_doing_unaligned_access
>> +  vptr:shared_object_with_vptr_failures.so
>> +
>> +There are several limitations:
>> +
>> +* Sometimes your binary must have enough debug info and/or symbol table,
>> so
>> +  that the runtime could figure out source file or function name to match
>> +  against the suppression.
>> +* It is only possible to suppress recoverable checks. For the example
>> above,
>> +  you can additionally pass
>> +  ``-fsanitize-recover=signed-integer-overflow,alignment,vptr``, although
>> +  most of UBSan checks are recoverable by default.
>> +* Check groups (like ``undefined``) can't be used in suppressions file,
>> only
>> +  fine-grained checks are supported.
>> +
>>  Supported Platforms
>>  ===
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
>
> --
> Alexey Samsonov
> vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16705: Avoid overly large SmallPtrSet/SmallSet

2016-01-29 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

LGTM.

-eric


Repository:
  rL LLVM

http://reviews.llvm.org/D16705



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


r259267 - Class Property: generate metadata for class properties in categories.

2016-01-29 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Jan 29 17:45:01 2016
New Revision: 259267

URL: http://llvm.org/viewvc/llvm-project?rev=259267&view=rev
Log:
Class Property: generate metadata for class properties in categories.

The list of class properties is saved in
Old ABI: category->class_properties (category->size will be updated as well)
New ABI: category->class_properties (a flag in objc_image_info to indicate
 whether or not the list of class properties is present)

rdar://23891898

Added:
cfe/trunk/test/CodeGenObjC/metadata-class-properties.m
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=259267&r1=259266&r2=259267&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Jan 29 17:45:01 2016
@@ -3045,6 +3045,7 @@ CGObjCMac::EmitMethodDescList(Twine Name
   struct _objc_protocol_list *protocols;
   uint32_t size; // 
   struct _objc_property_list *instance_properties;
+  struct _objc_property_list *class_properties;
   };
 */
 void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
@@ -3071,7 +3072,7 @@ void CGObjCMac::GenerateCategory(const O
 // Class methods should always be defined.
 ClassMethods.push_back(GetMethodConstant(I));
 
-  llvm::Constant *Values[7];
+  llvm::Constant *Values[8];
   Values[0] = GetClassName(OCD->getName());
   Values[1] = GetClassName(Interface->getObjCRuntimeNameAsString());
   LazySymbols.insert(Interface->getIdentifier());
@@ -3094,8 +3095,11 @@ void CGObjCMac::GenerateCategory(const O
   if (Category) {
 Values[6] = EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + ExtName.str(),
  OCD, Category, ObjCTypes, false);
+Values[7] = EmitPropertyList("\01l_OBJC_$_CLASS_PROP_LIST_" + 
ExtName.str(),
+ OCD, Category, ObjCTypes, true);
   } else {
 Values[6] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy);
+Values[7] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy);
   }
 
   llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.CategoryTy,
@@ -4480,7 +4484,8 @@ enum ImageInfoFlags {
   // A flag indicating that the module has no instances of a @synthesize of a
   // superclass variable. 
   eImageInfo_CorrectedSynthesize = (1 << 4), // This flag is no longer set by 
clang.
-  eImageInfo_ImageIsSimulated= (1 << 5)
+  eImageInfo_ImageIsSimulated= (1 << 5),
+  eImageInfo_ClassProperties = (1 << 6)
 };
 
 void CGObjCCommonMac::EmitImageInfo() {
@@ -4532,6 +4537,10 @@ void CGObjCCommonMac::EmitImageInfo() {
Triple.getArch() == llvm::Triple::x86_64))
 Mod.addModuleFlag(llvm::Module::Error, "Objective-C Is Simulated",
   eImageInfo_ImageIsSimulated);
+
+  // Indicate whether we are generating class properties.
+  Mod.addModuleFlag(llvm::Module::Error, "Objective-C Class Properties",
+eImageInfo_ClassProperties);
 }
 
 // struct objc_module {
@@ -5387,12 +5396,14 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
   //   struct _objc_protocol_list *protocols;
   //   uint32_t size;  // sizeof(struct _objc_category)
   //   struct _objc_property_list *instance_properties;// category's @property
+  //   struct _objc_property_list *class_properties;
   // }
   CategoryTy =
 llvm::StructType::create("struct._objc_category",
  Int8PtrTy, Int8PtrTy, MethodListPtrTy,
  MethodListPtrTy, ProtocolListPtrTy,
- IntTy, PropertyListPtrTy, nullptr);
+ IntTy, PropertyListPtrTy, PropertyListPtrTy,
+ nullptr);
 
   // Global metadata structures
 
@@ -5565,6 +5576,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
   //   const struct _method_list_t * const class_methods;
   //   const struct _protocol_list_t * const protocols;
   //   const struct _prop_list_t * const properties;
+  //   const struct _prop_list_t * const class_properties;
   // }
   CategorynfABITy = llvm::StructType::create("struct._category_t",
  Int8PtrTy, ClassnfABIPtrTy,
@@ -5572,6 +5584,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
  MethodListnfABIPtrTy,
  ProtocolListnfABIPtrTy,
  PropertyListPtrTy,
+ PropertyListPtrTy,
  nullptr);
 
   // New types for nonfragile abi messaging.
@@ -6122,6 +6135,7 @@ llvm::Value *CGObjCNonFragileABIMac::Gen
 ///   const struct _method_list_t * const class_methods;
 ///   const struct _protocol_list_t * const protocols;
 ///   const struct _prop_list_t * const properties;
+///  

r259268 - Class Property: generate metadata for class properties in protocols.

2016-01-29 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Jan 29 17:46:55 2016
New Revision: 259268

URL: http://llvm.org/viewvc/llvm-project?rev=259268&view=rev
Log:
Class Property: generate metadata for class properties in protocols.

The list of class properties is saved in
Old ABI: protocol->ext->class_properties (protocol->ext->size will be updated)
New ABI: protocol->class_properties (protocol->size will be updated)

rdar://23891898

Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjC/metadata-class-properties.m
cfe/trunk/test/CodeGenObjC/objc2-protocol-metadata.m

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=259268&r1=259267&r2=259268&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Fri Jan 29 17:46:55 2016
@@ -2801,6 +2801,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProt
   struct objc_method_description_list *optional_class_methods;
   struct objc_property_list *instance_properties;
   const char ** extendedMethodTypes;
+  struct objc_property_list *class_properties;
   };
 */
 llvm::Constant *
@@ -2821,11 +2822,14 @@ CGObjCMac::EmitProtocolExtension(const O
   EmitPropertyList("OBJC_$_PROP_PROTO_LIST_" + PD->getName(), nullptr, PD,
ObjCTypes, false),
   EmitProtocolMethodTypes("OBJC_PROTOCOL_METHOD_TYPES_" + PD->getName(),
-  MethodTypesExt, ObjCTypes)};
+  MethodTypesExt, ObjCTypes),
+  EmitPropertyList("OBJC_$_CLASS_PROP_PROTO_LIST_" + PD->getName(), 
nullptr,
+   PD, ObjCTypes, true)};
 
   // Return null if no extension bits are used.
   if (Values[1]->isNullValue() && Values[2]->isNullValue() &&
-  Values[3]->isNullValue() && Values[4]->isNullValue())
+  Values[3]->isNullValue() && Values[4]->isNullValue() &&
+  Values[5]->isNullValue())
 return llvm::Constant::getNullValue(ObjCTypes.ProtocolExtensionPtrTy);
 
   llvm::Constant *Init =
@@ -5290,12 +5294,13 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen
   //   struct _objc_method_description_list *optional_class_methods;
   //   struct _objc_property_list *instance_properties;
   //   const char ** extendedMethodTypes;
+  //   struct _objc_property_list *class_properties;
   // }
   ProtocolExtensionTy =
 llvm::StructType::create("struct._objc_protocol_extension",
  IntTy, MethodDescriptionListPtrTy,
  MethodDescriptionListPtrTy, PropertyListPtrTy,
- Int8PtrPtrTy, nullptr);
+ Int8PtrPtrTy, PropertyListPtrTy, nullptr);
 
   // struct _objc_protocol_extension *
   ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy);
@@ -5471,6 +5476,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
   //   const uint32_t flags;  // = 0
   //   const char ** extendedMethodTypes;
   //   const char *demangledName;
+  //   const struct _prop_list_t * class_properties;
   // }
 
   // Holder for struct _protocol_list_t *
@@ -5483,7 +5489,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
  MethodListnfABIPtrTy, MethodListnfABIPtrTy,
  MethodListnfABIPtrTy, MethodListnfABIPtrTy,
  PropertyListPtrTy, IntTy, IntTy, Int8PtrPtrTy,
- Int8PtrTy,
+ Int8PtrTy, PropertyListPtrTy,
  nullptr);
 
   // struct _protocol_t*
@@ -6437,6 +6443,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
 ///   const uint32_t flags;  // = 0
 ///   const char ** extendedMethodTypes;
 ///   const char *demangledName;
+///   const struct _prop_list_t * class_properties;
 /// }
 /// @endcode
 ///
@@ -6488,7 +6495,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
   MethodTypesExt.insert(MethodTypesExt.end(),
 OptMethodTypesExt.begin(), OptMethodTypesExt.end());
 
-  llvm::Constant *Values[12];
+  llvm::Constant *Values[13];
   // isa is NULL
   Values[0] = llvm::Constant::getNullValue(ObjCTypes.ObjectPtrTy);
   Values[1] = GetClassName(PD->getObjCRuntimeNameAsString());
@@ -6524,6 +6531,10 @@ llvm::Constant *CGObjCNonFragileABIMac::
MethodTypesExt, ObjCTypes);
   // const char *demangledName;
   Values[11] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy);
+
+  Values[12] = EmitPropertyList(
+  "\01l_OBJC_$_CLASS_PROP_LIST_" + PD->getObjCRuntimeNameAsString(),
+  nullptr, PD, ObjCTypes, true);
 
   llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolnfABITy,
Values);

Modified: cfe/trunk/test/CodeGenObjC/metadata-class-properties.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/metadata-class-properties.m?rev=259268&r1=25

r259271 - Improve -Wconstant-conversion

2016-01-29 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Jan 29 17:51:16 2016
New Revision: 259271

URL: http://llvm.org/viewvc/llvm-project?rev=259271&view=rev
Log:
Improve -Wconstant-conversion

Switch the evaluation from isIntegerConstantExpr to EvaluateAsInt.
EvaluateAsInt will evaluate more types of expressions than
isIntegerConstantExpr.

Move one case from -Wsign-conversion to -Wconstant-conversion.  The case is:
1) Source and target types are signed
2) Source type is wider than the target type
3) The source constant value is positive
4) The conversion will store the value as negative in the target.

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp
cfe/trunk/test/Sema/constant-conversion.c

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=259271&r1=259270&r2=259271&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Jan 29 17:51:16 2016
@@ -7578,7 +7578,7 @@ void CheckImplicitConversion(Sema &S, Ex
 // If the source is a constant, use a default-on diagnostic.
 // TODO: this should happen for bitfield stores, too.
 llvm::APSInt Value(32);
-if (E->isIntegerConstantExpr(Value, S.Context)) {
+if (E->EvaluateAsInt(Value, S.Context, Expr::SE_AllowSideEffects)) {
   if (S.SourceMgr.isInSystemMacro(CC))
 return;
 
@@ -7603,6 +7603,42 @@ void CheckImplicitConversion(Sema &S, Ex
 return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_integer_precision);
   }
 
+  if (TargetRange.Width == SourceRange.Width && !TargetRange.NonNegative &&
+  SourceRange.NonNegative && Source->isSignedIntegerType()) {
+// Warn when doing a signed to signed conversion, warn if the positive
+// source value is exactly the width of the target type, which will
+// cause a negative value to be stored.
+
+llvm::APSInt Value;
+if (E->EvaluateAsInt(Value, S.Context, Expr::SE_AllowSideEffects)) {
+  if (!S.SourceMgr.isInSystemMacro(CC)) {
+
+IntegerLiteral *IntLit =
+dyn_cast(E->IgnoreParenImpCasts());
+
+// If initializing from a constant, and the constant starts with '0',
+// then it is a binary, octal, or hexadecimal.  Allow these constants
+// to fill all the bits, even if there is a sign change.
+if (!IntLit ||
+*(S.getSourceManager().getCharacterData(IntLit->getLocStart())) !=
+'0') {
+
+  std::string PrettySourceValue = Value.toString(10);
+  std::string PrettyTargetValue =
+  PrettyPrintInRange(Value, TargetRange);
+
+  S.DiagRuntimeBehavior(
+  E->getExprLoc(), E,
+  S.PDiag(diag::warn_impcast_integer_precision_constant)
+  << PrettySourceValue << PrettyTargetValue << E->getType() << 
T
+  << E->getSourceRange() << clang::SourceRange(CC));
+  return;
+}
+  }
+}
+// Fall through for non-constants to give a sign conversion warning.
+  }
+
   if ((TargetRange.NonNegative && !SourceRange.NonNegative) ||
   (!TargetRange.NonNegative && SourceRange.NonNegative &&
SourceRange.Width == TargetRange.Width)) {

Modified: cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp?rev=259271&r1=259270&r2=259271&view=diff
==
--- cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp Fri Jan 29 17:51:16 2016
@@ -242,8 +242,8 @@ namespace UndefinedBehavior {
 constexpr int n13 = n5 + n5; // expected-error {{constant expression}} 
expected-note {{value -4294967296 is outside the range of }}
 constexpr int n14 = n3 - n5; // expected-error {{constant expression}} 
expected-note {{value 4294967295 is outside the range of }}
 constexpr int n15 = n5 * n5; // expected-error {{constant expression}} 
expected-note {{value 4611686018427387904 is outside the range of }}
-constexpr signed char c1 = 100 * 2; // ok
-constexpr signed char c2 = '\x64' * '\2'; // also ok
+constexpr signed char c1 = 100 * 2; // ok expected-warning{{changes value}}
+constexpr signed char c2 = '\x64' * '\2'; // also ok  
expected-warning{{changes value}}
 constexpr long long ll1 = 0x7fff; // ok
 constexpr long long ll2 = ll1 + 1; // expected-error {{constant}} 
expected-note {{ 9223372036854775808 }}
 constexpr long long ll3 = -ll1 - 1; // ok

Modified: cfe/trunk/test/Sema/constant-conversion.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/constant-conversion.c?rev=259271&r1=259270&r2=259271&view=diff
==
--- cfe/trunk/test/Sema/constant-conversio

r259275 - This patch adds doxygen comments for the intrinsincs in the header file __wmmintrin_aes.h.

2016-01-29 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Fri Jan 29 17:59:00 2016
New Revision: 259275

URL: http://llvm.org/viewvc/llvm-project?rev=259275&view=rev
Log:
This patch adds doxygen comments for the intrinsincs in the header file 
__wmmintrin_aes.h.
The doxygen comments are automatically generated based on Sony's intrinsics 
document.

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


Modified:
cfe/trunk/lib/Headers/__wmmintrin_aes.h

Modified: cfe/trunk/lib/Headers/__wmmintrin_aes.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__wmmintrin_aes.h?rev=259275&r1=259274&r2=259275&view=diff
==
--- cfe/trunk/lib/Headers/__wmmintrin_aes.h (original)
+++ cfe/trunk/lib/Headers/__wmmintrin_aes.h Fri Jan 29 17:59:00 2016
@@ -28,36 +28,121 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("aes")))
 
+/// \brief Performs a single round of AES encryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESENC instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the encrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesenc_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesenc128(__V, __R);
 }
 
+/// \brief Performs the final round of AES encryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESENCLAST instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the encrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesenclast_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesenclast128(__V, __R);
 }
 
+/// \brief Performs a single round of AES decryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESDEC instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the decrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesdec_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesdec128(__V, __R);
 }
 
+/// \brief Performs the final round of AES decryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESDECLAST instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the decrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesdeclast_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesdeclast128(__V, __R);
 }
 
+/// \brief Applies the AES InvMixColumns() transformation to an expanded key
+///contained in the source operand, and writes the result to the
+///destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESIMC instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the expanded key.
+/// \returns A 128-bit integer vector containing the transformed value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesimc_si128(__m128i __V)
 {
   return (__m128i)__builtin_ia32_aesimc128(__V);
 }
 
+/// \brief Generates a round key for AES encyption, operating on 128-bit data 
+///specified in the first source operand and using an 8-bit round constant
+///specified by the second source operand, and writes the result to the 
+///destination.
+///
+/// \headerfile 
+///
+/// \code
+/// __m128i _mm_aeskeygenassist_si128(__m128i C, const int R);
+///

Re: [PATCH] D16562: Adding doxygen comments to the LLVM intrinsics (part 3, __wmmintrin_aes.h)

2016-01-29 Thread Katya Romanova via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259275: This patch adds doxygen comments for the intrinsincs 
in the header file… (authored by kromanova).

Changed prior to commit:
  http://reviews.llvm.org/D16562?vs=45924&id=46447#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16562

Files:
  cfe/trunk/lib/Headers/__wmmintrin_aes.h

Index: cfe/trunk/lib/Headers/__wmmintrin_aes.h
===
--- cfe/trunk/lib/Headers/__wmmintrin_aes.h
+++ cfe/trunk/lib/Headers/__wmmintrin_aes.h
@@ -28,36 +28,121 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("aes")))
 
+/// \brief Performs a single round of AES encryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESENC instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the encrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesenc_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesenc128(__V, __R);
 }
 
+/// \brief Performs the final round of AES encryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESENCLAST instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the encrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesenclast_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesenclast128(__V, __R);
 }
 
+/// \brief Performs a single round of AES decryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESDEC instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the decrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesdec_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesdec128(__V, __R);
 }
 
+/// \brief Performs the final round of AES decryption using the Equivalent
+///Inverse Cipher, transforming the state value from the first source
+///operand using a 128-bit round key value contained in the second source
+///operand, and writes the result to the destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESDECLAST instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the state value.
+/// \param __R
+///A 128-bit integer vector containing the round key value.
+/// \returns A 128-bit integer vector containing the decrypted value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesdeclast_si128(__m128i __V, __m128i __R)
 {
   return (__m128i)__builtin_ia32_aesdeclast128(__V, __R);
 }
 
+/// \brief Applies the AES InvMixColumns() transformation to an expanded key
+///contained in the source operand, and writes the result to the
+///destination.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VAESIMC instruction.
+///
+/// \param __V
+///A 128-bit integer vector containing the expanded key.
+/// \returns A 128-bit integer vector containing the transformed value.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_aesimc_si128(__m128i __V)
 {
   return (__m128i)__builtin_ia32_aesimc128(__V);
 }
 
+/// \brief Generates a round key for AES encyption, operating on 128-bit data 
+///specified in the first source operand and using an 8-bit round constant
+///specified by the second source operand, and writes the result to the 
+///destination.
+///
+/// \headerfile 
+///
+/// \code
+/// __m128i _mm_aeskeygenassist_si128(__m128i C, const int R);
+/// \endcode
+///
+/// This intrinsic corresponds to the \c AESKEYGENASSIST instruction.
+///
+/// \param C
+///A 128-bit integer vector that is used to generate the AES encryption key.
+/// \param R
+///An 8-b

Re: r259260 - [UBSan] Add documentation for runtime issue suppression.

2016-01-29 Thread Alexey Samsonov via cfe-commits
On Fri, Jan 29, 2016 at 3:16 PM, Hans Wennborg  wrote:

> Yes, that seems like a good idea. Go ahead and merge (or let me know
> if you'd prefer me to do it).
>

I'd appreciate if you could do it. Thanks!


>
> On Fri, Jan 29, 2016 at 3:14 PM, Alexey Samsonov 
> wrote:
> > Hans, do you think it makes sense to merge this patch into 3.8?
> >
> > On Fri, Jan 29, 2016 at 3:07 PM, Alexey Samsonov via cfe-commits
> >  wrote:
> >>
> >> Author: samsonov
> >> Date: Fri Jan 29 17:07:14 2016
> >> New Revision: 259260
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=259260&view=rev
> >> Log:
> >> [UBSan] Add documentation for runtime issue suppression.
> >>
> >> Modified:
> >> cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> >>
> >> Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=259260&r1=259259&r2=259260&view=diff
> >>
> >>
> ==
> >> --- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
> >> +++ cfe/trunk/docs/UndefinedBehaviorSanitizer.rst Fri Jan 29 17:07:14
> 2016
> >> @@ -168,6 +168,38 @@ UndefinedBehaviorSanitizer supports ``sr
> >>  :doc:`SanitizerSpecialCaseList`, that can be used to suppress error
> >> reports
> >>  in the specified source files or functions.
> >>
> >> +Runtime suppressions
> >> +
> >> +
> >> +Sometimes you can suppress UBSan error reports for specific files,
> >> functions,
> >> +or libraries without recompiling the code. You need to pass a path to
> >> +suppression file in a ``UBSAN_OPTIONS`` environment variable.
> >> +
> >> +.. code-block:: bash
> >> +
> >> +UBSAN_OPTIONS=suppressions=MyUBSan.supp
> >> +
> >> +You need to specify a :ref:`check ` you are suppressing
> and
> >> the
> >> +bug location. For example:
> >> +
> >> +.. code-block:: bash
> >> +
> >> +  signed-integer-overflow:file-with-known-overflow.cpp
> >> +  alignment:function_doing_unaligned_access
> >> +  vptr:shared_object_with_vptr_failures.so
> >> +
> >> +There are several limitations:
> >> +
> >> +* Sometimes your binary must have enough debug info and/or symbol
> table,
> >> so
> >> +  that the runtime could figure out source file or function name to
> match
> >> +  against the suppression.
> >> +* It is only possible to suppress recoverable checks. For the example
> >> above,
> >> +  you can additionally pass
> >> +  ``-fsanitize-recover=signed-integer-overflow,alignment,vptr``,
> although
> >> +  most of UBSan checks are recoverable by default.
> >> +* Check groups (like ``undefined``) can't be used in suppressions file,
> >> only
> >> +  fine-grained checks are supported.
> >> +
> >>  Supported Platforms
> >>  ===
> >>
> >>
> >>
> >> ___
> >> cfe-commits mailing list
> >> cfe-commits@lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
> >
> >
> >
> > --
> > Alexey Samsonov
> > vonos...@gmail.com
>



-- 
Alexey Samsonov
vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r259278 - Remove references to autotools build.

2016-01-29 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Fri Jan 29 18:54:42 2016
New Revision: 259278

URL: http://llvm.org/viewvc/llvm-project?rev=259278&view=rev
Log:
Remove references to autotools build.

Modified:
cfe/trunk/CODE_OWNERS.TXT
cfe/trunk/www/get_started.html

Modified: cfe/trunk/CODE_OWNERS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=259278&r1=259277&r2=259278&view=diff
==
--- cfe/trunk/CODE_OWNERS.TXT (original)
+++ cfe/trunk/CODE_OWNERS.TXT Fri Jan 29 18:54:42 2016
@@ -23,7 +23,7 @@ D: CMake, library layering
 
 N: Eric Christopher
 E: echri...@gmail.com
-D: Debug Information, autotools/configure/make build, inline assembly
+D: Debug Information, inline assembly
 
 N: Doug Gregor
 E: dgre...@apple.com

Modified: cfe/trunk/www/get_started.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/get_started.html?rev=259278&r1=259277&r2=259278&view=diff
==
--- cfe/trunk/www/get_started.html (original)
+++ cfe/trunk/www/get_started.html Fri Jan 29 18:54:42 2016
@@ -98,9 +98,6 @@ follows:
 KDevelop3. For more details see
 http://llvm.org/docs/CMake.html";>Building LLVM with CMake
 page.
-  You can also build Clang with
-http://llvm.org/docs/BuildingLLVMWithAutotools.html";>
-autotools, but some features may be unavailable there.
   
   
 


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


[libcxx] r259281 - [docs] Remove references to autoconf build.

2016-01-29 Thread Alexey Samsonov via cfe-commits
Author: samsonov
Date: Fri Jan 29 19:11:42 2016
New Revision: 259281

URL: http://llvm.org/viewvc/llvm-project?rev=259281&view=rev
Log:
[docs] Remove references to autoconf build.

Modified:
libcxx/trunk/docs/BuildingLibcxx.rst

Modified: libcxx/trunk/docs/BuildingLibcxx.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=259281&r1=259280&r2=259281&view=diff
==
--- libcxx/trunk/docs/BuildingLibcxx.rst (original)
+++ libcxx/trunk/docs/BuildingLibcxx.rst Fri Jan 29 19:11:42 2016
@@ -34,8 +34,7 @@ The basic steps needed to build libc++ a
 
 #. Configure and build libc++ with libc++abi:
 
-   CMake is the only supported configuration system. Unlike other LLVM
-   projects autotools is not supported for either libc++ or libc++abi.
+   CMake is the only supported configuration system.
 
Clang is the preferred compiler when building and using libc++.
 


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


r259284 - Avoid overly large SmallPtrSet/SmallSet

2016-01-29 Thread Matthias Braun via cfe-commits
Author: matze
Date: Fri Jan 29 19:27:06 2016
New Revision: 259284

URL: http://llvm.org/viewvc/llvm-project?rev=259284&view=rev
Log:
Avoid overly large SmallPtrSet/SmallSet

These sets perform linear searching in small mode so it is never a good
idea to use SmallSize/N bigger than 32.

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

Modified:
cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp

Modified: cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp?rev=259284&r1=259283&r2=259284&view=diff
==
--- cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp (original)
+++ cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp Fri Jan 29 19:27:06 2016
@@ -22,9 +22,7 @@
 
 using namespace clang;
 
-// The number of ValueDecls we want to keep track of by default (per-function)
-#define VARDECL_SET_SIZE 256
-typedef llvm::SmallPtrSet VarDeclSet;
+typedef llvm::SmallPtrSet VarDeclSet;
 
 PseudoConstantAnalysis::PseudoConstantAnalysis(const Stmt *DeclBody) :
   DeclBody(DeclBody), Analyzed(false) {

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=259284&r1=259283&r2=259284&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Jan 29 19:27:06 2016
@@ -3843,7 +3843,7 @@ public:
 }
   }
 
-  typedef llvm::SmallPtrSet::iterator iterator;
+  typedef llvm::SmallPtrSetImpl::iterator iterator;
   iterator begin() const { return Overridden.begin(); }
   iterator end() const { return Overridden.end(); }
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp?rev=259284&r1=259283&r2=259284&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp Fri Jan 29 
19:27:06 2016
@@ -43,7 +43,7 @@ void AnalyzerStatsChecker::checkEndAnaly
 ExprEngine &Eng) const {
   const CFG *C = nullptr;
   const SourceManager &SM = B.getSourceManager();
-  llvm::SmallPtrSet reachable;
+  llvm::SmallPtrSet reachable;
 
   // Root node should have the location context of the top most function.
   const ExplodedNode *GraphRoot = *G.roots_begin();

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp?rev=259284&r1=259283&r2=259284&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp Fri Jan 29 
19:27:06 2016
@@ -26,10 +26,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "llvm/ADT/SmallSet.h"
 
-// The number of CFGBlock pointers we want to reserve memory for. This is used
-// once for each function we analyze.
-#define DEFAULT_CFGBLOCKS 256
-
 using namespace clang;
 using namespace ento;
 
@@ -39,7 +35,7 @@ public:
   void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,
 ExprEngine &Eng) const;
 private:
-  typedef llvm::SmallSet CFGBlocksSet;
+  typedef llvm::SmallSet CFGBlocksSet;
 
   static inline const Stmt *getUnreachableStmt(const CFGBlock *CB);
   static void FindUnreachableEntryPoints(const CFGBlock *CB,


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


Re: [PATCH] D16705: Avoid overly large SmallPtrSet/SmallSet

2016-01-29 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259284: Avoid overly large SmallPtrSet/SmallSet (authored by 
matze).

Changed prior to commit:
  http://reviews.llvm.org/D16705?vs=46337&id=46457#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16705

Files:
  cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
  cfe/trunk/lib/Sema/SemaDeclObjC.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp

Index: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp
@@ -3843,7 +3843,7 @@
 }
   }
 
-  typedef llvm::SmallPtrSet::iterator iterator;
+  typedef llvm::SmallPtrSetImpl::iterator iterator;
   iterator begin() const { return Overridden.begin(); }
   iterator end() const { return Overridden.end(); }
 
Index: cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
===
--- cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
+++ cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
@@ -22,9 +22,7 @@
 
 using namespace clang;
 
-// The number of ValueDecls we want to keep track of by default (per-function)
-#define VARDECL_SET_SIZE 256
-typedef llvm::SmallPtrSet VarDeclSet;
+typedef llvm::SmallPtrSet VarDeclSet;
 
 PseudoConstantAnalysis::PseudoConstantAnalysis(const Stmt *DeclBody) :
   DeclBody(DeclBody), Analyzed(false) {
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -26,10 +26,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "llvm/ADT/SmallSet.h"
 
-// The number of CFGBlock pointers we want to reserve memory for. This is used
-// once for each function we analyze.
-#define DEFAULT_CFGBLOCKS 256
-
 using namespace clang;
 using namespace ento;
 
@@ -39,7 +35,7 @@
   void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,
 ExprEngine &Eng) const;
 private:
-  typedef llvm::SmallSet CFGBlocksSet;
+  typedef llvm::SmallSet CFGBlocksSet;
 
   static inline const Stmt *getUnreachableStmt(const CFGBlock *CB);
   static void FindUnreachableEntryPoints(const CFGBlock *CB,
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
@@ -43,7 +43,7 @@
 ExprEngine &Eng) const {
   const CFG *C = nullptr;
   const SourceManager &SM = B.getSourceManager();
-  llvm::SmallPtrSet reachable;
+  llvm::SmallPtrSet reachable;
 
   // Root node should have the location context of the top most function.
   const ExplodedNode *GraphRoot = *G.roots_begin();


Index: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp
@@ -3843,7 +3843,7 @@
 }
   }
 
-  typedef llvm::SmallPtrSet::iterator iterator;
+  typedef llvm::SmallPtrSetImpl::iterator iterator;
   iterator begin() const { return Overridden.begin(); }
   iterator end() const { return Overridden.end(); }
 
Index: cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
===
--- cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
+++ cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
@@ -22,9 +22,7 @@
 
 using namespace clang;
 
-// The number of ValueDecls we want to keep track of by default (per-function)
-#define VARDECL_SET_SIZE 256
-typedef llvm::SmallPtrSet VarDeclSet;
+typedef llvm::SmallPtrSet VarDeclSet;
 
 PseudoConstantAnalysis::PseudoConstantAnalysis(const Stmt *DeclBody) :
   DeclBody(DeclBody), Analyzed(false) {
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -26,10 +26,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "llvm/ADT/SmallSet.h"
 
-// The number of CFGBlock pointers we want to reserve memory for. This is used
-// once for each function we analyze.
-#define DEFAULT_CFGBLOCKS 256
-
 using namespace clang;
 using namespace ento;
 
@@ -39,7 +35,7 @@
   void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,
 ExprEngine &Eng) const;
 private:
-  typedef llvm::SmallSet CFGBlocksSet;
+  typedef llvm::SmallSet CFGBlocksSet;
 
   static inline const Stmt *g

Re: [PATCH] D16514: Add -stop-on-failure driver option, and enable it by default for CUDA compiles.

2016-01-29 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Talking to echristo irl, he would like to know why we don't have this problem 
with mac universal binaries -- or, do we?  He would like to be consistent; I'm 
onboard with that.


http://reviews.llvm.org/D16514



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


r259287 - [SemaCXX] Fix crash-on-invalid while trying to deduce return type of a lambda.

2016-01-29 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Jan 29 19:51:20 2016
New Revision: 259287

URL: http://llvm.org/viewvc/llvm-project?rev=259287&view=rev
Log:
[SemaCXX] Fix crash-on-invalid while trying to deduce return type of a lambda.

rdar://22032373

Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/SemaCXX/lambda-expressions.cpp

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=259287&r1=259286&r2=259287&view=diff
==
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Fri Jan 29 19:51:20 2016
@@ -3066,22 +3066,23 @@ bool Sema::DeduceFunctionTypeFromReturnE
   //  has multiple return statements, the return type is deduced for each 
return
   //  statement. [...] if the type deduced is not the same in each deduction,
   //  the program is ill-formed.
-  if (AT->isDeduced() && !FD->isInvalidDecl()) {
+  QualType DeducedT = AT->getDeducedType();
+  if (!DeducedT.isNull() && !FD->isInvalidDecl()) {
 AutoType *NewAT = Deduced->getContainedAutoType();
 CanQualType OldDeducedType = Context.getCanonicalFunctionResultType(
-   AT->getDeducedType());
+   DeducedT);
 CanQualType NewDeducedType = Context.getCanonicalFunctionResultType(
NewAT->getDeducedType());
 if (!FD->isDependentContext() && OldDeducedType != NewDeducedType) {
   const LambdaScopeInfo *LambdaSI = getCurLambda();
   if (LambdaSI && LambdaSI->HasImplicitReturnType) {
 Diag(ReturnLoc, diag::err_typecheck_missing_return_type_incompatible)
-  << NewAT->getDeducedType() << AT->getDeducedType()
+  << NewAT->getDeducedType() << DeducedT
   << true /*IsLambda*/;
   } else {
 Diag(ReturnLoc, diag::err_auto_fn_different_deductions)
   << (AT->isDecltypeAuto() ? 1 : 0)
-  << NewAT->getDeducedType() << AT->getDeducedType();
+  << NewAT->getDeducedType() << DeducedT;
   }
   return true;
 }

Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/lambda-expressions.cpp?rev=259287&r1=259286&r2=259287&view=diff
==
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Fri Jan 29 19:51:20 2016
@@ -476,3 +476,14 @@ int main() {
 
 A a;
 }
+
+// rdar://22032373
+namespace rdar22032373 {
+void foo() {
+  auto blk = [](bool b) {
+if (b)
+  return undeclared_error; // expected-error {{use of undeclared 
identifier}}
+return 0;
+  };
+}
+}


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


r259288 - [analyzer] Make suppression of macro defensive checks work with -analyzer-eagerly-assume.

2016-01-29 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Fri Jan 29 19:59:33 2016
New Revision: 259288

URL: http://llvm.org/viewvc/llvm-project?rev=259288&view=rev
Log:
[analyzer] Make suppression of macro defensive checks work with 
-analyzer-eagerly-assume.

This is the default for the analyzer but the flag is added by the driver so
our suppression tests didn't cover this case.

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
cfe/trunk/test/Analysis/inlining/false-positive-suppression.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=259288&r1=259287&r2=259288&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Fri Jan 29 
19:59:33 2016
@@ -14,6 +14,7 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
+#include "clang/Analysis/CFGStmtMap.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
@@ -834,21 +835,41 @@ SuppressInlineDefensiveChecksVisitor::Vi
 }
 
 // Treat defensive checks in function-like macros as if they were an 
inlined
-// defensive check.
-auto CurPoint = Succ->getLocation().getAs();
+// defensive check. If the bug location is not in a macro and the
+// terminator for the current location is in a macro then suppress the
+// warning.
 auto BugPoint = BR.getErrorNode()->getLocation().getAs();
 
-if (!CurPoint || !BugPoint)
+if (!BugPoint)
   return nullptr;
 
-SourceLocation CurLoc =
-CurPoint->getSrc()->getTerminator().getStmt()->getLocStart();
 SourceLocation BugLoc = BugPoint->getStmt()->getLocStart();
+if (BugLoc.isMacroID())
+  return nullptr;
+
+ProgramPoint CurPoint = Succ->getLocation();
+const Stmt *CurTerminatorStmt = nullptr;
+if (auto BE = CurPoint.getAs()) {
+  CurTerminatorStmt = BE->getSrc()->getTerminator().getStmt();
+} else if (auto SP = CurPoint.getAs()) {
+  const Stmt *CurStmt = SP->getStmt();
+  if (!CurStmt->getLocStart().isMacroID())
+return nullptr;
+
+  CFGStmtMap *Map = CurLC->getAnalysisDeclContext()->getCFGStmtMap();
+  CurTerminatorStmt = Map->getBlock(CurStmt)->getTerminator();
+} else {
+  return nullptr;
+}
+
+if (!CurTerminatorStmt)
+  return nullptr;
 
-if (CurLoc.isMacroID() && !BugLoc.isMacroID()) {
+SourceLocation TerminatorLoc = CurTerminatorStmt->getLocStart();
+if (TerminatorLoc.isMacroID()) {
   const SourceManager &SMgr = BRC.getSourceManager();
-  std::pair CLInfo = SMgr.getDecomposedLoc(CurLoc);
-  SrcMgr::SLocEntry SE = SMgr.getSLocEntry(CLInfo.first);
+  std::pair TLInfo = 
SMgr.getDecomposedLoc(TerminatorLoc);
+  SrcMgr::SLocEntry SE = SMgr.getSLocEntry(TLInfo.first);
   const SrcMgr::ExpansionInfo &EInfo = SE.getExpansion();
   if (EInfo.isFunctionMacroExpansion()) {
 BR.markInvalid("Suppress Macro IDC", CurLC);

Modified: cfe/trunk/test/Analysis/inlining/false-positive-suppression.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inlining/false-positive-suppression.c?rev=259288&r1=259287&r2=259288&view=diff
==
--- cfe/trunk/test/Analysis/inlining/false-positive-suppression.c (original)
+++ cfe/trunk/test/Analysis/inlining/false-positive-suppression.c Fri Jan 29 
19:59:33 2016
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config 
suppress-null-return-paths=false -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -DSUPPRESSED=1 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config 
avoid-suppressing-null-argument-paths=true -DSUPPRESSED=1 -DNULL_ARGS=1 -verify 
%s
+// RUN: %clang_cc1 -analyze -analyzer-eagerly-assume -analyzer-checker=core 
-analyzer-config suppress-null-return-paths=false -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-eagerly-assume -analyzer-checker=core 
-verify -DSUPPRESSED=1 %s
+// RUN: %clang_cc1 -analyze -analyzer-eagerly-assume -analyzer-checker=core 
-analyzer-config avoid-suppressing-null-argument-paths=true -DSUPPRESSED=1 
-DNULL_ARGS=1 -verify %s
 
 int opaquePropertyCheck(void *object);
 int coin();
@@ -145,14 +145,24 @@ int isEqual(int *p, int *q);
 #define ISNOTEQUAL(a, b)   (!ISEQUAL(a, b))
 void testNestedDisjunctiveMacro(int *p, int *q) {
   if (ISNOTEQUAL(p,q)) {
-(void)*p; // no-warning
-(void)*q; // no-warning
+*p = 1; // no-warning
+*q = 1; // no-warning
   }
 
-  (void)*p; // no-warning
-  (void)*q; // no-warning
+  *p = 1; // no-warni

[clang-tools-extra] r259289 - test/clang-tidy/performance-for-range-copy.cpp: Appease for targeting ms mode.

2016-01-29 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Jan 29 20:15:19 2016
New Revision: 259289

URL: http://llvm.org/viewvc/llvm-project?rev=259289&view=rev
Log:
test/clang-tidy/performance-for-range-copy.cpp: Appease for targeting ms mode.

Modified:
clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy.cpp?rev=259289&r1=259288&r2=259289&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-for-range-copy.cpp Fri 
Jan 29 20:15:19 2016
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-for-range-copy %t
+// RUN: %check_clang_tidy %s performance-for-range-copy %t -- -- -std=c++11 
-fno-delayed-template-parsing
 
 namespace std {
 


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


Re: [PATCH] D3976: -Wcomma, a new warning for questionable uses of the comma operator

2016-01-29 Thread Richard Trieu via cfe-commits
rtrieu added a comment.

Not sure what happened.  Will check it out on Monday.


http://reviews.llvm.org/D3976



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


Re: [PATCH] D8149: Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes

2016-01-29 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 46464.
LegalizeAdulthood added a comment.

Fix RegistryTest unit test
make check-all passes


http://reviews.llvm.org/D8149

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/ASTMatchersTest.cpp
  unittests/ASTMatchers/Dynamic/RegistryTest.cpp

Index: unittests/ASTMatchers/Dynamic/RegistryTest.cpp
===
--- unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -421,7 +421,7 @@
constructMatcher("parameterCountIs", 3), Error.get())
   .isNull());
   EXPECT_EQ("Incorrect type for arg 2. (Expected = Matcher) != "
-"(Actual = Matcher)",
+"(Actual = Matcher)",
 Error->toString());
 
   // Bad argument type with variadic.
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1091,6 +1091,16 @@
   notMatches("class X {}; void y() { X *x; }", varDecl(hasType(ClassX;
 }
 
+TEST(HasType, MatchesTypedefDecl) {
+  EXPECT_TRUE(matches("typedef int X;", typedefDecl(hasType(asString("int");
+  EXPECT_TRUE(matches("typedef const int T;",
+  typedefDecl(hasType(asString("const int");
+  EXPECT_TRUE(notMatches("typedef const int T;",
+ typedefDecl(hasType(asString("int");
+  EXPECT_TRUE(matches("typedef int foo; typedef foo bar;",
+  typedefDecl(hasType(asString("foo")), hasName("bar";
+}
+
 TEST(HasTypeLoc, MatchesDeclaratorDecls) {
   EXPECT_TRUE(matches("int x;",
   varDecl(hasName("x"), hasTypeLoc(loc(asString("int"));
@@ -1563,6 +1573,9 @@
  functionDecl(isVariadic(;
   EXPECT_TRUE(notMatches("void f();", functionDecl(isVariadic(;
   EXPECT_TRUE(notMatchesC("void f();", functionDecl(isVariadic(;
+  EXPECT_TRUE(matches("void f(...);", functionDecl(parameterCountIs(0;
+  EXPECT_TRUE(matchesC("void f();", functionDecl(parameterCountIs(0;
+  EXPECT_TRUE(matches("void f(int, ...);", functionDecl(parameterCountIs(1;
 }
 
 TEST(FunctionTemplate, MatchesFunctionTemplateDeclarations) {
@@ -1719,6 +1732,7 @@
   EXPECT_TRUE(matches("class X { void f(int i) {} };", Function1Arg));
   EXPECT_TRUE(notMatches("void f() {}", Function1Arg));
   EXPECT_TRUE(notMatches("void f(int i, int j, int k) {}", Function1Arg));
+  EXPECT_TRUE(matches("void f(int i, ...) {};", Function1Arg));
 }
 
 TEST(Matcher, References) {
@@ -4447,6 +4461,15 @@
   EXPECT_TRUE(matches("void f(int i) {}", functionType()));
 }
 
+TEST(TypeMatching, MatchesFunctionProtoTypes) {
+  EXPECT_TRUE(matches("int (*f)(int);", functionProtoType()));
+  EXPECT_TRUE(matches("void f(int i);", functionProtoType()));
+  EXPECT_TRUE(matches("void f();", functionProtoType(parameterCountIs(0;
+  EXPECT_TRUE(notMatchesC("void f();", functionProtoType()));
+  EXPECT_TRUE(
+  matchesC("void f(void);", functionProtoType(parameterCountIs(0;
+}
+
 TEST(TypeMatching, MatchesParenType) {
   EXPECT_TRUE(
   matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType());
@@ -5148,7 +5171,8 @@
   namespaceDecl(isInline(), hasName("m";
 }
 
-// FIXME: Figure out how to specify paths so the following tests pass on Windows.
+// FIXME: Figure out how to specify paths so the following tests pass on
+// Windows.
 #ifndef LLVM_ON_WIN32
 
 TEST(Matcher, IsExpansionInMainFileMatcher) {
Index: lib/ASTMatchers/Dynamic/Registry.cpp
===
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -182,6 +182,7 @@
   REGISTER_MATCHER(forStmt);
   REGISTER_MATCHER(friendDecl);
   REGISTER_MATCHER(functionDecl);
+  REGISTER_MATCHER(functionProtoType);
   REGISTER_MATCHER(functionTemplateDecl);
   REGISTER_MATCHER(functionType);
   REGISTER_MATCHER(gotoStmt);
Index: include/clang/ASTMatchers/ASTMatchersInternal.h
===
--- include/clang/ASTMatchers/ASTMatchersInternal.h
+++ include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -60,6 +60,17 @@
 
 namespace internal {
 
+/// \brief Unifies obtaining the underlying type of a regular node through
+/// `getType` and a TypedefNameDecl node through `getUnderlyingType`.
+template 
+inline QualType getUnderlyingType(const NodeType &Node) {
+  return Node.getType();
+}
+
+template <> inline QualType getUnderlyingType(const TypedefDecl &Node) {
+  return Node.getUnderlyingType();
+}
+
 /// \brief Internal version of BoundNodes. Holds all the bound nodes.
 class BoundNodesMap {
 public:
Index: include/c

Re: [PATCH] D8149: Extend hasType narrowing matcher for TypedefDecls, add functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes

2016-01-29 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

It seems that phabricator hasn't been configured to allow me to reopen the 
revision, but I've updated the diff.


http://reviews.llvm.org/D8149



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


Re: [PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

2016-01-29 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 46466.
LegalizeAdulthood added a comment.

Re-upload diff


http://reviews.llvm.org/D16529

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/RawStringLiteralCheck.cpp
  clang-tidy/modernize/RawStringLiteralCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-raw-string-literal.rst
  test/clang-tidy/modernize-raw-string-literal.cpp

Index: test/clang-tidy/modernize-raw-string-literal.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-raw-string-literal.cpp
@@ -0,0 +1,68 @@
+// RUN: %check_clang_tidy %s modernize-raw-string-literal %t
+
+char const *const BackSlash{"goink\\frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: escaped string literal can be written as a raw string literal [modernize-raw-string-literal]
+// CHECK-FIXES: {{^}}char const *const BackSlash{R"(goink\frob)"};{{$}}
+
+char const *const Bell{"goink\\\afrob"};
+char const *const BackSpace{"goink\\\bfrob"};
+char const *const FormFeed{"goink\\\ffrob"};
+char const *const CarraigeReturn{"goink\\\rfrob"};
+char const *const HorizontalTab{"goink\\\tfrob"};
+char const *const VerticalTab{"goink\\\vfrob"};
+char const *const OctalNonPrintable{"\\\003"};
+char const *const HexNonPrintable{"\\\x03"};
+char const *const Delete{"\\\177"};
+char const *const TrailingSpace{"A line \\with space. \n"};
+char const *const TrailingNewLine{"A single \\line.\n"};
+char const *const AlreadyRaw{R"(foobie\\bletch)"};
+char const *const UTF8Literal{u8"foobie\\bletch"};
+char const *const UTF8RawLiteral{u8R"(foobie\\bletch)"};
+char16_t const *const UTF16Literal{u"foobie\\bletch"};
+char16_t const *const UTF16RawLiteral{uR"(foobie\\bletch)"};
+char32_t const *const UTF32Literal{U"foobie\\bletch"};
+char32_t const *const UTF32RawLiteral{UR"(foobie\\bletch)"};
+wchar_t const *const WideLiteral{L"foobie\\bletch"};
+wchar_t const *const WideRawLiteral{LR"(foobie\\bletch)"};
+
+char const *const NewLine{"goink\nfrob\n"};
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const NewLine{R"(goink{{$}}
+// CHECK-FIXES-NEXT: {{^}}frob{{$}}
+// CHECK-FIXES-NEXT: {{^}})"};{{$}}
+
+char const *const SingleQuote{"goink\'frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: {{.*}} can be written as a raw string literal
+// CHECK-XFIXES: {{^}}char const *const SingleQuote{R"(goink'frob)"};{{$}}
+
+char const *const DoubleQuote{"goink\"frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const DoubleQuote{R"(goink"frob)"};{{$}}
+
+char const *const QuestionMark{"goink\?frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const QuestionMark{R"(goink?frob)"};{{$}}
+
+char const *const RegEx{"goink\\(one|two\\)\\?.*\\nfrob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const RegEx{R"(goink\(one|two\)\\\?.*\nfrob)"};{{$}}
+
+char const *const Path{"C:\\Program Files\\Vendor\\Application\\Application.exe"};
+// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const Path{R"(C:\Program Files\Vendor\Application\Application.exe)"};{{$}}
+
+char const *const ContainsSentinel{"who\\ops)\""};
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const ContainsSentinel{R"lit(who\ops)")lit"};{{$}}
+
+char const *const ContainsDelim{"whoops)\")lit\""};
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const ContainsDelim{R"lit1(whoops)")lit")lit1"};{{$}}
+
+char const *const OctalPrintable{"\100\\"};
+// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const OctalPrintable{R"(@\)"};{{$}}
+
+char const *const HexPrintable{"\x40\\"};
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const HexPrintable{R"(@\)"};{{$}}
Index: docs/clang-tidy/checks/modernize-raw-string-literal.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-raw-string-literal.rst
@@ -0,0 +1,56 @@
+.. title:: clang-tidy - modernize-raw-string-literal
+
+modernize-raw-string-literal
+
+
+This check selectively replaces string literals containing escaped characters
+with raw string literals.
+
+Example:
+
+.. code-blocK:: c++
+
+  const char *const Quotes{"embedded \"quotes\""};
+  const char *const Paragraph{"Line one.\nLine two.\nLine three.\n"};
+  

Re: [PATCH] D16308: clang-tidy Enhance readability-simplify-boolean-expr check to handle implicit conversions of integral types to bool and member pointers

2016-01-29 Thread Richard via cfe-commits
LegalizeAdulthood marked 2 inline comments as done.


Comment at: clang-tidy/readability/SimplifyBooleanExprCheck.h:77
@@ -74,3 +76,3 @@
 ///  implicit conversion of `i & 1` to `bool` and becomes
-///  `bool b = static_cast(i & 1);`.
+///  `bool b = i & 1 != 0;`.
 ///

aaron.ballman wrote:
> Perhaps a different idea regarding parens isn't to add/remove parens in 
> various checks for readability, but instead have two readability checks that 
> do different things (both disabled by default?): (1) remove spurious parens 
> where the presence of the parens has no effect on the order of evaluation of 
> the subexpressions, and (2) add parens where there is an operator precedence 
> difference between the operators of two subexpressions. Both of these checks 
> are at odds with one another (which is why I don't think it makes sense to 
> enable them by default), but both certainly seem like they would be useful.
> 
> Thoughts on the general idea (not trying to sign either of us up for work to 
> implement it)?
I'm of two minds on this, I'm not really coming down hard on either side.  It 
feels like there should be a readability check for removing parenthesis to 
consolidate the heuristics all in one place and that check can in turn be 
configured by parameters.


http://reviews.llvm.org/D16308



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


LLVM buildmaster will be restarted in few minutes.

2016-01-29 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted in few minutes.

Thanks

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


Re: [PATCH] D12761: MPI-Checker patch for Clang Static Analyzer

2016-01-29 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Hi Alexander,

Sorry for the delay!

The patch should be rebased from the clang repo; for example, you could run 
"svn diff" from the clang directory. More comments inline.



Comment at: tools/clang/lib/StaticAnalyzer/Checkers/Checkers.td:75
@@ -74,1 +74,3 @@
 
+def MPI : Package<"mpi">;
+

This should probably go under the 'option' package. What do you think?


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h:24
@@ +23,3 @@
+namespace clang {
+namespace mpi {
+

Should this be clang::ento::mpi? Alternatively, you could place everything into 
a single file and have it live in anonymous namespace. This would also be more 
consistent with the existing checkers.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h:40
@@ +39,3 @@
+
+  // ast reports ––
+

Looks like some of the AST stuff was deleted and some was kept. Please, either 
remove all of it or keep all of it in.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:26
@@ +25,3 @@
+public:
+  // path-sensitive callbacks
+  void checkPreCall(const CallEvent &CE, CheckerContext &Ctx) const {

nit: Please, remove the comments with "" for consistency.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:43
@@ +42,3 @@
+private:
+  const std::unique_ptr CheckerSens;
+

I'd stress "path" instead of "sensitive" in the name. Also, this indirection is 
redundant if you remove the AST checks.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPICheckerPathSensitive.cpp:43
@@ +42,3 @@
+  if (Req && Req->CurrentState == Request::State::Nonblocking) {
+BugReporter.reportDoubleNonblocking(PreCallEvent, *Req, MR, ExplNode);
+  }

You should use 'generateErrorNode' or 'generateNonFatalErrorNode' to generate 
the node on which the error should be reported. If the error is non-fatal, 
you'd need to use the generated node below. Specifically, use it's state and 
pass it as the predecessor when adding a transition.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPICheckerPathSensitive.cpp:74
@@ +73,3 @@
+  // A wait has no matching nonblocking call.
+  BugReporter.reportUnmatchedWait(PreCallEvent, ReqRegion, ExplNode);
+}

This is called in a loop. Should you break once the first error is reported?

Also, as before you should use the CheckerContext API to produce a node on 
which the error should be reported.




Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPICheckerPathSensitive.cpp:79
@@ +78,3 @@
+  if (!ReqRegions.empty()) {
+Ctx.addTransition(State);
+  }

Don't forget to specify a predecessor here once the code above changes.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPICheckerPathSensitive.h:87
@@ +86,3 @@
+  const MPIFunctionClassifier FuncClassifier;
+  MPIBugReporter BugReporter;
+};

Please, use a name other than 'BugReporter' to avoid confusing it with the 
BugReporter in the analyzer.


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h:45
@@ +44,3 @@
+  bool isAllgatherType(const clang::IdentifierInfo *const IdentInfo) const;
+  bool isAlltoallType(const clang::IdentifierInfo *const IdentInfo) const;
+  bool isReduceType(const clang::IdentifierInfo *const IdentInfo) const;

Some of these classifier functions are not used either..


Comment at: 
tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h:77
@@ +76,3 @@
+  llvm::SmallVector MPIPointToCollTypes;
+  llvm::SmallVector MPICollToPointTypes;
+  llvm::SmallVector MPICollToCollTypes;

MPIPointToCollTypes  and MPICollToPointTypes do not seem to be used.


Comment at: tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h:56
@@ +55,3 @@
+struct RequestMap {};
+typedef llvm::ImmutableMap RequestMapImpl;

Let's add some documentation on why you are not using the standard macro 
REGISTER_MAP_WITH_PROGRAMSTATE. (Might help to avoid confusion lear on.)


Comment at: tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/Utility.cpp:21
@@ +20,3 @@
+
+namespace util {
+

I'd like to remove the Utility.cpp completely by either making the helper 
functions static or moving them to other shared components.


Comment at: tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/Utility.cpp:40
@@ +39,3 @@
+
+clang::StringRef sourceRangeAsStringRef(const clang::SourceRange &Range,
+

Re: [PATCH] D16063: [Analyzer] Use a wider integer type for an array index

2016-01-29 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

Looks like all of Gabor's comments were addressed. LGTM. Thank you!


http://reviews.llvm.org/D16063



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