[PATCH] D37954: Try to shorten system header paths when using -MD depfiles

2017-10-12 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn added a comment.

ping? I'll push it next week if there is no new feedback.


https://reviews.llvm.org/D37954



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


[PATCH] D35082: [OpenCL] Add LangAS::opencl_private to represent private address space in AST

2017-10-12 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315668: [OpenCL] Add LangAS::opencl_private to represent 
private address space in AST (authored by yaxunl).

Changed prior to commit:
  https://reviews.llvm.org/D35082?vs=118813=118882#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35082

Files:
  cfe/trunk/include/clang/Basic/AddressSpaces.h
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/lib/AST/Expr.cpp
  cfe/trunk/lib/AST/ItaniumMangle.cpp
  cfe/trunk/lib/AST/TypePrinter.cpp
  cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
  cfe/trunk/lib/Basic/Targets/NVPTX.h
  cfe/trunk/lib/Basic/Targets/SPIR.h
  cfe/trunk/lib/Basic/Targets/TCE.h
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl
  cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
  cfe/trunk/test/SemaOpenCL/address-spaces.cl
  cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl
  cfe/trunk/test/SemaOpenCL/extern.cl
  cfe/trunk/test/SemaOpenCL/storageclass-cl20.cl
  cfe/trunk/test/SemaOpenCL/storageclass.cl
  cfe/trunk/test/SemaTemplate/address_space-dependent.cpp

Index: cfe/trunk/include/clang/Basic/AddressSpaces.h
===
--- cfe/trunk/include/clang/Basic/AddressSpaces.h
+++ cfe/trunk/include/clang/Basic/AddressSpaces.h
@@ -25,16 +25,17 @@
 ///
 enum ID {
   // The default value 0 is the value used in QualType for the the situation
-  // where there is no address space qualifier. For most languages, this also
-  // corresponds to the situation where there is no address space qualifier in
-  // the source code, except for OpenCL, where the address space value 0 in
-  // QualType represents private address space in OpenCL source code.
+  // where there is no address space qualifier.
   Default = 0,
 
   // OpenCL specific address spaces.
+  // In OpenCL each l-value must have certain non-default address space, each
+  // r-value must have no address space (i.e. the default address space). The
+  // pointee of a pointer must have non-default address space.
   opencl_global,
   opencl_local,
   opencl_constant,
+  opencl_private,
   opencl_generic,
 
   // CUDA specific address spaces.
Index: cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
===
--- cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
+++ cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
@@ -7,6 +7,24 @@
 // RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,SPIR %s
 // RUN: %clang_cc1 %s -O0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,SPIR %s
 
+// SPIR: %struct.S = type { i32, i32, i32* }
+// CL20SPIR: %struct.S = type { i32, i32, i32 addrspace(4)* }
+struct S {
+  int x;
+  int y;
+  int *z;
+};
+
+// CL20-DAG: @g_extern_var = external addrspace(1) global float
+// CL20-DAG: @l_extern_var = external addrspace(1) global float
+// CL20-DAG: @test_static.l_static_var = internal addrspace(1) global float 0.00e+00
+// CL20-DAG: @g_static_var = internal addrspace(1) global float 0.00e+00
+
+#ifdef CL20
+// CL20-DAG: @g_s = common addrspace(1) global %struct.S zeroinitializer
+struct S g_s;
+#endif
+
 // SPIR: i32* %arg
 // GIZ: i32 addrspace(5)* %arg
 void f__p(__private int *arg) {}
@@ -58,3 +76,52 @@
 // CL20-DAG: @f.ii = internal addrspace(1) global i32 0
 #endif
 }
+
+typedef int int_td;
+typedef int *intp_td;
+// SPIR: define void @test_typedef(i32 addrspace(1)* %x, i32 addrspace(2)* %y, i32* %z)
+void test_typedef(global int_td *x, constant int_td *y, intp_td z) {
+  *x = *y;
+  *z = 0;
+}
+
+// SPIR: define void @test_struct()
+void test_struct() {
+  // SPIR: %ps = alloca %struct.S*
+  // CL20SPIR: %ps = alloca %struct.S addrspace(4)*
+  struct S *ps;
+  // SPIR: store i32 0, i32* %x
+  // CL20SPIR: store i32 0, i32 addrspace(4)* %x
+  ps->x = 0;
+#ifdef CL20
+  // CL20SPIR: store i32 0, i32 addrspace(1)* getelementptr inbounds (%struct.S, %struct.S addrspace(1)* @g_s, i32 0, i32 0)
+  g_s.x = 0;
+#endif
+}
+
+// SPIR-LABEL: define void @test_void_par()
+void test_void_par(void) {}
+
+// SPIR-LABEL: define i32 @test_func_return_type()
+int test_func_return_type(void) {
+  return 0;
+}
+
+#ifdef CL20
+extern float g_extern_var;
+
+// CL20-LABEL: define {{.*}}void @test_extern(
+kernel void test_extern(global float *buf) {
+  extern float l_extern_var;
+  buf[0] += g_extern_var + l_extern_var;
+}
+
+static float g_static_var;
+
+// CL20-LABEL: define {{.*}}void @test_static(
+kernel void test_static(global float *buf) {
+  static float l_static_var;
+  buf[0] += g_static_var + l_static_var;
+}
+
+#endif
Index: cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl
===
--- cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl
+++ 

r315668 - [OpenCL] Add LangAS::opencl_private to represent private address space in AST

2017-10-12 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Thu Oct 12 20:37:48 2017
New Revision: 315668

URL: http://llvm.org/viewvc/llvm-project?rev=315668=rev
Log:
[OpenCL] Add LangAS::opencl_private to represent private address space in AST

Currently Clang uses default address space (0) to represent private address 
space for OpenCL
in AST. There are two issues with this:

Multiple address spaces including private address space cannot be diagnosed.
There is no mangling for default address space. For example, if private int* is 
emitted as
i32 addrspace(5)* in IR. It is supposed to be mangled as PUAS5i but it is 
mangled as
Pi instead.

This patch attempts to represent OpenCL private address space explicitly in 
AST. It adds
a new enum LangAS::opencl_private and adds it to the variable types which are 
implicitly
private:

automatic variables without address space qualifier

function parameter

pointee type without address space qualifier (OpenCL 1.2 and below)

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

Removed:
cfe/trunk/test/SemaOpenCL/extern.cl
Modified:
cfe/trunk/include/clang/Basic/AddressSpaces.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
cfe/trunk/lib/Basic/Targets/NVPTX.h
cfe/trunk/lib/Basic/Targets/SPIR.h
cfe/trunk/lib/Basic/Targets/TCE.h
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenOpenCL/address-spaces-mangling.cl
cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
cfe/trunk/test/SemaOpenCL/address-spaces.cl
cfe/trunk/test/SemaOpenCL/cl20-device-side-enqueue.cl
cfe/trunk/test/SemaOpenCL/storageclass-cl20.cl
cfe/trunk/test/SemaOpenCL/storageclass.cl
cfe/trunk/test/SemaTemplate/address_space-dependent.cpp

Modified: cfe/trunk/include/clang/Basic/AddressSpaces.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AddressSpaces.h?rev=315668=315667=315668=diff
==
--- cfe/trunk/include/clang/Basic/AddressSpaces.h (original)
+++ cfe/trunk/include/clang/Basic/AddressSpaces.h Thu Oct 12 20:37:48 2017
@@ -25,16 +25,17 @@ namespace LangAS {
 ///
 enum ID {
   // The default value 0 is the value used in QualType for the the situation
-  // where there is no address space qualifier. For most languages, this also
-  // corresponds to the situation where there is no address space qualifier in
-  // the source code, except for OpenCL, where the address space value 0 in
-  // QualType represents private address space in OpenCL source code.
+  // where there is no address space qualifier.
   Default = 0,
 
   // OpenCL specific address spaces.
+  // In OpenCL each l-value must have certain non-default address space, each
+  // r-value must have no address space (i.e. the default address space). The
+  // pointee of a pointer must have non-default address space.
   opencl_global,
   opencl_local,
   opencl_constant,
+  opencl_private,
   opencl_generic,
 
   // CUDA specific address spaces.

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=315668=315667=315668=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Oct 12 20:37:48 2017
@@ -707,6 +707,7 @@ static const LangAS::Map *getAddressSpac
   1, // opencl_global
   3, // opencl_local
   2, // opencl_constant
+  0, // opencl_private
   4, // opencl_generic
   5, // cuda_device
   6, // cuda_constant

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=315668=315667=315668=diff
==
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Oct 12 20:37:48 2017
@@ -3293,20 +3293,20 @@ Expr::isNullPointerConstant(ASTContext &
   // Check that it is a cast to void*.
   if (const PointerType *PT = CE->getType()->getAs()) {
 QualType Pointee = PT->getPointeeType();
-Qualifiers Q = Pointee.getQualifiers();
-// In OpenCL v2.0 generic address space acts as a placeholder
-// and should be ignored.
-bool IsASValid = true;
-if (Ctx.getLangOpts().OpenCLVersion >= 200) {
-  if (Pointee.getAddressSpace() == LangAS::opencl_generic)
-Q.removeAddressSpace();
-  else
-IsASValid = false;
-}
+// Only (void*)0 or equivalent are treated as nullptr. If pointee type
+// has non-default address space it is not treated as nullptr.
+// (__generic void*)0 in OpenCL 2.0 should not be treated as nullptr
+// 

r315665 - [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Alexander Shaposhnikov via cfe-commits
Author: alexshap
Date: Thu Oct 12 20:21:39 2017
New Revision: 315665

URL: http://llvm.org/viewvc/llvm-project?rev=315665=rev
Log:
[clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting 
LLVM_PROFTDATA

At the moment if LLVM_BUILD_INSTRUMENTED is set to True 
one has to set LLVM_PROFTDATA even if it's not really used 
(because of message(FATAL_ERROR ...)). 
Building the instrumented version of Clang can be useful even if 
one doesn't plan to build the target generate-profdata
(currently that target would only compile 
utils/perf-training/cxx/hello_world.cpp).
For example, one can run the instrumented version of Clang 
via a separate build system against a different codebase, 
collect/analyze the profiles and merge them by llvm-profdata later.

Differential revision: https://reviews.llvm.org/D38859

Modified:
cfe/trunk/utils/perf-training/CMakeLists.txt

Modified: cfe/trunk/utils/perf-training/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/CMakeLists.txt?rev=315665=315664=315665=diff
==
--- cfe/trunk/utils/perf-training/CMakeLists.txt (original)
+++ cfe/trunk/utils/perf-training/CMakeLists.txt Thu Oct 12 20:21:39 2017
@@ -30,13 +30,13 @@ if(LLVM_BUILD_INSTRUMENTED)
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to 
use for merging PGO data")
+message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to 
llvm-profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)


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


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315665: [clang] Enable clang build with 
LLVM_BUILD_INSTRUMENTED without setting… (authored by alexshap).

Changed prior to commit:
  https://reviews.llvm.org/D38859?vs=118869=118881#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38859

Files:
  cfe/trunk/utils/perf-training/CMakeLists.txt


Index: cfe/trunk/utils/perf-training/CMakeLists.txt
===
--- cfe/trunk/utils/perf-training/CMakeLists.txt
+++ cfe/trunk/utils/perf-training/CMakeLists.txt
@@ -30,13 +30,13 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to 
use for merging PGO data")
+message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to 
llvm-profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)


Index: cfe/trunk/utils/perf-training/CMakeLists.txt
===
--- cfe/trunk/utils/perf-training/CMakeLists.txt
+++ cfe/trunk/utils/perf-training/CMakeLists.txt
@@ -30,13 +30,13 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to use for merging PGO data")
+message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to llvm-profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38773: [Sema] Add support for flexible array members in Obj-C.

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:15055
   }
+  // If it is the last field is checked elsewhere.
 }

vsapsai wrote:
> rjmccall wrote:
> > "Whether" rather than "If", please.  You should also leave a comment about 
> > *why* we can't check this here — I assume because you also want to complain 
> > about the last explicit ivar if there are synthesized ivars?  I think we 
> > could at least still check this for `@interface` ivars.
> Will change s/If/Whether/
> 
> Main reason for checking elsewhere is to check after ivars are synthesized, 
> you are right. At some point I had this check done here but for detecting 
> ivar-after-flexible-array on interface/extension, interface/implementation 
> border I am relying on chained ObjCIvarDecl. But here I have `ArrayRef *> Fields` so implementation will be different. I decided that it would be 
> cleaner to perform the check only in DiagnoseVariableSizedIvars.
Is there a reason to do any of the checking here, then?


https://reviews.llvm.org/D38773



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


r315662 - Support for destroying operator delete, per C++2a proposal P0722.

2017-10-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Oct 12 18:55:36 2017
New Revision: 315662

URL: http://llvm.org/viewvc/llvm-project?rev=315662=rev
Log:
Support for destroying operator delete, per C++2a proposal P0722.

This feature is not (yet) approved by the C++ committee, so this is liable to
be reverted or significantly modified based on committee feedback.

No functionality change intended for existing code (a new type must be defined
in namespace std to take advantage of this feature).

Added:
cfe/trunk/test/CodeGenCXX/cxx2a-destroying-delete.cpp
cfe/trunk/test/SemaCXX/cxx2a-destroying-delete.cpp
Modified:
cfe/trunk/include/clang/AST/ASTMutationListener.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/include/clang/AST/ASTMutationListener.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTMutationListener.h?rev=315662=315661=315662=diff
==
--- cfe/trunk/include/clang/AST/ASTMutationListener.h (original)
+++ cfe/trunk/include/clang/AST/ASTMutationListener.h Thu Oct 12 18:55:36 2017
@@ -22,6 +22,7 @@ namespace clang {
   class CXXRecordDecl;
   class Decl;
   class DeclContext;
+  class Expr;
   class FieldDecl;
   class FunctionDecl;
   class FunctionTemplateDecl;
@@ -80,7 +81,8 @@ public:
 
   /// \brief A virtual destructor's operator delete has been resolved.
   virtual void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
-  const FunctionDecl *Delete) {}
+  const FunctionDecl *Delete,
+  Expr *ThisArg) {}
 
   /// \brief An implicit member got a definition.
   virtual void CompletedImplicitDefinition(const FunctionDecl *D) {}

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=315662=315661=315662=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Oct 12 18:55:36 2017
@@ -2036,6 +2036,9 @@ public:
   /// true through IsAligned.
   bool isReplaceableGlobalAllocationFunction(bool *IsAligned = nullptr) const;
 
+  /// \brief Determine whether this is a destroying operator delete.
+  bool isDestroyingOperatorDelete() const;
+
   /// Compute the language linkage.
   LanguageLinkage getLanguageLinkage() const;
 

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=315662=315661=315662=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Oct 12 18:55:36 2017
@@ -2566,7 +2566,10 @@ public:
 class CXXDestructorDecl : public CXXMethodDecl {
   void anchor() override;
 
+  // FIXME: Don't allocate storage for these except in the first declaration
+  // of a virtual destructor.
   FunctionDecl *OperatorDelete;
+  Expr *OperatorDeleteThisArg;
 
   CXXDestructorDecl(ASTContext , CXXRecordDecl *RD, SourceLocation StartLoc,
 const DeclarationNameInfo ,
@@ -2574,7 +2577,7 @@ class CXXDestructorDecl : public CXXMeth
 bool isInline, bool isImplicitlyDeclared)
 : CXXMethodDecl(CXXDestructor, C, RD, StartLoc, NameInfo, T, TInfo,
 SC_None, isInline, /*isConstexpr=*/false, 
SourceLocation()),
-  OperatorDelete(nullptr) {
+  OperatorDelete(nullptr), OperatorDeleteThisArg(nullptr) {
 setImplicit(isImplicitlyDeclared);
   }
 
@@ -2587,10 +2590,13 @@ public:
bool isImplicitlyDeclared);
   static CXXDestructorDecl *CreateDeserialized(ASTContext & C, unsigned ID);
 
-  void setOperatorDelete(FunctionDecl *OD);
+  void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg);
   const FunctionDecl *getOperatorDelete() const {
 return getCanonicalDecl()->OperatorDelete;
   }
+  Expr *getOperatorDeleteThisArg() const {
+return getCanonicalDecl()->OperatorDeleteThisArg;
+  }
 
   CXXDestructorDecl *getCanonicalDecl() override {
 return cast(FunctionDecl::getCanonicalDecl());

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

r315661 - Recommit r315087 "[refactor] add support for refactoring options"

2017-10-12 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Thu Oct 12 18:53:13 2017
New Revision: 315661

URL: http://llvm.org/viewvc/llvm-project?rev=315661=rev
Log:
Recommit r315087 "[refactor] add support for refactoring options"

The recommit fixes a UB bug that occurred only on a small number of bots.

Original message:

This commit adds initial support for refactoring options. One can now use
optional and required std::string options.

This commit also adds a NewNameOption for the local-rename refactoring action to
allow rename to work with custom names.

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

Added:
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringOption.h
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringOptionVisitor.h
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringOptions.h
Modified:
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRule.h

cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
cfe/trunk/include/clang/Tooling/Refactoring/Rename/RenamingAction.h
cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp
cfe/trunk/test/Refactor/LocalRename/Field.cpp
cfe/trunk/test/Refactor/tool-test-support.c
cfe/trunk/tools/clang-refactor/ClangRefactor.cpp

Modified: cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRule.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRule.h?rev=315661=315660=315661=diff
==
--- cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRule.h 
(original)
+++ cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRule.h Thu Oct 
12 18:53:13 2017
@@ -16,6 +16,7 @@
 namespace clang {
 namespace tooling {
 
+class RefactoringOptionVisitor;
 class RefactoringResultConsumer;
 class RefactoringRuleContext;
 
@@ -43,6 +44,14 @@ public:
   /// Returns true when the rule has a source selection requirement that has
   /// to be fullfilled before refactoring can be performed.
   virtual bool hasSelectionRequirement() = 0;
+
+  /// Traverses each refactoring option used by the rule and invokes the
+  /// \c visit callback in the consumer for each option.
+  ///
+  /// Options are visited in the order of use, e.g. if a rule has two
+  /// requirements that use options, the options from the first requirement
+  /// are visited before the options in the second requirement.
+  virtual void visitRefactoringOptions(RefactoringOptionVisitor ) = 0;
 };
 
 } // end namespace tooling

Modified: 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h?rev=315661=315660=315661=diff
==
--- 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h 
(original)
+++ 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h 
Thu Oct 12 18:53:13 2017
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_ACTION_RULE_REQUIREMENTS_H
 
 #include "clang/Basic/LLVM.h"
+#include "clang/Tooling/Refactoring/RefactoringOption.h"
 #include "clang/Tooling/Refactoring/RefactoringRuleContext.h"
 #include "llvm/Support/Error.h"
 #include 
@@ -53,6 +54,45 @@ public:
   }
 };
 
+/// A base class for any requirement that requires some refactoring options.
+class RefactoringOptionsRequirement : public RefactoringActionRuleRequirement {
+public:
+  virtual ~RefactoringOptionsRequirement() {}
+
+  /// Returns the set of refactoring options that are used when evaluating this
+  /// requirement.
+  virtual ArrayRef
+  getRefactoringOptions() const = 0;
+};
+
+/// A requirement that evaluates to the value of the given \c OptionType when
+/// the \c OptionType is a required option. When the \c OptionType is an
+/// optional option, the requirement will evaluate to \c None if the option is
+/// not specified or to an appropriate value otherwise.
+template 
+class OptionRequirement : public RefactoringOptionsRequirement {
+public:
+  OptionRequirement() : Opt(createRefactoringOption()) {}
+
+  ArrayRef
+  getRefactoringOptions() const final override {
+return Opt;
+  }
+
+  Expected
+  evaluate(RefactoringRuleContext &) const {
+return static_cast(Opt.get())->getValue();
+  }
+
+private:
+  /// The partially-owned option.
+  ///
+  /// The ownership of the option is shared among the different requirements
+  /// because the same option can be used by multiple rules in one refactoring
+  /// action.
+  std::shared_ptr Opt;
+};
+
 } // end namespace tooling
 } // end namespace clang
 

Modified: 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
URL: 

[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:2263
+  }
+}
+

joerg wrote:
> vsk wrote:
> > rjmccall wrote:
> > > Is there a reason this only fails on x86?  If LLVM doesn't have generic 
> > > wide-operation lowering, this probably needs to be a target whitelist 
> > > rather than a blacklist.
> > That makes sense. For the 128-bit operation, the whitelist is {x86-64, 
> > wasm64, mips64}. We don't support this operation for bit widths larger than 
> > 128 bits on any target. I'll update the patch accordingly.
> That sounds wrong. __int128_t should be supported by all 64bit architectures, 
> not just those three.
I didn't mean to imply generic int128_t operations aren't supported. This patch 
just focuses on muloti4 (signed multiplication with overflow checking).


https://reviews.llvm.org/D38861



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


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:2263
+  }
+}
+

vsk wrote:
> rjmccall wrote:
> > Is there a reason this only fails on x86?  If LLVM doesn't have generic 
> > wide-operation lowering, this probably needs to be a target whitelist 
> > rather than a blacklist.
> That makes sense. For the 128-bit operation, the whitelist is {x86-64, 
> wasm64, mips64}. We don't support this operation for bit widths larger than 
> 128 bits on any target. I'll update the patch accordingly.
That sounds wrong. __int128_t should be supported by all 64bit architectures, 
not just those three.


https://reviews.llvm.org/D38861



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


[PATCH] D38816: Convert clang::LangAS to a strongly typed enum

2017-10-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: tools/libclang/CXType.cpp:402
+  ASTContext  = cxtu::getASTUnit(GetTU(CT))->getASTContext();
+  return Ctx.getTargetAddressSpace(T);
 }

arichardson wrote:
> yaxunl wrote:
> > Is this function suppose to return AST address space or target address 
> > space?
> > 
> > Some targets e.g. x86 maps all AST address spaces to 0. Returning target 
> > address space will not let the client unable to differentiate different 
> > address spaces in the source language.
> I am not entirely sure what the correct return value is here because the 
> current implementation returns either the LanguageAS or `LangAS - 
> LangAS::FirstTargetAddressSpace` which can also overlap. So possibly it 
> should just always returning the AST address space?
> 
> I think for now I will just keep the current behaviour with a FIXME and 
> create a followup patch.
> 
That's fine. Thanks.


https://reviews.llvm.org/D38816



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


[PATCH] D38773: [Sema] Add support for flexible array members in Obj-C.

2017-10-12 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5226
+def err_objc_variable_sized_type_not_at_end : Error<
+  "field %0 with variable sized type %1 is not at the end of class">;
+def note_next_field_declaration : Note<

rjmccall wrote:
> "Variable sized type" is a bit too close to the C99 variably-sized array type 
> extension.  Maybe "unbounded array type" if you're trying to cover both "int 
> x[];" and "int x[0];"?
> 
> Well, I guess there's some precedent for using this terminology, but ugh.
I took "variable sized type" entirely from

```
def ext_variable_sized_type_in_struct : ExtWarn<
  "field %0 with variable sized type %1 not at the end of a struct or class is"
  " a GNU extension">, InGroup;
```

