r362316 - Add script to update OpenMP -ast-dump test expectations, and use it to

2019-06-01 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sat Jun  1 21:00:38 2019
New Revision: 362316

URL: http://llvm.org/viewvc/llvm-project?rev=362316=rev
Log:
Add script to update OpenMP -ast-dump test expectations, and use it to
regenerate the test expectations.

(Only two tests change, as a result of no longer matching the 0x in a
pointer; the other tests were already excluding that.)

Added:
cfe/trunk/utils/make-ast-dump-check.sh   (with props)
Modified:
cfe/trunk/test/AST/ast-dump-openmp-for.c
cfe/trunk/test/AST/ast-dump-openmp-parallel.c

Modified: cfe/trunk/test/AST/ast-dump-openmp-for.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-openmp-for.c?rev=362316=362315=362316=diff
==
--- cfe/trunk/test/AST/ast-dump-openmp-for.c (original)
+++ cfe/trunk/test/AST/ast-dump-openmp-for.c Sat Jun  1 21:00:38 2019
@@ -35,208 +35,208 @@ void test_five(int x, int y, int z) {
 ;
 }
 
-// CHECK: TranslationUnitDecl 0x{{.*}} <> 
-// CHECK: |-FunctionDecl 0x{{.*}} <{{.*}}ast-dump-openmp-for.c:3:1, line:7:1> 
line:3:6 test_one 'void (int)'
-// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}}  col:19 used x 'int'
-// CHECK-NEXT: | `-CompoundStmt 0x{{.*}} 
-// CHECK-NEXT: |   `-OMPForDirective 0x{{.*}} 
-// CHECK-NEXT: | `-CapturedStmt 0x{{.*}} 
-// CHECK-NEXT: |   |-CapturedDecl 0x{{.*}} <> 
-// CHECK-NEXT: |   | |-ForStmt 0x{{.*}} 
-// CHECK-NEXT: |   | | |-DeclStmt 0x{{.*}} 
-// CHECK-NEXT: |   | | | `-VarDecl 0x{{.*}}  col:12 used i 
'int' cinit
-// CHECK-NEXT: |   | | |   `-IntegerLiteral 0x{{.*}}  'int' 0
+// CHECK: TranslationUnitDecl {{.*}} <> 
+// CHECK: |-FunctionDecl {{.*}} <{{.*}}ast-dump-openmp-for.c:3:1, line:7:1> 
line:3:6 test_one 'void (int)'
+// CHECK-NEXT: | |-ParmVarDecl {{.*}}  col:19 used x 'int'
+// CHECK-NEXT: | `-CompoundStmt {{.*}} 
+// CHECK-NEXT: |   `-OMPForDirective {{.*}} 
+// CHECK-NEXT: | `-CapturedStmt {{.*}} 
+// CHECK-NEXT: |   |-CapturedDecl {{.*}} <> 
+// CHECK-NEXT: |   | |-ForStmt {{.*}} 
+// CHECK-NEXT: |   | | |-DeclStmt {{.*}} 
+// CHECK-NEXT: |   | | | `-VarDecl {{.*}}  col:12 used i 
'int' cinit
+// CHECK-NEXT: |   | | |   `-IntegerLiteral {{.*}}  'int' 0
 // CHECK-NEXT: |   | | |-<<>>
-// CHECK-NEXT: |   | | |-BinaryOperator 0x{{.*}}  'int' '<'
-// CHECK-NEXT: |   | | | |-ImplicitCastExpr 0x{{.*}}  'int' 

-// CHECK-NEXT: |   | | | | `-DeclRefExpr 0x{{.*}}  'int' lvalue 
Var 0x{{.*}} 'i' 'int'
-// CHECK-NEXT: |   | | | `-ImplicitCastExpr 0x{{.*}}  'int' 

-// CHECK-NEXT: |   | | |   `-DeclRefExpr 0x{{.*}}  'int' lvalue 
ParmVar 0x{{.*}} 'x' 'int'
-// CHECK-NEXT: |   | | |-UnaryOperator 0x{{.*}}  'int' 
postfix '++'
-// CHECK-NEXT: |   | | | `-DeclRefExpr 0x{{.*}}  'int' lvalue Var 
0x{{.*}} 'i' 'int'
-// CHECK-NEXT: |   | | `-NullStmt 0x{{.*}}  
openmp_structured_block
-// CHECK-NEXT: |   | |-ImplicitParamDecl 0x{{.*}}  col:1 
implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:4:1) 
*const restrict'
-// CHECK-NEXT: |   | `-VarDecl 0x{{.*}}  col:12 used i 
'int' cinit
-// CHECK-NEXT: |   |   `-IntegerLiteral 0x{{.*}}  'int' 0
-// CHECK-NEXT: |   `-DeclRefExpr 0x{{.*}}  'int' lvalue ParmVar 
0x{{.*}} 'x' 'int'
-// CHECK-NEXT: |-FunctionDecl 0x{{.*}}  line:9:6 test_two 
'void (int, int)'
-// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}}  col:19 used x 'int'
-// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}}  col:26 used y 'int'
-// CHECK-NEXT: | `-CompoundStmt 0x{{.*}} 
-// CHECK-NEXT: |   `-OMPForDirective 0x{{.*}} 
-// CHECK-NEXT: | `-CapturedStmt 0x{{.*}} 
-// CHECK-NEXT: |   |-CapturedDecl 0x{{.*}} <> 
-// CHECK-NEXT: |   | |-ForStmt 0x{{.*}} 
-// CHECK-NEXT: |   | | |-DeclStmt 0x{{.*}} 
-// CHECK-NEXT: |   | | | `-VarDecl 0x{{.*}}  col:12 used i 
'int' cinit
-// CHECK-NEXT: |   | | |   `-IntegerLiteral 0x{{.*}}  'int' 0
+// CHECK-NEXT: |   | | |-BinaryOperator {{.*}}  'int' '<'
+// CHECK-NEXT: |   | | | |-ImplicitCastExpr {{.*}}  'int' 

+// CHECK-NEXT: |   | | | | `-DeclRefExpr {{.*}}  'int' lvalue Var 
{{.*}} 'i' 'int'
+// CHECK-NEXT: |   | | | `-ImplicitCastExpr {{.*}}  'int' 

+// CHECK-NEXT: |   | | |   `-DeclRefExpr {{.*}}  'int' lvalue 
ParmVar {{.*}} 'x' 'int'
+// CHECK-NEXT: |   | | |-UnaryOperator {{.*}}  'int' 
postfix '++'
+// CHECK-NEXT: |   | | | `-DeclRefExpr {{.*}}  'int' lvalue Var 
{{.*}} 'i' 'int'
+// CHECK-NEXT: |   | | `-NullStmt {{.*}}  openmp_structured_block
+// CHECK-NEXT: |   | |-ImplicitParamDecl {{.*}}  col:1 implicit 
__context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:4:1) *const 
restrict'
+// CHECK-NEXT: |   | `-VarDecl {{.*}}  col:12 used i 
'int' cinit
+// CHECK-NEXT: |   |   `-IntegerLiteral {{.*}}  'int' 0
+// CHECK-NEXT: |   `-DeclRefExpr {{.*}}  'int' lvalue ParmVar 
{{.*}} 'x' 'int'
+// CHECK-NEXT: |-FunctionDecl {{.*}}  line:9:6 test_two 
'void (int, int)'
+// CHECK-NEXT: | 

r362317 - Factor out commonality between variable capture initialization and

2019-06-01 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sat Jun  1 21:00:43 2019
New Revision: 362317

URL: http://llvm.org/viewvc/llvm-project?rev=362317=rev
Log:
Factor out commonality between variable capture initialization and
'this' capture initialization.

Modified:
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/AST/ast-dump-expr-json.cpp
cfe/trunk/test/AST/ast-dump-expr.cpp

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=362317=362316=362317=diff
==
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Sat Jun  1 21:00:43 2019
@@ -386,6 +386,8 @@ public:
   }
 
   /// Create the initialization entity for a lambda capture.
+  ///
+  /// \p VarID The name of the entity being captured, or nullptr for 'this'.
   static InitializedEntity InitializeLambdaCapture(IdentifierInfo *VarID,
QualType FieldType,
SourceLocation Loc) {
@@ -509,7 +511,7 @@ public:
   /// For a lambda capture, return the capture's name.
   StringRef getCapturedVarName() const {
 assert(getKind() == EK_LambdaCapture && "Not a lambda capture!");
-return Capture.VarID->getName();
+return Capture.VarID ? Capture.VarID->getName() : "this";
   }
 
   /// Determine the location of the capture when initializing

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=362317=362316=362317=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Sat Jun  1 21:00:43 2019
@@ -5291,11 +5291,6 @@ public:
   const unsigned *const FunctionScopeIndexToStopAt = nullptr,
   bool ByCopy = false);
 
-  /// Initialize the given 'this' capture with a suitable 'this' or '*this'
-  /// expression.
-  ExprResult performThisCaptureInitialization(const sema::Capture ,
-  bool IsImplicit);
-
   /// Determine whether the given type is the type of *this that is used
   /// outside of the body of a member function for a type that is currently
   /// being defined.
@@ -5808,6 +5803,11 @@ public:
   /// Build a FieldDecl suitable to hold the given capture.
   FieldDecl *BuildCaptureField(RecordDecl *RD, const sema::Capture );
 
+  /// Initialize the given capture with a suitable expression.
+  ExprResult BuildCaptureInit(const sema::Capture ,
+  SourceLocation ImplicitCaptureLoc,
+  bool IsOpenMPMapping = false);
+
   /// Complete a lambda-expression having processed and attached the
   /// lambda body.
   ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,

Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=362317=362316=362317=diff
==
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Sat Jun  1 21:00:43 2019
@@ -1431,32 +1431,22 @@ static void addBlockPointerConversion(Se
   Class->addDecl(Conversion);
 }
 
-ExprResult Sema::performThisCaptureInitialization(const Capture ,
-  bool IsImplicit) {
-  QualType ThisTy = getCurrentThisType();
-  SourceLocation Loc = Cap.getLocation();
-  Expr *This = BuildCXXThisExpr(Loc, ThisTy, IsImplicit);
-  if (Cap.isReferenceCapture())
-return This;
-
-  // Capture (by copy) of '*this'.
-  Expr *StarThis = CreateBuiltinUnaryOp(Loc, UO_Deref, This).get();
-  InitializedEntity Entity = InitializedEntity::InitializeLambdaCapture(
-  nullptr, Cap.getCaptureType(), Loc);
-  InitializationKind InitKind =
-  InitializationKind::CreateDirect(Loc, Loc, Loc);
-  InitializationSequence Init(*this, Entity, InitKind, StarThis);
-  return Init.Perform(*this, Entity, InitKind, StarThis);
-}
-
-static ExprResult performLambdaVarCaptureInitialization(
-Sema , const Capture , FieldDecl *Field,
-SourceLocation ImplicitCaptureLoc, bool IsImplicitCapture) {
-  assert(Capture.isVariableCapture() && "not a variable capture");
-
-  auto *Var = Capture.getVariable();
+ExprResult Sema::BuildCaptureInit(const Capture ,
+  SourceLocation ImplicitCaptureLoc,
+  bool IsOpenMPMapping) {
+  // VLA captures don't have a stored initialization expression.
+  if (Cap.isVLATypeCapture())
+return ExprResult();
+
+  // An init-capture is initialized directly from its stored initializer.
+  if 

[PATCH] D59744: Fix i386 ABI "__m64" type bug

2019-06-01 Thread Wei Xiao via Phabricator via cfe-commits
wxiao3 added a comment.

Hi all,

With the latest version, I have made below changes according to all your 
comments:

1. Only apply the fix to Linux where many libraries are built by GCC.
2. Avoid converting the QualType to llvm::Type and then checking if the 
llvm::Type is a 64-bit vector, which is unnecessary and inefficient. 
Furthermore, I remove the utility function: IsX86_MMXType since It's very 
simple to check _m64 type based on QualType.

Ok for merge now?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59744/new/

https://reviews.llvm.org/D59744



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


[PATCH] D59744: Fix i386 ABI "__m64" type bug

2019-06-01 Thread Wei Xiao via Phabricator via cfe-commits
wxiao3 updated this revision to Diff 202579.
wxiao3 edited the summary of this revision.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59744/new/

https://reviews.llvm.org/D59744

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/x86_32-arguments-linux.c
  test/CodeGen/x86_32-m64.c

Index: test/CodeGen/x86_32-m64.c
===
--- /dev/null
+++ test/CodeGen/x86_32-m64.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-pc-linux-gnu -target-cpu pentium4 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,LINUX
+// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-apple-darwin9 -target-cpu yonah -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,DARWIN
+// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-pc-elfiamcu -mfloat-abi soft -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,IAMCU
+// RUN: %clang_cc1 -w -O2 -fblocks -triple i386-pc-win32 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,WIN32
+
+#include 
+__m64 m64;
+void callee(__m64 __m1, __m64 __m2);
+__m64 caller(__m64 __m1, __m64 __m2)
+{
+// LINUX-LABEL: define x86_mmx @caller(x86_mmx %__m1.coerce, x86_mmx %__m2.coerce)
+// LINUX: tail call void @callee(x86_mmx %__m2.coerce, x86_mmx %__m1.coerce)
+// LINUX: ret x86_mmx
+// DARWIN-LABEL: define i64 @caller(i64 %__m1.coerce, i64 %__m2.coerce)
+// DARWIN: tail call void @callee(i64 %__m2.coerce, i64 %__m1.coerce)
+// DARWIN: ret i64
+// IAMCU-LABEL: define <1 x i64> @caller(i64 %__m1.coerce, i64 %__m2.coerce)
+// IAMCU: tail call void @callee(i64 %__m2.coerce, i64 %__m1.coerce)
+// IAMCU: ret <1 x i64>
+// WIN32-LABEL: define dso_local <1 x i64> @caller(i64 %__m1.coerce, i64 %__m2.coerce)
+// WIN32: call void @callee(i64 %__m2.coerce, i64 %__m1.coerce)
+// WIN32: ret <1 x i64>
+  callee(__m2, __m1);
+  return m64;
+}
Index: test/CodeGen/x86_32-arguments-linux.c
===
--- test/CodeGen/x86_32-arguments-linux.c
+++ test/CodeGen/x86_32-arguments-linux.c
@@ -3,7 +3,7 @@
 
 // CHECK-LABEL: define void @f56(
 // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
-// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 4,
+// CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4,
 // CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
 // CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
 // CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
@@ -12,7 +12,7 @@
 
 // CHECK: call void (i32, ...) @f56_0(i32 1,
 // CHECK: i32 %{{.*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
-// CHECK: i64 %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
+// CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
 // CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
 // CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 4 %{{[^ ]*}},
 // CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 4 %{{[^ ]*}},
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -915,14 +915,6 @@
: ABIArgInfo::getDirect());
 }
 