I'm not covering `int x[0];`. All the changes are for `int x[];` and `struct { 
int x[]; }`



Comment at: clang/lib/Sema/SemaDecl.cpp:15055
   }
+  // If it is the last field is checked elsewhere.
 }

rjmccall wrote:
> "Whether" rather than "If", please.  You should also leave a comment about 
> *why* we can't check this here — I assume because you also want to complain 
> about the last explicit ivar if there are synthesized ivars?  I think we 
> could at least still check this for `@interface` ivars.
Will change s/If/Whether/

Main reason for checking elsewhere is to check after ivars are synthesized, you 
are right. At some point I had this check done here but for detecting 
ivar-after-flexible-array on interface/extension, interface/implementation 
border I am relying on chained ObjCIvarDecl. But here I have `ArrayRef 
Fields` so implementation will be different. I decided that it would be cleaner 
to perform the check only in DiagnoseVariableSizedIvars.


https://reviews.llvm.org/D38773



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


Re: r298369 - [OpenCL] Added diagnostic for checking length of vector

2017-10-12 Thread Bruno Cardoso Lopes via cfe-commits
On Thu, Oct 12, 2017 at 8:39 AM, Anastasia Stulova
 wrote:
>
> I think this bit is a bit confusing to us. Some of our original OpenCL
> checks were removed in some places because in some cases OpenCL semantic was
> adopted elsewhere.

It's confusing indeed. We should probably enhance the docs for
scenarios like this.

> But I think this should indeed go under OpenCL check.

https://reviews.llvm.org/D38868

Thanks,

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D38859



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


[PATCH] D38868: [OpenCL] Restrict swizzle length check to OpenCL mode

2017-10-12 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno created this revision.
Herald added a subscriber: yaxunl.

Change behavior introduced in r298369 and only error out on vector component 
invalid length access on OpenCL mode.


https://reviews.llvm.org/D38868

Files:
  lib/Sema/SemaExprMember.cpp
  test/SemaOpenCL/vector_swizzle_length.cl


Index: test/SemaOpenCL/vector_swizzle_length.cl
===
--- test/SemaOpenCL/vector_swizzle_length.cl
+++ test/SemaOpenCL/vector_swizzle_length.cl
@@ -1,10 +1,17 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 -x cl %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 -x c %s -verify -pedantic -fsyntax-only
 
 typedef float float8 __attribute__((ext_vector_type(8)));
 
 void foo() {
-float8 f2 = (float8)(0, 0, 0, 0, 0, 0, 0, 0);
+float8 f2 = (float8){0, 0, 0, 0, 0, 0, 0, 0};
 
+#if defined(__OPENCL_C_VERSION__)
 f2.s01234; // expected-error {{vector component access has invalid length 
5.  Supported: 1,2,3,4,8,16}}
 f2.xyzxy; // expected-error {{vector component access has invalid length 
5.  Supported: 1,2,3,4,8,16}}
+#else
+// expected-no-diagnostics
+(void)f2.s01234;
+(void)f2.xyzxy;
+#endif
 }
Index: lib/Sema/SemaExprMember.cpp
===
--- lib/Sema/SemaExprMember.cpp
+++ lib/Sema/SemaExprMember.cpp
@@ -384,7 +384,9 @@
 }
   }
 
-  if (!HalvingSwizzle) {
+  // OpenCL mode requires swizzle length to be in accordance with accepted
+  // sizes. Clang however supports arbitrary lengths for other languages.
+  if (S.getLangOpts().OpenCL && !HalvingSwizzle) {
 unsigned SwizzleLength = CompName->getLength();
 
 if (HexSwizzle)


Index: test/SemaOpenCL/vector_swizzle_length.cl
===
--- test/SemaOpenCL/vector_swizzle_length.cl
+++ test/SemaOpenCL/vector_swizzle_length.cl
@@ -1,10 +1,17 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 -x cl %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 -x c %s -verify -pedantic -fsyntax-only
 
 typedef float float8 __attribute__((ext_vector_type(8)));
 
 void foo() {
-float8 f2 = (float8)(0, 0, 0, 0, 0, 0, 0, 0);
+float8 f2 = (float8){0, 0, 0, 0, 0, 0, 0, 0};
 
+#if defined(__OPENCL_C_VERSION__)
 f2.s01234; // expected-error {{vector component access has invalid length 5.  Supported: 1,2,3,4,8,16}}
 f2.xyzxy; // expected-error {{vector component access has invalid length 5.  Supported: 1,2,3,4,8,16}}
+#else
+// expected-no-diagnostics
+(void)f2.s01234;
+(void)f2.xyzxy;
+#endif
 }
Index: lib/Sema/SemaExprMember.cpp
===
--- lib/Sema/SemaExprMember.cpp
+++ lib/Sema/SemaExprMember.cpp
@@ -384,7 +384,9 @@
 }
   }
 
-  if (!HalvingSwizzle) {
+  // OpenCL mode requires swizzle length to be in accordance with accepted
+  // sizes. Clang however supports arbitrary lengths for other languages.
+  if (S.getLangOpts().OpenCL && !HalvingSwizzle) {
 unsigned SwizzleLength = CompName->getLength();
 
 if (HexSwizzle)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r315656 - [MS] Don't bail on replacing dllimport vbase dtors with base dtors

2017-10-12 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Oct 12 17:53:02 2017
New Revision: 315656

URL: http://llvm.org/viewvc/llvm-project?rev=315656=rev
Log:
[MS] Don't bail on replacing dllimport vbase dtors with base dtors

Fix PR32990 by effectively reverting r283063 and solving it a different
way.

We want to limit the hack to not replace equivalent available_externally
dtors specifically to libc++, which uses always_inline. It seems certain
versions of libc++ do not provide all the symbols that an explicit
template instantiation is expected to provide.

If we get to the code that forms a real alias, only *then* check if this
is available_externally, and do that by asking a better question, which
is "is this a declaration for the linker?", because *that's* what means
we can't form an alias to it.

As a follow-on simplification, remove the InEveryTU parameter. Its last
use guarded this code for forming aliases, but we should never form
aliases to declarations, regardless of what we know about every TU.

Added:
cfe/trunk/test/CodeGenCXX/dllimport-dtor-thunks.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=315656=315655=315656=diff
==
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Oct 12 17:53:02 2017
@@ -110,16 +110,14 @@ bool CodeGenModule::TryEmitBaseDestructo
 return true;
 
   return TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Base),
-  GlobalDecl(BaseD, Dtor_Base),
-  false);
+  GlobalDecl(BaseD, Dtor_Base));
 }
 
 /// Try to emit a definition as a global alias for another definition.
 /// If \p InEveryTU is true, we know that an equivalent alias can be produced
 /// in every translation unit.
 bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
- GlobalDecl TargetDecl,
- bool InEveryTU) {
+ GlobalDecl TargetDecl) {
   if (!getCodeGenOpts().CXXCtorDtorAliases)
 return true;
 
@@ -134,11 +132,6 @@ bool CodeGenModule::TryEmitDefinitionAsA
   llvm::GlobalValue::LinkageTypes TargetLinkage =
   getFunctionLinkage(TargetDecl);
 
-  // available_externally definitions aren't real definitions, so we cannot
-  // create an alias to one.
-  if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage)
-return true;
-
   // Check if we have it already.
   StringRef MangledName = getMangledName(AliasDecl);
   llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
@@ -161,7 +154,14 @@ bool CodeGenModule::TryEmitDefinitionAsA
 
   // Instead of creating as alias to a linkonce_odr, replace all of the uses
   // of the aliasee.
-  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) {
+  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
+  !(TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage &&
+TargetDecl.getDecl()->hasAttr())) {
+// FIXME: An extern template instantiation will create functions with
+// linkage "AvailableExternally". In libc++, some classes also define
+// members with attribute "AlwaysInline" and expect no reference to
+// be generated. It is desirable to reenable this optimisation after
+// corresponding LLVM changes.
 addReplacement(MangledName, Aliasee);
 return false;
   }
@@ -176,13 +176,11 @@ bool CodeGenModule::TryEmitDefinitionAsA
 return true;
   }
 
-  if (!InEveryTU) {
-// If we don't have a definition for the destructor yet, don't
-// emit.  We can't emit aliases to declarations; that's just not
-// how aliases work.
-if (Ref->isDeclaration())
-  return true;
-  }
+  // If we don't have a definition for the destructor yet or the definition is
+  // avaialable_externally, don't emit an alias.  We can't emit aliases to
+  // declarations; that's just not how aliases work.
+  if (Ref->isDeclarationForLinker())
+return true;
 
   // Don't create an alias to a linker weak symbol. This avoids producing
   // different COMDATs in different TUs. Another option would be to

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=315656=315655=315656=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Thu Oct 12 17:53:02 2017
@@ -1145,8 +1145,7 @@ public:
   /// are emitted lazily.
   void EmitGlobal(GlobalDecl D);
 
-  bool TryEmitDefinitionAsAlias(GlobalDecl Alias, GlobalDecl Target,
-bool InEveryTU);
+  bool 

r315655 - [Analyzer] Assume that CFBooleanRef const globals are non-null

2017-10-12 Thread George Karpenkov via cfe-commits
Author: george.karpenkov
Date: Thu Oct 12 17:51:41 2017
New Revision: 315655

URL: http://llvm.org/viewvc/llvm-project?rev=315655=rev
Log:
[Analyzer] Assume that CFBooleanRef const globals are non-null

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

Added:
cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp
  - copied, changed from r315652, 
cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullStringConstantsChecker.cpp
cfe/trunk/test/Analysis/nonnull-global-constants.mm
  - copied, changed from r315652, 
cfe/trunk/test/Analysis/nonnull-string-constants.mm
Removed:
cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullStringConstantsChecker.cpp
cfe/trunk/test/Analysis/nonnull-string-constants.mm
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=315655=315654=315655=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Thu Oct 12 
17:51:41 2017
@@ -132,7 +132,7 @@ def DynamicTypePropagation : Checker<"Dy
   HelpText<"Generate dynamic type information">,
   DescFile<"DynamicTypePropagation.cpp">;
 
-def NonnullStringConstantsChecker: Checker<"NonnilStringConstants">,
+def NonnullGlobalConstantsChecker: Checker<"NonnilStringConstants">,
   HelpText<"Assume that const string-like globals are non-null">,
   DescFile<"NonilStringConstantsChecker.cpp">;
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=315655=315654=315655=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Thu Oct 12 17:51:41 
2017
@@ -57,7 +57,7 @@ add_clang_library(clangStaticAnalyzerChe
   NSErrorChecker.cpp
   NoReturnFunctionChecker.cpp
   NonNullParamChecker.cpp
-  NonnullStringConstantsChecker.cpp
+  NonnullGlobalConstantsChecker.cpp
   NullabilityChecker.cpp
   NumberObjectConversionChecker.cpp
   ObjCAtSyncChecker.cpp

Copied: cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp 
(from r315652, 
cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullStringConstantsChecker.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp?p2=cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp=cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullStringConstantsChecker.cpp=315652=315655=315655=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullStringConstantsChecker.cpp 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NonnullGlobalConstantsChecker.cpp Thu 
Oct 12 17:51:41 2017
@@ -1,4 +1,4 @@
-//==- NonnullStringConstantsChecker.cpp ---*- C++ 
-*--//
+//==- NonnullGlobalConstantsChecker.cpp ---*- C++ 
-*--//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -7,15 +7,17 @@
 //
 
//===--===//
 //
-//  This checker adds an assumption that constant string-like globals are
+//  This checker adds an assumption that constant globals of certain types* are
 //  non-null, as otherwise they generally do not convey any useful information.
-//  The assumption is useful, as many framework use such global const strings,
+//  The assumption is useful, as many framework use e. g. global const strings,
 //  and the analyzer might not be able to infer the global value if the
 //  definition is in a separate translation unit.
-//  The following types (and their typedef aliases) are considered string-like:
+//  The following types (and their typedef aliases) are considered to be
+//  non-null:
 //   - `char* const`
 //   - `const CFStringRef` from CoreFoundation
 //   - `NSString* const` from Foundation
+//   - `CFBooleanRef` from Foundation
 //
 
//===--===//
 
@@ -31,12 +33,13 @@ using namespace ento;
 
 namespace {
 
-class NonnullStringConstantsChecker : public Checker {
+class NonnullGlobalConstantsChecker : public Checker {
   mutable IdentifierInfo *NSStringII = nullptr;
   mutable IdentifierInfo *CFStringRefII = nullptr;
+  mutable IdentifierInfo *CFBooleanRefII = nullptr;
 
 public:
-  NonnullStringConstantsChecker() {}
+  NonnullGlobalConstantsChecker() {}
 
   void checkLocation(SVal l, bool isLoad, const Stmt *S,
  CheckerContext ) const;
@@ -46,22 

[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap updated this revision to Diff 118869.
alexshap added a comment.

Update the wording


Repository:
  rL LLVM

https://reviews.llvm.org/D38859

Files:
  utils/perf-training/CMakeLists.txt


Index: utils/perf-training/CMakeLists.txt
===
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -30,13 +30,13 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to 
use for merging PGO data")
+message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to 
llvm-profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)


Index: utils/perf-training/CMakeLists.txt
===
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -30,13 +30,13 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to use for merging PGO data")
+message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to llvm-profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap updated this revision to Diff 118868.

Repository:
  rL LLVM

https://reviews.llvm.org/D38859

Files:
  utils/perf-training/CMakeLists.txt


Index: utils/perf-training/CMakeLists.txt
===
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -30,13 +30,13 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to 
use for merging PGO data")
+message(STATUS "LLVM_PROFDATA needs to point to llvm-profdata to enable 
merging profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)


Index: utils/perf-training/CMakeLists.txt
===
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -30,13 +30,13 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to use for merging PGO data")
+message(STATUS "LLVM_PROFDATA needs to point to llvm-profdata to enable merging profdata")
+  else()
+add_custom_target(generate-profdata
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
+  COMMENT "Merging profdata"
+  DEPENDS generate-profraw)
   endif()
-
-  add_custom_target(generate-profdata
-COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
-COMMENT "Merging profdata"
-DEPENDS generate-profraw)
 endif()
 
 find_program(DTRACE dtrace)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r315652 - Typos in tutorial

2017-10-12 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Thu Oct 12 17:31:07 2017
New Revision: 315652

URL: http://llvm.org/viewvc/llvm-project?rev=315652=rev
Log:
Typos in tutorial

Modified:
cfe/trunk/www/hacking.html

Modified: cfe/trunk/www/hacking.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/hacking.html?rev=315652=315651=315652=diff
==
--- cfe/trunk/www/hacking.html (original)
+++ cfe/trunk/www/hacking.html Thu Oct 12 17:31:07 2017
@@ -246,9 +246,9 @@
   For example:
 
   
-  python C:\Tool\llvm\utils\lit\lit.py -sv
+  python C:\Tools\llvm\utils\lit\lit.py -sv
   --param=build_mode=Win32 --param=build_config=Debug
-  --param=clang_site_config=c:\Tools\build\tools\clang\test\lit.site.cfg
+  --param=clang_site_config=C:\Tools\build\tools\clang\test\lit.site.cfg
   C:\Tools\llvm\tools\clang\test\Sema\wchar.c
 
 


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


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

In https://reviews.llvm.org/D38859#896517, @alexshap wrote:

> yeah, i agree, this is not a good idea. My thoughts were different - right 
> now it's not particularly convenient that one has to specify LLVM_PROFDATA 
> when it's not actually used by the build.
>  Maybe we can create the target "generate-profdata" only if LLVM_PROFDATA is 
> set (but don't fail otherwise) ?


+ 1, sgtm


Repository:
  rL LLVM

https://reviews.llvm.org/D38859



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


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added a comment.

yeah, i agree, this is not a good idea. My thoughts were different - right now 
it's not particularly convenient that one has to specify LLVM_PROFDATA when 
it's not actually used by the build.
Maybe we can create the target "generate-profdata" only if LLVM_PROFDATA is set 
(but don't fail otherwise) ?


Repository:
  rL LLVM

https://reviews.llvm.org/D38859



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


[PATCH] D38863: Typos in tutorial

2017-10-12 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.

You generally don't need a pre-commit review for such a change.


https://reviews.llvm.org/D38863



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


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

llvm-profdata is tightly coupled with the host compiler: while this setup may 
work if you get lucky, I don't think it's resilient to changes in libProfData. 
Also, using the instrumented llvm-profdata will be slow and create extra 
profiles.

As an alternative, have you considered building an llvm-profdata compatible 
with your host compiler in a separate step?


Repository:
  rL LLVM

https://reviews.llvm.org/D38859



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


r315643 - Handle/assert on DK_Remark

2017-10-12 Thread Adam Nemet via cfe-commits
Author: anemet
Date: Thu Oct 12 16:56:54 2017
New Revision: 315643

URL: http://llvm.org/viewvc/llvm-project?rev=315643=rev
Log:
Handle/assert on DK_Remark

We don't generate remarks during inline assembly parsing so no need to handle
these for now.

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

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=315643=315642=315643=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Thu Oct 12 16:56:54 2017
@@ -433,6 +433,8 @@ void BackendConsumer::InlineAsmDiagHandl
   case llvm::SourceMgr::DK_Note:
 DiagID = diag::note_fe_inline_asm;
 break;
+  case llvm::SourceMgr::DK_Remark:
+llvm_unreachable("remarks unexpected");
   }
   // If this problem has clang-level source location information, report the
   // issue in the source with a note showing the instantiated
@@ -919,6 +921,8 @@ static void BitcodeInlineAsmDiagHandler(
   case llvm::SourceMgr::DK_Note:
 DiagID = diag::note_fe_inline_asm;
 break;
+  case llvm::SourceMgr::DK_Remark:
+llvm_unreachable("remarks unexpected");
   }
 
   Diags->Report(DiagID).AddString("cannot compile inline asm");


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


Re: [PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Richard Smith via cfe-commits
On 12 October 2017 at 15:41, Roman Lebedev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Fri, Oct 13, 2017 at 1:22 AM, Richard Smith 
> wrote:
> > On 12 October 2017 at 15:11, Roman Lebedev via Phabricator via
> cfe-commits
> >  wrote:
> >>
> >> lebedev.ri reopened this revision.
> >> lebedev.ri added a comment.
> >> This revision is now accepted and ready to land.
> >>
> >> Reverted due to http://bb9.pgr.jp/#/builders/20/builds/59 that i don't
> >> currently know how to deal with.
> >> It is really sad that i failed to encounter it during testing.
> >
> >
> > I see three issues there:
>
> > 1) A warning in this code due to missing parentheses around a ^ operator.
>
> > 2) This code generating correct warnings in the libc++ test suite.
> Yes, this one is the problem.
>
> I'm honestly not sure about these comparisons with
> std::numeric_limits<...>::{min,max}()
> They is similar to what Nico Weber (CC'd, just in case) is raising in
> post-review mail in
> https://lists.llvm.org/pipermail/cfe-commits/Week-of-
> Mon-20171009/206427.html
> I personally would very much prefer to have the warning, as explained
> in the follow-up mail.


Our general philosophy on such things is: if there's some pattern of false
positives (ie, cases where the code is reasonable and intentionally
performing a tautological comparison) that we can reasonably identify, then
disabling the warning for those cases would be a good idea. If the rate of
false positives is not very low and we can't identify the problematic
patterns, then we should turn the warning off by default.

But even if the warning ends up off by default, we should still have it
available.

> You could ask EricWF (cc'd) to look at those and either fix them or turn
> the warning
> > flag off for libc++'s tests.
> Eric: could you *please* look into that? :)
> That is way too deep to change without prior knowledge about the code i
> think.
>
> > 3) A stage2 / stage3 comparison failure in CGAtomic.cpp. That's
> pre-existing
> > and nothing to do with your change.
>
> Roman.
> ___
> 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


r315639 - [Sema][ObjC] Complete merging ObjC methods before checking their

2017-10-12 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Thu Oct 12 16:24:38 2017
New Revision: 315639

URL: http://llvm.org/viewvc/llvm-project?rev=315639=rev
Log:
[Sema][ObjC] Complete merging ObjC methods before checking their
overriding methods.

This should fix test case Analysis/retain-release.m that was failing on
the reverse iteration bot:

http://lab.llvm.org:8011/builders/reverse-iteration

The test used to fail because the loop in CheckObjCMethodOverrides would
merge attribute ns_returns_retained on methods while checking whether
the overriding methods were compatible. Since OverrideSearch::Overridden
is a SmallPtrSet and the order in which the elements of the set are
visited is non-deterministic, the test would fail when method 'clone' of
the protocol 'F18P' was visited before F18(Cat)'s method 'clone' was
visited.

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=315639=315638=315639=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Oct 12 16:24:38 2017
@@ -3580,8 +3580,6 @@ void Sema::mergeObjCMethodDecls(ObjCMeth
  ni = newMethod->param_begin(), ne = newMethod->param_end();
ni != ne && oi != oe; ++ni, ++oi)
 mergeParamDeclAttributes(*ni, *oi, *this);
-
-  CheckObjCMethodOverride(newMethod, oldMethod);
 }
 
 static void diagnoseVarDeclTypeMismatch(Sema , VarDecl *New, VarDecl* Old) {

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=315639=315638=315639=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu Oct 12 16:24:38 2017
@@ -4223,6 +4223,10 @@ void Sema::CheckObjCMethodOverrides(ObjC
 
 // Then merge the declarations.
 mergeObjCMethodDecls(ObjCMethod, overridden);
+  }
+
+  for (ObjCMethodDecl *overridden : overrides) {
+CheckObjCMethodOverride(ObjCMethod, overridden);
 
 if (ObjCMethod->isImplicit() && overridden->isImplicit())
   continue; // Conflicting properties are detected elsewhere.


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


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

In https://reviews.llvm.org/D38861#896435, @rjmccall wrote:

> Okay.  Sounds good to me.
>
> We intend to actually implement the generic lowering, I hope?


Yes, I'll make a note of that in PR34920, and am tracking the bug internally in 
rdar://problem/34963321.


https://reviews.llvm.org/D38861



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


[PATCH] D38700: [Sema][Crash] Correctly handle an non-dependent noexcept expr in function template

2017-10-12 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315638: [Sema][Crash] Correctly handle an non-dependent 
noexcept expr in function… (authored by erichkeane).

Changed prior to commit:
  https://reviews.llvm.org/D38700?vs=118245=118858#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38700

Files:
  cfe/trunk/lib/Sema/SemaDeclCXX.cpp
  cfe/trunk/test/CXX/except/except.spec/p1.cpp


Index: cfe/trunk/test/CXX/except/except.spec/p1.cpp
===
--- cfe/trunk/test/CXX/except/except.spec/p1.cpp
+++ cfe/trunk/test/CXX/except/except.spec/p1.cpp
@@ -86,3 +86,12 @@
 f<0>(); // expected-note{{in instantiation of function template 
specialization}}
   }
 }
+
+namespace FuncTmplNoexceptError {
+  int a = 0;
+  // expected-error@+1{{argument to noexcept specifier must be a constant 
expression}}
+  template  T f() noexcept(a++){ return {};}
+  void g(){
+f();
+  }
+};
Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -14865,10 +14865,16 @@
 return;
   }
 
-  if (!NoexceptExpr->isValueDependent())
-NoexceptExpr = VerifyIntegerConstantExpression(NoexceptExpr, nullptr,
- diag::err_noexcept_needs_constant_expression,
- /*AllowFold*/ false).get();
+  if (!NoexceptExpr->isValueDependent()) {
+ExprResult Result = VerifyIntegerConstantExpression(
+NoexceptExpr, nullptr, 
diag::err_noexcept_needs_constant_expression,
+/*AllowFold*/ false);
+if (Result.isInvalid()) {
+  ESI.Type = EST_BasicNoexcept;
+  return;
+}
+NoexceptExpr = Result.get();
+  }
   ESI.NoexceptExpr = NoexceptExpr;
 }
 return;


Index: cfe/trunk/test/CXX/except/except.spec/p1.cpp
===
--- cfe/trunk/test/CXX/except/except.spec/p1.cpp
+++ cfe/trunk/test/CXX/except/except.spec/p1.cpp
@@ -86,3 +86,12 @@
 f<0>(); // expected-note{{in instantiation of function template specialization}}
   }
 }
+
+namespace FuncTmplNoexceptError {
+  int a = 0;
+  // expected-error@+1{{argument to noexcept specifier must be a constant expression}}
+  template  T f() noexcept(a++){ return {};}
+  void g(){
+f();
+  }
+};
Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -14865,10 +14865,16 @@
 return;
   }
 
-  if (!NoexceptExpr->isValueDependent())
-NoexceptExpr = VerifyIntegerConstantExpression(NoexceptExpr, nullptr,
- diag::err_noexcept_needs_constant_expression,
- /*AllowFold*/ false).get();
+  if (!NoexceptExpr->isValueDependent()) {
+ExprResult Result = VerifyIntegerConstantExpression(
+NoexceptExpr, nullptr, diag::err_noexcept_needs_constant_expression,
+/*AllowFold*/ false);
+if (Result.isInvalid()) {
+  ESI.Type = EST_BasicNoexcept;
+  return;
+}
+NoexceptExpr = Result.get();
+  }
   ESI.NoexceptExpr = NoexceptExpr;
 }
 return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Okay.  Sounds good to me.

We intend to actually implement the generic lowering, I hope?


https://reviews.llvm.org/D38861



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


r315638 - [Sema][Crash] Correctly handle an non-dependent noexcept expr in function template

2017-10-12 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Thu Oct 12 16:01:53 2017
New Revision: 315638

URL: http://llvm.org/viewvc/llvm-project?rev=315638=rev
Log:
[Sema][Crash] Correctly handle an non-dependent noexcept expr in function 
template

It seems that all of the other templated cases are handled correctly,
however the function template case was not correctly handled. This
patch recovers from this condition by setting the function to noexcept
after diagnosing. Previously it simply set NoexceptExpr to null,
which caused an Assert when this was evaluated during substitution.

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


Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CXX/except/except.spec/p1.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=315638=315637=315638=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Oct 12 16:01:53 2017
@@ -14865,10 +14865,16 @@ void Sema::checkExceptionSpecification(
 return;
   }
 
-  if (!NoexceptExpr->isValueDependent())
-NoexceptExpr = VerifyIntegerConstantExpression(NoexceptExpr, nullptr,
- diag::err_noexcept_needs_constant_expression,
- /*AllowFold*/ false).get();
+  if (!NoexceptExpr->isValueDependent()) {
+ExprResult Result = VerifyIntegerConstantExpression(
+NoexceptExpr, nullptr, 
diag::err_noexcept_needs_constant_expression,
+/*AllowFold*/ false);
+if (Result.isInvalid()) {
+  ESI.Type = EST_BasicNoexcept;
+  return;
+}
+NoexceptExpr = Result.get();
+  }
   ESI.NoexceptExpr = NoexceptExpr;
 }
 return;

Modified: cfe/trunk/test/CXX/except/except.spec/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/except/except.spec/p1.cpp?rev=315638=315637=315638=diff
==
--- cfe/trunk/test/CXX/except/except.spec/p1.cpp (original)
+++ cfe/trunk/test/CXX/except/except.spec/p1.cpp Thu Oct 12 16:01:53 2017
@@ -86,3 +86,12 @@ namespace PR11084 {
 f<0>(); // expected-note{{in instantiation of function template 
specialization}}
   }
 }
+
+namespace FuncTmplNoexceptError {
+  int a = 0;
+  // expected-error@+1{{argument to noexcept specifier must be a constant 
expression}}
+  template  T f() noexcept(a++){ return {};}
+  void g(){
+f();
+  }
+};


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


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:2263
+  }
+}
+

rjmccall wrote:
> Is there a reason this only fails on x86?  If LLVM doesn't have generic 
> wide-operation lowering, this probably needs to be a target whitelist rather 
> than a blacklist.
That makes sense. For the 128-bit operation, the whitelist is {x86-64, wasm64, 
mips64}. We don't support this operation for bit widths larger than 128 bits on 
any target. I'll update the patch accordingly.


https://reviews.llvm.org/D38861



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


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 118857.
vsk added a comment.
Herald added a subscriber: aheejin.

- Update to check against a whitelist of supported targets.


https://reviews.llvm.org/D38861

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtins-overflow-unsupported.c
  test/CodeGen/builtins-overflow.c


Index: test/CodeGen/builtins-overflow.c
===
--- test/CodeGen/builtins-overflow.c
+++ test/CodeGen/builtins-overflow.c
@@ -2,7 +2,9 @@
 // rdar://13421498
 
 // RUN: %clang_cc1 -triple "i686-unknown-unknown"   -emit-llvm -x c %s -o - | 
FileCheck %s
-// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | 
FileCheck %s
+// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | 
FileCheck %s --check-prefixes=CHECK,M64
+// RUN: %clang_cc1 -triple "wasm64-unknown-unknown" -emit-llvm -x c %s -o - | 
FileCheck %s --check-prefixes=M64
+// RUN: %clang_cc1 -triple "mips64-unknown-unknown" -emit-llvm -x c %s -o - | 
FileCheck %s --check-prefixes=M64
 // RUN: %clang_cc1 -triple "x86_64-mingw32" -emit-llvm -x c %s -o - | 
FileCheck %s
 
 extern unsigned UnsignedErrorCode;
@@ -338,3 +340,20 @@
 return LongLongErrorCode;
   return result;
 }
+
+#if defined(__LP64__)
+signed long long test_mixed_sign_mul_i64(signed long long a, unsigned long 
long b) {
+  // M64-LABEL: define i64 @test_mixed_sign_mul_i64
+  // M64: sext i64 {{.*}} to i65
+  // M64-NEXT: zext i64 {{.*}} to i65
+  // M64-NEXT: call { i65, i1 } @llvm.smul.with.overflow.i65
+  // M64-NEXT: [[OFLOW_1:%.*]] = extractvalue { i65, i1 } {{.*}}, 1
+  // M64-NEXT: [[RES:%.*]] = extractvalue { i65, i1 } {{.*}}, 0
+  // M64-NEXT: [[RES_TRUNC:%.*]] = trunc i65 {{.*}} to i64
+  // M64-NEXT: [[RES_EXT:%.*]] = zext i64 {{.*}} to i65
+  // M64-NEXT: [[OFLOW_2:%.*]] = icmp ne i65 [[RES]], [[RES_EXT]]
+  // M64-NEXT: or i1 [[OFLOW_1]], [[OFLOW_2]]
+  // M64-NEXT: store i64 [[RES_TRUNC]]
+  return __builtin_mul_overflow(a, b, );
+}
+#endif
Index: test/CodeGen/builtins-overflow-unsupported.c
===
--- /dev/null
+++ test/CodeGen/builtins-overflow-unsupported.c
@@ -0,0 +1,14 @@
+// RUN: not %clang_cc1 -triple "i686-unknown-unknown"   -emit-llvm -x c %s -o 
- 2>&1 | FileCheck %s --check-prefix=M32
+// RUN: not %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o 
- 2>&1 | FileCheck %s --check-prefix=M64
+
+signed long long try_smul_i65(signed long long a, unsigned long long b) {
+  // M32: [[@LINE+1]]:10: error: cannot compile this __builtin_mul_overflow 
with mixed-sign operands yet
+  return __builtin_mul_overflow(a, b, );
+}
+
+#if defined(__LP64__)
+__int128_t try_smul_i29(__int128_t a, __uint128_t b) {
+  // M64: [[@LINE+1]]:10: error: cannot compile this __builtin_mul_overflow 
with mixed-sign operands yet
+  return __builtin_mul_overflow(a, b, );
+}
+#endif
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -397,6 +397,15 @@
   return {Width, Signed};
 }
 
+// Check if the target supports checked multiplication with 128-bit operands.
+static bool has128BitMulOverflowSupport(const llvm::Triple ) {
+  if (!Triple.isArch64Bit())
+return false;
+  return StringSwitch(llvm::Triple::getArchTypePrefix(Triple.getArch()))
+  .Cases("x86", "wasm", "mips", true)
+  .Default(false);
+}
+
 Value *CodeGenFunction::EmitVAStartEnd(Value *ArgValue, bool IsStart) {
   llvm::Type *DestType = Int8PtrTy;
   if (ArgValue->getType() != DestType)
@@ -2248,11 +2257,21 @@
 WidthAndSignedness EncompassingInfo =
 EncompassingIntegerType({LeftInfo, RightInfo, ResultInfo});
 
+llvm::Type *ResultLLVMTy = CGM.getTypes().ConvertType(ResultQTy);
+
+if (BuiltinID == Builtin::BI__builtin_mul_overflow) {
+  if ((EncompassingInfo.Width > 64 &&
+   !has128BitMulOverflowSupport(getTarget().getTriple())) ||
+  (EncompassingInfo.Width > 128)) {
+CGM.ErrorUnsupported(E,
+ "__builtin_mul_overflow with mixed-sign 
operands");
+return RValue::get(llvm::UndefValue::get(ResultLLVMTy));
+  }
+}
+
 llvm::Type *EncompassingLLVMTy =
 llvm::IntegerType::get(CGM.getLLVMContext(), EncompassingInfo.Width);
 
-llvm::Type *ResultLLVMTy = CGM.getTypes().ConvertType(ResultQTy);
-
 llvm::Intrinsic::ID IntrinsicId;
 switch (BuiltinID) {
 default:


Index: test/CodeGen/builtins-overflow.c
===
--- test/CodeGen/builtins-overflow.c
+++ test/CodeGen/builtins-overflow.c
@@ -2,7 +2,9 @@
 // rdar://13421498
 
 // RUN: %clang_cc1 -triple "i686-unknown-unknown"   -emit-llvm -x c %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple 

[PATCH] D38863: Typos in tutorial

2017-10-12 Thread Jan Korous via Phabricator via cfe-commits
jkorous-apple created this revision.

https://reviews.llvm.org/D38863

Files:
  www/hacking.html


Index: www/hacking.html
===
--- www/hacking.html
+++ www/hacking.html
@@ -246,9 +246,9 @@
   For example:
 
   
-  python C:\Tool\llvm\utils\lit\lit.py -sv
+  python C:\Tools\llvm\utils\lit\lit.py -sv
   --param=build_mode=Win32 --param=build_config=Debug
-  --param=clang_site_config=c:\Tools\build\tools\clang\test\lit.site.cfg
+  --param=clang_site_config=C:\Tools\build\tools\clang\test\lit.site.cfg
   C:\Tools\llvm\tools\clang\test\Sema\wchar.c
 
 


Index: www/hacking.html
===
--- www/hacking.html
+++ www/hacking.html
@@ -246,9 +246,9 @@
   For example:
 
   
-  python C:\Tool\llvm\utils\lit\lit.py -sv
+  python C:\Tools\llvm\utils\lit\lit.py -sv
   --param=build_mode=Win32 --param=build_config=Debug
-  --param=clang_site_config=c:\Tools\build\tools\clang\test\lit.site.cfg
+  --param=clang_site_config=C:\Tools\build\tools\clang\test\lit.site.cfg
   C:\Tools\llvm\tools\clang\test\Sema\wchar.c
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38773: [Sema] Add support for flexible array members in Obj-C.

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5226
+def err_objc_variable_sized_type_not_at_end : Error<
+  "field %0 with variable sized type %1 is not at the end of class">;
+def note_next_field_declaration : Note<

"Variable sized type" is a bit too close to the C99 variably-sized array type 
extension.  Maybe "unbounded array type" if you're trying to cover both "int 
x[];" and "int x[0];"?

Well, I guess there's some precedent for using this terminology, but ugh.



Comment at: clang/lib/Sema/SemaDecl.cpp:15055
   }
+  // If it is the last field is checked elsewhere.
 }

"Whether" rather than "If", please.  You should also leave a comment about 
*why* we can't check this here — I assume because you also want to complain 
about the last explicit ivar if there are synthesized ivars?  I think we could 
at least still check this for `@interface` ivars.


https://reviews.llvm.org/D38773



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


Re: [PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via cfe-commits
On Fri, Oct 13, 2017 at 1:22 AM, Richard Smith  wrote:
> On 12 October 2017 at 15:11, Roman Lebedev via Phabricator via cfe-commits
>  wrote:
>>
>> lebedev.ri reopened this revision.
>> lebedev.ri added a comment.
>> This revision is now accepted and ready to land.
>>
>> Reverted due to http://bb9.pgr.jp/#/builders/20/builds/59 that i don't
>> currently know how to deal with.
>> It is really sad that i failed to encounter it during testing.
>
>
> I see three issues there:

> 1) A warning in this code due to missing parentheses around a ^ operator.

> 2) This code generating correct warnings in the libc++ test suite.
Yes, this one is the problem.

I'm honestly not sure about these comparisons with
std::numeric_limits<...>::{min,max}()
They is similar to what Nico Weber (CC'd, just in case) is raising in
post-review mail in
https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20171009/206427.html
I personally would very much prefer to have the warning, as explained
in the follow-up mail.

> You could ask EricWF (cc'd) to look at those and either fix them or turn the 
> warning
> flag off for libc++'s tests.
Eric: could you *please* look into that? :)
That is way too deep to change without prior knowledge about the code i think.

> 3) A stage2 / stage3 comparison failure in CGAtomic.cpp. That's pre-existing
> and nothing to do with your change.

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


[PATCH] D38794: [CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

This function feels increasingly poorly-named, but let's leave that alone for 
now.


Repository:
  rL LLVM

https://reviews.llvm.org/D38794



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


[PATCH] D38796: [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Yes, thank for you handling the cast case well.


Repository:
  rL LLVM

https://reviews.llvm.org/D38796



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


[PATCH] D38795: [CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D38795



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


[PATCH] D38793: [CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D38793



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


[PATCH] D38791: [CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D38791



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


[PATCH] D38788: [CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue base info

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D38788



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


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:2263
+  }
+}
+

Is there a reason this only fails on x86?  If LLVM doesn't have generic 
wide-operation lowering, this probably needs to be a target whitelist rather 
than a blacklist.


https://reviews.llvm.org/D38861



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


[PATCH] D38816: Convert clang::LangAS to a strongly typed enum

2017-10-12 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson planned changes to this revision.
arichardson added inline comments.



Comment at: include/clang/Basic/AddressSpaces.h:66
 
+inline LangAS LangASFromTargetAS(unsigned TargetAS) {
+  return static_cast((TargetAS) +

yaxunl wrote:
> how about `getLangASFromTargetAS` ? It is preferred to start with small 
> letters.
Sounds good, I'll do that.



Comment at: tools/libclang/CXType.cpp:402
+  ASTContext  = cxtu::getASTUnit(GetTU(CT))->getASTContext();
+  return Ctx.getTargetAddressSpace(T);
 }

yaxunl wrote:
> Is this function suppose to return AST address space or target address space?
> 
> Some targets e.g. x86 maps all AST address spaces to 0. Returning target 
> address space will not let the client unable to differentiate different 
> address spaces in the source language.
I am not entirely sure what the correct return value is here because the 
current implementation returns either the LanguageAS or `LangAS - 
LangAS::FirstTargetAddressSpace` which can also overlap. So possibly it should 
just always returning the AST address space?

I think for now I will just keep the current behaviour with a FIXME and create 
a followup patch.



https://reviews.llvm.org/D38816



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


[PATCH] D35082: [OpenCL] Add LangAS::opencl_private to represent private address space in AST

2017-10-12 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

A few minor comments; feel free to commit after addressing them.




Comment at: include/clang/Basic/AddressSpaces.h:34
 
   // OpenCL specific address spaces.
   opencl_global,

yaxunl wrote:
> rjmccall wrote:
> > I think you need a real comment about the design of OpenCL address spaces 
> > here.  Specifically, it is important to note that OpenCL no longer uses 
> > LangAS::Default for anything except r-values.
> Will do.
Thanks, WFM.



Comment at: lib/AST/TypePrinter.cpp:1703
 OS << "__shared";
 break;
   default:

Please add the case here, even if it's unreachable for now.



Comment at: lib/Sema/SemaType.cpp:5754
 default:
   assert(Attr.getKind() == AttributeList::AT_OpenCLPrivateAddressSpace);
+  ASIdx = LangAS::opencl_private; break;

Please just make this a case, and then the default can be llvm_unreachable.


https://reviews.llvm.org/D35082



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


[PATCH] D38861: [CodeGen] Error on unsupported checked multiplies early

2017-10-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.

LLVM's smul.with.overflow intrinsic isn't supported on X86 for bit
widths larger than 64, or on X86-64 for bit widths larger than 128.

The failure mode is either a linker error ("the __muloti4 builtin isn't
available for this target") or an assertion failure ("SelectionDAG
doesn't know what builtin to call").

Until we actually add builtin support for 128-bit multiply-with-overflow
on X86, we should error-out on unsupported calls as early as possible.

https://bugs.llvm.org/show_bug.cgi?id=34920


https://reviews.llvm.org/D38861

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtins-overflow-unsupported.c
  test/CodeGen/builtins-overflow.c


Index: test/CodeGen/builtins-overflow.c
===
--- test/CodeGen/builtins-overflow.c
+++ test/CodeGen/builtins-overflow.c
@@ -2,7 +2,7 @@
 // rdar://13421498
 
 // RUN: %clang_cc1 -triple "i686-unknown-unknown"   -emit-llvm -x c %s -o - | 
FileCheck %s
-// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | 
FileCheck %s
+// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | 
FileCheck %s --check-prefixes=CHECK,M64
 // RUN: %clang_cc1 -triple "x86_64-mingw32" -emit-llvm -x c %s -o - | 
FileCheck %s
 
 extern unsigned UnsignedErrorCode;
@@ -338,3 +338,20 @@
 return LongLongErrorCode;
   return result;
 }
+
+#if defined(__LP64__)
+signed long long test_mixed_sign_mul_i64(signed long long a, unsigned long 
long b) {
+  // M64-LABEL: define i64 @test_mixed_sign_mul_i64
+  // M64: sext i64 {{.*}} to i65
+  // M64-NEXT: zext i64 {{.*}} to i65
+  // M64-NEXT: call { i65, i1 } @llvm.smul.with.overflow.i65
+  // M64-NEXT: [[OFLOW_1:%.*]] = extractvalue { i65, i1 } {{.*}}, 1
+  // M64-NEXT: [[RES:%.*]] = extractvalue { i65, i1 } {{.*}}, 0
+  // M64-NEXT: [[RES_TRUNC:%.*]] = trunc i65 {{.*}} to i64
+  // M64-NEXT: [[RES_EXT:%.*]] = zext i64 {{.*}} to i65
+  // M64-NEXT: [[OFLOW_2:%.*]] = icmp ne i65 [[RES]], [[RES_EXT]]
+  // M64-NEXT: or i1 [[OFLOW_1]], [[OFLOW_2]]
+  // M64-NEXT: store i64 [[RES_TRUNC]]
+  return __builtin_mul_overflow(a, b, );
+}
+#endif
Index: test/CodeGen/builtins-overflow-unsupported.c
===
--- /dev/null
+++ test/CodeGen/builtins-overflow-unsupported.c
@@ -0,0 +1,14 @@
+// RUN: not %clang_cc1 -triple "i686-unknown-unknown"   -emit-llvm -x c %s -o 
- 2>&1 | FileCheck %s --check-prefix=M32
+// RUN: not %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o 
- 2>&1 | FileCheck %s --check-prefix=M64
+
+signed long long try_smul_i65(signed long long a, unsigned long long b) {
+  // M32: [[@LINE+1]]:10: error: cannot compile this __builtin_mul_overflow 
with mixed-sign operands yet
+  return __builtin_mul_overflow(a, b, );
+}
+
+#if defined(__LP64__)
+__int128_t try_smul_i29(__int128_t a, __uint128_t b) {
+  // M64: [[@LINE+1]]:10: error: cannot compile this __builtin_mul_overflow 
with mixed-sign operands yet
+  return __builtin_mul_overflow(a, b, );
+}
+#endif
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -2248,11 +2248,23 @@
 WidthAndSignedness EncompassingInfo =
 EncompassingIntegerType({LeftInfo, RightInfo, ResultInfo});
 
+llvm::Type *ResultLLVMTy = CGM.getTypes().ConvertType(ResultQTy);
+
+const auto  = getTarget().getTriple();
+if (BuiltinID == Builtin::BI__builtin_mul_overflow) {
+  if ((EncompassingInfo.Width > 64 &&
+   Triple.getArch() == llvm::Triple::ArchType::x86) ||
+  (EncompassingInfo.Width > 128 &&
+   Triple.getArch() == llvm::Triple::ArchType::x86_64)) {
+CGM.ErrorUnsupported(E,
+ "__builtin_mul_overflow with mixed-sign 
operands");
+return RValue::get(llvm::UndefValue::get(ResultLLVMTy));
+  }
+}
+
 llvm::Type *EncompassingLLVMTy =
 llvm::IntegerType::get(CGM.getLLVMContext(), EncompassingInfo.Width);
 
-llvm::Type *ResultLLVMTy = CGM.getTypes().ConvertType(ResultQTy);
-
 llvm::Intrinsic::ID IntrinsicId;
 switch (BuiltinID) {
 default:


Index: test/CodeGen/builtins-overflow.c
===
--- test/CodeGen/builtins-overflow.c
+++ test/CodeGen/builtins-overflow.c
@@ -2,7 +2,7 @@
 // rdar://13421498
 
 // RUN: %clang_cc1 -triple "i686-unknown-unknown"   -emit-llvm -x c %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple "x86_64-unknown-unknown" -emit-llvm -x c %s -o - | FileCheck %s --check-prefixes=CHECK,M64
 // RUN: %clang_cc1 -triple "x86_64-mingw32" -emit-llvm -x c %s -o - | FileCheck %s
 
 extern unsigned UnsignedErrorCode;
@@ -338,3 +338,20 @@
 return LongLongErrorCode;
   return result;
 }
+
+#if 

Re: [PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Richard Smith via cfe-commits
On 12 October 2017 at 15:11, Roman Lebedev via Phabricator via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> lebedev.ri reopened this revision.
> lebedev.ri added a comment.
> This revision is now accepted and ready to land.
>
> Reverted due to http://bb9.pgr.jp/#/builders/20/builds/59 that i don't
> currently know how to deal with.
> It is really sad that i failed to encounter it during testing.


I see three issues there:

1) A warning in this code due to missing parentheses around a ^ operator.
2) This code generating correct warnings in the libc++ test suite. You
could ask EricWF (cc'd) to look at those and either fix them or turn the
warning flag off for libc++'s tests.
3) A stage2 / stage3 comparison failure in CGAtomic.cpp. That's
pre-existing and nothing to do with your change.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri reopened this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Reverted due to http://bb9.pgr.jp/#/builders/20/builds/59 that i don't 
currently know how to deal with.
It is really sad that i failed to encounter it during testing.


Repository:
  rL LLVM

https://reviews.llvm.org/D38101



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


[PATCH] D38700: [Sema][Crash] Correctly handle an non-dependent noexcept expr in function template

2017-10-12 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

Looks good, thanks!


https://reviews.llvm.org/D38700



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


r315631 - Revert "[Sema] Diagnose tautological comparison with type's min/max values"

2017-10-12 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Thu Oct 12 15:03:20 2017
New Revision: 315631

URL: http://llvm.org/viewvc/llvm-project?rev=315631=rev
Log:
Revert "[Sema] Diagnose tautological comparison with type's min/max values"

This reverts r315614,r315615,r315621,r315622
Breaks http://bb9.pgr.jp/#/builders/20/builds/59

/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:95:17:
 error: comparison 'long long' > 9223372036854775807 is always false 
[-Werror,-Wtautological-constant-compare]
if (max_sec > Lim::max()) return false;
~~~ ^ ~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:13:
 error: comparison 'long long' < -9223372036854775808 is always false 
[-Werror,-Wtautological-constant-compare]
if (sec < Lim::min() || sec > Lim::max())   return false;
~~~ ^ ~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:33:
 error: comparison 'long long' > 9223372036854775807 is always false 
[-Werror,-Wtautological-constant-compare]
if (sec < Lim::min() || sec > Lim::max())   return false;
~~~ ^ ~~
3 errors generated.
--

I'm not yet sure what is the proper fix.

Removed:
cfe/trunk/test/Sema/tautological-constant-compare.c
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Analysis/conversion.c
cfe/trunk/test/Analysis/null-deref-ps.c
cfe/trunk/test/Sema/outof-range-constant-compare.c
cfe/trunk/test/Sema/tautological-unsigned-zero-compare.c

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=315631=315630=315631=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Thu Oct 12 15:03:20 2017
@@ -78,10 +78,6 @@ Improvements to Clang's diagnostics
   when the signed integer is coerced to an unsigned type for the comparison.
   ``-Wsign-compare`` was adjusted not to warn in this case.
 
-- ``-Wtautological-constant-compare`` is a new warning that warns on
-  tautological comparisons between integer variable of the type ``T`` and the
-  largest/smallest possible integer constant of that same type.
-
 - ``-Wnull-pointer-arithmetic`` now warns about performing pointer arithmetic
   on a null pointer. Such pointer arithmetic has an undefined behavior if the
   offset is nonzero. It also now warns about arithmetic on a null pointer

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=315631=315630=315631=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Oct 12 15:03:20 2017
@@ -432,15 +432,13 @@ def StrncatSize : DiagGroup<"strncat-siz
 def TautologicalUnsignedZeroCompare : 
DiagGroup<"tautological-unsigned-zero-compare">;
 def TautologicalUnsignedEnumZeroCompare : 
DiagGroup<"tautological-unsigned-enum-zero-compare">;
 def TautologicalOutOfRangeCompare : 
DiagGroup<"tautological-constant-out-of-range-compare">;
-def TautologicalConstantCompare : DiagGroup<"tautological-constant-compare",
-[TautologicalUnsignedZeroCompare,
- 
TautologicalUnsignedEnumZeroCompare,
- TautologicalOutOfRangeCompare]>;
 def TautologicalPointerCompare : DiagGroup<"tautological-pointer-compare">;
 def TautologicalOverlapCompare : DiagGroup<"tautological-overlap-compare">;
 def TautologicalUndefinedCompare : DiagGroup<"tautological-undefined-compare">;
 def TautologicalCompare : DiagGroup<"tautological-compare",
-[TautologicalConstantCompare,
+[TautologicalUnsignedZeroCompare,
+ TautologicalUnsignedEnumZeroCompare,
+ TautologicalOutOfRangeCompare,
  TautologicalPointerCompare,
  TautologicalOverlapCompare,
  TautologicalUndefinedCompare]>;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=315631=315630=315631=diff

r315630 - [cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.

2017-10-12 Thread Matt Morehouse via cfe-commits
Author: morehouse
Date: Thu Oct 12 15:00:09 2017
New Revision: 315630

URL: http://llvm.org/viewvc/llvm-project?rev=315630=rev
Log:
[cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.

Modified:
cfe/trunk/tools/clang-format/CMakeLists.txt
cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
cfe/trunk/tools/clang-fuzzer/CMakeLists.txt

Modified: cfe/trunk/tools/clang-format/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/CMakeLists.txt?rev=315630=315629=315630=diff
==
--- cfe/trunk/tools/clang-format/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-format/CMakeLists.txt Thu Oct 12 15:00:09 2017
@@ -15,7 +15,7 @@ target_link_libraries(clang-format
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 

Modified: cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt?rev=315630=315629=315630=diff
==
--- cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt Thu Oct 12 15:00:09 2017
@@ -11,5 +11,5 @@ add_clang_executable(clang-format-fuzzer
 
 target_link_libraries(clang-format-fuzzer
   ${CLANG_FORMAT_LIB_DEPS}
-  ${LIB_FUZZING_ENGINE}
+  ${LLVM_LIB_FUZZING_ENGINE}
   )

Modified: cfe/trunk/tools/clang-fuzzer/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/CMakeLists.txt?rev=315630=315629=315630=diff
==
--- cfe/trunk/tools/clang-fuzzer/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-fuzzer/CMakeLists.txt Thu Oct 12 15:00:09 2017
@@ -1,7 +1,7 @@
 set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} FuzzMutate)
 set(CXX_FLAGS_NOFUZZ ${CMAKE_CXX_FLAGS})
 set(DUMMY_MAIN DummyClangFuzzer.cpp)
-if(DEFINED LIB_FUZZING_ENGINE)
+if(LLVM_LIB_FUZZING_ENGINE)
   unset(DUMMY_MAIN)
 elseif(LLVM_USE_SANITIZE_COVERAGE)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
@@ -50,7 +50,7 @@ if(CLANG_ENABLE_PROTO_FUZZER)
   target_link_libraries(clang-proto-fuzzer
 ${ProtobufMutator_LIBRARIES}
 ${PROTOBUF_LIBRARIES}
-${LIB_FUZZING_ENGINE}
+${LLVM_LIB_FUZZING_ENGINE}
 clangCXXProto
 clangHandleCXX
 clangProtoToCXX
@@ -66,6 +66,6 @@ add_clang_executable(clang-fuzzer
   )
 
 target_link_libraries(clang-fuzzer
-  ${LIB_FUZZING_ENGINE}
+  ${LLVM_LIB_FUZZING_ENGINE}
   clangHandleCXX
   )


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


r315627 - [lit] Raise the logic for enabling clang & lld substitutions to llvm.

2017-10-12 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Thu Oct 12 14:56:05 2017
New Revision: 315627

URL: http://llvm.org/viewvc/llvm-project?rev=315627=rev
Log:
[lit] Raise the logic for enabling clang & lld substitutions to llvm.

This paves the way for other projects which might /use/ clang or
lld but not necessarily need to the full set of functionality
available to clang and lld tests to be able to have a basic set
of substitutions that allow a project to run the clang or lld
executables.

Modified:
cfe/trunk/test/lit.cfg.py

Modified: cfe/trunk/test/lit.cfg.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=315627=315626=315627=diff
==
--- cfe/trunk/test/lit.cfg.py (original)
+++ cfe/trunk/test/lit.cfg.py Thu Oct 12 14:56:05 2017
@@ -39,162 +39,43 @@ config.test_source_root = os.path.dirnam
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.clang_obj_root, 'test')
 
-# Clear some environment variables that might affect Clang.
-#
-# This first set of vars are read by Clang, but shouldn't affect tests
-# that aren't specifically looking for these features, or are required
-# simply to run the tests at all.
-#
-# FIXME: Should we have a tool that enforces this?
-
-# safe_env_vars = ('TMPDIR', 'TEMP', 'TMP', 'USERPROFILE', 'PWD',
-#  'MACOSX_DEPLOYMENT_TARGET', 'IPHONEOS_DEPLOYMENT_TARGET',
-#  'VCINSTALLDIR', 'VC100COMNTOOLS', 'VC90COMNTOOLS',
-#  'VC80COMNTOOLS')
-possibly_dangerous_env_vars = ['COMPILER_PATH', 'RC_DEBUG_OPTIONS',
-   'CINDEXTEST_PREAMBLE_FILE', 'LIBRARY_PATH',
-   'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
-   'OBJC_INCLUDE_PATH', 'OBJCPLUS_INCLUDE_PATH',
-   'LIBCLANG_TIMING', 'LIBCLANG_OBJTRACKING',
-   'LIBCLANG_LOGGING', 'LIBCLANG_BGPRIO_INDEX',
-   'LIBCLANG_BGPRIO_EDIT', 'LIBCLANG_NOTHREADS',
-   'LIBCLANG_RESOURCE_USAGE',
-   'LIBCLANG_CODE_COMPLETION_LOGGING']
-# Clang/Win32 may refer to %INCLUDE%. vsvarsall.bat sets it.
-if platform.system() != 'Windows':
-possibly_dangerous_env_vars.append('INCLUDE')
-
-llvm_config.clear_environment(possibly_dangerous_env_vars)
-
-# Tweak the PATH to include the tools dir and the scripts dir.
-llvm_config.with_environment(
-'PATH', [config.llvm_tools_dir, config.clang_tools_dir], append_path=True)
+llvm_config.use_default_substitutions()
 
-llvm_config.with_environment('LD_LIBRARY_PATH', [
- config.llvm_shlib_dir, config.llvm_libs_dir], 
append_path=True)
+llvm_config.use_clang()
 
 # Propagate path to symbolizer for ASan/MSan.
 llvm_config.with_system_environment(
 ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
 
-llvm_config.use_default_substitutions()
-
-# Discover the 'clang' and 'clangcc' to use.
-
-
-def inferClang(PATH):
-# Determine which clang to use.
-clang = os.getenv('CLANG')
-
-# If the user set clang in the environment, definitely use that and don't
-# try to validate.
-if clang:
-return clang
-
-# Otherwise look in the path.
-clang = lit.util.which('clang', PATH)
-
-if not clang:
-lit_config.fatal("couldn't find 'clang' program, try setting "
- 'CLANG in your environment')
-
-return clang
-
-
-config.clang = inferClang(config.environment['PATH']).replace('\\', '/')
-if not lit_config.quiet:
-lit_config.note('using clang: %r' % config.clang)
-
-# Plugins (loadable modules)
-# TODO: This should be supplied by Makefile or autoconf.
-if sys.platform in ['win32', 'cygwin']:
-has_plugins = config.enable_shared
-else:
-has_plugins = True
-
-if has_plugins and config.llvm_plugin_ext:
-config.available_features.add('plugins')
-
-config.substitutions.append(('%llvmshlibdir', config.llvm_shlib_dir))
-config.substitutions.append(('%pluginext', config.llvm_plugin_ext))
 config.substitutions.append(('%PATH%', config.environment['PATH']))
 
-if config.clang_examples:
-config.available_features.add('examples')
 
-builtin_include_dir = llvm_config.get_clang_builtin_include_dir(config.clang)
+# For each occurrence of a clang tool name, replace it with the full path to
+# the build directory holding that tool.  We explicitly specify the directories
+# to search to ensure that we get the tools just built and not some random
+# tools that might happen to be in the user's PATH.
+tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]
 
 tools = [
-# By specifying %clang_cc1 as part of the substitution, this substitution
-# relies on repeated substitution, so must come before %clang_cc1.
-ToolSubst('%clang_analyze_cc1', command='%clang_cc1',
-  extra_args=['-analyze', '%analyze']),
-

Re: r315614 - [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via cfe-commits
On Fri, Oct 13, 2017 at 12:12 AM, Nico Weber  wrote:
> Huh, I consider clang not warning on this a feature, not a bug. Why are we
> trying to match what gcc does here?
Because i have been bitten by this more than once.
It did result in big amount of wasted time, and this "thread":
https://lists.llvm.org/pipermail/llvm-dev/2017-August/116390.html

As with all the clang diagnostics, you can disable them
I personally don't have any opinion on comparisons with
std::numeric_limits<...>::{min,max}()

> Say you have code like this:
>
> int64_t aligned_start = 0;
> int64_t aligned_size = 0;
> CalculateVMAlignedBoundaries(region.offset,
>  region.size,
>  _start,
>  _size,
>  _offset);
>
> // Ensure that the casts in the mmap call below are sane.
> if (aligned_start < 0 || aligned_size < 0 ||
> aligned_start > std::numeric_limits::max() ||
> static_cast(aligned_size) >
> std::numeric_limits::max() ||
> static_cast(region.size) >
> std::numeric_limits::max()) {
>   DLOG(ERROR) << "Region bounds are not valid for mmap";
>   return false;
> }
>
> This code works in 64-bit and 32-bit. off_t has different sizes on both, so
> the comparison is useful. The warning uselessly fires on this code.
> On Thu, Oct 12, 2017 at 4:16 PM, Roman Lebedev via cfe-commits
>  wrote:
>>
>> Author: lebedevri
>> Date: Thu Oct 12 13:16:51 2017
>> New Revision: 315614
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=315614=rev
>> Log:
>> [Sema] Diagnose tautological comparison with type's min/max values
>>
>> Summary:
>> Currently, clang only diagnoses completely out-of-range comparisons (e.g.
>> `char` and constant `300`),
>> and comparisons of unsigned and `0`. But gcc also does diagnose the
>> comparisons with the
>> `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to
>> speak
>>
>> Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
>> Continuation of https://reviews.llvm.org/D37565
>>
>> Reviewers: rjmccall, rsmith, aaron.ballman
>>
>> Reviewed By: rsmith
>>
>> Subscribers: rtrieu, jroelofs, cfe-commits
>>
>> Tags: #clang
>>
>> Differential Revision: https://reviews.llvm.org/D38101
>>
>> Added:
>> cfe/trunk/test/Sema/tautological-constant-compare.c
>> Modified:
>> cfe/trunk/docs/ReleaseNotes.rst
>> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/lib/Sema/SemaChecking.cpp
>> cfe/trunk/test/Sema/outof-range-constant-compare.c
>> cfe/trunk/test/Sema/tautological-unsigned-zero-compare.c
>>
>> Modified: cfe/trunk/docs/ReleaseNotes.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=315614=315613=315614=diff
>>
>> ==
>> --- cfe/trunk/docs/ReleaseNotes.rst (original)
>> +++ cfe/trunk/docs/ReleaseNotes.rst Thu Oct 12 13:16:51 2017
>> @@ -78,6 +78,10 @@ Improvements to Clang's diagnostics
>>when the signed integer is coerced to an unsigned type for the
>> comparison.
>>``-Wsign-compare`` was adjusted not to warn in this case.
>>
>> +- ``-Wtautological-constant-compare`` is a new warning that warns on
>> +  tautological comparisons between integer variable of the type ``T`` and
>> the
>> +  largest/smallest possible integer constant of that same type.
>> +
>>  - ``-Wnull-pointer-arithmetic`` now warns about performing pointer
>> arithmetic
>>on a null pointer. Such pointer arithmetic has an undefined behavior if
>> the
>>offset is nonzero. It also now warns about arithmetic on a null pointer
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=315614=315613=315614=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Oct 12 13:16:51
>> 2017
>> @@ -432,13 +432,15 @@ def StrncatSize : DiagGroup<"strncat-siz
>>  def TautologicalUnsignedZeroCompare :
>> DiagGroup<"tautological-unsigned-zero-compare">;
>>  def TautologicalUnsignedEnumZeroCompare :
>> DiagGroup<"tautological-unsigned-enum-zero-compare">;
>>  def TautologicalOutOfRangeCompare :
>> DiagGroup<"tautological-constant-out-of-range-compare">;
>> +def TautologicalConstantCompare :
>> DiagGroup<"tautological-constant-compare",
>> +
>> [TautologicalUnsignedZeroCompare,
>> +
>> TautologicalUnsignedEnumZeroCompare,
>> +
>> TautologicalOutOfRangeCompare]>;
>>  def TautologicalPointerCompare :
>> DiagGroup<"tautological-pointer-compare">;
>>  def TautologicalOverlapCompare :
>> DiagGroup<"tautological-overlap-compare">;
>>  