-/// IsX86_MMXType - Return true if this is an MMX type.
-bool IsX86_MMXType(llvm::Type *IRType) {
-  // Return true if the type is an MMX type <2 x i32>, <4 x i16>, or <8 x i8>.
-  return IRType->isVectorTy() && IRType->getPrimitiveSizeInBits() == 64 &&
-cast(IRType)->getElementType()->isIntegerTy() &&
-IRType->getScalarSizeInBits() != 64;
-}
-
 static llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction ,
   StringRef Constraint,
   llvm::Type* Ty) {
@@ -1010,7 +1002,9 @@
   bool IsWin32StructABI;
   bool IsSoftFloatABI;
   bool IsMCUABI;
+  bool IsLinuxABI;
   unsigned DefaultNumRegisterParameters;
+  bool IsMMXEnabled;
 
   static bool isRegisterSize(unsigned Size) {
 return (Size == 8 || Size == 16 || Size == 32 || Size == 64);
@@ -1070,13 +1064,16 @@
 
   X86_32ABIInfo(CodeGen::CodeGenTypes , bool DarwinVectorABI,
 bool RetSmallStructInRegABI, bool Win32StructABI,
-unsigned NumRegisterParameters, bool SoftFloatABI)
+unsigned NumRegisterParameters, bool SoftFloatABI,
+bool MMXEnabled)
 : SwiftABIInfo(CGT), IsDarwinVectorABI(DarwinVectorABI),
   IsRetSmallStructInRegABI(RetSmallStructInRegABI),
   IsWin32StructABI(Win32StructABI),
   IsSoftFloatABI(SoftFloatABI),
   IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
-  DefaultNumRegisterParameters(NumRegisterParameters) {}
+  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux()),
+  DefaultNumRegisterParameters(NumRegisterParameters),
+  IsMMXEnabled(MMXEnabled) {}
 
   bool shouldPassIndirectlyForSwift(ArrayRef scalars,
 bool asReturnValue) const override {
@@ 

[PATCH] D62445: [test] Fix plugin tests

2019-06-01 Thread Don Hinton via Phabricator via cfe-commits
hintonda updated this revision to Diff 202573.
hintonda added a comment.

- Fix dependencies so required plugins get built before tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62445/new/

https://reviews.llvm.org/D62445

Files:
  clang/lib/Analysis/CMakeLists.txt
  clang/lib/Analysis/plugins/CMakeLists.txt
  clang/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt
  
clang/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp
  
clang/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports
  clang/lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt
  clang/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp
  
clang/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports
  clang/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt
  clang/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp
  clang/lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports
  clang/test/Analysis/lit.local.cfg
  clang/test/Analysis/plugins/CMakeLists.txt
  clang/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt
  
clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp
  
clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports
  clang/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt
  clang/test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp
  
clang/test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports
  clang/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt
  clang/test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp
  clang/test/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports
  clang/test/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/HandleLLVMOptions.cmake

Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -912,14 +912,6 @@
   message(FATAL_ERROR "LLVM_LINK_LLVM_DYLIB not compatible with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS")
 endif()
 
-# Plugin support
-# FIXME: Make this configurable.
-if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)
-  set(LLVM_ENABLE_PLUGINS ON)
-else()
-  set(LLVM_ENABLE_PLUGINS OFF)
-endif()
-
 # By default we should enable LLVM_ENABLE_IDE only for multi-configuration
 # generators. This option disables optional build system features that make IDEs
 # less usable.
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -672,6 +672,17 @@
 message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")
 message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
 
+if(WIN32 OR CYGWIN)
+  if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)
+set(LLVM_ENABLE_PLUGINS_default ON)
+  else()
+set(LLVM_ENABLE_PLUGINS_default OFF)
+  endif()
+else()
+  set(LLVM_ENABLE_PLUGINS_default ON)
+endif()
+option(LLVM_ENABLE_PLUGINS "Enable plugin support" ${LLVM_ENABLE_PLUGINS_default})
+
 include(HandleLLVMOptions)
 
 # Verify that we can find a Python 2 interpreter.  Python 3 is unsupported.
Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -83,12 +83,6 @@
 )
 endif ()
 
-if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES)
-  list(APPEND CLANG_TEST_DEPS
-SampleAnalyzerPlugin
-)
-endif ()
-
 set(CLANG_TEST_PARAMS
   clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
   USE_Z3_SOLVER=0
@@ -126,27 +120,13 @@
 endif()
 
 if (CLANG_ENABLE_STATIC_ANALYZER)
-  add_subdirectory(Analysis/plugins)
-  list(APPEND CLANG_TEST_DEPS clang-analyzer-plugin)
-
-  # check-all would launch those tests via check-clang.
-  set(EXCLUDE_FROM_ALL ON)
-
-  add_lit_testsuite(check-clang-analyzer "Running the Clang analyzer tests"
-${CMAKE_CURRENT_BINARY_DIR}/Analysis
-PARAMS ${ANALYZER_TEST_PARAMS}
-DEPENDS ${CLANG_TEST_DEPS})
-  set_target_properties(check-clang-analyzer PROPERTIES FOLDER "Clang tests")
-
-  if (LLVM_WITH_Z3)
-add_lit_testsuite(check-clang-analyzer-z3 "Running the Clang analyzer tests, using Z3 as a solver"
-  ${CMAKE_CURRENT_BINARY_DIR}/Analysis
-  PARAMS ${ANALYZER_TEST_PARAMS_Z3}
-  DEPENDS ${CLANG_TEST_DEPS})
-set_target_properties(check-clang-analyzer-z3 PROPERTIES FOLDER "Clang tests")
+  if (LLVM_ENABLE_PLUGINS)
+set(CLANG_TEST_DEPS
+  SampleAnalyzerPlugin
+  CheckerDependencyHandlingAnalyzerPlugin
+  CheckerOptionHandlingAnalyzerPlugin
+  )
   endif()
-
-  set(EXCLUDE_FROM_ALL OFF)
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
Index: 

[PATCH] D62445: [test] Fix plugin tests

2019-06-01 Thread Don Hinton via Phabricator via cfe-commits
hintonda reopened this revision.
hintonda added a comment.
This revision is now accepted and ready to land.

This patch broke some of the bots, so reopening to track the fix.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62445/new/

https://reviews.llvm.org/D62445



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


[PATCH] D62435: Add Attribute NoThrow as an Exception Specifier Type

2019-06-01 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

This change had another breaking effect as well, for the MinGW target. Code 
that implements a COM interface easily ends up overriding a 
`__declspec(nothrow)` function with a method that in most cases (at least in 
cases that follow the microsoft sample code) lacks the same attribute. For code 
with `-fms-extensions`, this is a warning (as all exception spec mismatches are 
non-fatal there), but MinGW code doesn't necessarily use this option. See 
https://bugs.llvm.org/show_bug.cgi?id=42100 for full issue report and 
discussion.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62435/new/

https://reviews.llvm.org/D62435



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


[PATCH] D61729: [docs] Fix example for Allman brace breaking style

2019-06-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment.

This file is generated from the `clang/include/clang/Format/Format.h` header 
file by the `clang/docs/tools/dump_format_style.py` script. Please update the 
header file and rerun the script.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61729/new/

https://reviews.llvm.org/D61729



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


[PATCH] D54258: [Clang] Fix pretty printing of CUDA address spaces

2019-06-01 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D54258#1524643 , @richardmembarth 
wrote:

> Do you know when this will be merged?


I apologize, I wasn't aware you needed this merged on your behalf. I normally 
would be happy to do so, but I'm currently traveling. Maybe @Anastasia or 
someone else can help, otherwise I will merge it when I get back to the office 
in two weeks.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54258/new/

https://reviews.llvm.org/D54258



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


[PATCH] D62782: Fix -Wdouble-promotion warnings.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added a reviewer: mclow.lists.
Herald added subscribers: ldionne, christof.

Repository:
  rCXX libc++

https://reviews.llvm.org/D62782

Files:
  include/limits
  include/utility


Index: include/utility
===
--- include/utility
+++ include/utility
@@ -1479,7 +1479,7 @@
 size_t operator()(float __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-   if (__v == 0.0)
+   if (__v == 0.0f)
return 0;
 return __scalar_hash::operator()(__v);
 }
@@ -1507,7 +1507,7 @@
 size_t operator()(long double __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-if (__v == 0.0)
+if (__v == 0.0L)
 return 0;
 #if defined(__i386__)
 // Zero out padding bits
Index: include/limits
===
--- include/limits
+++ include/limits
@@ -409,7 +409,7 @@
 static _LIBCPP_CONSTEXPR const bool is_exact = false;
 static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() 
_NOEXCEPT {return __LDBL_EPSILON__;}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return 0.5;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() 
_NOEXCEPT {return 0.5L;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;


Index: include/utility
===
--- include/utility
+++ include/utility
@@ -1479,7 +1479,7 @@
 size_t operator()(float __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-   if (__v == 0.0)
+   if (__v == 0.0f)
return 0;
 return __scalar_hash::operator()(__v);
 }
@@ -1507,7 +1507,7 @@
 size_t operator()(long double __v) const _NOEXCEPT
 {
 // -0.0 and 0.0 should return same hash
-if (__v == 0.0)
+if (__v == 0.0L)
 return 0;
 #if defined(__i386__)
 // Zero out padding bits
Index: include/limits
===
--- include/limits
+++ include/limits
@@ -409,7 +409,7 @@
 static _LIBCPP_CONSTEXPR const bool is_exact = false;
 static _LIBCPP_CONSTEXPR const int  radix = __FLT_RADIX__;
 _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
-_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
+_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5L;}
 
 static _LIBCPP_CONSTEXPR const int  min_exponent = __LDBL_MIN_EXP__;
 static _LIBCPP_CONSTEXPR const int  min_exponent10 = __LDBL_MIN_10_EXP__;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem marked an inline comment as done.
brucem added a comment.

In D43159#1526215 , @mclow.lists wrote:

> What was the result of testing with `-std=c++98` and/or `-std=gnu++98` ?
>  The code changes look fine; but as @Ericwf said


It seems to work for me in `-std=c++98` ...

I responded to the point that @Ericwf made before ... the `__nullptr` header is 
included by the wrapper around `stddef.h` ... and these aren't the first / only 
usages of `nullptr` in the headers.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159



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


[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem marked 2 inline comments as done.
brucem added inline comments.



Comment at: include/memory:1259
 template  static __two __test(...);
 template  static char __test(typename _Xp::template 
rebind<_Up>::other* = 0);
 public:

zoecarver wrote:
> This could be `nullptr` too. 
This pointed out a number of things that could be fixed, so did  that and 
updated.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159



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


[PATCH] D62780: msabi: Fix exponential mangling time for even more contrived inputs

2019-06-01 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: rnk.

This is a follow-up to r362293 which fixed exponential time needed
for mangling certain templates. This fixes the same issue if that
template pattern happens in template arguments > 10: The first
ten template arguments can use back references, and r362293 added
caching for back references. For latter arguments, we have to add
a cache for the mangling itself instead.

Fixes PR42091 even more.


https://reviews.llvm.org/D62780

Files:
  clang/lib/AST/MicrosoftMangle.cpp
  clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp

Index: clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
===
--- clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
+++ clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
@@ -232,3 +232,25 @@
 void f(B6 a) {}
 
 // CHECK: "?f@@YAXU?$Food@U?$Food@U?$Food@U?$Food@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U3@U3@U3@U3@U3@U3@U3@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U4@U4@U4@U4@U4@U4@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U3@U3@U3@U3@U3@U3@U3@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U5@U5@U5@U5@U5@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U3@U3@U3@U3@U3@U3@U3@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U4@U4@U4@U4@U4@U4@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U3@U3@U3@U3@U3@U3@U3@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U2@U2@U2@U2@U2@U2@U2@U2@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@U?$Food@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U?$Food@@@U6@U6@U6@U6@U1@U1@U1@U1@U1@U1@U1@U1@U1@U1Z"
+
+
+// Similar to the previous case, except that the later arguments aren't
+// present in the earlier ones and hence aren't in the backref cache.
+template 
+struct Fooe {};
+
+using C0 = Fooe;
+using C1 = Fooe;
+using C2 = Fooe;
+using C3 = Fooe;
+using C4 = Fooe;
+using C5 = Fooe;
+using C6 = Fooe;
+using C7 = Fooe;
+
+// This too should take milliseconds, not minutes.
+void f(C7 a) {}
+// CHECK: "??@f23afdfb44276eaa53a5575352cf0ebc@"
Index: clang/lib/AST/MicrosoftMangle.cpp
===
--- clang/lib/AST/MicrosoftMangle.cpp
+++ clang/lib/AST/MicrosoftMangle.cpp
@@ -31,6 +31,7 @@
 #include "llvm/Support/xxhash.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/StringSaver.h"
 
 using namespace clang;
 
@@ -268,6 +269,11 @@
   ArgBackRefMap FunArgBackReferences;
   ArgBackRefMap TemplateArgBackReferences;
 
+  typedef llvm::DenseMap TemplateArgStringMap;
+  TemplateArgStringMap TemplateArgStrings;
+  llvm::StringSaver TemplateArgStringStorage;
+  

[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver added inline comments.



Comment at: include/memory:1259
 template  static __two __test(...);
 template  static char __test(typename _Xp::template 
rebind<_Up>::other* = 0);
 public:

This could be `nullptr` too. 


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159



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


[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 202555.
brucem added a comment.

Remove CMakeLists.txt change.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159

Files:
  include/__functional_base
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/deque
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/regex
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/type_traits
  include/valarray
  src/ios.cpp
  src/locale.cpp
  src/new.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -84,7 +84,7 @@
 unsigned n;
 int mib[2] = {CTL_HW, HW_NCPU};
 std::size_t s = sizeof(n);
-sysctl(mib, 2, , , 0, 0);
+sysctl(mib, 2, , , nullptr, 0);
 return n;
 #elif defined(_SC_NPROCESSORS_ONLN)
 long result = sysconf(_SC_NPROCESSORS_ONLN);
Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -64,7 +64,7 @@
 if (size == 0)
 size = 1;
 void* p;
-while ((p = ::malloc(size)) == 0)
+while ((p = ::malloc(size)) == nullptr)
 {
 // If malloc fails and there is a new_handler,
 // call it to try free up memory.
@@ -85,7 +85,7 @@
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -111,7 +111,7 @@
 void*
 operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -206,7 +206,7 @@
 void*
 operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -232,7 +232,7 @@
 void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -47,7 +47,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 struct __libcpp_unique_locale {
-  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {}
+  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, nullptr)) {}
 
   ~__libcpp_unique_locale() {
 if (__loc_)
@@ -536,7 +536,7 @@
 
 locale::locale(const char* name)
 : __locale_(name ? new __imp(name)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -549,7 +549,7 @@
 
 locale::locale(const locale& other, const char* name, category c)
 : __locale_(name ? new __imp(*other.__locale_, name, c)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -664,18 +664,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + string(n));
 }
 
 collate_byname::collate_byname(const string& name, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+  __l(newlocale(LC_ALL_MASK, name.c_str(), nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + name);
 }
@@ -703,7 +703,7 @@
 collate_byname::do_transform(const char_type* lo, const char_type* hi) const
 {
 const string_type in(lo, hi);
-string_type out(strxfrm_l(0, in.c_str(), 0, __l), char());
+string_type out(strxfrm_l(nullptr, in.c_str(), 0, __l), char());
 strxfrm_l(const_cast(out.c_str()), in.c_str(), out.size()+1, __l);
 return out;
 }
@@ -712,18 +712,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname(size_t refs)"
 " failed to construct for " + string(n));
 }
 
 collate_byname::collate_byname(const 

[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 202554.
brucem added a comment.
Herald added a subscriber: mgorny.

Updated to current master and added more nullptr usage.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159

Files:
  CMakeLists.txt
  include/__functional_base
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/deque
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/regex
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/type_traits
  include/valarray
  src/ios.cpp
  src/locale.cpp
  src/new.cpp
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -84,7 +84,7 @@
 unsigned n;
 int mib[2] = {CTL_HW, HW_NCPU};
 std::size_t s = sizeof(n);
-sysctl(mib, 2, , , 0, 0);
+sysctl(mib, 2, , , nullptr, 0);
 return n;
 #elif defined(_SC_NPROCESSORS_ONLN)
 long result = sysconf(_SC_NPROCESSORS_ONLN);
Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -64,7 +64,7 @@
 if (size == 0)
 size = 1;
 void* p;
-while ((p = ::malloc(size)) == 0)
+while ((p = ::malloc(size)) == nullptr)
 {
 // If malloc fails and there is a new_handler,
 // call it to try free up memory.
@@ -85,7 +85,7 @@
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -111,7 +111,7 @@
 void*
 operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -206,7 +206,7 @@
 void*
 operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -232,7 +232,7 @@
 void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -47,7 +47,7 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 struct __libcpp_unique_locale {
-  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {}
+  __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, nullptr)) {}
 
   ~__libcpp_unique_locale() {
 if (__loc_)
@@ -536,7 +536,7 @@
 
 locale::locale(const char* name)
 : __locale_(name ? new __imp(name)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -549,7 +549,7 @@
 
 locale::locale(const locale& other, const char* name, category c)
 : __locale_(name ? new __imp(*other.__locale_, name, c)
- : (__throw_runtime_error("locale constructed with null"), (__imp*)0))
+ : (__throw_runtime_error("locale constructed with null"), nullptr))
 {
 __locale_->__add_shared();
 }
@@ -664,18 +664,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + string(n));
 }
 
 collate_byname::collate_byname(const string& name, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
+  __l(newlocale(LC_ALL_MASK, name.c_str(), nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + name);
 }
@@ -703,7 +703,7 @@
 collate_byname::do_transform(const char_type* lo, const char_type* hi) const
 {
 const string_type in(lo, hi);
-string_type out(strxfrm_l(0, in.c_str(), 0, __l), char());
+string_type out(strxfrm_l(nullptr, in.c_str(), 0, __l), char());
 strxfrm_l(const_cast(out.c_str()), in.c_str(), out.size()+1, __l);
 return out;
 }
@@ -712,18 +712,18 @@
 
 collate_byname::collate_byname(const char* n, size_t refs)
 : collate(refs),
-  __l(newlocale(LC_ALL_MASK, n, 0))
+  __l(newlocale(LC_ALL_MASK, n, nullptr))
 {
-if (__l == 0)
+if (__l == nullptr)
 __throw_runtime_error("collate_byname::collate_byname(size_t refs)"
 " 

[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

In D43159#1526170 , @brucem wrote:

> Can we revive this review? I'd still like to land this ...


What was the result of testing with `-std=c++98` and/or `-std=gnu++98` ?
The code changes look fine; but as @Ericwf said


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159



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


[PATCH] D43159: Modernize: Use nullptr more.

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.
Herald added subscribers: libcxx-commits, jfb, ldionne, christof.

Can we revive this review? I'd still like to land this ...


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43159/new/

https://reviews.llvm.org/D43159



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


[PATCH] D43226: __threading_support: Remove (void) in favor of ().

2019-06-01 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem added a comment.
Herald added subscribers: libcxx-commits, ldionne.

Can we revive this review? I'd still like to land it ...


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43226/new/

https://reviews.llvm.org/D43226



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


[PATCH] D62746: msabi: Fix exponential mangling time for certain pathological inputs

2019-06-01 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG73f05841992c: msabi: Fix exponential mangling time for 
certain pathological inputs (authored by thakis).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D62746?vs=202472=202542#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62746/new/

https://reviews.llvm.org/D62746

Files:
  clang/lib/AST/MicrosoftMangle.cpp
  clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp

Index: clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
===
--- clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
+++ clang/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp
@@ -191,3 +191,44 @@
 // CHECK: "??$fun_tmpl_recurse@H$1??$fun_tmpl_recurse@H$1?ident@fn_space@@YA?AURetVal@2@H@Z@fn_space@@YA?AURetVal@1@H@Z@fn_space@@YA?AURetVal@0@H@Z"
 // CHECK: "??$fun_tmpl_recurse@H$1?ident@fn_space@@YA?AURetVal@2@H@Z@fn_space@@YA?AURetVal@0@H@Z"
 }
+
+
+template 
+struct Fooob {};
+
+using A0 = Fooob;
+using A1 = Fooob;
+using A2 = Fooob;
+using A3 = Fooob;
+using A4 = Fooob;
+using A5 = Fooob;
+using A6 = Fooob;
+using A7 = Fooob;
+using A8 = Fooob;
+using A9 = Fooob;
+using A10 = Fooob;
+
+// This should take milliseconds, not minutes.
+void f(A9 a) {}
+// CHECK: "?f@@YAXU?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@U?$Fooob@HH@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1@@@U1@U1@U1@U1@U1@U1@U1@U1@U1Z"
+
+
+template 
+struct Food {};
+
+using B0 = Food;
+using B1 = Food;
+using B2 = Food;
+using B3 = Food;
+using B4 = Food;
+using B5 = Food;
+using B6 = Food;
+
+// This too should take milliseconds, not minutes.
+void f(B6 a) {}
+
+// CHECK: 

r362293 - msabi: Fix exponential mangling time for certain pathological inputs

2019-06-01 Thread Nico Weber via cfe-commits
Author: nico
Date: Sat Jun  1 03:12:07 2019
New Revision: 362293

URL: http://llvm.org/viewvc/llvm-project?rev=362293=rev
Log:
msabi: Fix exponential mangling time for certain pathological inputs

Template back references used to be recursively recomputed, add a
memoization cache to cut down on this.

Since there are now two different types of argument maps, rename the
existing TypeBackReferences to FunArgBackReferences, and rename
mangleArgumentType() to mangleFunctionArgumentType().

Fixes PR42091, the input there now takes 50ms instead of 7s to compile.

No intended behavior change.

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

Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=362293=362292=362293=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Sat Jun  1 03:12:07 2019
@@ -265,7 +265,8 @@ class MicrosoftCXXNameMangler {
   BackRefVec NameBackReferences;
 
   typedef llvm::DenseMap ArgBackRefMap;
-  ArgBackRefMap TypeBackReferences;
+  ArgBackRefMap FunArgBackReferences;
+  ArgBackRefMap TemplateArgBackReferences;
 
   typedef std::set> PassObjectSizeArgsSet;
   PassObjectSizeArgsSet PassObjectSizeArgs;
@@ -343,7 +344,7 @@ private:
   const TemplateArgumentList );
   void mangleObjCMethodName(const ObjCMethodDecl *MD);
 
-  void mangleArgumentType(QualType T, SourceRange Range);
+  void mangleFunctionArgumentType(QualType T, SourceRange Range);
   void manglePassObjectSizeArg(const PassObjectSizeAttr *POSA);
 
   bool isArtificialTagType(QualType T) const;
@@ -793,7 +794,7 @@ void MicrosoftCXXNameMangler::mangleUnqu
 // the X part is aliased. However, if you need to mangle
 //   void foo(A::X, A::X),
 // the A::X<> part is not aliased.
-// That said, from the mangler's perspective we have a structure like this:
+// That is, from the mangler's perspective we have a structure like this:
 //   namespace[s] -> type[ -> template-parameters]
 // but from the Clang perspective we have
 //   type [ -> template-parameters]
@@ -803,12 +804,30 @@ void MicrosoftCXXNameMangler::mangleUnqu
 // the mangled type name as a key to check the mangling of different types
 // for aliasing.
 
-llvm::SmallString<64> TemplateMangling;
-llvm::raw_svector_ostream Stream(TemplateMangling);
-MicrosoftCXXNameMangler Extra(Context, Stream);
-Extra.mangleTemplateInstantiationName(TD, *TemplateArgs);
-
-mangleSourceName(TemplateMangling);
+// It's important to key cache reads off ND, not TD -- the same TD can
+// be used with different TemplateArgs, but ND uniquely identifies
+// TD / TemplateArg pairs.
+ArgBackRefMap::iterator Found = TemplateArgBackReferences.find(ND);
+if (Found == TemplateArgBackReferences.end()) {
+  // Mangle full template name into temporary buffer.
+  llvm::SmallString<64> TemplateMangling;
+  llvm::raw_svector_ostream Stream(TemplateMangling);
+  MicrosoftCXXNameMangler Extra(Context, Stream);
+  Extra.mangleTemplateInstantiationName(TD, *TemplateArgs);
+
+  // Use the string backref vector to possibly get a back reference.
+  mangleSourceName(TemplateMangling);
+
+  // Memoize back reference for this type.
+  BackRefVec::iterator StringFound =
+  llvm::find(NameBackReferences, TemplateMangling);
+  if (StringFound != NameBackReferences.end()) {
+TemplateArgBackReferences[ND] =
+StringFound - NameBackReferences.begin();
+  }
+} else {
+  Out << Found->second;
+}
 return;
   }
 
@@ -1282,11 +1301,13 @@ void MicrosoftCXXNameMangler::mangleTemp
   // Always start with the unqualified name.
 
   // Templates have their own context for back references.
-  ArgBackRefMap OuterArgsContext;
+  ArgBackRefMap OuterFunArgsContext;
+  ArgBackRefMap OuterTemplateArgsContext;
   BackRefVec OuterTemplateContext;
   PassObjectSizeArgsSet OuterPassObjectSizeArgs;
   NameBackReferences.swap(OuterTemplateContext);
-  TypeBackReferences.swap(OuterArgsContext);
+  FunArgBackReferences.swap(OuterFunArgsContext);
+  TemplateArgBackReferences.swap(OuterTemplateArgsContext);
   PassObjectSizeArgs.swap(OuterPassObjectSizeArgs);
 
   mangleUnscopedTemplateName(TD);
@@ -1294,7 +1315,8 @@ void MicrosoftCXXNameMangler::mangleTemp
 
   // Restore the previous back reference contexts.
   NameBackReferences.swap(OuterTemplateContext);
-  TypeBackReferences.swap(OuterArgsContext);
+  FunArgBackReferences.swap(OuterFunArgsContext);
+  TemplateArgBackReferences.swap(OuterTemplateArgsContext);
   PassObjectSizeArgs.swap(OuterPassObjectSizeArgs);
 }
 
@@ -1699,8 +1721,8 @@ void MicrosoftCXXNameMangler::manglePoin
 

r362186 - Revert "[X86] Fix i386 struct and union parameter alignment"

2019-06-01 Thread Pengfei Wang via cfe-commits
Author: pengfei
Date: Thu May 30 18:50:07 2019
New Revision: 362186

URL: http://llvm.org/viewvc/llvm-project?rev=362186=rev
Log:
Revert "[X86] Fix i386 struct and union parameter alignment"

This reverts commit d61cb749f4ac2c90244906d756e80a5c4a7ffa89 (SVN:
361934).

According to James suggestion, revert this change. Please ref:
https://reviews.llvm.org/D60748

Removed:
cfe/trunk/test/CodeGen/x86_32-align-linux.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/x86_32-arguments-linux.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=362186=362185=362186=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu May 30 18:50:07 2019
@@ -1010,7 +1010,6 @@ class X86_32ABIInfo : public SwiftABIInf
   bool IsWin32StructABI;
   bool IsSoftFloatABI;
   bool IsMCUABI;
-  bool IsLinuxABI;
   unsigned DefaultNumRegisterParameters;
 
   static bool isRegisterSize(unsigned Size) {
@@ -1077,7 +1076,6 @@ public:
   IsWin32StructABI(Win32StructABI),
   IsSoftFloatABI(SoftFloatABI),
   IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
-  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux()),
   DefaultNumRegisterParameters(NumRegisterParameters) {}
 
   bool shouldPassIndirectlyForSwift(ArrayRef scalars,
@@ -1494,15 +1492,8 @@ unsigned X86_32ABIInfo::getTypeStackAlig
   if (Align <= MinABIStackAlignInBytes)
 return 0; // Use default alignment.
 
-  if (IsLinuxABI) {
-// i386 System V ABI 2.1: Structures and unions assume the alignment of 
their
-// most strictly aligned component.
-//
-// Exclude other System V OS (e.g Darwin, PS4 and FreeBSD) since we don't
-// want to spend any effort dealing with the ramifications of ABI breaks.
-return Align;
-  } else if (!IsDarwinVectorABI) {
-// On non-Darwin and non-Linux, the stack type alignment is always 4.
+  // On non-Darwin, the stack type alignment is always 4.
+  if (!IsDarwinVectorABI) {
 // Set explicit alignment, since we may need to realign the top.
 return MinABIStackAlignInBytes;
   }

Removed: cfe/trunk/test/CodeGen/x86_32-align-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-align-linux.c?rev=362185=auto
==
--- cfe/trunk/test/CodeGen/x86_32-align-linux.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-align-linux.c (removed)
@@ -1,25 +0,0 @@
-// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu 
-emit-llvm -o %t %s
-// RUN: FileCheck < %t %s
-
-#include 
-
-typedef union {
-int d[4];
-__m128 m;
-} M128;
-
-extern void foo(int, ...);
-
-M128 a;
-
-// CHECK-LABEL: define void @test
-// CHECK: entry:
-// CHECK: call void (i32, ...) @foo(i32 1, %union.M128* byval align 16
-// CHECK: call void (i32, ...) @foo(i32 1, <4 x float>
-
-void test(void)
-{
-  foo(1, a);
-  foo(1, a.m);
-}
-

Modified: cfe/trunk/test/CodeGen/x86_32-arguments-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments-linux.c?rev=362186=362185=362186=diff
==
--- cfe/trunk/test/CodeGen/x86_32-arguments-linux.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments-linux.c Thu May 30 18:50:07 2019
@@ -3,21 +3,21 @@
 
 // CHECK-LABEL: define void @f56(
 // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
-// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 8 %a3,
-// CHECK: <1 x double> %a4, %struct.s56_2* byval align 8 %a5,
-// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 16 %a7,
-// CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9,
-// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 32 %a11,
-// CHECK: <4 x double> %a12, %struct.s56_6* byval align 32 %a13)
+// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 4,
+// CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
+// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
+// CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
+// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
+// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
 
 // CHECK: call void (i32, ...) @f56_0(i32 1,
 // CHECK: i32 %{{.*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
-// CHECK: i64 %{{[^ ]*}}, %struct.s56_1* byval align 8 %{{[^ ]*}},
-// CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 8 %{{[^ ]*}},
-// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 16 %{{[^ ]*}},
-// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}},
-// CHECK: <8 x i32> %{{[^ ]*}}, %struct.s56_5* byval align 32 %{{[^ ]*}},
-// CHECK: <4 x double> %{{[^ ]*}}, %struct.s56_6* byval align 32 %{{[^ ]*}})
+// CHECK: i64 %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
+// CHECK: <1 x 

[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-06-01 Thread Jennifer Yu via Phabricator via cfe-commits
jyu2 added a comment.

jyu2 committed rG954ec09aed4f 
: clang 
support gnu asm goto

In D56571#1523895 , @nickdesaulniers 
wrote:

> Was this committed accidentally?
>
> Today in master I see:
>
> - r362106: Revert "clang support gnu asm goto." Erich Keane 
> 
> - r362059: Mark CodeGen/asm-goto.c as x86 specific after r362045 Fangrui Song 
> 
> - r362045: clang support gnu asm goto. Jennifer Yu 
>
>   and yet this Phabricator review is still open.
>
>   It may be easier to rebase this into a monorepo checkout, then commit with 
> `git llvm push`. 
> https://llvm.org/docs/GettingStarted.html#for-developers-to-commit-changes-from-git
>
>   As @kees  noted, for new test files that contain x86 assembly, they need a 
> `-triple` that specifies an x86 target, otherwise the implicit target is 
> based on the host, which may not be x86.  We still want to verify that 
> non-x86 host can cross compile to x86 correctly.  Sorry we did not catch this 
> earlier in code review.


Thanks Kees and Nick!  I am currently work on those tests to see if I can make 
them more generic.  All my test using x86 instruction.  So that is not working 
for arm or arm64 target.  Will update you once I am done for this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571



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


[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-06-01 Thread Kees Cook via Phabricator via cfe-commits
kees added a comment.

Nick points out that "REQUIRES: x86-registered-target" is likely not needed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571



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


[clang-tools-extra] r362176 - [clangd] clang-format SymbolCollector.cpp

2019-06-01 Thread Nathan Ridge via cfe-commits
Author: nridge
Date: Thu May 30 16:54:43 2019
New Revision: 362176

URL: http://llvm.org/viewvc/llvm-project?rev=362176=rev
Log:
[clangd] clang-format SymbolCollector.cpp

Modified:
clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp

Modified: clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp?rev=362176=362175=362176=diff
==
--- clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp Thu May 30 
16:54:43 2019
@@ -416,8 +416,7 @@ bool SymbolCollector::handleMacroOccuren
   return true;
 }
 
-void SymbolCollector::setIncludeLocation(const Symbol ,
- SourceLocation Loc) {
+void SymbolCollector::setIncludeLocation(const Symbol , SourceLocation Loc) {
   if (Opts.CollectIncludePath)
 if (shouldCollectIncludePath(S.SymInfo.Kind))
   // Use the expansion location to get the #include header since this is
@@ -681,7 +680,7 @@ static bool isErrorAboutInclude(llvm::St
   if (!Line.consume_front("#"))
 return false;
   Line = Line.ltrim();
-  if (! Line.startswith("error"))
+  if (!Line.startswith("error"))
 return false;
   return Line.contains_lower("includ"); // Matches "include" or "including".
 }
@@ -689,7 +688,7 @@ static bool isErrorAboutInclude(llvm::St
 bool SymbolCollector::isDontIncludeMeHeader(llvm::StringRef Content) {
   llvm::StringRef Line;
   // Only sniff up to 100 lines or 10KB.
-  Content = Content.take_front(100*100);
+  Content = Content.take_front(100 * 100);
   for (unsigned I = 0; I < 100 && !Content.empty(); ++I) {
 std::tie(Line, Content) = Content.split('\n');
 if (isIf(Line) && isErrorAboutInclude(Content.split('\n').first))


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


[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-06-01 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

Was this committed accidentally?

Today in master I see:

- r362106: Revert "clang support gnu asm goto." Erich Keane 

- r362059: Mark CodeGen/asm-goto.c as x86 specific after r362045 Fangrui Song 

- r362045: clang support gnu asm goto. Jennifer Yu 

and yet this Phabricator review is still open.

It may be easier to rebase this into a monorepo checkout, then commit with `git 
llvm push`.
https://llvm.org/docs/GettingStarted.html#for-developers-to-commit-changes-from-git

As @kees  noted, for new test files that contain x86 assembly, they need a 
`-triple` that specifies an x86 target, otherwise the implicit target is based 
on the host, which may not be x86.  We still want to verify that non-x86 host 
can cross compile to x86 correctly.  Sorry we did not catch this earlier in 
code review.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571



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


[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-06-01 Thread Kees Cook via Phabricator via cfe-commits
kees added inline comments.



Comment at: test/Analysis/asm-goto.cpp:1
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck 
%s
+

Based on Nathan's comments in another thread, it seems like this needs to be:

```
// REQUIRES: x86-registered-target
// RUN: %clang_analyze_cc1 -triple x86_64 -analyzer-checker=debug.DumpCFG %s 
2>&1 | FileCheck %s
```



Comment at: test/CodeGen/asm-goto.c:1
+// RUN: %clang_cc1 -O0 -emit-llvm  %s -o - | FileCheck %s
+

Based on Nathan's comments in another thread, it seems like this needs to be:

```
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -O0 -triple x86_64 -emit-llvm  %s -o - | FileCheck %s
```



Comment at: test/Sema/asm-goto.cpp:1
+// RUN: %clang_cc1 %s -triple i386-pc-linux-gnu -verify -fsyntax-only
+

Based on Nathan's comments in another thread, it seems like this needs to be:

```
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify -fblocks -std=gnu99 %s 
-Wno-unreachable-code
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571



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


r361934 - [X86] Fix i386 struct and union parameter alignment

2019-06-01 Thread Pengfei Wang via cfe-commits
Author: pengfei
Date: Wed May 29 01:42:35 2019
New Revision: 361934

URL: http://llvm.org/viewvc/llvm-project?rev=361934=rev
Log:
[X86] Fix i386 struct and union parameter alignment

According to i386 System V ABI 2.1: Structures and unions assume the
alignment of their most strictly aligned component. But current
implementation always takes them as 4-byte aligned which will result
in incorrect code, e.g:

 1 #include 
 2 typedef union {
 3 int d[4];
 4 __m128 m;
 5 } M128;
 6 extern void foo(int, ...);
 7 void test(void)
 8 {
 9   M128 a;
10   foo(1, a);
11   foo(1, a.m);
12 }

The first call (line 10) takes the second arg as 4-byte aligned while
the second call (line 11) takes the second arg as 16-byte aligned.
There is oxymoron for the alignment of the 2 calls because they should
be the same.

This patch fixes the bug by following i386 System V ABI and apply it to
Linux only since other System V OS (e.g Darwin, PS4 and FreeBSD) don't
want to spend any effort dealing with the ramifications of ABI breaks
at present.

Patch by Wei Xiao (wxiao3)

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

Added:
cfe/trunk/test/CodeGen/x86_32-align-linux.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/x86_32-arguments-linux.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=361934=361933=361934=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed May 29 01:42:35 2019
@@ -1010,6 +1010,7 @@ class X86_32ABIInfo : public SwiftABIInf
   bool IsWin32StructABI;
   bool IsSoftFloatABI;
   bool IsMCUABI;
+  bool IsLinuxABI;
   unsigned DefaultNumRegisterParameters;
 
   static bool isRegisterSize(unsigned Size) {
@@ -1076,6 +1077,7 @@ public:
   IsWin32StructABI(Win32StructABI),
   IsSoftFloatABI(SoftFloatABI),
   IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
+  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux()),
   DefaultNumRegisterParameters(NumRegisterParameters) {}
 
   bool shouldPassIndirectlyForSwift(ArrayRef scalars,
@@ -1492,8 +1494,15 @@ unsigned X86_32ABIInfo::getTypeStackAlig
   if (Align <= MinABIStackAlignInBytes)
 return 0; // Use default alignment.
 
-  // On non-Darwin, the stack type alignment is always 4.
-  if (!IsDarwinVectorABI) {
+  if (IsLinuxABI) {
+// i386 System V ABI 2.1: Structures and unions assume the alignment of 
their
+// most strictly aligned component.
+//
+// Exclude other System V OS (e.g Darwin, PS4 and FreeBSD) since we don't
+// want to spend any effort dealing with the ramifications of ABI breaks.
+return Align;
+  } else if (!IsDarwinVectorABI) {
+// On non-Darwin and non-Linux, the stack type alignment is always 4.
 // Set explicit alignment, since we may need to realign the top.
 return MinABIStackAlignInBytes;
   }

Added: cfe/trunk/test/CodeGen/x86_32-align-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-align-linux.c?rev=361934=auto
==
--- cfe/trunk/test/CodeGen/x86_32-align-linux.c (added)
+++ cfe/trunk/test/CodeGen/x86_32-align-linux.c Wed May 29 01:42:35 2019
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu 
-emit-llvm -o %t %s
+// RUN: FileCheck < %t %s
+
+#include 
+
+typedef union {
+int d[4];
+__m128 m;
+} M128;
+
+extern void foo(int, ...);
+
+M128 a;
+
+// CHECK-LABEL: define void @test
+// CHECK: entry:
+// CHECK: call void (i32, ...) @foo(i32 1, %union.M128* byval align 16
+// CHECK: call void (i32, ...) @foo(i32 1, <4 x float>
+
+void test(void)
+{
+  foo(1, a);
+  foo(1, a.m);
+}
+

Modified: cfe/trunk/test/CodeGen/x86_32-arguments-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments-linux.c?rev=361934=361933=361934=diff
==
--- cfe/trunk/test/CodeGen/x86_32-arguments-linux.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments-linux.c Wed May 29 01:42:35 2019
@@ -3,21 +3,21 @@
 
 // CHECK-LABEL: define void @f56(
 // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
-// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 4,
-// CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
-// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
-// CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
-// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
-// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
+// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 8 %a3,
+// CHECK: <1 x double> %a4, %struct.s56_2* byval align 8 %a5,
+// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 16 %a7,
+// CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9,
+//