[PATCH] D38742: [CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions in sm_70

2017-10-12 Thread Artem Belevich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315624: [CUDA] Added __hmma_m16n16k16_* builtins to support 
mma instructions on sm_70 (authored by tra).

Changed prior to commit:
  https://reviews.llvm.org/D38742?vs=118636=118848#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38742

Files:
  cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
  cfe/trunk/lib/CodeGen/CGBuiltin.cpp
  cfe/trunk/test/CodeGen/builtins-nvptx-sm_70.cu

Index: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
+++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
@@ -688,5 +688,18 @@
 BUILTIN(__nvvm_ldg_f4, "E4fE4fC*", "")
 BUILTIN(__nvvm_ldg_d2, "E2dE2dC*", "")
 
+// Builtins to support WMMA instructions on sm_70
+TARGET_BUILTIN(__hmma_m16n16k16_ld_a, "vi*iC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_ld_b, "vi*iC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f16, "vi*iC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f32, "vf*fC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*i*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*f*UiIi", "", "ptx60")
+
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f16, "vi*iC*iC*iC*IiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f16, "vf*iC*iC*iC*IiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f32, "vf*iC*iC*fC*IiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f32, "vi*iC*iC*fC*IiIi", "", "ptx60")
+
 #undef BUILTIN
 #undef TARGET_BUILTIN
Index: cfe/trunk/test/CodeGen/builtins-nvptx-sm_70.cu
===
--- cfe/trunk/test/CodeGen/builtins-nvptx-sm_70.cu
+++ cfe/trunk/test/CodeGen/builtins-nvptx-sm_70.cu
@@ -0,0 +1,166 @@
+// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -target-cpu sm_70 \
+// RUN:-fcuda-is-device -target-feature +ptx60 \
+// RUN:-S -emit-llvm -o - -x cuda %s \
+// RUN:   | FileCheck -check-prefix=CHECK %s
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_60 \
+// RUN:   -fcuda-is-device -S -o /dev/null -x cuda -verify %s
+
+#if !defined(CUDA_VERSION)
+#define __device__ __attribute__((device))
+#define __global__ __attribute__((global))
+#define __shared__ __attribute__((shared))
+#define __constant__ __attribute__((constant))
+
+typedef unsigned long long uint64_t;
+#endif
+// We have to keep all builtins that depend on particular target feature in the
+// same function, because the codegen will stop after the very first function
+// that encounters an error, so -verify will not be able to find errors in
+// subsequent functions.
+
+// CHECK-LABEL: nvvm_wmma
+__device__ void nvvm_wmma(int *src, int *dst,
+  float *fsrc, float *fdst,
+  int ldm) {
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.a.sync.row.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_a' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_a(dst, src, ldm, 0);
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.a.sync.col.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_a' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_a(dst, src+1, ldm, 1);
+
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.b.sync.row.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_b' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_b(dst, src, ldm, 0);
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.b.sync.col.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_b' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_b(dst, src+2, ldm, 1);
+
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.c.sync.row.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_c_f16' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_c_f16(dst, src, ldm, 0);
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.c.sync.col.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_c_f16' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_c_f16(dst, src, ldm, 1);
+
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.c.sync.row.m16n16k16.stride.f32
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_c_f32' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_c_f32(fdst, fsrc, ldm, 0);
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.load.c.sync.col.m16n16k16.stride.f32
+  // expected-error@+1 {{'__hmma_m16n16k16_ld_c_f32' needs target feature ptx60}}
+  __hmma_m16n16k16_ld_c_f32(fdst, fsrc, ldm, 1);
+
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.store.d.sync.row.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_st_c_f16' needs target feature ptx60}}
+  __hmma_m16n16k16_st_c_f16(dst, src, ldm, 0);
+  // CHECK: call {{.*}} @llvm.nvvm.wmma.store.d.sync.col.m16n16k16.stride.f16
+  // expected-error@+1 {{'__hmma_m16n16k16_st_c_f16' needs target feature ptx60}}
+  __hmma_m16n16k16_st_c_f16(dst, src, ldm, 1);

r315624 - [CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions on sm_70

2017-10-12 Thread Artem Belevich via cfe-commits
Author: tra
Date: Thu Oct 12 14:32:19 2017
New Revision: 315624

URL: http://llvm.org/viewvc/llvm-project?rev=315624=rev
Log:
[CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions on sm_70

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

Added:
cfe/trunk/test/CodeGen/builtins-nvptx-sm_70.cu
Modified:
cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def?rev=315624=315623=315624=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def Thu Oct 12 14:32:19 2017
@@ -688,5 +688,18 @@ BUILTIN(__nvvm_ldg_f2, "E2fE2fC*", "")
 BUILTIN(__nvvm_ldg_f4, "E4fE4fC*", "")
 BUILTIN(__nvvm_ldg_d2, "E2dE2dC*", "")
 
+// Builtins to support WMMA instructions on sm_70
+TARGET_BUILTIN(__hmma_m16n16k16_ld_a, "vi*iC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_ld_b, "vi*iC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f16, "vi*iC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f32, "vf*fC*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*i*UiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*f*UiIi", "", "ptx60")
+
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f16, "vi*iC*iC*iC*IiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f16, "vf*iC*iC*iC*IiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f32, "vf*iC*iC*fC*IiIi", "", "ptx60")
+TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f32, "vi*iC*iC*fC*IiIi", "", "ptx60")
+
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=315624=315623=315624=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Oct 12 14:32:19 2017
@@ -9731,6 +9731,204 @@ Value *CodeGenFunction::EmitNVPTXBuiltin
 Builder.CreateStore(Pred, PredOutPtr);
 return Builder.CreateExtractValue(ResultPair, 0);
   }
+  case NVPTX::BI__hmma_m16n16k16_ld_a:
+  case NVPTX::BI__hmma_m16n16k16_ld_b:
+  case NVPTX::BI__hmma_m16n16k16_ld_c_f16:
+  case NVPTX::BI__hmma_m16n16k16_ld_c_f32: {
+Address Dst = EmitPointerWithAlignment(E->getArg(0));
+Value *Src = EmitScalarExpr(E->getArg(1));
+Value *Ldm = EmitScalarExpr(E->getArg(2));
+llvm::APSInt isColMajorArg;
+if (!E->getArg(3)->isIntegerConstantExpr(isColMajorArg, getContext()))
+  return nullptr;
+bool isColMajor = isColMajorArg.getSExtValue();
+unsigned IID;
+unsigned NumResults;
+switch (BuiltinID) {
+case NVPTX::BI__hmma_m16n16k16_ld_a:
+  IID = isColMajor ? Intrinsic::nvvm_wmma_load_a_f16_col_stride
+   : Intrinsic::nvvm_wmma_load_a_f16_row_stride;
+  NumResults = 8;
+  break;
+case NVPTX::BI__hmma_m16n16k16_ld_b:
+  IID = isColMajor ? Intrinsic::nvvm_wmma_load_b_f16_col_stride
+   : Intrinsic::nvvm_wmma_load_b_f16_row_stride;
+  NumResults = 8;
+  break;
+case NVPTX::BI__hmma_m16n16k16_ld_c_f16:
+  IID = isColMajor ? Intrinsic::nvvm_wmma_load_c_f16_col_stride
+   : Intrinsic::nvvm_wmma_load_c_f16_row_stride;
+  NumResults = 4;
+  break;
+case NVPTX::BI__hmma_m16n16k16_ld_c_f32:
+  IID = isColMajor ? Intrinsic::nvvm_wmma_load_c_f32_col_stride
+   : Intrinsic::nvvm_wmma_load_c_f32_row_stride;
+  NumResults = 8;
+  break;
+default:
+  llvm_unreachable("Unexpected builtin ID.");
+}
+Value *Result =
+Builder.CreateCall(CGM.getIntrinsic(IID),
+   {Builder.CreatePointerCast(Src, VoidPtrTy), Ldm});
+
+// Save returned values.
+for (unsigned i = 0; i < NumResults; ++i) {
+  Builder.CreateAlignedStore(
+  Builder.CreateBitCast(Builder.CreateExtractValue(Result, i),
+Dst.getElementType()),
+  Builder.CreateGEP(Dst.getPointer(), llvm::ConstantInt::get(IntTy, 
i)),
+  CharUnits::fromQuantity(4));
+}
+return Result;
+  }
+
+  case NVPTX::BI__hmma_m16n16k16_st_c_f16:
+  case NVPTX::BI__hmma_m16n16k16_st_c_f32: {
+Value *Dst = EmitScalarExpr(E->getArg(0));
+Address Src = EmitPointerWithAlignment(E->getArg(1));
+Value *Ldm = EmitScalarExpr(E->getArg(2));
+llvm::APSInt isColMajorArg;
+if (!E->getArg(3)->isIntegerConstantExpr(isColMajorArg, getContext()))
+  return nullptr;
+bool isColMajor = isColMajorArg.getSExtValue();
+unsigned IID;
+unsigned NumResults = 8;
+// PTX Instructions (and LLVM instrinsics) are defined for slice _d_, yet
+// for some reason nvcc builtins use _c_.
+switch 

r315622 - [Analysis] Un-silence -Wtautological-unsigned-zero-compare in null-deref-ps.c

2017-10-12 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Thu Oct 12 14:15:26 2017
New Revision: 315622

URL: http://llvm.org/viewvc/llvm-project?rev=315622=rev
Log:
[Analysis] Un-silence -Wtautological-unsigned-zero-compare in null-deref-ps.c

Stage-2 builds failed:

error: 'warning' diagnostics expected but not seen:
  File 
/home/buildbot/modules-slave-2/clang-x86_64-linux-selfhost-modules-2/llvm.src/tools/clang/test/Analysis/null-deref-ps.c
 Line 238: always true

Modified:
cfe/trunk/test/Analysis/null-deref-ps.c

Modified: cfe/trunk/test/Analysis/null-deref-ps.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/null-deref-ps.c?rev=315622=315621=315622=diff
==
--- cfe/trunk/test/Analysis/null-deref-ps.c (original)
+++ cfe/trunk/test/Analysis/null-deref-ps.c Thu Oct 12 14:15:26 2017
@@ -1,5 +1,5 @@
-// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-Wno-tautological-constant-compare -analyzer-checker=core,deadcode,alpha.core 
-std=gnu99 -analyzer-store=region -analyzer-purge=none -verify %s 
-Wno-error=return-type
-// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-Wno-tautological-constant-compare -analyzer-checker=core,deadcode,alpha.core 
-std=gnu99 -analyzer-store=region -verify %s -Wno-error=return-type
+// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare 
-analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region 
-analyzer-purge=none -verify %s -Wno-error=return-type
+// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-Wno-tautological-constant-compare -Wtautological-unsigned-zero-compare 
-analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region 
-verify %s -Wno-error=return-type
 
 typedef unsigned uintptr_t;
 


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


Re: r315614 - [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Nico Weber via cfe-commits
Huh, I consider clang not warning on this a feature, not a bug. Why are we
trying to match what gcc does here?

Say you have code like this:

int64_t aligned_start = 0;
int64_t aligned_size = 0;
CalculateVMAlignedBoundaries(region.offset,
 region.size,
 _start,
 _size,
 _offset);

// Ensure that the casts in the mmap call below are sane.
if (aligned_start < 0 || aligned_size < 0 ||
aligned_start > std::numeric_limits::max() ||
static_cast(aligned_size) >
std::numeric_limits::max() ||
static_cast(region.size) >
std::numeric_limits::max()) {
  DLOG(ERROR) << "Region bounds are not valid for mmap";
  return false;
}

This code works in 64-bit and 32-bit. off_t has different sizes on both, so
the comparison is useful. The warning uselessly fires on this code.

On Thu, Oct 12, 2017 at 4:16 PM, Roman Lebedev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: lebedevri
> Date: Thu Oct 12 13:16:51 2017
> New Revision: 315614
>
> URL: http://llvm.org/viewvc/llvm-project?rev=315614=rev
> Log:
> [Sema] Diagnose tautological comparison with type's min/max values
>
> Summary:
> Currently, clang only diagnoses completely out-of-range comparisons (e.g.
> `char` and constant `300`),
> and comparisons of unsigned and `0`. But gcc also does diagnose the
> comparisons with the
> `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak
>
> Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
> Continuation of https://reviews.llvm.org/D37565
>
> Reviewers: rjmccall, rsmith, aaron.ballman
>
> Reviewed By: rsmith
>
> Subscribers: rtrieu, jroelofs, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D38101
>
> Added:
> cfe/trunk/test/Sema/tautological-constant-compare.c
> Modified:
> cfe/trunk/docs/ReleaseNotes.rst
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaChecking.cpp
> cfe/trunk/test/Sema/outof-range-constant-compare.c
> cfe/trunk/test/Sema/tautological-unsigned-zero-compare.c
>
> Modified: cfe/trunk/docs/ReleaseNotes.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/
> ReleaseNotes.rst?rev=315614=315613=315614=diff
> 
> ==
> --- cfe/trunk/docs/ReleaseNotes.rst (original)
> +++ cfe/trunk/docs/ReleaseNotes.rst Thu Oct 12 13:16:51 2017
> @@ -78,6 +78,10 @@ Improvements to Clang's diagnostics
>when the signed integer is coerced to an unsigned type for the
> comparison.
>``-Wsign-compare`` was adjusted not to warn in this case.
>
> +- ``-Wtautological-constant-compare`` is a new warning that warns on
> +  tautological comparisons between integer variable of the type ``T`` and
> the
> +  largest/smallest possible integer constant of that same type.
> +
>  - ``-Wnull-pointer-arithmetic`` now warns about performing pointer
> arithmetic
>on a null pointer. Such pointer arithmetic has an undefined behavior if
> the
>offset is nonzero. It also now warns about arithmetic on a null pointer
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/DiagnosticGroups.td?rev=315614=315613=315614=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Oct 12 13:16:51
> 2017
> @@ -432,13 +432,15 @@ def StrncatSize : DiagGroup<"strncat-siz
>  def TautologicalUnsignedZeroCompare : DiagGroup<"tautological-
> unsigned-zero-compare">;
>  def TautologicalUnsignedEnumZeroCompare : DiagGroup<"tautological-
> unsigned-enum-zero-compare">;
>  def TautologicalOutOfRangeCompare : DiagGroup<"tautological-
> constant-out-of-range-compare">;
> +def TautologicalConstantCompare : DiagGroup<"tautological-
> constant-compare",
> +[
> TautologicalUnsignedZeroCompare,
> +
>  TautologicalUnsignedEnumZeroCompare,
> +
>  TautologicalOutOfRangeCompare]>;
>  def TautologicalPointerCompare : DiagGroup<"tautological-
> pointer-compare">;
>  def TautologicalOverlapCompare : DiagGroup<"tautological-
> overlap-compare">;
>  def TautologicalUndefinedCompare : DiagGroup<"tautological-
> undefined-compare">;
>  def TautologicalCompare : DiagGroup<"tautological-compare",
> -[TautologicalUnsignedZeroCompare,
> - TautologicalUnsignedEnumZeroCompare,
> - TautologicalOutOfRangeCompare,
> +[TautologicalConstantCompare,
>   

[PATCH] D36111: [COFF, ARM64] Add MS builtins __dmb, __dsb, __isb

2017-10-12 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

This one can be abandoned now.


https://reviews.llvm.org/D36111



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


r315621 - [SemaChecking] Suppress a GCC warning. NFCI.

2017-10-12 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Oct 12 14:08:29 2017
New Revision: 315621

URL: http://llvm.org/viewvc/llvm-project?rev=315621=rev
Log:
[SemaChecking] Suppress a GCC warning. NFCI.

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=315621=315620=315621=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Oct 12 14:08:29 2017
@@ -8652,7 +8652,8 @@ bool CheckTautologicalComparison(Sema 
 
   bool ConstIsLowerBound = (Op == BO_LT || Op == BO_LE) ^ RhsConstant;
   bool ResultWhenConstEqualsOther = (Op == BO_LE || Op == BO_GE);
-  bool ResultWhenConstNeOther = ConstIsLowerBound ^ ValueType == 
LimitType::Max;
+  bool ResultWhenConstNeOther =
+  ConstIsLowerBound ^ (ValueType == LimitType::Max);
   if (ResultWhenConstEqualsOther != ResultWhenConstNeOther)
 return false; // The comparison is not tautological.
 


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


[PATCH] D38680: [libunwind] Fix handling of DW_CFA_GNU_args_size

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

lgtm




Comment at: src/libunwind.cpp:188
+  co->getInfo();
+  pint_t orgArgSize = (pint_t)info.gp;
+  uint64_t orgFuncStart = info.start_ip;

mstorsjo wrote:
> rnk wrote:
> > I think it makes sense to have this here: the contract is that if the 
> > personality sets the IP when the cursor pointed to a PC with a non-zero arg 
> > size, we should adjust SP for the personality.
> > 
> > However, it's not clear to me that we don't need the same adjustment when 
> > stepping across frames that use arg size without a frame pointer.
> When stepping across frames, the gnu args size is already included in, as 
> part of the CFA offset, so with the current code, it steps too far.
OK, yes, now I see the code that does that. :)


https://reviews.llvm.org/D38680



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


[PATCH] D38840: [compiler-rt] [cmake] [asan] Remove unnecessary gtest dep from dynamic tests

2017-10-12 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315620: [cmake] [asan] Remove unnecessary gtest dep from 
dynamic tests (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D38840?vs=118826=118842#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38840

Files:
  compiler-rt/trunk/lib/asan/tests/CMakeLists.txt


Index: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
===
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
@@ -205,7 +205,7 @@
   add_compiler_rt_test(AsanDynamicUnitTests "${dynamic_test_name}" 
"${arch}"
 SUBDIR "dynamic"
 OBJECTS ${ASAN_INST_TEST_OBJECTS}
-DEPS gtest asan ${ASAN_INST_TEST_OBJECTS}
+DEPS asan ${ASAN_INST_TEST_OBJECTS}
 LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS}
 )
 endif()


Index: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
===
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
@@ -205,7 +205,7 @@
   add_compiler_rt_test(AsanDynamicUnitTests "${dynamic_test_name}" "${arch}"
 SUBDIR "dynamic"
 OBJECTS ${ASAN_INST_TEST_OBJECTS}
-DEPS gtest asan ${ASAN_INST_TEST_OBJECTS}
+DEPS asan ${ASAN_INST_TEST_OBJECTS}
 LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS}
 )
 endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38425: [clangd] Document highlights for clangd

2017-10-12 Thread William Enright via Phabricator via cfe-commits
Nebiroth updated this revision to Diff 118838.
Nebiroth marked an inline comment as done.
Nebiroth added a comment.

Addressed review comments.
Fixed some tests not having updated providers.
Removed TargetDeclarationFinder for less code reuse.
DocumentHighlight struct is now unparsed correctly.


https://reviews.llvm.org/D38425

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  test/clangd/documenthighlight.test
  test/clangd/initialize-params-invalid.test
  test/clangd/initialize-params.test

Index: test/clangd/initialize-params.test
===
--- test/clangd/initialize-params.test
+++ test/clangd/initialize-params.test
@@ -5,18 +5,21 @@
 Content-Length: 143
 
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootUri":"file:///path/to/workspace","capabilities":{},"trace":"off"}}
-# CHECK: Content-Length: 535
+# CHECK: Content-Length: 580
 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{
 # CHECK:   "textDocumentSync": 1,
 # CHECK:   "documentFormattingProvider": true,
 # CHECK:   "documentRangeFormattingProvider": true,
 # CHECK:   "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]},
 # CHECK:   "codeActionProvider": true,
 # CHECK:   "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">",":"]},
 # CHECK:   "signatureHelpProvider": {"triggerCharacters": ["(",","]},
-# CHECK:   "definitionProvider": true
+# CHECK:   "definitionProvider": true,
+# CHECK:   "documentHighlightProvider": true
 # CHECK: }}}
 #
 Content-Length: 44
 
 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
+
+
Index: test/clangd/initialize-params-invalid.test
===
--- test/clangd/initialize-params-invalid.test
+++ test/clangd/initialize-params-invalid.test
@@ -5,16 +5,17 @@
 Content-Length: 142
 
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":"","rootUri":"file:///path/to/workspace","capabilities":{},"trace":"off"}}
-# CHECK: Content-Length: 535
+# CHECK: Content-Length: 580
 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{
 # CHECK:   "textDocumentSync": 1,
 # CHECK:   "documentFormattingProvider": true,
 # CHECK:   "documentRangeFormattingProvider": true,
 # CHECK:   "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]},
 # CHECK:   "codeActionProvider": true,
 # CHECK:   "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">",":"]},
 # CHECK:   "signatureHelpProvider": {"triggerCharacters": ["(",","]},
-# CHECK:   "definitionProvider": true
+# CHECK:   "definitionProvider": true,
+# CHECK:   "documentHighlightProvider": true
 # CHECK: }}}
 #
 Content-Length: 44
Index: test/clangd/documenthighlight.test
===
--- /dev/null
+++ test/clangd/documenthighlight.test
@@ -0,0 +1,42 @@
+# RUN: clangd -run-synchronously < %s | FileCheck %s
+# It is absolutely vital that this file has CRLF line endings.
+#
+Content-Length: 125
+
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+# CHECK: Content-Length: 580
+# CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{
+# CHECK:   "textDocumentSync": 1,
+# CHECK:   "documentFormattingProvider": true,
+# CHECK:   "documentRangeFormattingProvider": true,
+# CHECK:   "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]},
+# CHECK:   "codeActionProvider": true,
+# CHECK:   "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">",":"]},
+# CHECK:   "signatureHelpProvider": {"triggerCharacters": ["(",","]},
+# CHECK:   "definitionProvider": true,
+# CHECK:   "documentHighlightProvider": true
+# CHECK: }}}
+#
+
+Content-Length: 455
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#define MACRO 1\nnamespace ns1 {\nstruct MyClass {\nint xasd;\nvoid anotherOperation() {\n}\nstatic int foo(MyClass*) {\nreturn 0;\n}\n\n};\nstruct Foo {\nint xasd;\n};\n}\nint main() {\nint bonjour;\nbonjour = 2;\nns1::Foo bar = { xasd : 1};\nbar.xasd = 3;\nns1::MyClass* Params;\nParams->anotherOperation();}\n"}}}
+
+Content-Length: 156
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":17,"character":2}}}
+# Go to local variable
+# CHECK: {"jsonrpc":"2.0","id":1,"result":[{"range": {"start": {"line": 16, "character": 4}, "end": {"line": 16, "character": 12}}, "kind": 1},{"range": {"start": {"line": 17, "character": 0}, "end": {"line": 17, 

r315615 - [Analysis] Silence -Wtautological-constant-compare in two tests

2017-10-12 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Thu Oct 12 13:27:41 2017
New Revision: 315615

URL: http://llvm.org/viewvc/llvm-project?rev=315615=rev
Log:
[Analysis] Silence -Wtautological-constant-compare in two tests

Yes, did not check that. Need to do better :(
I do not believe it makes sense to do expect that warning here.

Modified:
cfe/trunk/test/Analysis/conversion.c
cfe/trunk/test/Analysis/null-deref-ps.c

Modified: cfe/trunk/test/Analysis/conversion.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/conversion.c?rev=315615=315614=315615=diff
==
--- cfe/trunk/test/Analysis/conversion.c (original)
+++ cfe/trunk/test/Analysis/conversion.c Thu Oct 12 13:27:41 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -Wno-conversion 
-analyzer-checker=core,alpha.core.Conversion -verify %s
+// RUN: %clang_analyze_cc1 -Wno-conversion -Wno-tautological-constant-compare 
-analyzer-checker=core,alpha.core.Conversion -verify %s
 
 unsigned char U8;
 signed char S8;

Modified: cfe/trunk/test/Analysis/null-deref-ps.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/null-deref-ps.c?rev=315615=315614=315615=diff
==
--- cfe/trunk/test/Analysis/null-deref-ps.c (original)
+++ cfe/trunk/test/Analysis/null-deref-ps.c Thu Oct 12 13:27:41 2017
@@ -1,5 +1,5 @@
-// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region 
-analyzer-purge=none -verify %s -Wno-error=return-type
-// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-analyzer-checker=core,deadcode,alpha.core -std=gnu99 -analyzer-store=region 
-verify %s -Wno-error=return-type
+// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-Wno-tautological-constant-compare -analyzer-checker=core,deadcode,alpha.core 
-std=gnu99 -analyzer-store=region -analyzer-purge=none -verify %s 
-Wno-error=return-type
+// RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 
-Wno-tautological-constant-compare -analyzer-checker=core,deadcode,alpha.core 
-std=gnu99 -analyzer-store=region -verify %s -Wno-error=return-type
 
 typedef unsigned uintptr_t;
 


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


[PATCH] D38840: [compiler-rt] [cmake] [asan] Remove unnecessary gtest dep from dynamic tests

2017-10-12 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision.
george.karpenkov added a comment.
This revision is now accepted and ready to land.

LGTM, provided tests pass both in standalone and "normal" modes.


https://reviews.llvm.org/D38840



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


[PATCH] D38816: Convert clang::LangAS to a strongly typed enum

2017-10-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: include/clang/Basic/AddressSpaces.h:66
 
+inline LangAS LangASFromTargetAS(unsigned TargetAS) {
+  return static_cast((TargetAS) +

how about `getLangASFromTargetAS` ? It is preferred to start with small letters.



Comment at: tools/libclang/CXType.cpp:402
+  ASTContext  = cxtu::getASTUnit(GetTU(CT))->getASTContext();
+  return Ctx.getTargetAddressSpace(T);
 }

Is this function suppose to return AST address space or target address space?

Some targets e.g. x86 maps all AST address spaces to 0. Returning target 
address space will not let the client unable to differentiate different address 
spaces in the source language.


https://reviews.llvm.org/D38816



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


[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315614: [Sema] Diagnose tautological comparison with type's 
min/max values (authored by lebedevri).

Changed prior to commit:
  https://reviews.llvm.org/D38101?vs=118833=118835#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38101

Files:
  cfe/trunk/docs/ReleaseNotes.rst
  cfe/trunk/include/clang/Basic/DiagnosticGroups.td
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/test/Sema/outof-range-constant-compare.c
  cfe/trunk/test/Sema/tautological-constant-compare.c
  cfe/trunk/test/Sema/tautological-unsigned-zero-compare.c

Index: cfe/trunk/docs/ReleaseNotes.rst
===
--- cfe/trunk/docs/ReleaseNotes.rst
+++ cfe/trunk/docs/ReleaseNotes.rst
@@ -78,6 +78,10 @@
   when the signed integer is coerced to an unsigned type for the comparison.
   ``-Wsign-compare`` was adjusted not to warn in this case.
 
+- ``-Wtautological-constant-compare`` is a new warning that warns on
+  tautological comparisons between integer variable of the type ``T`` and the
+  largest/smallest possible integer constant of that same type.
+
 - ``-Wnull-pointer-arithmetic`` now warns about performing pointer arithmetic
   on a null pointer. Such pointer arithmetic has an undefined behavior if the
   offset is nonzero. It also now warns about arithmetic on a null pointer
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5938,18 +5938,18 @@
   "member function %q1 is declared const here|"
   "%select{|nested }1data member %2 declared const here}0">;
 
-def warn_lunsigned_always_true_comparison : Warning<
-  "comparison of unsigned expression %0 is always %select{false|true}1">,
+def warn_unsigned_always_true_comparison : Warning<
+  "comparison of %select{%3|unsigned expression}0 %2 "
+  "%select{unsigned expression|%3}0 is always %select{false|true}4">,
   InGroup;
-def warn_runsigned_always_true_comparison : Warning<
-  "comparison of %0 unsigned expression is always %select{false|true}1">,
-  InGroup;
-def warn_lunsigned_enum_always_true_comparison : Warning<
-  "comparison of unsigned enum expression %0 is always %select{false|true}1">,
-  InGroup;
-def warn_runsigned_enum_always_true_comparison : Warning<
-  "comparison of %0 unsigned enum expression is always %select{false|true}1">,
+def warn_unsigned_enum_always_true_comparison : Warning<
+  "comparison of %select{%3|unsigned enum expression}0 %2 "
+  "%select{unsigned enum expression|%3}0 is always %select{false|true}4">,
   InGroup;
+def warn_tautological_constant_compare : Warning<
+  "comparison %select{%3|%1}0 %2 "
+  "%select{%1|%3}0 is always %select{false|true}4">,
+  InGroup;
 
 def warn_mixed_sign_comparison : Warning<
   "comparison of integers of different signs: %0 and %1">,
Index: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td
@@ -432,13 +432,15 @@
 def TautologicalUnsignedZeroCompare : DiagGroup<"tautological-unsigned-zero-compare">;
 def TautologicalUnsignedEnumZeroCompare : DiagGroup<"tautological-unsigned-enum-zero-compare">;
 def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">;
+def TautologicalConstantCompare : DiagGroup<"tautological-constant-compare",
+[TautologicalUnsignedZeroCompare,
+ TautologicalUnsignedEnumZeroCompare,
+ TautologicalOutOfRangeCompare]>;
 def TautologicalPointerCompare : DiagGroup<"tautological-pointer-compare">;
 def TautologicalOverlapCompare : DiagGroup<"tautological-overlap-compare">;
 def TautologicalUndefinedCompare : DiagGroup<"tautological-undefined-compare">;
 def TautologicalCompare : DiagGroup<"tautological-compare",
-[TautologicalUnsignedZeroCompare,
- TautologicalUnsignedEnumZeroCompare,
- TautologicalOutOfRangeCompare,
+[TautologicalConstantCompare,
  TautologicalPointerCompare,
  TautologicalOverlapCompare,
  TautologicalUndefinedCompare]>;
Index: cfe/trunk/test/Sema/outof-range-constant-compare.c
===
--- cfe/trunk/test/Sema/outof-range-constant-compare.c
+++ cfe/trunk/test/Sema/outof-range-constant-compare.c
@@ -7,58 +7,6 @@
 {
 int a = value();
 
-if (a == 

r315614 - [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Thu Oct 12 13:16:51 2017
New Revision: 315614

URL: http://llvm.org/viewvc/llvm-project?rev=315614=rev
Log:
[Sema] Diagnose tautological comparison with type's min/max values

Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. 
`char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons 
with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: rtrieu, jroelofs, cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/Sema/tautological-constant-compare.c
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/outof-range-constant-compare.c
cfe/trunk/test/Sema/tautological-unsigned-zero-compare.c

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=315614=315613=315614=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Thu Oct 12 13:16:51 2017
@@ -78,6 +78,10 @@ Improvements to Clang's diagnostics
   when the signed integer is coerced to an unsigned type for the comparison.
   ``-Wsign-compare`` was adjusted not to warn in this case.
 
+- ``-Wtautological-constant-compare`` is a new warning that warns on
+  tautological comparisons between integer variable of the type ``T`` and the
+  largest/smallest possible integer constant of that same type.
+
 - ``-Wnull-pointer-arithmetic`` now warns about performing pointer arithmetic
   on a null pointer. Such pointer arithmetic has an undefined behavior if the
   offset is nonzero. It also now warns about arithmetic on a null pointer

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=315614=315613=315614=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Oct 12 13:16:51 2017
@@ -432,13 +432,15 @@ def StrncatSize : DiagGroup<"strncat-siz
 def TautologicalUnsignedZeroCompare : 
DiagGroup<"tautological-unsigned-zero-compare">;
 def TautologicalUnsignedEnumZeroCompare : 
DiagGroup<"tautological-unsigned-enum-zero-compare">;
 def TautologicalOutOfRangeCompare : 
DiagGroup<"tautological-constant-out-of-range-compare">;
+def TautologicalConstantCompare : DiagGroup<"tautological-constant-compare",
+[TautologicalUnsignedZeroCompare,
+ 
TautologicalUnsignedEnumZeroCompare,
+ TautologicalOutOfRangeCompare]>;
 def TautologicalPointerCompare : DiagGroup<"tautological-pointer-compare">;
 def TautologicalOverlapCompare : DiagGroup<"tautological-overlap-compare">;
 def TautologicalUndefinedCompare : DiagGroup<"tautological-undefined-compare">;
 def TautologicalCompare : DiagGroup<"tautological-compare",
-[TautologicalUnsignedZeroCompare,
- TautologicalUnsignedEnumZeroCompare,
- TautologicalOutOfRangeCompare,
+[TautologicalConstantCompare,
  TautologicalPointerCompare,
  TautologicalOverlapCompare,
  TautologicalUndefinedCompare]>;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=315614=315613=315614=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Oct 12 13:16:51 
2017
@@ -5938,18 +5938,18 @@ def note_typecheck_assign_const : Note<
   "member function %q1 is declared const here|"
   "%select{|nested }1data member %2 declared const here}0">;
 
-def warn_lunsigned_always_true_comparison : Warning<
-  "comparison of unsigned expression %0 is always %select{false|true}1">,
+def warn_unsigned_always_true_comparison : Warning<
+  "comparison of %select{%3|unsigned expression}0 %2 "
+  "%select{unsigned expression|%3}0 is always %select{false|true}4">,
   InGroup;
-def warn_runsigned_always_true_comparison : Warning<
-  "comparison of %0 unsigned expression is always 

[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 118833.
lebedev.ri added a comment.

Getting really weird problems when trying to use arc patch, maybe re-updating 
the differential helps


Repository:
  rL LLVM

https://reviews.llvm.org/D38101

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/Sema/outof-range-constant-compare.c
  test/Sema/tautological-constant-compare.c
  test/Sema/tautological-unsigned-zero-compare.c

Index: test/Sema/tautological-unsigned-zero-compare.c
===
--- test/Sema/tautological-unsigned-zero-compare.c
+++ test/Sema/tautological-unsigned-zero-compare.c
@@ -1,47 +1,370 @@
 // RUN: %clang_cc1 -fsyntax-only -DTEST -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wno-tautological-unsigned-zero-compare -verify %s
+// RUN: %clang_cc1 -fsyntax-only -DTEST -verify -x c++ %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-tautological-unsigned-zero-compare -verify -x c++ %s
 
-unsigned value(void);
+unsigned uvalue(void);
+signed int svalue(void);
 
-int main() {
-  unsigned un = value();
+#define macro(val) val
+
+#ifdef __cplusplus
+template
+void TFunc() {
+  // Make sure that we do warn for normal variables in template functions !
+  unsigned char c = svalue();
+#ifdef TEST
+  if (c < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+  return;
+#else
+  if (c < 0)
+  return;
+#endif
+
+  if (c < macro(0))
+  return;
+
+  T v = svalue();
+  if (v < 0)
+  return;
+}
+#endif
+
+int main()
+{
+#ifdef __cplusplus
+  TFunc();
+  TFunc();
+#endif
+
+  unsigned un = uvalue();
 
 #ifdef TEST
+  if (un == 0)
+  return 0;
+  if (un != 0)
+  return 0;
   if (un < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
-return 0;
+  return 0;
+  if (un <= 0)
+  return 0;
+  if (un > 0)
+  return 0;
   if (un >= 0) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
-return 0;
+  return 0;
+
+  if (0 == un)
+  return 0;
+  if (0 != un)
+  return 0;
+  if (0 < un)
+  return 0;
   if (0 <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
-return 0;
+  return 0;
   if (0 > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
-return 0;
-  if (un < 0U) // expected-warning {{comparison of unsigned expression < 0 is always false}}
-return 0;
-  if (un >= 0U) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
-return 0;
-  if (0U <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
-return 0;
-  if (0U > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
-return 0;
+  return 0;
+  if (0 >= un)
+  return 0;
+
+  if (un == 0UL)
+  return 0;
+  if (un != 0UL)
+  return 0;
+  if (un < 0UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+  return 0;
+  if (un <= 0UL)
+  return 0;
+  if (un > 0UL)
+  return 0;
+  if (un >= 0UL) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
+  return 0;
+
+  if (0UL == un)
+  return 0;
+  if (0UL != un)
+  return 0;
+  if (0UL < un)
+  return 0;
+  if (0UL <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
+  return 0;
+  if (0UL > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
+  return 0;
+  if (0UL >= un)
+  return 0;
 #else
 // expected-no-diagnostics
+  if (un == 0)
+  return 0;
+  if (un != 0)
+  return 0;
   if (un < 0)
-return 0;
+  return 0;
+  if (un <= 0)
+  return 0;
+  if (un > 0)
+  return 0;
   if (un >= 0)
-return 0;
+  return 0;
+
+  if (0 == un)
+  return 0;
+  if (0 != un)
+  return 0;
+  if (0 < un)
+  return 0;
   if (0 <= un)
-return 0;
+  return 0;
   if (0 > un)
-return 0;
-  if (un < 0U)
-return 0;
-  if (un >= 0U)
-return 0;
-  if (0U <= un)
-return 0;
-  if (0U > un)
-return 0;
+  return 0;
+  if (0 >= un)
+  return 0;
+
+  if (un == 0UL)
+  return 0;
+  if (un != 0UL)
+  return 0;
+  if (un < 0UL)
+  return 0;
+  if (un <= 0UL)
+  return 0;
+  if (un > 0UL)
+  return 0;
+  if (un >= 0UL)
+  return 0;
+
+  if (0UL == un)
+  return 0;
+  if (0UL != un)
+  return 0;
+  if (0UL < un)
+  return 0;
+  if (0UL <= un)
+  return 0;
+  if (0UL > un)
+  return 0;
+  if (0UL >= un)
+  return 0;
 #endif
 
+
+  signed int a = svalue();
+
+#ifdef TEST
+  if (a == 0)
+  return 0;
+  if (a != 0)
+  return 0;
+  if (a < 0)
+  return 0;
+  if (a <= 0)
+  return 0;
+  if (a > 0)
+  return 0;
+  if (a >= 0)
+  return 0;
+
+  if (0 == a)
+  return 0;
+  if (0 != a)
+  

r315611 - [OPENMP] Fix PR34927: Emit initializer for reduction array with declare

2017-10-12 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Oct 12 13:03:39 2017
New Revision: 315611

URL: http://llvm.org/viewvc/llvm-project?rev=315611=rev
Log:
[OPENMP] Fix PR34927: Emit initializer for reduction array with declare
reduction.

If the reduction is an array or an array section and reduction operation
is declare reduction without initializer, it may lead to crash.

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/test/OpenMP/declare_reduction_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=315611=315610=315611=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Oct 12 13:03:39 2017
@@ -786,7 +786,8 @@ static void emitInitWithReductionInitial
 /// \param Init Initial expression of array.
 /// \param SrcAddr Address of the original array.
 static void EmitOMPAggregateInit(CodeGenFunction , Address DestAddr,
- QualType Type, const Expr *Init,
+ QualType Type, bool EmitDeclareReductionInit,
+ const Expr *Init,
  const OMPDeclareReductionDecl *DRD,
  Address SrcAddr = Address::invalid()) {
   // Perform element-by-element initialization.
@@ -840,7 +841,7 @@ static void EmitOMPAggregateInit(CodeGen
   // Emit copy.
   {
 CodeGenFunction::RunCleanupsScope InitScope(CGF);
-if (DRD && (DRD->getInitializer() || !Init)) {
+if (EmitDeclareReductionInit) {
   emitInitWithReductionInitializer(CGF, DRD, Init, DestElementCurrent,
SrcElementCurrent, ElementTy);
 } else
@@ -887,8 +888,12 @@ void ReductionCodeGen::emitAggregateInit
   // captured region.
   auto *PrivateVD =
   cast(cast(ClausesData[N].Private)->getDecl());
+  bool EmitDeclareReductionInit =
+  DRD && (DRD->getInitializer() || !PrivateVD->hasInit());
   EmitOMPAggregateInit(CGF, PrivateAddr, PrivateVD->getType(),
-   DRD ? ClausesData[N].ReductionOp : PrivateVD->getInit(),
+   EmitDeclareReductionInit,
+   EmitDeclareReductionInit ? ClausesData[N].ReductionOp
+: PrivateVD->getInit(),
DRD, SharedLVal.getAddress());
 }
 

Modified: cfe/trunk/test/OpenMP/declare_reduction_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_reduction_codegen.cpp?rev=315611=315610=315611=diff
==
--- cfe/trunk/test/OpenMP/declare_reduction_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_reduction_codegen.cpp Thu Oct 12 13:03:39 2017
@@ -9,6 +9,26 @@
 // CHECK: [[SSS_INT:.+]] = type { i32 }
 // CHECK-LOAD: [[SSS_INT:.+]] = type { i32 }
 
+// CHECK: add
+void add(short , short ) {}
+
+#pragma omp declare reduction(my_add : short : add(omp_out, omp_in))
+
+// CHECK: define internal void @.
+// CHECK: call void @{{.+}}add{{.+}}(
+// CHECK: ret void
+
+// CHECK: foo_reduction_array
+void foo_reduction_array() {
+  short y[1];
+  // CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) 
@__kmpc_fork_call(
+#pragma omp parallel for reduction(my_add : y)
+  for (int i = 0; i < 1; i++) {
+  }
+}
+
+// CHECK: define internal void @
+
 #pragma omp declare reduction(+ : int, char : omp_out *= omp_in)
 // CHECK: define internal {{.*}}void @{{[^(]+}}(i32* noalias, i32* noalias)
 // CHECK: [[MUL:%.+]] = mul nsw i32


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


[PATCH] D38859: [clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

2017-10-12 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap created this revision.
Herald added a subscriber: mgorny.

At the moment if LLVM_BUILD_INSTRUMENTED is set to True 
one has to set LLVM_PROFTDATA even if it's not necessary (because of 
message(FATAL_ERROR ...)). 
Building instrumented Clang is useful even if one doesn't plan to use the 
target generate-profdata
(currently that target would use only 
llvm/tools/clang/utils/perf-training/cxx/hello_world.cpp as a source).
For example, one can run the instrumented version of Clang via a separate build 
system against a different codebase, 
collect the profiles and merge them by lllvm-profdata later.


Repository:
  rL LLVM

https://reviews.llvm.org/D38859

Files:
  utils/perf-training/CMakeLists.txt


Index: utils/perf-training/CMakeLists.txt
===
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -30,13 +30,18 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to 
use for merging PGO data")
+set(LLVM_PROFDATA ${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+message(STATUS "LLVM_PROFDATA is set to point to llvm-profdata built from 
the sources")
+set(GENERATE_PROFDATA_DEPENDS_ON_LLVM_PROFTDATA TRUE)
   endif()
-
+  
   add_custom_target(generate-profdata
 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py 
merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata 
${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Merging profdata"
 DEPENDS generate-profraw)
+  if (GENERATE_PROFDATA_DEPENDS_ON_LLVM_PROFTDATA)
+add_dependencies(generate-profdata llvm-profdata)
+  endif()
 endif()
 
 find_program(DTRACE dtrace)


Index: utils/perf-training/CMakeLists.txt
===
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -30,13 +30,18 @@
   endif()
 
   if(NOT LLVM_PROFDATA)
-message(FATAL_ERROR "Must set LLVM_PROFDATA to point to llvm-profdata to use for merging PGO data")
+set(LLVM_PROFDATA ${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+message(STATUS "LLVM_PROFDATA is set to point to llvm-profdata built from the sources")
+set(GENERATE_PROFDATA_DEPENDS_ON_LLVM_PROFTDATA TRUE)
   endif()
-
+  
   add_custom_target(generate-profdata
 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Merging profdata"
 DEPENDS generate-profraw)
+  if (GENERATE_PROFDATA_DEPENDS_ON_LLVM_PROFTDATA)
+add_dependencies(generate-profdata llvm-profdata)
+  endif()
 endif()
 
 find_program(DTRACE dtrace)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: lib/Sema/SemaChecking.cpp:8930
+// We only care about expressions where just one side is literal
+if (IsRHSIntegralLiteral ^ IsLHSIntegralLiteral) {
+  // Is the constant on the RHS or LHS?

rsmith wrote:
> It would probably be more obvious to use `||` here, since you already 
> returned in the case where both sides are constant.
And what if neither of them is constant?
I *think* we could reach this point in that case.
At least it is not immediately obvious to me why it can't happen.


Repository:
  rL LLVM

https://reviews.llvm.org/D38101



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


[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 118829.
lebedev.ri marked an inline comment as done.

Repository:
  rL LLVM

https://reviews.llvm.org/D38101

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/Sema/outof-range-constant-compare.c
  test/Sema/tautological-constant-compare.c
  test/Sema/tautological-unsigned-zero-compare.c

Index: test/Sema/tautological-unsigned-zero-compare.c
===
--- test/Sema/tautological-unsigned-zero-compare.c
+++ test/Sema/tautological-unsigned-zero-compare.c
@@ -1,47 +1,370 @@
 // RUN: %clang_cc1 -fsyntax-only -DTEST -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wno-tautological-unsigned-zero-compare -verify %s
+// RUN: %clang_cc1 -fsyntax-only -DTEST -verify -x c++ %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-tautological-unsigned-zero-compare -verify -x c++ %s
 
-unsigned value(void);
+unsigned uvalue(void);
+signed int svalue(void);
 
-int main() {
-  unsigned un = value();
+#define macro(val) val
+
+#ifdef __cplusplus
+template
+void TFunc() {
+  // Make sure that we do warn for normal variables in template functions !
+  unsigned char c = svalue();
+#ifdef TEST
+  if (c < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+  return;
+#else
+  if (c < 0)
+  return;
+#endif
+
+  if (c < macro(0))
+  return;
+
+  T v = svalue();
+  if (v < 0)
+  return;
+}
+#endif
+
+int main()
+{
+#ifdef __cplusplus
+  TFunc();
+  TFunc();
+#endif
+
+  unsigned un = uvalue();
 
 #ifdef TEST
+  if (un == 0)
+  return 0;
+  if (un != 0)
+  return 0;
   if (un < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
-return 0;
+  return 0;
+  if (un <= 0)
+  return 0;
+  if (un > 0)
+  return 0;
   if (un >= 0) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
-return 0;
+  return 0;
+
+  if (0 == un)
+  return 0;
+  if (0 != un)
+  return 0;
+  if (0 < un)
+  return 0;
   if (0 <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
-return 0;
+  return 0;
   if (0 > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
-return 0;
-  if (un < 0U) // expected-warning {{comparison of unsigned expression < 0 is always false}}
-return 0;
-  if (un >= 0U) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
-return 0;
-  if (0U <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
-return 0;
-  if (0U > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
-return 0;
+  return 0;
+  if (0 >= un)
+  return 0;
+
+  if (un == 0UL)
+  return 0;
+  if (un != 0UL)
+  return 0;
+  if (un < 0UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+  return 0;
+  if (un <= 0UL)
+  return 0;
+  if (un > 0UL)
+  return 0;
+  if (un >= 0UL) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
+  return 0;
+
+  if (0UL == un)
+  return 0;
+  if (0UL != un)
+  return 0;
+  if (0UL < un)
+  return 0;
+  if (0UL <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
+  return 0;
+  if (0UL > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
+  return 0;
+  if (0UL >= un)
+  return 0;
 #else
 // expected-no-diagnostics
+  if (un == 0)
+  return 0;
+  if (un != 0)
+  return 0;
   if (un < 0)
-return 0;
+  return 0;
+  if (un <= 0)
+  return 0;
+  if (un > 0)
+  return 0;
   if (un >= 0)
-return 0;
+  return 0;
+
+  if (0 == un)
+  return 0;
+  if (0 != un)
+  return 0;
+  if (0 < un)
+  return 0;
   if (0 <= un)
-return 0;
+  return 0;
   if (0 > un)
-return 0;
-  if (un < 0U)
-return 0;
-  if (un >= 0U)
-return 0;
-  if (0U <= un)
-return 0;
-  if (0U > un)
-return 0;
+  return 0;
+  if (0 >= un)
+  return 0;
+
+  if (un == 0UL)
+  return 0;
+  if (un != 0UL)
+  return 0;
+  if (un < 0UL)
+  return 0;
+  if (un <= 0UL)
+  return 0;
+  if (un > 0UL)
+  return 0;
+  if (un >= 0UL)
+  return 0;
+
+  if (0UL == un)
+  return 0;
+  if (0UL != un)
+  return 0;
+  if (0UL < un)
+  return 0;
+  if (0UL <= un)
+  return 0;
+  if (0UL > un)
+  return 0;
+  if (0UL >= un)
+  return 0;
 #endif
 
+
+  signed int a = svalue();
+
+#ifdef TEST
+  if (a == 0)
+  return 0;
+  if (a != 0)
+  return 0;
+  if (a < 0)
+  return 0;
+  if (a <= 0)
+  return 0;
+  if (a > 0)
+  return 0;
+  if (a >= 0)
+  return 0;
+
+  if (0 == a)
+  return 0;
+  if (0 != a)
+  return 0;
+  if (0 < a)
+  return 0;
+  if (0 <= a)
+  return 0;
+  if (0 > a)
+ 

[PATCH] D38840: [compiler-rt] [cmake] [asan] Remove unnecessary gtest dep from dynamic tests

2017-10-12 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 118826.
mgorny retitled this revision from "[compiler-rt] [cmake] [asan] Reuse 
generate_asan_tests for dynamic tests" to "[compiler-rt] [cmake] [asan] Remove 
unnecessary gtest dep from dynamic tests".
mgorny edited the summary of this revision.
mgorny added a comment.

Ok, here's another idea. Since the objects have been compiled already (and they 
explicitly depend on gtest via their own deps), let's just remove the 
extraneous gtest dep.


https://reviews.llvm.org/D38840

Files:
  lib/asan/tests/CMakeLists.txt


Index: lib/asan/tests/CMakeLists.txt
===
--- lib/asan/tests/CMakeLists.txt
+++ lib/asan/tests/CMakeLists.txt
@@ -205,7 +205,7 @@
   add_compiler_rt_test(AsanDynamicUnitTests "${dynamic_test_name}" 
"${arch}"
 SUBDIR "dynamic"
 OBJECTS ${ASAN_INST_TEST_OBJECTS}
-DEPS gtest asan ${ASAN_INST_TEST_OBJECTS}
+DEPS asan ${ASAN_INST_TEST_OBJECTS}
 LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS}
 )
 endif()


Index: lib/asan/tests/CMakeLists.txt
===
--- lib/asan/tests/CMakeLists.txt
+++ lib/asan/tests/CMakeLists.txt
@@ -205,7 +205,7 @@
   add_compiler_rt_test(AsanDynamicUnitTests "${dynamic_test_name}" "${arch}"
 SUBDIR "dynamic"
 OBJECTS ${ASAN_INST_TEST_OBJECTS}
-DEPS gtest asan ${ASAN_INST_TEST_OBJECTS}
+DEPS asan ${ASAN_INST_TEST_OBJECTS}
 LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS}
 )
 endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38101: [Sema] Diagnose tautological comparison with type's min/max values

2017-10-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Thanks, this looks great.




Comment at: lib/Sema/SemaChecking.cpp:8940
+  } else if (!T->hasUnsignedIntegerRepresentation())
+IsComparisonConstant = E->isIntegerConstantExpr(S.Context);
+

lebedev.ri wrote:
> rsmith wrote:
> > It seems suboptimal to evaluate both sides of the comparison and then 
> > evaluate the entire comparison again in this case. Presumably the point is 
> > to catch comparisons whose operands are not of integral type (eg, floating 
> > point), but we could get that benefit and also catch more integral cases by 
> > switching from `isIntegerConstantExpr` to the more appropriate 
> > `EvaluateAsRValue`.
> > 
> > I'm fine with a cleanup to avoid the repeated evaluation here being 
> > deferred to a later patch.
> If we look at this code closely, if `hasUnsignedIntegerRepresentation() == 
> false`, we always do `return AnalyzeImpConvsInComparison(S, E);`, regardless 
> of `E->isIntegerConstantExpr(S.Context)`.
> So if i move more stuff into `if (T->isIntegralType(S.Context))`, then ` 
> E->isIntegerConstantExpr(S.Context);` is simply gone.
> At least the current tests say so.
It looks like the old behavior was to suppress the 
`CheckTautologicalComparisonWithZero` diagnostics when:

* the comparison has a constant value, and
* the types being compared are not integral types, and
* the types being compared do not have an unsigned integer representation

However, `CheckTautologicalComparisonWithZero` only emits diagnostics for 
comparisons with integral types. So I think you're right that the old codepath 
that evaluated `E->isIntegerConstantExpr(S.Context)` was pointless.



Comment at: lib/Sema/SemaChecking.cpp:8924
 
-  // If this is a tautological comparison, suppress -Wsign-compare.
-  if (CheckTautologicalComparisonWithZero(S, E))
-return AnalyzeImpConvsInComparison(S, E);
+bool IsComparisonConstant = (IsRHSIntegralLiteral && IsLHSIntegralLiteral);
+// We don't care about expressions whose result is a constant.

I don't think this variable pulls its weight any more, especially given the 
adjacent comment. Inline its initializer into the `if` condition, maybe?



Comment at: lib/Sema/SemaChecking.cpp:8930
+// We only care about expressions where just one side is literal
+if (IsRHSIntegralLiteral ^ IsLHSIntegralLiteral) {
+  // Is the constant on the RHS or LHS?

It would probably be more obvious to use `||` here, since you already returned 
in the case where both sides are constant.


Repository:
  rL LLVM

https://reviews.llvm.org/D38101



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


r315607 - [X86] Add CLWB intrinsic. clang part

2017-10-12 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Oct 12 11:57:15 2017
New Revision: 315607

URL: http://llvm.org/viewvc/llvm-project?rev=315607=rev
Log:
[X86] Add CLWB intrinsic. clang part

Reviewers: RKSimon, zvi, igorb

Reviewed By: RKSimon

Subscribers: cfe-commits

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

Added:
cfe/trunk/lib/Headers/clwbintrin.h
cfe/trunk/test/CodeGen/builtin-clwb.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/CMakeLists.txt
cfe/trunk/lib/Headers/immintrin.h

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=315607=315606=315607=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Oct 12 11:57:15 2017
@@ -641,6 +641,9 @@ TARGET_BUILTIN(__builtin_ia32_xsaves, "v
 //CLFLUSHOPT
 TARGET_BUILTIN(__builtin_ia32_clflushopt, "vvC*", "", "clflushopt")
 
+//CLWB
+TARGET_BUILTIN(__builtin_ia32_clwb, "vvC*", "", "clwb")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "", "")

Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=315607=315606=315607=diff
==
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Thu Oct 12 11:57:15 2017
@@ -33,6 +33,7 @@ set(files
   clzerointrin.h
   cpuid.h
   clflushoptintrin.h
+  clwbintrin.h
   emmintrin.h
   f16cintrin.h
   float.h

Added: cfe/trunk/lib/Headers/clwbintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/clwbintrin.h?rev=315607=auto
==
--- cfe/trunk/lib/Headers/clwbintrin.h (added)
+++ cfe/trunk/lib/Headers/clwbintrin.h Thu Oct 12 11:57:15 2017
@@ -0,0 +1,52 @@
+/*=== clwbintrin.h - CLWB intrinsic ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef __CLWBINTRIN_H
+#define __CLWBINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  
__target__("clwb")))
+
+/// \brief Writes back to memory the cache line (if modified) that contains the
+/// linear address specified in \a __p from any level of the cache hierarchy in
+/// the cache coherence domain
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the  CLWB  instruction.
+///
+/// \param __p
+///A pointer to the memory location used to identify the cache line to be
+///written back.
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clwb(void const *__p) {
+  __builtin_ia32_clwb(__p);
+}
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif

Modified: cfe/trunk/lib/Headers/immintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=315607=315606=315607=diff
==
--- cfe/trunk/lib/Headers/immintrin.h (original)
+++ cfe/trunk/lib/Headers/immintrin.h Thu Oct 12 11:57:15 2017
@@ -58,6 +58,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLWB__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif

Added: cfe/trunk/test/CodeGen/builtin-clwb.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-clwb.c?rev=315607=auto

[PATCH] D38781: [X86] Add CLWB intrinsic. clang part

2017-10-12 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315607: [X86] Add CLWB intrinsic. clang part (authored by 
ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D38781?vs=118816=118822#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38781

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/CMakeLists.txt
  cfe/trunk/lib/Headers/clwbintrin.h
  cfe/trunk/lib/Headers/immintrin.h
  cfe/trunk/test/CodeGen/builtin-clwb.c

Index: cfe/trunk/lib/Headers/clwbintrin.h
===
--- cfe/trunk/lib/Headers/clwbintrin.h
+++ cfe/trunk/lib/Headers/clwbintrin.h
@@ -0,0 +1,52 @@
+/*=== clwbintrin.h - CLWB intrinsic ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef __CLWBINTRIN_H
+#define __CLWBINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("clwb")))
+
+/// \brief Writes back to memory the cache line (if modified) that contains the
+/// linear address specified in \a __p from any level of the cache hierarchy in
+/// the cache coherence domain
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the  CLWB  instruction.
+///
+/// \param __p
+///A pointer to the memory location used to identify the cache line to be
+///written back.
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clwb(void const *__p) {
+  __builtin_ia32_clwb(__p);
+}
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif
Index: cfe/trunk/lib/Headers/CMakeLists.txt
===
--- cfe/trunk/lib/Headers/CMakeLists.txt
+++ cfe/trunk/lib/Headers/CMakeLists.txt
@@ -33,6 +33,7 @@
   clzerointrin.h
   cpuid.h
   clflushoptintrin.h
+  clwbintrin.h
   emmintrin.h
   f16cintrin.h
   float.h
Index: cfe/trunk/lib/Headers/immintrin.h
===
--- cfe/trunk/lib/Headers/immintrin.h
+++ cfe/trunk/lib/Headers/immintrin.h
@@ -58,6 +58,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLWB__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif
Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -641,6 +641,9 @@
 //CLFLUSHOPT
 TARGET_BUILTIN(__builtin_ia32_clflushopt, "vvC*", "", "clflushopt")
 
+//CLWB
+TARGET_BUILTIN(__builtin_ia32_clwb, "vvC*", "", "clwb")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "", "")
Index: cfe/trunk/test/CodeGen/builtin-clwb.c
===
--- cfe/trunk/test/CodeGen/builtin-clwb.c
+++ cfe/trunk/test/CodeGen/builtin-clwb.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-apple-darwin -target-feature +clwb  -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include 
+
+void test_mm_clwb(const void *__m) {
+  //CHECK-LABEL: @test_mm_clwb
+  //CHECK: @llvm.x86.clwb
+  _mm_clwb(__m);
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38839: [compiler-rt] [cmake] [interception] Remove duplicate gtest from test COMPILE_DEPS

2017-10-12 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315605: [cmake] [interception] Remove duplicate gtest from 
test COMPILE_DEPS (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D38839?vs=118754=118821#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38839

Files:
  compiler-rt/trunk/lib/interception/tests/CMakeLists.txt


Index: compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
===
--- compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
@@ -89,7 +89,7 @@
 InterceptionUnitTests "Interception-${arch}-Test" ${arch}
 RUNTIME ${INTERCEPTION_COMMON_LIB}
 SOURCES ${INTERCEPTION_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
-COMPILE_DEPS gtest ${INTERCEPTION_TEST_HEADERS}
+COMPILE_DEPS ${INTERCEPTION_TEST_HEADERS}
 DEPS gtest
 CFLAGS ${INTERCEPTION_TEST_CFLAGS_COMMON}
 LINK_FLAGS ${INTERCEPTION_TEST_LINK_FLAGS_COMMON})


Index: compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
===
--- compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
@@ -89,7 +89,7 @@
 InterceptionUnitTests "Interception-${arch}-Test" ${arch}
 RUNTIME ${INTERCEPTION_COMMON_LIB}
 SOURCES ${INTERCEPTION_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
-COMPILE_DEPS gtest ${INTERCEPTION_TEST_HEADERS}
+COMPILE_DEPS ${INTERCEPTION_TEST_HEADERS}
 DEPS gtest
 CFLAGS ${INTERCEPTION_TEST_CFLAGS_COMMON}
 LINK_FLAGS ${INTERCEPTION_TEST_LINK_FLAGS_COMMON})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38838: [compiler-rt] [cmake] Fix skipping DEPS (typo) in sanitizer_test_compile()

2017-10-12 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315604: [cmake] Fix skipping DEPS (typo) in 
sanitizer_test_compile() (authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D38838?vs=118752=118820#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38838

Files:
  compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake


Index: compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
===
--- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
+++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
@@ -51,7 +51,7 @@
   endif()
   clang_compile(${output_obj} ${source}
 CFLAGS ${TEST_CFLAGS} ${TARGET_CFLAGS}
-DEPS ${TEST_COMPILE_DEPS})
+DEPS ${COMPILE_DEPS})
   list(APPEND ${obj_list} ${output_obj})
   set("${obj_list}" "${${obj_list}}" PARENT_SCOPE)
 endfunction()


Index: compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
===
--- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
+++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
@@ -51,7 +51,7 @@
   endif()
   clang_compile(${output_obj} ${source}
 CFLAGS ${TEST_CFLAGS} ${TARGET_CFLAGS}
-DEPS ${TEST_COMPILE_DEPS})
+DEPS ${COMPILE_DEPS})
   list(APPEND ${obj_list} ${output_obj})
   set("${obj_list}" "${${obj_list}}" PARENT_SCOPE)
 endfunction()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38857: [OpenCL] Improve printing and semantic check related to implicit addr space

2017-10-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.

There are two issues:

1. only (void*)0 should be treated as nullptr

2. only explicit addr space should be printed

This patch introduces a flag in Qualifier to indicating a non-default address 
space qualifier is deduced by context. Only
non-implicit address space qualifier will be print out when printing AST. It is 
also used to identify nullptr.

However this review does not rule out alternative approaches, e.g. using 
AttributedType. We will explore alternative approaches.


https://reviews.llvm.org/D38857

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/Type.h
  lib/AST/ASTContext.cpp
  lib/AST/Expr.cpp
  lib/AST/TypePrinter.cpp
  lib/Sema/SemaType.cpp
  test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
  test/SemaOpenCL/address-spaces.cl
  test/SemaOpenCL/atomic-ops.cl
  test/SemaOpenCL/invalid-block.cl
  test/SemaOpenCL/invalid-pipes-cl2.0.cl
  test/SemaOpenCL/null_literal.cl
  test/SemaOpenCL/vector_conv_invalid.cl
  test/SemaTemplate/address_space-dependent.cpp

Index: test/SemaTemplate/address_space-dependent.cpp
===
--- test/SemaTemplate/address_space-dependent.cpp
+++ test/SemaTemplate/address_space-dependent.cpp
@@ -43,7 +43,7 @@
 
 template 
 void tooBig() {
-  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388598)}}
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (4194294)}}
 }
 
 template 
@@ -101,7 +101,7 @@
   car<1, 2, 3>(); // expected-note {{in instantiation of function template specialization 'car<1, 2, 3>' requested here}}
   HasASTemplateFields<1> HASTF;
   neg<-1>(); // expected-note {{in instantiation of function template specialization 'neg<-1>' requested here}}
-  correct<0x76>();
+  correct<0x36>();
   tooBig<8388650>(); // expected-note {{in instantiation of function template specialization 'tooBig<8388650>' requested here}}
 
   __attribute__((address_space(1))) char *x;
Index: test/SemaOpenCL/vector_conv_invalid.cl
===
--- test/SemaOpenCL/vector_conv_invalid.cl
+++ test/SemaOpenCL/vector_conv_invalid.cl
@@ -16,7 +16,7 @@
   e = (constant int4)i;
   e = (private int4)i;
 
-  private int4 *private_ptr = (const private int4 *)const_global_ptr; // expected-error{{casting 'const __global int4 *' to type 'const int4 *' changes address space of pointer}}
+  private int4 *private_ptr = (const private int4 *)const_global_ptr; // expected-error{{casting 'const __global int4 *' to type 'const __private int4 *' changes address space of pointer}}
   global int4 *global_ptr = const_global_ptr; // expected-warning {{initializing '__global int4 *' with an expression of type 'const __global int4 *' discards qualifiers}}
   global_ptr = (global int4 *)const_global_ptr;
 }
Index: test/SemaOpenCL/null_literal.cl
===
--- test/SemaOpenCL/null_literal.cl
+++ test/SemaOpenCL/null_literal.cl
@@ -1,29 +1,68 @@
 // RUN: %clang_cc1 -verify %s
-// RUN: %clang_cc1 -cl-std=CL2.0 -DCL20 -verify %s
+// RUN: %clang_cc1 -cl-std=CL2.0 -verify %s
 
 #define NULL ((void*)0)
 
 void foo(){
+  global int *g1 = NULL;
+  global int *g2 = (global void *)0;
+  global int *g3 = (constant void *)0; // expected-error{{initializing '__global int *' with an expression of type '__constant void *' changes address space of pointer}}
+  global int *g4 = (local void *)0; // expected-error{{initializing '__global int *' with an expression of type '__local void *' changes address space of pointer}}
+  global int *g5 = (private void *)0; // expected-error{{initializing '__global int *' with an expression of type '__private void *' changes address space of pointer}}
 
-global int* ptr1 = NULL;
+  constant int *c1 = NULL;
+  constant int *c2 = (global void *)0; // expected-error{{initializing '__constant int *' with an expression of type '__global void *' changes address space of pointer}}
+  constant int *c3 = (constant void *)0;
+  constant int *c4 = (local void *)0; // expected-error{{initializing '__constant int *' with an expression of type '__local void *' changes address space of pointer}}
+  constant int *c5 = (private void *)0; // expected-error{{initializing '__constant int *' with an expression of type '__private void *' changes address space of pointer}}
 
-global int* ptr2 = (global void*)0;
+  local int *l1 = NULL;
+  local int *l2 = (global void *)0; // expected-error{{initializing '__local int *' with an expression of type '__global void *' changes address space of pointer}}
+  local int *l3 = (constant void *)0; // expected-error{{initializing '__local int *' with an expression of type '__constant void *' changes address space of pointer}}
+  local int *l4 = (local void *)0;
+  local int *l5 = (private void *)0; // 

[PATCH] D38781: [X86] Add CLWB intrinsic. clang part

2017-10-12 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

LGTM - one minor




Comment at: lib/Headers/clwbintrin.h:42
+///
+/// \param __p
+///A pointer to the memory location used to identify the cache line to be

\param __m


https://reviews.llvm.org/D38781



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


[PATCH] D38853: [clang-format] Allow building fuzzer with OSS-Fuzz flags.

2017-10-12 Thread Matt Morehouse via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL315603: [clang-format] Allow building fuzzer with OSS-Fuzz 
flags. (authored by morehouse).

Changed prior to commit:
  https://reviews.llvm.org/D38853?vs=118805=118819#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38853

Files:
  cfe/trunk/tools/clang-format/CMakeLists.txt
  cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt


Index: cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
===
--- cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
+++ cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
@@ -1,11 +1,15 @@
 set(LLVM_LINK_COMPONENTS support)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+if(LLVM_USE_SANITIZE_COVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+endif()
 
 add_clang_executable(clang-format-fuzzer
   EXCLUDE_FROM_ALL
   ClangFormatFuzzer.cpp
   )
 
 target_link_libraries(clang-format-fuzzer
-  ${CLANG_FORMAT_LIB_DEPS})
+  ${CLANG_FORMAT_LIB_DEPS}
+  ${LIB_FUZZING_ENGINE}
+  )
Index: cfe/trunk/tools/clang-format/CMakeLists.txt
===
--- cfe/trunk/tools/clang-format/CMakeLists.txt
+++ cfe/trunk/tools/clang-format/CMakeLists.txt
@@ -15,7 +15,7 @@
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LLVM_USE_SANITIZE_COVERAGE )
+if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 


Index: cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
===
--- cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
+++ cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
@@ -1,11 +1,15 @@
 set(LLVM_LINK_COMPONENTS support)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+if(LLVM_USE_SANITIZE_COVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+endif()
 
 add_clang_executable(clang-format-fuzzer
   EXCLUDE_FROM_ALL
   ClangFormatFuzzer.cpp
   )
 
 target_link_libraries(clang-format-fuzzer
-  ${CLANG_FORMAT_LIB_DEPS})
+  ${CLANG_FORMAT_LIB_DEPS}
+  ${LIB_FUZZING_ENGINE}
+  )
Index: cfe/trunk/tools/clang-format/CMakeLists.txt
===
--- cfe/trunk/tools/clang-format/CMakeLists.txt
+++ cfe/trunk/tools/clang-format/CMakeLists.txt
@@ -15,7 +15,7 @@
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LLVM_USE_SANITIZE_COVERAGE )
+if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r315603 - [clang-format] Allow building fuzzer with OSS-Fuzz flags.

2017-10-12 Thread Matt Morehouse via cfe-commits
Author: morehouse
Date: Thu Oct 12 11:39:10 2017
New Revision: 315603

URL: http://llvm.org/viewvc/llvm-project?rev=315603=rev
Log:
[clang-format] Allow building fuzzer with OSS-Fuzz flags.

Reviewers: kcc, bogner

Reviewed By: kcc

Subscribers: cfe-commits, mgorny

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

Modified:
cfe/trunk/tools/clang-format/CMakeLists.txt
cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt

Modified: cfe/trunk/tools/clang-format/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/CMakeLists.txt?rev=315603=315602=315603=diff
==
--- cfe/trunk/tools/clang-format/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-format/CMakeLists.txt Thu Oct 12 11:39:10 2017
@@ -15,7 +15,7 @@ target_link_libraries(clang-format
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LLVM_USE_SANITIZE_COVERAGE )
+if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 

Modified: cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt?rev=315603=315602=315603=diff
==
--- cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-format/fuzzer/CMakeLists.txt Thu Oct 12 11:39:10 2017
@@ -1,6 +1,8 @@
 set(LLVM_LINK_COMPONENTS support)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+if(LLVM_USE_SANITIZE_COVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+endif()
 
 add_clang_executable(clang-format-fuzzer
   EXCLUDE_FROM_ALL
@@ -8,4 +10,6 @@ add_clang_executable(clang-format-fuzzer
   )
 
 target_link_libraries(clang-format-fuzzer
-  ${CLANG_FORMAT_LIB_DEPS})
+  ${CLANG_FORMAT_LIB_DEPS}
+  ${LIB_FUZZING_ENGINE}
+  )


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


[PATCH] D35082: [OpenCL] Add LangAS::opencl_private to represent private address space in AST

2017-10-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 118813.
yaxunl marked 7 inline comments as done.
yaxunl edited the summary of this revision.
yaxunl added a comment.

Separate implicit addr space flag to another patch as John suggested.

This patch only introduces the private addr space but does not print it.


https://reviews.llvm.org/D35082

Files:
  include/clang/Basic/AddressSpaces.h
  lib/AST/ASTContext.cpp
  lib/AST/Expr.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/TypePrinter.cpp
  lib/Basic/Targets/AMDGPU.cpp
  lib/Basic/Targets/NVPTX.h
  lib/Basic/Targets/SPIR.h
  lib/Basic/Targets/TCE.h
  lib/CodeGen/CGDecl.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaType.cpp
  test/CodeGenOpenCL/address-spaces-mangling.cl
  test/CodeGenOpenCL/address-spaces.cl
  test/SemaOpenCL/address-spaces.cl
  test/SemaOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/extern.cl
  test/SemaOpenCL/storageclass-cl20.cl
  test/SemaOpenCL/storageclass.cl
  test/SemaTemplate/address_space-dependent.cpp

Index: test/SemaTemplate/address_space-dependent.cpp
===
--- test/SemaTemplate/address_space-dependent.cpp
+++ test/SemaTemplate/address_space-dependent.cpp
@@ -43,7 +43,7 @@
 
 template 
 void tooBig() {
-  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388599)}}
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388598)}}
 }
 
 template 
@@ -101,7 +101,7 @@
   car<1, 2, 3>(); // expected-note {{in instantiation of function template specialization 'car<1, 2, 3>' requested here}}
   HasASTemplateFields<1> HASTF;
   neg<-1>(); // expected-note {{in instantiation of function template specialization 'neg<-1>' requested here}}
-  correct<0x77>();
+  correct<0x76>();
   tooBig<8388650>(); // expected-note {{in instantiation of function template specialization 'tooBig<8388650>' requested here}}
 
   __attribute__((address_space(1))) char *x;
Index: test/SemaOpenCL/storageclass.cl
===
--- test/SemaOpenCL/storageclass.cl
+++ test/SemaOpenCL/storageclass.cl
@@ -5,6 +5,20 @@
 int G3 = 0;// expected-error{{program scope variable must reside in constant address space}}
 global int G4 = 0; // expected-error{{program scope variable must reside in constant address space}}
 
+static float g_implicit_static_var = 0; // expected-error {{program scope variable must reside in constant address space}}
+static constant float g_constant_static_var = 0;
+static global float g_global_static_var = 0;   // expected-error {{program scope variable must reside in constant address space}}
+static local float g_local_static_var = 0; // expected-error {{program scope variable must reside in constant address space}}
+static private float g_private_static_var = 0; // expected-error {{program scope variable must reside in constant address space}}
+static generic float g_generic_static_var = 0; // expected-error{{OpenCL version 1.2 does not support the 'generic' type qualifier}} // expected-error {{program scope variable must reside in constant address space}}
+
+extern float g_implicit_extern_var; // expected-error {{extern variable must reside in constant address space}}
+extern constant float g_constant_extern_var;
+extern global float g_global_extern_var;   // expected-error {{extern variable must reside in constant address space}}
+extern local float g_local_extern_var; // expected-error {{extern variable must reside in constant address space}}
+extern private float g_private_extern_var; // expected-error {{extern variable must reside in constant address space}}
+extern generic float g_generic_extern_var; // expected-error{{OpenCL version 1.2 does not support the 'generic' type qualifier}} // expected-error {{extern variable must reside in constant address space}}
+
 void kernel foo(int x) {
   // static is not allowed at local scope before CL2.0
   static int S1 = 5;  // expected-error{{variables in function scope cannot be declared static}}
@@ -45,10 +59,17 @@
 __attribute__((address_space(100))) int L4; // expected-error{{automatic variable qualified with an invalid address space}}
   }
 
+  static float l_implicit_static_var = 0;  // expected-error {{variables in function scope cannot be declared static}}
+  static constant float l_constant_static_var = 0; // expected-error {{variables in function scope cannot be declared static}}
+  static global float l_global_static_var = 0; // expected-error {{variables in function scope cannot be declared static}}
+  static local float l_local_static_var = 0;   // expected-error {{variables in function scope cannot be declared static}}
+  static private float l_private_static_var = 0;   // expected-error {{variables in function scope cannot be declared static}}
+  static generic float 

[PATCH] D38781: [X86] Add CLWB intrinsic. clang part

2017-10-12 Thread Craig Topper via Phabricator via cfe-commits
craig.topper updated this revision to Diff 118816.
craig.topper added a comment.

Address review feedback


https://reviews.llvm.org/D38781

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/CMakeLists.txt
  lib/Headers/clwbintrin.h
  lib/Headers/immintrin.h
  test/CodeGen/builtin-clwb.c

Index: test/CodeGen/builtin-clwb.c
===
--- /dev/null
+++ test/CodeGen/builtin-clwb.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-apple-darwin -target-feature +clwb  -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include 
+
+void test_mm_clwb(const void *__m) {
+  //CHECK-LABEL: @test_mm_clwb
+  //CHECK: @llvm.x86.clwb
+  _mm_clwb(__m);
+}
Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -58,6 +58,10 @@
 #include 
 #endif
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLWB__)
+#include 
+#endif
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
 #endif
Index: lib/Headers/clwbintrin.h
===
--- /dev/null
+++ lib/Headers/clwbintrin.h
@@ -0,0 +1,52 @@
+/*=== clwbintrin.h - CLWB intrinsic ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __IMMINTRIN_H
+#error "Never use  directly; include  instead."
+#endif
+
+#ifndef __CLWBINTRIN_H
+#define __CLWBINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("clwb")))
+
+/// \brief Writes back to memory the cache line (if modified) that contains the
+/// linear address specified in \a __m from any level of the cache hierarchy in
+/// the cache coherence domain
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the  CLWB  instruction.
+///
+/// \param __p
+///A pointer to the memory location used to identify the cache line to be
+///written back.
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clwb(void const *__m) {
+  __builtin_ia32_clwb(__m);
+}
+
+#undef __DEFAULT_FN_ATTRS
+
+#endif
Index: lib/Headers/CMakeLists.txt
===
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -33,6 +33,7 @@
   clzerointrin.h
   cpuid.h
   clflushoptintrin.h
+  clwbintrin.h
   emmintrin.h
   f16cintrin.h
   float.h
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -641,6 +641,9 @@
 //CLFLUSHOPT
 TARGET_BUILTIN(__builtin_ia32_clflushopt, "vvC*", "", "clflushopt")
 
+//CLWB
+TARGET_BUILTIN(__builtin_ia32_clwb, "vvC*", "", "clwb")
+
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "", "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38853: [clang-format] Allow building fuzzer with OSS-Fuzz flags.

2017-10-12 Thread Kostya Serebryany via Phabricator via cfe-commits
kcc added a reviewer: bogner.
kcc accepted this revision.
kcc added a comment.
This revision is now accepted and ready to land.

LGTM

+Justin FYI

Please also take a look at llvm-isel-fuzzer, which I've just added to oss-fuzz


https://reviews.llvm.org/D38853



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


[PATCH] D38853: [clang-format] Allow building fuzzer with OSS-Fuzz flags.

2017-10-12 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse created this revision.
Herald added a subscriber: mgorny.

https://reviews.llvm.org/D38853

Files:
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-format/fuzzer/CMakeLists.txt


Index: clang/tools/clang-format/fuzzer/CMakeLists.txt
===
--- clang/tools/clang-format/fuzzer/CMakeLists.txt
+++ clang/tools/clang-format/fuzzer/CMakeLists.txt
@@ -1,11 +1,15 @@
 set(LLVM_LINK_COMPONENTS support)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+if(LLVM_USE_SANITIZE_COVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+endif()
 
 add_clang_executable(clang-format-fuzzer
   EXCLUDE_FROM_ALL
   ClangFormatFuzzer.cpp
   )
 
 target_link_libraries(clang-format-fuzzer
-  ${CLANG_FORMAT_LIB_DEPS})
+  ${CLANG_FORMAT_LIB_DEPS}
+  ${LIB_FUZZING_ENGINE}
+  )
Index: clang/tools/clang-format/CMakeLists.txt
===
--- clang/tools/clang-format/CMakeLists.txt
+++ clang/tools/clang-format/CMakeLists.txt
@@ -15,7 +15,7 @@
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LLVM_USE_SANITIZE_COVERAGE )
+if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 


Index: clang/tools/clang-format/fuzzer/CMakeLists.txt
===
--- clang/tools/clang-format/fuzzer/CMakeLists.txt
+++ clang/tools/clang-format/fuzzer/CMakeLists.txt
@@ -1,11 +1,15 @@
 set(LLVM_LINK_COMPONENTS support)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+if(LLVM_USE_SANITIZE_COVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+endif()
 
 add_clang_executable(clang-format-fuzzer
   EXCLUDE_FROM_ALL
   ClangFormatFuzzer.cpp
   )
 
 target_link_libraries(clang-format-fuzzer
-  ${CLANG_FORMAT_LIB_DEPS})
+  ${CLANG_FORMAT_LIB_DEPS}
+  ${LIB_FUZZING_ENGINE}
+  )
Index: clang/tools/clang-format/CMakeLists.txt
===
--- clang/tools/clang-format/CMakeLists.txt
+++ clang/tools/clang-format/CMakeLists.txt
@@ -15,7 +15,7 @@
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LLVM_USE_SANITIZE_COVERAGE )
+if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r315594 - [X86] Use -ffreestanding instead of using the mm_malloc.h include guard hack on more of the builtin tests.

2017-10-12 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Oct 12 10:21:01 2017
New Revision: 315594

URL: http://llvm.org/viewvc/llvm-project?rev=315594=rev
Log:
[X86] Use -ffreestanding instead of using the mm_malloc.h include guard hack on 
more of the builtin tests.

Modified:
cfe/trunk/test/CodeGen/adc-builtins.c
cfe/trunk/test/CodeGen/avx512ifmavl-builtins.c
cfe/trunk/test/CodeGen/builtin-clflushopt.c
cfe/trunk/test/CodeGen/builtin-clzero.c

Modified: cfe/trunk/test/CodeGen/adc-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/adc-builtins.c?rev=315594=315593=315594=diff
==
--- cfe/trunk/test/CodeGen/adc-builtins.c (original)
+++ cfe/trunk/test/CodeGen/adc-builtins.c Thu Oct 12 10:21:01 2017
@@ -1,6 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | 
FileCheck %s
-
-#define __MM_MALLOC_H
+// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -o 
- %s | FileCheck %s
 
 #include 
 

Modified: cfe/trunk/test/CodeGen/avx512ifmavl-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512ifmavl-builtins.c?rev=315594=315593=315594=diff
==
--- cfe/trunk/test/CodeGen/avx512ifmavl-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512ifmavl-builtins.c Thu Oct 12 10:21:01 2017
@@ -1,6 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx512ifma 
-target-feature +avx512vl -emit-llvm -o - -Wall -Werror | FileCheck %s
-
-#define __MM_MALLOC_H
+// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-apple-darwin 
-target-feature +avx512ifma -target-feature +avx512vl -emit-llvm -o - -Wall 
-Werror | FileCheck %s
 
 #include 
 

Modified: cfe/trunk/test/CodeGen/builtin-clflushopt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-clflushopt.c?rev=315594=315593=315594=diff
==
--- cfe/trunk/test/CodeGen/builtin-clflushopt.c (original)
+++ cfe/trunk/test/CodeGen/builtin-clflushopt.c Thu Oct 12 10:21:01 2017
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clflushopt  
-emit-llvm -o - -Wall -Werror | FileCheck %s
-#define __MM_MALLOC_H
+// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-apple-darwin 
-target-feature +clflushopt  -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+#include 
 
-#include 
 void test_mm_clflushopt(char * __m) {
   //CHECK-LABEL: @test_mm_clflushopt
   //CHECK: @llvm.x86.clflushopt

Modified: cfe/trunk/test/CodeGen/builtin-clzero.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-clzero.c?rev=315594=315593=315594=diff
==
--- cfe/trunk/test/CodeGen/builtin-clzero.c (original)
+++ cfe/trunk/test/CodeGen/builtin-clzero.c Thu Oct 12 10:21:01 2017
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +clzero  
-emit-llvm -o - -Wall -Werror | FileCheck %s
-#define __MM_MALLOC_H
+// RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-apple-darwin 
-target-feature +clzero  -emit-llvm -o - -Wall -Werror | FileCheck %s
 
 #include 
+
 void test_mm_clzero(void * __m) {
   //CHECK-LABEL: @test_mm_clzero
   //CHECK: @llvm.x86.clzero


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


[PATCH] D38816: Convert clang::LangAS to a strongly typed enum

2017-10-12 Thread Alexey Bader via Phabricator via cfe-commits
bader accepted this revision.
bader added a comment.
This revision is now accepted and ready to land.

@arichardson, great work! Thanks a lot!


https://reviews.llvm.org/D38816



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


[PATCH] D38840: [compiler-rt] [cmake] [asan] Reuse generate_asan_tests for dynamic tests

2017-10-12 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov requested changes to this revision.
george.karpenkov added a comment.
This revision now requires changes to proceed.

@mgorny so this one actually changes semantics.
The previous one reused generated object files, and with the change it will 
start recompiling all the tests again.
(and actually being able to export object files has added quite a bit of 
complexity to all these compiler-rt macros).

The current code also looks weird, because it depends on 
`ASAN_INST_TEST_OBJECTS`, but will actually recompile and export them.

I think a better fix would be to change `add_compiler_rt_test` to accept two 
kinds of dependencies (probably again `DEPS` and `COMPILE_DEPS`? I know the 
name is not very descriptive, but I've kept it from the previous version).
It already checks that variable to conditionally add `clang` to dependencies.


https://reviews.llvm.org/D38840



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


[PATCH] D38838: [compiler-rt] [cmake] Fix skipping DEPS (typo) in sanitizer_test_compile()

2017-10-12 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision.
george.karpenkov added a comment.
This revision is now accepted and ready to land.

Yep, thanks! Good to go provided tests run.
Looks like we haven't spotted it due to other bug you have fixed cancelling 
this one out.


https://reviews.llvm.org/D38838



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


[PATCH] D38839: [compiler-rt] [cmake] [interception] Remove duplicate gtest from test COMPILE_DEPS

2017-10-12 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision.
george.karpenkov added a comment.
This revision is now accepted and ready to land.

Yep, thanks! This was probably the root cause of the failure.


https://reviews.llvm.org/D38839



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


Re: [PATCH] D38464: [clangd] less boilerplate in RPC dispatch

2017-10-12 Thread David Blaikie via cfe-commits
I mention it only out of interest of deduplication of functionality/code
within the LLVM project as a whole. Be nice not to maintain two things if
one would suffice.

On Thu, Oct 12, 2017 at 6:21 AM Sam McCall  wrote:

> Interesting - this is pretty primitive, and still fairly tightly coupled
> to JSON-RPC.
> I can't easily tell from the code how the ORC RPC functionality - would it
> be easy to use with JSON-RPC, does it make sense to use serialization only,
> does it have opinions about threading models? And really, what would we
> expect to gain vs using the current more naive code (it looks more
> complicated, probably having more complex requirements).
>
> On Mon, Oct 9, 2017 at 11:16 PM, David Blaikie  wrote:
>
>> hey Lang (& folks here) any chance there's some overlap between the RPC
>> functionality here and the RPC functionality in ORC that could be
>> deduplicated/refactored?
>>
>> On Fri, Oct 6, 2017 at 5:30 AM Ilya Biryukov via Phabricator via
>> cfe-commits  wrote:
>>
>>> ilya-biryukov accepted this revision.
>>> ilya-biryukov added a comment.
>>> This revision is now accepted and ready to land.
>>>
>>> LGTM.
>>> Note there's a new LSP method handler added upstream
>>> (`textDocument/signatureHelp`), we should add it to this change before
>>> submitting.
>>>
>>>
>>>
>>> 
>>> Comment at: clangd/ClangdLSPServer.h:47
>>>// Implement ProtocolCallbacks.
>>> -  void onInitialize(StringRef ID, InitializeParams IP,
>>> -JSONOutput ) override;
>>> -  void onShutdown(JSONOutput ) override;
>>> -  void onDocumentDidOpen(DidOpenTextDocumentParams Params,
>>> - JSONOutput ) override;
>>> -  void onDocumentDidChange(DidChangeTextDocumentParams Params,
>>> -   JSONOutput ) override;
>>> -  void onDocumentDidClose(DidCloseTextDocumentParams Params,
>>> -  JSONOutput ) override;
>>> -  void onDocumentOnTypeFormatting(DocumentOnTypeFormattingParams Params,
>>> -  StringRef ID, JSONOutput )
>>> override;
>>> -  void onDocumentRangeFormatting(DocumentRangeFormattingParams Params,
>>> - StringRef ID, JSONOutput )
>>> override;
>>> -  void onDocumentFormatting(DocumentFormattingParams Params, StringRef
>>> ID,
>>> -JSONOutput ) override;
>>> -  void onCodeAction(CodeActionParams Params, StringRef ID,
>>> -JSONOutput ) override;
>>> -  void onCompletion(TextDocumentPositionParams Params, StringRef ID,
>>> -JSONOutput ) override;
>>> -  void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
>>> -JSONOutput ) override;
>>> -  void onSwitchSourceHeader(TextDocumentIdentifier Params, StringRef ID,
>>> -JSONOutput ) override;
>>> +  void onInitialize(Ctx , InitializeParams ) override;
>>> +  void onShutdown(Ctx , NoParams ) override;
>>> 
>>> sammccall wrote:
>>> > ilya-biryukov wrote:
>>> > > ilya-biryukov wrote:
>>> > > > Maybe there's a way to have a typed return value instead of `Ctx`?
>>> > > > This would give an interface that's harder to misuse: one can't
>>> forget to call `reply` or call it twice.
>>> > > >
>>> > > > Here's on design that comes to mind.
>>> > > > Notification handlers could have `void` return, normal requests
>>> can return `Optional` or `Optional` (with result json).
>>> > > > `Optional` is be used to indicate whether error occurred while
>>> processing the request.
>>> > > >
>>> > > After putting more thought into it, `Ctx`-based API seems to have an
>>> advantage: it will allow us to easily implement async responses.
>>> > > E.g., we can run code completion on a background thread and continue
>>> processing other requests. When completion is ready, we will simply call
>>> `Ctx.reply` to return results to the language client.
>>> > >
>>> > > To make that possible, can we allow moving `RequestContext` and pass
>>> it by-value instead of by-ref?
>>> > Yeah I thought about returning a value... it certainly reads more
>>> nicely, but I don't think we're ready to do a good job in this patch:
>>> >  - return value should be an object ready to be serialized (rather
>>> than a JSON string) - I don't want to bring that in scope here, but it
>>> might affect the details of the API
>>> >  - there's several cases we know about (return object, no reply, error
>>> reply) and some we're not sure about (async as you mention - any multiple
>>> responses)? I think this needs some design, and I don't yet know the
>>> project well enough to drive it.
>>> >
>>> > I've switched to passing Ctx by value as you suggest (though it's
>>> certainly cheap enough to copy, too).
>>> Yeah, copy is also fine there performance-wise.
>>>
>>> I do think move-only interface fits slightly better. We can check a
>>> whole bunch of 

[PATCH] D36562: [Bitfield] Make the bitfield a separate location if it has width of legal integer type and its bit offset is naturally aligned for the type

2017-10-12 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: include/clang/Frontend/CodeGenOptions.def:182
 CODEGENOPT(SoftFloat , 1, 0) ///< -soft-float.
+CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0) ///< Enable finegrained bitfield 
accesses.
 CODEGENOPT(StrictEnums   , 1, 0) ///< Optimize based on strict enum 
definition.

finegrained -> fine-grained

(I suppose we're not sticking to 80 cols in this file anyway)



Repository:
  rL LLVM

https://reviews.llvm.org/D36562



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


[PATCH] D38852: [Hexagon] Handling of new HVX flags and target-features

2017-10-12 Thread Sumanth Gundapaneni via Phabricator via cfe-commits
sgundapa created this revision.
Herald added a subscriber: eraman.

This patch has the following changes

1. A new flag "-mhvx-length={64B|128B}" is introduced to specify the

length of the vector. Previously we have used "-mhvx-double" for 128 Bytes.
This adds the target-feature "+hvx-length{64|128}b"

2. The "-mhvx" flag must be provided on command line to enable HVX for Hexagon.

If no -mhvx-length flag is specified, a default length is picked from the arch
mentioned in this priority order from either -mhvx=vxx or -mcpu. For v60 and 
v62 
the default length is 64 Byte. For unknown versions, the length is 128 Byte.
The -mhvx flag adds the target-feature "+hvxv{hvx_version}"

3. The 64 Byte mode is soon going to be deprecated. A warning is emitted if 64 
Byte

is enabled. A warning is still emitted for the default 64 Byte as well. This 
warning
can be suppressed with a -Wno flag.

4. The "-mhvx-double" and "-mno-hvx-double" flags are deprecated. A warning is

emitted if the driver sees them on commandline. "-mhvx-double" is an alias to
"-mhvx-length=128B"

5. The compilation will error out if -mhvx-length is specified with out an

-mhvx/-mhvx= flag

6. The macro __HVX_LENGTH__ is defined and is set to the length of the

vector.
Eg: #define __HVX_LENGTH__ 64

7. The macro __HVX_ARCH__ is defined and is set to the version of the HVX.

Eg: #define __HVX_ARCH__ 62


Repository:
  rL LLVM

https://reviews.llvm.org/D38852

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  lib/Basic/Targets/Hexagon.cpp
  lib/Basic/Targets/Hexagon.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/Hexagon.cpp
  lib/Driver/ToolChains/Hexagon.h
  test/CodeGen/hexagon-inline-asm.c
  test/Driver/hexagon-hvx.c
  test/Preprocessor/hexagon-predefines.c

Index: test/Preprocessor/hexagon-predefines.c
===
--- test/Preprocessor/hexagon-predefines.c
+++ test/Preprocessor/hexagon-predefines.c
@@ -1,32 +1,43 @@
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv5 %s | FileCheck %s -check-prefix CHECK-V5
-
 // CHECK-V5: #define __HEXAGON_ARCH__ 5
 // CHECK-V5: #define __HEXAGON_V5__ 1
+// CHECK-V5-NOT: #define __HVX_LENGTH__
+// CHECK-V5-NOT: #define __HVX__ 1
 // CHECK-V5: #define __hexagon__ 1
 
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv55 %s | FileCheck %s -check-prefix CHECK-V55
-
 // CHECK-V55: #define __HEXAGON_ARCH__ 55
 // CHECK-V55: #define __HEXAGON_V55__ 1
+// CHECK-V55-NOT: #define __HVX_LENGTH__
+// CHECK-V55-NOT: #define __HVX__ 1
 // CHECK-V55: #define __hexagon__ 1
 
 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 %s | FileCheck %s -check-prefix CHECK-V60
-
 // CHECK-V60: #define __HEXAGON_ARCH__ 60
 // CHECK-V60: #define __HEXAGON_V60__ 1
+// CHECK-V60-NOT: #define __HVX_LENGTH__
+// CHECK-V60-NOT: #define __HVX__ 1
 // CHECK-V60: #define __hexagon__ 1
 
-// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 -target-feature +hvx %s | FileCheck %s -check-prefix CHECK-V60HVX
-
-// CHECK-V60HVX: #define __HEXAGON_ARCH__ 60
-// CHECK-V60HVX: #define __HEXAGON_V60__ 1
-// CHECK-V60HVX: #define __HVX__ 1
-
-// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 -target-feature +hvx-double  %s | FileCheck %s -check-prefix CHECK-V60HVXD
-
-// CHECK-V60HVXD: #define __HEXAGON_ARCH__ 60
-// CHECK-V60HVXD: #define __HEXAGON_V60__ 1
-// CHECK-V60HVXD: #define __HVXDBL__ 1
-// CHECK-V60HVXD: #define __HVX__ 1
-// CHECK-V60HVXD: #define __hexagon__ 1
-
+// The HVX flags are explicitly defined by the driver.
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 \
+// RUN: -target-feature +hvxv60 -target-feature +hvx-length64b %s | FileCheck \
+// RUN: %s -check-prefix CHECK-V60HVX-64B
+// CHECK-V60HVX-64B: #define __HEXAGON_ARCH__ 60
+// CHECK-V60HVX-64B: #define __HEXAGON_V60__ 1
+// CHECK-V60HVX-64B-NOT: #define __HVXDBL__ 1
+// CHECK-V60HVX-64B: #define __HVX_ARCH__ 60
+// CHECK-V60HVX-64B: #define __HVX_LENGTH__ 64
+// CHECK-V60HVX-64B: #define __HVX__ 1
+// CHECK-V60HVX-64B: #define __hexagon__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv60 \
+// RUN: -target-feature +hvxv60 -target-feature +hvx-length128b %s | FileCheck \
+// RUN: %s -check-prefix CHECK-V60HVX-128B
+// CHECK-V60HVX-128B: #define __HEXAGON_ARCH__ 60
+// CHECK-V60HVX-128B: #define __HEXAGON_V60__ 1
+// CHECK-V60HVX-128B: #define __HVXDBL__ 1
+// CHECK-V60HVX-128B: #define __HVX_ARCH__ 60
+// CHECK-V60HVX-128B: #define __HVX_LENGTH__ 128
+// CHECK-V60HVX-128B: #define __HVX__ 1
+// CHECK-V60HVX-128B: #define __hexagon__ 1
Index: test/Driver/hexagon-hvx.c
===
--- /dev/null
+++ test/Driver/hexagon-hvx.c
@@ -0,0 +1,90 @@
+// -
+// Tests 

[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments.



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:123
+  // Is variable changed anywhere in TU?
+  for (const Decl *D : AMgr.getASTContext().getTranslationUnitDecl()->decls()) 
{
+if (isChanged(D, VD))

danielmarjamaki wrote:
> dcoughlin wrote:
> > Since you are calling `getInitialStateForGlobalStaticVar()` in 
> > `getInitialState()` for each static variable declaration and 
> > `getInitialState()` is called for each top-level function, you are doing an 
> > n^3 operation in the size of the translation unit, which is going to be 
> > very, very expensive for large translation units.
> > 
> > Have you considered doing the analysis for static variables that are never 
> > changed during call-graph construction? This should be a linear operation 
> > and doing it during call-graph construction would avoid an extra walk of 
> > the entire translation unit.
> hmm... could you tell me where the call-graph construction is that I can 
> tweak?
I think I found it: `clang/lib/Analysis/CallGraph.cpp`


Repository:
  rL LLVM

https://reviews.llvm.org/D37897



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


[PATCH] D38816: Convert clang::LangAS to a strongly typed enum

2017-10-12 Thread Alexander Richardson via Phabricator via cfe-commits
arichardson added inline comments.



Comment at: lib/AST/TypePrinter.cpp:1323
 OS << "address_space(";
-OS << T->getEquivalentType().getAddressSpace();
+OS << T->getEquivalentType()
+  .getQualifiers()

Anastasia wrote:
> Why do we need this change?
`__attribute__((address_space(n)))` is a target address space and not a 
language address space like `LangAS::opencl_generic`. Isn't 
`Qualifiers::getAddressSpaceAttributePrintValue()` meant exactly for this use 
case?


https://reviews.llvm.org/D38816



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


[PATCH] D38700: [Sema][Crash] Correctly handle an non-dependent noexcept expr in function template

2017-10-12 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

Bump!  I realize the two of you are super busy, but if anyone else on 
cfe-commits wants to take a look, I'd apprecate it!
-Erich


https://reviews.llvm.org/D38700



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


[PATCH] D38781: [X86] Add CLWB intrinsic. clang part

2017-10-12 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: lib/Headers/clwbintrin.h:34
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm_clwb(void const *__m) {

Worth adding the doxygen description? You can probably just copy+paste+modify 
the _mm_clflush documentation.



Comment at: test/CodeGen/builtin-clwb.c:4
+
+#include 
+void test_mm_clwb(const void *__m) {

Match what is done in the other files: use -ffreestanding instead of defining 
__MM_MALLOC_H and include the "top header":


https://reviews.llvm.org/D38781



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


[PATCH] D36836: [clang-tidy] Implement readability-function-cognitive-complexity check

2017-10-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In https://reviews.llvm.org/D36836#889375, @aaron.ballman wrote:

> Adding @dberlin for licensing discussion questions.


Ping.

Yes, i agree that what i have added is not a directory, and not a proper 
license.
That is more of a template to hopefully stat moving things in the right 
direction.

To clarify, my problem with this Differential is that i'we yet to see any 
opinion on
the proposed check from the people who will actually have the final say whether
it will be accepted or not. It will be *really* sad if we go through all this 
trouble 
with the legal matters, and then it will be NACK'ed...


Repository:
  rL LLVM

https://reviews.llvm.org/D36836



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


[PATCH] D37897: [StaticAnalyzer] Fix ProgramState for static variables that are not written

2017-10-12 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added inline comments.



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:123
+  // Is variable changed anywhere in TU?
+  for (const Decl *D : AMgr.getASTContext().getTranslationUnitDecl()->decls()) 
{
+if (isChanged(D, VD))

dcoughlin wrote:
> Since you are calling `getInitialStateForGlobalStaticVar()` in 
> `getInitialState()` for each static variable declaration and 
> `getInitialState()` is called for each top-level function, you are doing an 
> n^3 operation in the size of the translation unit, which is going to be very, 
> very expensive for large translation units.
> 
> Have you considered doing the analysis for static variables that are never 
> changed during call-graph construction? This should be a linear operation and 
> doing it during call-graph construction would avoid an extra walk of the 
> entire translation unit.
hmm... could you tell me where the call-graph construction is that I can tweak?


Repository:
  rL LLVM

https://reviews.llvm.org/D37897



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


  1   2   >