[PATCH] D23418: [analyzer] Added a reusable constraint system to the CloneDetector

2017-03-31 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment.

Hi Raphael,

Then I will rebase my patch https://reviews.llvm.org/D31320 please review it 
when you have free time, thanks a lot!

Regards,
Leslie Zhai


https://reviews.llvm.org/D23418



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


[PATCH] D29904: [OpenMP] Prevent emission of exception handling code when using OpenMP to offload to NVIDIA devices.

2017-03-31 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld requested changes to this revision.
Hahnfeld added a comment.
This revision now requires changes to proceed.

Out of interest: This is a limition of the implementation, right? Because the 
standard only says: `A throw executed inside a target region must cause 
execution to resume within the same target region, and the same thread that 
threw the exception must catch it.`




Comment at: test/OpenMP/target_parallel_no_exceptions.cpp:14
+{
+  a = inc(a);
+}

Please make the test be valid OpenMP: `inc` is not in `declare target` and it's 
also a data race.

I think it's enough to only have a `target` construct in the test.


Repository:
  rL LLVM

https://reviews.llvm.org/D29904



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


[PATCH] D31321: [OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args

2017-03-31 Thread Egor Churaev via Phabricator via cfe-commits
echuraev updated this revision to Diff 93596.

https://reviews.llvm.org/D31321

Files:
  lib/CodeGen/CodeGenFunction.cpp
  test/CodeGenOpenCL/kernel-arg-info.cl


Index: test/CodeGenOpenCL/kernel-arg-info.cl
===
--- test/CodeGenOpenCL/kernel-arg-info.cl
+++ test/CodeGenOpenCL/kernel-arg-info.cl
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple 
spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
 
 kernel void foo(__global int * restrict X, const int Y, 
-volatile int anotherArg, __constant float * restrict Z) {
+volatile int anotherArg, __constant float * restrict Z,
+__global volatile int * V, __global const int * C) {
   *X = Y + anotherArg;
 }
 // CHECK: define spir_kernel void @foo{{[^!]+}}
@@ -60,11 +61,11 @@
 // CHECK-NOT: !kernel_arg_name
 // ARGINFO: !kernel_arg_name ![[MD54:[0-9]+]]
 
-// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2}
-// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none"}
-// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"}
-// CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"}
-// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"}
+// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2, i32 1, i32 1}
+// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none", !"none", !"none"}
+// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*", !"int*", !"int*"}
+// CHECK: ![[MD14]] = !{!"restrict", !"", !"", !"restrict const", !"volatile", 
!"const"}
+// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z", !"V", !"C"}
 // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1}
 // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", 
!"read_write"}
 // CHECK: ![[MD23]] = !{!"image1d_t", !"image2d_t", !"image2d_array_t", 
!"image1d_t"}
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -610,11 +610,6 @@
 
   argBaseTypeNames.push_back(llvm::MDString::get(Context, baseTypeName));
 
-  // Get argument type qualifiers:
-  if (ty.isConstQualified())
-typeQuals = "const";
-  if (ty.isVolatileQualified())
-typeQuals += typeQuals.empty() ? "volatile" : " volatile";
   if (isPipe)
 typeQuals = "pipe";
 }


Index: test/CodeGenOpenCL/kernel-arg-info.cl
===
--- test/CodeGenOpenCL/kernel-arg-info.cl
+++ test/CodeGenOpenCL/kernel-arg-info.cl
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
 
 kernel void foo(__global int * restrict X, const int Y, 
-volatile int anotherArg, __constant float * restrict Z) {
+volatile int anotherArg, __constant float * restrict Z,
+__global volatile int * V, __global const int * C) {
   *X = Y + anotherArg;
 }
 // CHECK: define spir_kernel void @foo{{[^!]+}}
@@ -60,11 +61,11 @@
 // CHECK-NOT: !kernel_arg_name
 // ARGINFO: !kernel_arg_name ![[MD54:[0-9]+]]
 
-// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2}
-// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none"}
-// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"}
-// CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"}
-// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"}
+// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2, i32 1, i32 1}
+// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none", !"none", !"none"}
+// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*", !"int*", !"int*"}
+// CHECK: ![[MD14]] = !{!"restrict", !"", !"", !"restrict const", !"volatile", !"const"}
+// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z", !"V", !"C"}
 // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1}
 // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", !"read_write"}
 // CHECK: ![[MD23]] = !{!"image1d_t", !"image2d_t", !"image2d_array_t", !"image1d_t"}
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -610,11 +610,6 @@
 
   argBaseTypeNames.push_back(llvm::MDString::get(Context, baseTypeName));
 
-  // Get argument type qualifiers:
-  if (ty.isConstQualified())
-typeQuals = "const";
-  if (ty.isVolatileQualified())
-typeQuals += typeQuals.empty() ? "volatile" : " volatile";
   if (isPipe)
 typeQuals = "pipe";
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r299190 - [clang-tidy] Correct code-block in the doc.

2017-03-31 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Mar 31 02:55:22 2017
New Revision: 299190

URL: http://llvm.org/viewvc/llvm-project?rev=299190&view=rev
Log:
[clang-tidy] Correct code-block in the doc.

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-container-size-empty.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-container-size-empty.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/readability-container-size-empty.rst?rev=299190&r1=299189&r2=299190&view=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-container-size-empty.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-container-size-empty.rst
 Fri Mar 31 02:55:22 2017
@@ -18,7 +18,7 @@ the future.
 The check issues warning if a container has ``size()`` and ``empty()`` methods
 matching following signatures:
 
-code-block:: c++
+.. code-block:: c++
 
   size_type size() const;
   bool empty() const;


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


[PATCH] D30643: [OpenCL] Extended diagnostics for atomic initialization

2017-03-31 Thread Egor Churaev via Phabricator via cfe-commits
echuraev updated this revision to Diff 93602.
echuraev marked an inline comment as done.

https://reviews.llvm.org/D30643

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaInit.cpp
  test/Parser/opencl-atomics-cl20.cl
  test/SemaOpenCL/atomic-init.cl


Index: test/SemaOpenCL/atomic-init.cl
===
--- /dev/null
+++ test/SemaOpenCL/atomic-init.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify  %s
+
+global atomic_int a1 = 0;
+
+kernel void test_atomic_initialization() {
+  a1 = 1; // expected-error {{atomic variable can only be assigned to a 
compile time constant}}
+  atomic_int a2 = 0; // expected-error {{atomic variable can be initialized to 
a variable only in global address space}}
+  private atomic_int a3 = 0; // expected-error {{atomic variable can be 
initialized to a variable only in global address space}}
+  local atomic_int a4 = 0; // expected-error {{'__local' variable cannot have 
an initializer}}
+  global atomic_int a5 = 0; // expected-error {{function scope variable cannot 
be declared in global address space}}
+  static global atomic_int a6 = 0;
+}
Index: test/Parser/opencl-atomics-cl20.cl
===
--- test/Parser/opencl-atomics-cl20.cl
+++ test/Parser/opencl-atomics-cl20.cl
@@ -67,7 +67,7 @@
   foo(&i);
 // OpenCL v2.0 s6.13.11.8, arithemtic operations are not permitted on atomic 
types.
   i++; // expected-error {{invalid argument type 'atomic_int' (aka 
'_Atomic(int)') to unary expression}}
-  i = 1; // expected-error {{atomic variable can only be assigned to a compile 
time constant in the declaration statement in the program scope}}
+  i = 1; // expected-error {{atomic variable can only be assigned to a compile 
time constant}}
   i += 1; // expected-error {{invalid operands to binary expression 
('atomic_int' (aka '_Atomic(int)') and 'int')}}
   i = i + i; // expected-error {{invalid operands to binary expression 
('atomic_int' (aka '_Atomic(int)') and 'atomic_int')}}
 }
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -6502,6 +6502,20 @@
   << Init->getSourceRange();
   }
 
+  // OpenCL v2.0 s6.13.11.1. atomic variables can be initialized in global 
scope
+  QualType ETy = Entity.getType();
+  Qualifiers TyQualifiers = ETy.getQualifiers();
+  bool HasGlobalAS = TyQualifiers.hasAddressSpace() &&
+ TyQualifiers.getAddressSpace() == LangAS::opencl_global;
+
+  if (S.getLangOpts().OpenCLVersion >= 200 &&
+  ETy->isAtomicType() && !HasGlobalAS &&
+  Entity.getKind() == InitializedEntity::EK_Variable && Args.size() > 0) {
+S.Diag(Args[0]->getLocStart(), diag::err_opencl_atomic_init) << 1 <<
+SourceRange(Entity.getDecl()->getLocStart(), Args[0]->getLocEnd());
+return ExprError();
+  }
+
   // Diagnose cases where we initialize a pointer to an array temporary, and 
the
   // pointer obviously outlives the temporary.
   if (Args.size() == 1 && Args[0]->getType()->isArrayType() &&
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -2,7 +2,7 @@
 if (LHSTy->isAtomicType() || RHSTy->isAtomicType()) {
   SourceRange SR(LHSExpr->getLocStart(), RHSExpr->getLocEnd());
   if (BO_Assign == Opc)
-Diag(OpLoc, diag::err_atomic_init_constant) << SR;
+Diag(OpLoc, diag::err_opencl_atomic_init) << 0 << SR;
   else
 ResultTy = InvalidOperands(OpLoc, LHS, RHS);
   return ExprError();
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -8284,9 +8284,9 @@
   "return value cannot be qualified with address space">;
 def err_opencl_constant_no_init : Error<
   "variable in constant address space must be initialized">;
-def err_atomic_init_constant : Error<
-  "atomic variable can only be assigned to a compile time constant"
-  " in the declaration statement in the program scope">;
+def err_opencl_atomic_init: Error<
+  "atomic variable can %select{only be assigned to a compile time constant|"
+  "be initialized to a variable only in global address space}0">;
 def err_opencl_implicit_vector_conversion : Error<
   "implicit conversions between vector types (%0 and %1) are not permitted">;
 def err_opencl_invalid_type_array : Error<


Index: test/SemaOpenCL/atomic-init.cl
===
--- /dev/null
+++ test/SemaOpenCL/atomic-init.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify  %s
+
+global atomic_int a1 = 0;
+
+kernel void test_atomic_initialization() {
+  a1 = 1; // expected-error {{atomic 

[PATCH] D29339: [OpenMP] Add support for auxiliary triple specification

2017-03-31 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: lib/Driver/ToolChains/Clang.cpp:1967-1968
+C.getSingleOffloadToolChain()
+->getTriple()
+.normalize();
+CmdArgs.push_back("-aux-triple");

I might be wrong here... Can you run the code through `clang-format` before 
committing to be sure?



Comment at: lib/Frontend/CompilerInstance.cpp:914-915
+  // Create TargetInfo for the other side of CUDA and OpenMP compilation.
+  if ((getLangOpts().CUDA && !getFrontendOpts().AuxTriple.empty()) ||
+  (getLangOpts().OpenMPIsDevice && !getFrontendOpts().AuxTriple.empty())) {
 auto TO = std::make_shared();

ABataev wrote:
> It's better to check `!getFrontendOpts().AuxTriple.empty()` only once in this 
> condition
Another micro optimization: `(getLangOpts().CUDA || 
getLangOpts().OpenMPIsDevice)` is probably cheaper than 
`!getFrontendOpts().AuxTriple.empty()` so it might be worth swapping the 
conditions as in the original code.


Repository:
  rL LLVM

https://reviews.llvm.org/D29339



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


[PATCH] D31515: [libc++] Implement LWG 2911 - add an is_aggregate type-trait

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93605.
EricWF added a comment.

GCC implemented `__is_aggregate` hours ago as part of 7.0.1. Update the feature 
checks to reflect that.


https://reviews.llvm.org/D31515

Files:
  include/__config
  include/type_traits
  
test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp
  test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -480,7 +480,7 @@
 	http://wg21.link/LWG2904";>2904Make variant move-assignment more exception safeKona
 	http://wg21.link/LWG2905";>2905is_constructible_v, P, D const &> should be false when D is not copy constructibleKona
 	http://wg21.link/LWG2908";>2908The less-than operator for shared pointers could do moreKona
-	http://wg21.link/LWG2911";>2911An is_aggregate type trait is neededKona
+	http://wg21.link/LWG2911";>2911An is_aggregate type trait is neededKonaComplete
 	http://wg21.link/LWG2921";>2921packaged_task and type-erased allocatorsKona
 	http://wg21.link/LWG2934";>2934optional doesn't compare with TKonaComplete
 

r299191 - [msan] Turn off lifetime markers even when use after scope checking is on.

2017-03-31 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri Mar 31 04:19:25 2017
New Revision: 299191

URL: http://llvm.org/viewvc/llvm-project?rev=299191&view=rev
Log:
[msan] Turn off lifetime markers even when use after scope checking is on.

Since r299174 use after scope checking is on by default. Even though
msan doesn't check for use after scope it gets confused by the lifetime
markers emitted for it, making unit tests fail. This is covered by
ninja check-msan.

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

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=299191&r1=299190&r2=299191&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Mar 31 04:19:25 2017
@@ -45,15 +45,15 @@ static bool shouldEmitLifetimeMarkers(co
   if (CGOpts.DisableLifetimeMarkers)
 return false;
 
-  // Asan uses markers for use-after-scope checks.
-  if (CGOpts.SanitizeAddressUseAfterScope)
-return true;
-
   // Disable lifetime markers in msan builds.
   // FIXME: Remove this when msan works with lifetime markers.
   if (LangOpts.Sanitize.has(SanitizerKind::Memory))
 return false;
 
+  // Asan uses markers for use-after-scope checks.
+  if (CGOpts.SanitizeAddressUseAfterScope)
+return true;
+
   // For now, only in optimized builds.
   return CGOpts.OptimizationLevel != 0;
 }


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


[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

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



Comment at: include/clang/AST/ASTContext.h:42
 #include "clang/Basic/Specifiers.h"
+#include "clang/Basic/VersionTuple.h"
 #include "llvm/ADT/APSInt.h"

I don't see why this is included here.



Comment at: include/clang/AST/Mangle.h:55
   const ManglerKind Kind;
+  // Used for cross tranlsation unit analysis.
+  // To reduce the risk of function name collision in C projects, we force

tranlsation => translation



Comment at: lib/AST/ASTContext.cpp:1457
+return nullptr;
+  for (Decl *D : DC->decls()) {
+const auto *SubDC = dyn_cast(D);

could add a "const" perhaps



Comment at: lib/AST/ASTContext.cpp:1491
+  std::string MangledFnName = getMangledName(FD, MangleCtx.get());
+  std::string ExternalFunctionMap = (XTUDir + "/externalFnMap.txt").str();
+  ASTUnit *Unit = nullptr;

as far as I see ExternalFunctionMap can be moved into the subscope.



Comment at: lib/AST/ASTContext.cpp:1500
+  std::string FunctionName, FileName;
+  while (ExternalFnMapFile >> FunctionName >> FileName)
+FunctionFileMap[FunctionName] = (XTUDir + "/" + FileName).str();

I would recommend that a parser is added that make sure the file data is 
correct/sane. If there is some load/save mismatch now or in the future or if 
the user choose to tweak the file for some reason, the behaviour could be wrong.




Comment at: lib/AST/ASTContext.cpp:1502
+FunctionFileMap[FunctionName] = (XTUDir + "/" + FileName).str();
+  ExternalFnMapFile.close();
+}

well.. I believe it's redundant to close this explicitly since the 
std::ifstream destructor should do that. But it doesn't hurt doing it.



Comment at: lib/Basic/SourceManager.cpp:2028
 /// \brief Determines the order of 2 source locations in the translation unit.
+/// FIXME: It also works when two locations are from different translation 
unit.
+///In that case it will return *some* order.

I am not good at english. But I believe unit=>units.



Comment at: lib/Basic/SourceManager.cpp:2126
   }
-  llvm_unreachable("Unsortable locations found");
+  // FIXME: Source locations from different translation unit.
+  return LOffs.first < ROffs.first;

I am not good at english. But I believe unit=>units.



Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:48
+#include 
+#include 
+#include 

I believe sys/file.h and unistd.h are posix includes.



Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:433
+return;
+  int fd = open(fileName.c_str(), O_CREAT|O_WRONLY|O_APPEND, 0666);
+  flock(fd, LOCK_EX);

this is posix file-I/O



Comment at: tools/clang-cmdline-arch-extractor/ClangCmdlineArchExtractor.cpp:56
+  if (Sources.empty())
+return 1;
+

Maybe use the EXIT_FAILURE instead



Comment at: tools/clang-cmdline-arch-extractor/ClangCmdlineArchExtractor.cpp:66
+  for (StringRef SourceFile : Sources) {
+char *Path = realpath(SourceFile.data(), nullptr);
+if (Path)

This is posix function as far as I know.



Comment at: tools/clang-cmdline-arch-extractor/ClangCmdlineArchExtractor.cpp:72
+
+  return 0;
+}

EXIT_SUCCESS is also possible however I guess that is 0 on all implementations.



Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:32
+#include 
+#include 
+#include 

posix includes



Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:153
+
+  if (!FileName.empty())
+switch (FD->getLinkageInternal()) {

I do not see how FileName could be empty. It always starts with "/ast/" right?



Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:193
+  lockedWrite(BuildDir + "/definedFns.txt", DefinedFuncsStr.str());
+  std::stringstream CFGStr;
+  for (auto &Entry : CG) {

if a STL stream will be used I recommend the std::ostringstream instead



Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:244
+errs() << "Exactly one XTU dir should be provided\n";
+return 1;
+  }

maybe use EXIT_FAILURE



Comment at: tools/clang-func-mapping/ClangFnMapGen.cpp:257
+  Tool.run(newFrontendActionFactory().get());
+}

no return.



Comment at: tools/xtu-analysis/xtu-analyze.py:29
+
+threading_factor = int(multiprocessing.cpu_count() * 1.5)
+analyser_output_formats = ['plist-multi-file', 'plist', 'plist-html',

does this mean that if there are 4 cores this script will by default use 6 
threads? isn't that too aggressive?


Repository:
  rL LLVM

https://reviews.llvm.

[PATCH] D29654: [OpenMP] Integrate OpenMP target region cubin into host binary

2017-03-31 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a reviewer: rnk.
Hahnfeld added a subscriber: rnk.
Hahnfeld added a comment.

Please format all comments as full sentences.




Comment at: lib/Driver/ToolChains/Cuda.cpp:338
+Args.getAllArgValues(options::OPT_march_EQ);
+assert(GPUArchs.size() == 1 && "Exactly one GPU Arch required for ptxas.");
+const std::string &GPUArch = GPUArchs[0];

Is this catched somewhere before with a diagnostic?



Comment at: lib/Driver/ToolChains/Cuda.cpp:381
+  StringRef Name = llvm::sys::path::filename(II.getFilename());
+  std::pair Split = Name.rsplit('.');
+  std::string TmpName =

`AddOpenMPLinkerScript` uses `llvm::sys::path::replace_extension` which does 
this magic internally



Comment at: lib/Driver/ToolChains/Cuda.cpp:388-394
+  const char *CopyExec = Args.MakeArgString(getToolChain().GetProgramPath(
+  C.getDriver().IsCLMode() ? "copy" : "cp"));
+  ArgStringList CopyCmdArgs;
+  CopyCmdArgs.push_back(II.getFilename());
+  CopyCmdArgs.push_back(CubinF);
+  C.addCommand(
+  llvm::make_unique(JA, *this, CopyExec, CopyCmdArgs, 
Inputs));

Copying files around would be something new in Clang that someone more 
experienced has to weight. @rnk, @hfinkel?


Repository:
  rL LLVM

https://reviews.llvm.org/D29654



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


[PATCH] D31515: [libc++] Implement LWG 2911 - add an is_aggregate type-trait

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93606.
EricWF added a comment.

- Fix accidental change.


https://reviews.llvm.org/D31515

Files:
  include/__config
  include/type_traits
  
test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp
  test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -480,7 +480,7 @@
 	http://wg21.link/LWG2904";>2904Make variant move-assignment more exception safeKona
 	http://wg21.link/LWG2905";>2905is_constructible_v, P, D const &> should be false when D is not copy constructibleKona
 	http://wg21.link/LWG2908";>2908The less-than operator for shared pointers could do moreKona
-	http://wg21.link/LWG2911";>2911An is_aggregate type trait is neededKona
+	http://wg21.link/LWG2911";>2911An is_aggregate type trait is neededKonaComplete
 	http://wg21.link/LWG2921";>2921packaged_task and type-erased allocatorsKona
 	http://wg21.link/LWG2934";>2934optional doesn't compare with TKonaComplete
 

[PATCH] D31515: [libc++] Implement LWG 2911 - add an is_aggregate type-trait

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93607.
EricWF added a comment.

- Fix typo in `// UNSUPPORTED` directive.


https://reviews.llvm.org/D31515

Files:
  include/__config
  include/type_traits
  
test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp
  test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -480,7 +480,7 @@
 	http://wg21.link/LWG2904";>2904Make variant move-assignment more exception safeKona
 	http://wg21.link/LWG2905";>2905is_constructible_v, P, D const &> should be false when D is not copy constructibleKona
 	http://wg21.link/LWG2908";>2908The less-than operator for shared pointers could do moreKona
-	http://wg21.link/LWG2911";>2911An is_aggregate type trait is neededKona
+	http://wg21.link/LWG2911";>2911An is_aggregate type trait is neededKonaComplete
 	http://wg21.link/LWG2921";>2921packaged_task and type-erased allocatorsKona
 	http://wg21.link/LWG2934";>2934optional doesn't compare with TKonaComplete
 

[PATCH] D29658: [OpenMP] Customize CUDA-based tool chain selection

2017-03-31 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld requested changes to this revision.
Hahnfeld added inline comments.
This revision now requires changes to proceed.



Comment at: lib/Frontend/CompilerInvocation.cpp:2181-2190
+  if (!(TT.getArch() == llvm::Triple::ppc ||
+TT.getArch() == llvm::Triple::ppc64 ||
+TT.getArch() == llvm::Triple::ppc64le ||
+TT.getArch() == llvm::Triple::nvptx ||
+TT.getArch() == llvm::Triple::nvptx64 ||
+TT.getArch() == llvm::Triple::x86 ||
+TT.getArch() == llvm::Triple::x86_64))

This is unrelated to CUDA, please split that into its own patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D29658



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


r299192 - [OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args

2017-03-31 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Fri Mar 31 05:14:52 2017
New Revision: 299192

URL: http://llvm.org/viewvc/llvm-project?rev=299192&view=rev
Log:
[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args

Summary:
"kernel_arg_type_qual" metadata should contain const/volatile/restrict
tags only for pointer types to match the corresponding requirement of
the OpenCL specification.

OpenCL 2.0 spec 5.9.3 Kernel Object Queries:

CL_KERNEL_ARG_TYPE_VOLATILE is returned if the argument is a pointer
and the referenced type is declared with the volatile qualifier.
[...]
Similarly, CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a
pointer and the referenced type is declared with the restrict or const
qualifier.
[...]
CL_KERNEL_ARG_TYPE_RESTRICT will be returned if the pointer type is
marked restrict.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=299192&r1=299191&r2=299192&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Mar 31 05:14:52 2017
@@ -610,11 +610,6 @@ static void GenOpenCLArgMetadata(const F
 
   argBaseTypeNames.push_back(llvm::MDString::get(Context, baseTypeName));
 
-  // Get argument type qualifiers:
-  if (ty.isConstQualified())
-typeQuals = "const";
-  if (ty.isVolatileQualified())
-typeQuals += typeQuals.empty() ? "volatile" : " volatile";
   if (isPipe)
 typeQuals = "pipe";
 }

Modified: cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl?rev=299192&r1=299191&r2=299192&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/kernel-arg-info.cl Fri Mar 31 05:14:52 2017
@@ -2,7 +2,8 @@
 // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple 
spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
 
 kernel void foo(__global int * restrict X, const int Y, 
-volatile int anotherArg, __constant float * restrict Z) {
+volatile int anotherArg, __constant float * restrict Z,
+__global volatile int * V, __global const int * C) {
   *X = Y + anotherArg;
 }
 // CHECK: define spir_kernel void @foo{{[^!]+}}
@@ -60,11 +61,11 @@ kernel void foo5(myImage img1, write_onl
 // CHECK-NOT: !kernel_arg_name
 // ARGINFO: !kernel_arg_name ![[MD54:[0-9]+]]
 
-// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2}
-// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none"}
-// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"}
-// CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"}
-// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"}
+// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2, i32 1, i32 1}
+// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none", !"none", !"none"}
+// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*", !"int*", !"int*"}
+// CHECK: ![[MD14]] = !{!"restrict", !"", !"", !"restrict const", !"volatile", 
!"const"}
+// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z", !"V", !"C"}
 // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1}
 // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", 
!"read_write"}
 // CHECK: ![[MD23]] = !{!"image1d_t", !"image2d_t", !"image2d_array_t", 
!"image1d_t"}


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


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:559
+  Float.toString(Chars, 0, 0);
+  AST = Z3_mk_numeral(Z3Context::ZC, Chars.c_str(), Sort);
+  break;

ddcc wrote:
> delcypher wrote:
> > @ddcc I'm not convinced this is a good idea. Printing as a decimal string 
> > could lead to rounding errors. I think you're better of getting an APInt 
> > from the APFloat, constructing a bitvector constant from those bits and 
> > then using `Z3_mk_fpa_to_fp_bv()` to get a Z3Expr of the right sort. That 
> > was we are being bit-wise accurate.
> From the comments inside `APFloat::toString()`, this should be precise enough 
> to round-trip from float to string and back again with no loss of precision. 
> However, the I agree that bitcasting makes more sense, especially given the 
> overhead of string conversion.
The APFloat comments claim this but[[ 
https://bugs.llvm.org/show_bug.cgi?id=24539 |  I've found at least one case 
where this does not hold ]] in the current implementation.


https://reviews.llvm.org/D28952



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


r299193 - Strip trailing whitespace

2017-03-31 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Mar 31 05:40:56 2017
New Revision: 299193

URL: http://llvm.org/viewvc/llvm-project?rev=299193&view=rev
Log:
Strip trailing whitespace

Modified:
cfe/trunk/include/clang/AST/ASTContext.h

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=299193&r1=299192&r2=299193&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Mar 31 05:40:56 2017
@@ -177,12 +177,12 @@ class ASTContext : public RefCountedBase
 
   mutable llvm::FoldingSet QualifiedTemplateNames;
   mutable llvm::FoldingSet DependentTemplateNames;
-  mutable llvm::FoldingSet 
+  mutable llvm::FoldingSet
 SubstTemplateTemplateParms;
   mutable llvm::ContextualFoldingSet 
+ ASTContext&>
 SubstTemplateTemplateParmPacks;
-  
+
   /// \brief The set of nested name specifiers.
   ///
   /// This set is managed by the NestedNameSpecifier class.
@@ -204,17 +204,17 @@ class ASTContext : public RefCountedBase
 
   /// \brief A cache mapping from CXXRecordDecls to key functions.
   llvm::DenseMap KeyFunctions;
-  
+
   /// \brief Mapping from ObjCContainers to their ObjCImplementations.
   llvm::DenseMap ObjCImpls;
-  
+
   /// \brief Mapping from ObjCMethod to its duplicate declaration in the same
   /// interface.
   llvm::DenseMap 
ObjCMethodRedecls;
 
   /// \brief Mapping from __block VarDecls to their copy initialization expr.
   llvm::DenseMap BlockVarCopyInits;
-
+
   /// \brief Mapping from class scope functions specialization to their
   /// template patterns.
   llvm::DenseMap
@@ -230,21 +230,21 @@ class ASTContext : public RefCountedBase
   /// is used in canonical template names.
   class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
 TemplateTemplateParmDecl *Parm;
-
+
   public:
-CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm) 
+CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm)
   : Parm(Parm) { }
-
+
 TemplateTemplateParmDecl *getParam() const { return Parm; }
-
+
 void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Parm); }
-
-static void Profile(llvm::FoldingSetNodeID &ID, 
+
+static void Profile(llvm::FoldingSetNodeID &ID,
 TemplateTemplateParmDecl *Parm);
   };
   mutable llvm::FoldingSet
 CanonTemplateTemplateParms;
-  
+
   TemplateTemplateParmDecl *
 getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTP) const;
 
@@ -263,7 +263,7 @@ class ASTContext : public RefCountedBase
 
   /// \brief The typedef for the predefined \c id type.
   mutable TypedefDecl *ObjCIdDecl;
-  
+
   /// \brief The typedef for the predefined \c SEL type.
   mutable TypedefDecl *ObjCSelDecl;
 
@@ -272,7 +272,7 @@ class ASTContext : public RefCountedBase
 
   /// \brief The typedef for the predefined \c Protocol class in Objective-C.
   mutable ObjCInterfaceDecl *ObjCProtocolClassDecl;
-  
+
   /// \brief The typedef for the predefined 'BOOL' type.
   mutable TypedefDecl *BOOLDecl;
 
@@ -302,12 +302,12 @@ class ASTContext : public RefCountedBase
   mutable TypedefDecl *CFConstantStringTypeDecl;
 
   mutable QualType ObjCSuperType;
-  
+
   QualType ObjCNSStringType;
 
   /// \brief The typedef declaration for the Objective-C "instancetype" type.
   TypedefDecl *ObjCInstanceTypeDecl;
-  
+
   /// \brief The type for the C FILE type.
   TypeDecl *FILEDecl;
 
@@ -455,11 +455,11 @@ private:
   /// \brief Mapping that stores parameterIndex values for ParmVarDecls when
   /// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex.
   typedef llvm::DenseMap ParameterIndexTable;
-  ParameterIndexTable ParamIndices;  
-  
+  ParameterIndexTable ParamIndices;
+
   ImportDecl *FirstLocalImport;
   ImportDecl *LastLocalImport;
-  
+
   TranslationUnitDecl *TUDecl;
   mutable ExternCContextDecl *ExternCContext;
   mutable BuiltinTemplateDecl *MakeIntegerSeqDecl;
@@ -496,7 +496,7 @@ private:
   /// \brief The logical -> physical address space map.
   const LangAS::Map *AddrSpaceMap;
 
-  /// \brief Address space map mangling must be used with language specific 
+  /// \brief Address space map mangling must be used with language specific
   /// address spaces (e.g. OpenCL/CUDA)
   bool AddrSpaceMapMangling;
 
@@ -508,7 +508,7 @@ private:
   const TargetInfo *Target;
   const TargetInfo *AuxTarget;
   clang::PrintingPolicy PrintingPolicy;
-  
+
 public:
   IdentifierTable &Idents;
   SelectorTable &Selectors;
@@ -612,7 +612,7 @@ public:
   void setPrintingPolicy(const clang::PrintingPolicy &Policy) {
 PrintingPolicy = Policy;
   }
-  
+
   SourceManager& getSourceManager() { return SourceMgr; }
   const SourceManager& getSourceManager() const { return SourceMgr; }
 
@@ -627,7 +627,7 @@ public:
 return static_cast(Allocate(

r299198 - Spelling mistakes in comments. NFCI.

2017-03-31 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Mar 31 06:00:53 2017
New Revision: 299198

URL: http://llvm.org/viewvc/llvm-project?rev=299198&view=rev
Log:
Spelling mistakes in comments. NFCI.

Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=299198&r1=299197&r2=299198&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Mar 31 06:00:53 2017
@@ -476,7 +476,7 @@ private:
   /// entities should not be instrumented.
   std::unique_ptr SanitizerBL;
 
-  /// \brief Function filtering mehcanism to determine whether a given function
+  /// \brief Function filtering mechanism to determine whether a given function
   /// should be imbued with the XRay "always" or "never" attributes.
   std::unique_ptr XRayFilter;
 

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=299198&r1=299197&r2=299198&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Mar 31 06:00:53 2017
@@ -838,7 +838,7 @@ protected:
 
 /// Describes the kind of default argument for this parameter. By default
 /// this is none. If this is normal, then the default argument is stored in
-/// the \c VarDecl initializer expression unless we were unble to parse
+/// the \c VarDecl initializer expression unless we were unable to parse
 /// (even an invalid) expression for the default argument.
 unsigned DefaultArgKind : 2;
 

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=299198&r1=299197&r2=299198&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Mar 31 06:00:53 2017
@@ -7453,7 +7453,7 @@ CheckReturnStackAddr(Sema &S, Expr *RetV
   if (!stackE)
 return; // Nothing suspicious was found.
 
-  // Parameters are initalized in the calling scope, so taking the address
+  // Parameters are initialized in the calling scope, so taking the address
   // of a parameter reference doesn't need a warning.
   for (auto *DRE : refVars)
 if (isa(DRE->getDecl()))


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


r299204 - clang-format: [JavaScript] Ignore QT keywords.

2017-03-31 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Fri Mar 31 07:04:37 2017
New Revision: 299204

URL: http://llvm.org/viewvc/llvm-project?rev=299204&view=rev
Log:
clang-format: [JavaScript] Ignore QT keywords.

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=299204&r1=299203&r2=299204&view=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Mar 31 07:04:37 2017
@@ -916,7 +916,9 @@ void UnwrappedLineParser::parseStructura
 return;
   }
 }
-if (FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
+if ((Style.Language == FormatStyle::LK_Cpp ||
+ Style.Language == FormatStyle::LK_ObjC) &&
+FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
Keywords.kw_slots, Keywords.kw_qslots)) {
   nextToken();
   if (FormatTok->is(tok::colon)) {

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=299204&r1=299203&r2=299204&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Mar 31 07:04:37 2017
@@ -167,6 +167,8 @@ TEST_F(FormatTestJS, ReservedWordsMethod
 TEST_F(FormatTestJS, CppKeywords) {
   // Make sure we don't mess stuff up because of C++ keywords.
   verifyFormat("return operator && (aa);");
+  // .. or QT ones.
+  verifyFormat("slots: Slot[];");
 }
 
 TEST_F(FormatTestJS, ES6DestructuringAssignment) {


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


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: cmake/modules/FindZ3.cmake:3
+# in the find_path() and find_library() calls
+find_package(PkgConfig QUIET)
+PKG_CHECK_MODULES(PC_Z3 QUIET libz3)

@ddcc Seeing as you don't want to use the new upstream Z3 CMake package config 
files I'll try to review this.

Upstream Z3 does not come with pkg-config files for the native library so I'm 
wondering where you expect this to work. Does a Linux distro add their own 
`.pc` files?

It looks like you only use these paths as hints so this so this looks like 
it'll work even without the pkg-config files.



Comment at: cmake/modules/FindZ3.cmake:5
+PKG_CHECK_MODULES(PC_Z3 QUIET libz3)
+set(Z3_DEFINITIONS ${PC_LIBZ3_CFLAGS_OTHER})
+

@ddcc This CMake variable is set but never used. Also based on the name it 
suggests that they are compiler definitions rather than other compiler flags. 
Does `_CFLAGS_OTHER` have those semantics? It's unclear from 
https://cmake.org/cmake/help/v3.7/module/FindPkgConfig.html#command:pkg_check_modules
 what they are supposed to be.

To consume these flags you could add `target_compile_definitions()` and 
`target_compile_options()` to all users of Z3. A more elegant way of doing this 
is to create an imported library target (e.g. `z3::libz3`) and set compile 
definitions, compile options and include directories on this imported target 
with `INTERFACE` visibility so that these usage requirements implicitly 
propagate to all users of `z3::libz3`.


https://reviews.llvm.org/D28952



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


r299210 - clang-format vs plugin support for Visual Studio 2017

2017-03-31 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Fri Mar 31 07:50:42 2017
New Revision: 299210

URL: http://llvm.org/viewvc/llvm-project?rev=299210&view=rev
Log:
clang-format vs plugin support for Visual Studio 2017

With the release of Visual Studio 2017, we need to at the very least
claim support for it in the current manifest file. With the changes
introducted in this patch we can install the extension again, but a
warning message will be shown stating that it's not supported
(https://twitter.com/parsley72/status/846558416751411200).

To get the rid of the warning more work is necessary, as VS 2017 changed
some things about extensions, see more here:
https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-migrate-extensibility-projects-to-visual-studio-2017.
While working on those changes, it has been suggested in the
mail list that this first patch is integrated in the meantime.

Patch by Hugo Puhlmann!

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

Modified:
cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in

Modified: cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in?rev=299210&r1=299209&r2=299210&view=diff
==
--- cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in (original)
+++ cfe/trunk/tools/clang-format-vs/source.extension.vsixmanifest.in Fri Mar 31 
07:50:42 2017
@@ -22,6 +22,9 @@
   
 Pro
   
+  
+Pro
+  
 
 
   


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


Re: r299204 - clang-format: [JavaScript] Ignore QT keywords.

2017-03-31 Thread Nico Weber via cfe-commits
Please use style.isCpp() (spelling?) instead of comparing with LK_Cpp and
LK_ObjC.

On Mar 31, 2017 8:17 AM, "Daniel Jasper via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

Author: djasper
Date: Fri Mar 31 07:04:37 2017
New Revision: 299204

URL: http://llvm.org/viewvc/llvm-project?rev=299204&view=rev
Log:
clang-format: [JavaScript] Ignore QT keywords.

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/
UnwrappedLineParser.cpp?rev=299204&r1=299203&r2=299204&view=diff

==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Mar 31 07:04:37 2017
@@ -916,7 +916,9 @@ void UnwrappedLineParser::parseStructura
 return;
   }
 }
-if (FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
+if ((Style.Language == FormatStyle::LK_Cpp ||
+ Style.Language == FormatStyle::LK_ObjC) &&
+FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
Keywords.kw_slots, Keywords.kw_qslots)) {
   nextToken();
   if (FormatTok->is(tok::colon)) {

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/
Format/FormatTestJS.cpp?rev=299204&r1=299203&r2=299204&view=diff

==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Mar 31 07:04:37 2017
@@ -167,6 +167,8 @@ TEST_F(FormatTestJS, ReservedWordsMethod
 TEST_F(FormatTestJS, CppKeywords) {
   // Make sure we don't mess stuff up because of C++ keywords.
   verifyFormat("return operator && (aa);");
+  // .. or QT ones.
+  verifyFormat("slots: Slot[];");
 }

 TEST_F(FormatTestJS, ES6DestructuringAssignment) {


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


[PATCH] D31140: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI

2017-03-31 Thread Christian Bruel via Phabricator via cfe-commits
chrib updated this revision to Diff 93631.
chrib added a dependency: D31139: [LLVMbugs] [Bug 18710] Only generate 
.ARM.exidx and .ARM.extab when needed with EHABI.
chrib added a comment.



1. Updating https://reviews.llvm.org/D31140: [LLVMbugs] [Bug 18710] Only 
generate .ARM.exidx and .ARM.extab when needed in EHABI #

Set UNTable of the language requiers an exception table.
Conservately only for ARM, necessary to emit the .cantunwind directive. But 
could probably be enabled for all targets.

depends on https://reviews.llvm.org/D31139


https://reviews.llvm.org/D31140

Files:
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h


Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -1341,6 +1341,9 @@
   void ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
   bool AttrOnCallSite,
   llvm::AttrBuilder &FuncAttrs);
+
+  bool needsUnwindTable();
+
 };
 }  // end namespace CodeGen
 }  // end namespace clang
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -865,13 +865,25 @@
   return true;
 }
 
+// This function needs an unwind table
+bool CodeGenModule::needsUnwindTable() {
+  if (CodeGenOpts.UnwindTables)
+return true;
+
+  llvm::Triple::ArchType Arch = Context.getTargetInfo().getTriple().getArch();
+  return hasUnwindExceptions (LangOpts) && Arch==llvm::Triple::arm;
+}
+
 void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
llvm::Function *F) {
   llvm::AttrBuilder B;
 
-  if (CodeGenOpts.UnwindTables)
+  // Set the attribute if the user requests it or if the language requiers it.
+  if (needsUnwindTable())
 B.addAttribute(llvm::Attribute::UWTable);
 
+  // If the module doesn't support exceptions the function cannot throw.
+  // We can have a nothrow function even if unwind tables are required.
   if (!hasUnwindExceptions(LangOpts))
 B.addAttribute(llvm::Attribute::NoUnwind);
 


Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -1341,6 +1341,9 @@
   void ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
   bool AttrOnCallSite,
   llvm::AttrBuilder &FuncAttrs);
+
+  bool needsUnwindTable();
+
 };
 }  // end namespace CodeGen
 }  // end namespace clang
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -865,13 +865,25 @@
   return true;
 }
 
+// This function needs an unwind table
+bool CodeGenModule::needsUnwindTable() {
+  if (CodeGenOpts.UnwindTables)
+return true;
+
+  llvm::Triple::ArchType Arch = Context.getTargetInfo().getTriple().getArch();
+  return hasUnwindExceptions (LangOpts) && Arch==llvm::Triple::arm;
+}
+
 void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
llvm::Function *F) {
   llvm::AttrBuilder B;
 
-  if (CodeGenOpts.UnwindTables)
+  // Set the attribute if the user requests it or if the language requiers it.
+  if (needsUnwindTable())
 B.addAttribute(llvm::Attribute::UWTable);
 
+  // If the module doesn't support exceptions the function cannot throw.
+  // We can have a nothrow function even if unwind tables are required.
   if (!hasUnwindExceptions(LangOpts))
 B.addAttribute(llvm::Attribute::NoUnwind);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r299214 - clang-format: Fix post-commit review comment of r299204, use Style.isCpp().

2017-03-31 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Fri Mar 31 08:30:24 2017
New Revision: 299214

URL: http://llvm.org/viewvc/llvm-project?rev=299214&view=rev
Log:
clang-format: Fix post-commit review comment of r299204, use Style.isCpp().

Also, while at it, s/IsCpp/isCpp/ so that it follows LLVM style.

Modified:
cfe/trunk/include/clang/Format/Format.h
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/FormatTokenLexer.cpp
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/lib/Format/UnwrappedLineParser.cpp

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=299214&r1=299213&r2=299214&view=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Fri Mar 31 08:30:24 2017
@@ -963,7 +963,7 @@ struct FormatStyle {
 /// Should be used for TableGen code.
 LK_TableGen
   };
-  bool IsCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
+  bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
 
   /// \brief Language, this format style is targeted at.
   LanguageKind Language;

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=299214&r1=299213&r2=299214&view=diff
==
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Fri Mar 31 08:30:24 2017
@@ -158,7 +158,7 @@ bool ContinuationIndenter::mustBreak(con
 return true;
   if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
(Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) &&
-Style.IsCpp() &&
+Style.isCpp() &&
 // FIXME: This is a temporary workaround for the case where 
clang-format
 // sets BreakBeforeParameter to avoid bin packing and this creates a
 // completely unnecessary line break after a template type that isn't
@@ -605,7 +605,7 @@ unsigned ContinuationIndenter::addTokenO
   // Any break on this level means that the parent level has been broken
   // and we need to avoid bin packing there.
   bool NestedBlockSpecialCase =
-  !Style.IsCpp() && Current.is(tok::r_brace) && State.Stack.size() > 1 &&
+  !Style.isCpp() && Current.is(tok::r_brace) && State.Stack.size() > 1 &&
   State.Stack[State.Stack.size() - 2].NestedBlockInlined;
   if (!NestedBlockSpecialCase)
 for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i)

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=299214&r1=299213&r2=299214&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Fri Mar 31 08:30:24 2017
@@ -1671,7 +1671,7 @@ bool isDeletedHeader(llvm::StringRef Hea
 tooling::Replacements
 fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
 const FormatStyle &Style) {
-  if (!Style.IsCpp())
+  if (!Style.isCpp())
 return Replaces;
 
   tooling::Replacements HeaderInsertions;
@@ -1895,7 +1895,7 @@ LangOptions getFormattingLangOpts(const
   LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
   LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
   LangOpts.LineComment = 1;
-  bool AlternativeOperators = Style.IsCpp();
+  bool AlternativeOperators = Style.isCpp();
   LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;
   LangOpts.Bool = 1;
   LangOpts.ObjC1 = 1;

Modified: cfe/trunk/lib/Format/FormatTokenLexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatTokenLexer.cpp?rev=299214&r1=299213&r2=299214&view=diff
==
--- cfe/trunk/lib/Format/FormatTokenLexer.cpp (original)
+++ cfe/trunk/lib/Format/FormatTokenLexer.cpp Fri Mar 31 08:30:24 2017
@@ -560,7 +560,7 @@ FormatToken *FormatTokenLexer::getNextTo
 Column = FormatTok->LastLineColumnWidth;
   }
 
-  if (Style.IsCpp()) {
+  if (Style.isCpp()) {
 if (!(Tokens.size() > 0 && Tokens.back()->Tok.getIdentifierInfo() &&
   Tokens.back()->Tok.getIdentifierInfo()->getPPKeywordID() ==
   tok::pp_define) &&

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=299214&r1=299213&r2=299214&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Mar 31 08:30:24 2017
@@ -311,13 +311,13 @@ private:
 // In C++, th

[PATCH] D31534: [ThinLTO] Handle -emit-llvm* in ThinLTO backends

2017-03-31 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson created this revision.
Herald added a subscriber: Prazek.

Use PreCodeGenModuleHook to invoke the correct writer when emitting LLVM
IR, returning false to skip codegen from within thinBackend.


https://reviews.llvm.org/D31534

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/thinlto-emit-llvm.c


Index: test/CodeGen/thinlto-emit-llvm.c
===
--- /dev/null
+++ test/CodeGen/thinlto-emit-llvm.c
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o 
- | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc 
-o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -994,9 +994,36 @@
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  legacy::PassManager PerModulePasses;
+  PerModulePasses.add(
+  createPrintModulePass(*OS, "", CGOpts.EmitLLVMUseLists));
+  PerModulePasses.run(*M);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  legacy::PassManager PerModulePasses;
+  PerModulePasses.add(
+  createBitcodeWriterPass(*OS, CGOpts.EmitLLVMUseLists));
+  PerModulePasses.run(*M);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {


Index: test/CodeGen/thinlto-emit-llvm.c
===
--- /dev/null
+++ test/CodeGen/thinlto-emit-llvm.c
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc -o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -994,9 +994,36 @@
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  legacy::PassManager PerModulePasses;
+  PerModulePasses.add(
+  createPrintModulePass(*OS, "", CGOpts.EmitLLVMUseLists));
+  PerModulePasses.run(*M);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  legacy::PassManager PerModulePasses;
+  PerModulePasses.add(
+  createBitcodeWriterPass(*OS, CGOpts.EmitLLVMUseLists));
+  PerModulePasses.run(*M);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31101: [ThinLTO] Use clang's existing code gen handling for ThinLTO backends

2017-03-31 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson abandoned this revision.
tejohnson added a comment.

Subsumed by https://reviews.llvm.org/D31534


https://reviews.llvm.org/D31101



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


r299217 - Add back test for r299152

2017-03-31 Thread Teresa Johnson via cfe-commits
Author: tejohnson
Date: Fri Mar 31 08:48:18 2017
New Revision: 299217

URL: http://llvm.org/viewvc/llvm-project?rev=299217&view=rev
Log:
Add back test for r299152

I am hoping the bot failures are addressed by using cc1 for the ThinLTO
backend invocations as well.

Modified:
cfe/trunk/test/CodeGen/function-sections.c

Modified: cfe/trunk/test/CodeGen/function-sections.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/function-sections.c?rev=299217&r1=299216&r2=299217&view=diff
==
--- cfe/trunk/test/CodeGen/function-sections.c (original)
+++ cfe/trunk/test/CodeGen/function-sections.c Fri Mar 31 08:48:18 2017
@@ -9,6 +9,12 @@
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fdata-sections -o - < %s | 
FileCheck %s --check-prefix=DATA_SECT
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fno-data-sections 
-fdata-sections -o - < %s | FileCheck %s --check-prefix=DATA_SECT
 
+// Try again through a clang invocation of the ThinLTO backend.
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 %s -flto=thin -emit-llvm-bc 
-o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 -x ir %t.o 
-fthinlto-index=%t.thinlto.bc -S -ffunction-sections -o - | FileCheck %s 
--check-prefix=FUNC_SECT
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 -x ir %t.o 
-fthinlto-index=%t.thinlto.bc -S -fdata-sections -o - | FileCheck %s 
--check-prefix=DATA_SECT
+
 const int hello = 123;
 void world() {}
 


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


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: CMakeLists.txt:188
 
+find_package(Z3 4.5)
+

ddcc wrote:
> delcypher wrote:
> > delcypher wrote:
> > > @ddcc It is of course up to you but I recently [[ added support for using 
> > > `libz3` directly | added support for using `libz3` directly ]] from 
> > > CMake. via it's own CMake config package. You only get this if Z3 was 
> > > built with CMake so you might not want this restriction.  This feature 
> > > has only just landed though and might not be sufficient for your needs.  
> > > If you take a look at Z3's example projects they are now built with this 
> > > mechanism when building with CMake.
> > > 
> > > If you are interested I'd be more than happy to work with you to get this 
> > > feature ready for your needs in upstream Z3 so you can use it here.
> > Sorry that URL should be https://github.com/Z3Prover/z3/pull/926
> I think this is useful, and upstream z3 has been in need of better packaging. 
> But until it's used by default over the current python script and the z3 
> folks actively maintain it, I'm a little hesitant to depend on it.
@ddcc Sure your reasoning makes sense.


https://reviews.llvm.org/D28952



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


Re: r299214 - clang-format: Fix post-commit review comment of r299204, use Style.isCpp().

2017-03-31 Thread Nico Weber via cfe-commits
Thanks!

On Fri, Mar 31, 2017 at 9:30 AM, Daniel Jasper via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: djasper
> Date: Fri Mar 31 08:30:24 2017
> New Revision: 299214
>
> URL: http://llvm.org/viewvc/llvm-project?rev=299214&view=rev
> Log:
> clang-format: Fix post-commit review comment of r299204, use Style.isCpp().
>
> Also, while at it, s/IsCpp/isCpp/ so that it follows LLVM style.
>
> Modified:
> cfe/trunk/include/clang/Format/Format.h
> cfe/trunk/lib/Format/ContinuationIndenter.cpp
> cfe/trunk/lib/Format/Format.cpp
> cfe/trunk/lib/Format/FormatTokenLexer.cpp
> cfe/trunk/lib/Format/TokenAnnotator.cpp
> cfe/trunk/lib/Format/UnwrappedLineParser.cpp
>
> Modified: cfe/trunk/include/clang/Format/Format.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Format/Format.h?rev=299214&r1=299213&r2=299214&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Format/Format.h (original)
> +++ cfe/trunk/include/clang/Format/Format.h Fri Mar 31 08:30:24 2017
> @@ -963,7 +963,7 @@ struct FormatStyle {
>  /// Should be used for TableGen code.
>  LK_TableGen
>};
> -  bool IsCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
> +  bool isCpp() const { return Language == LK_Cpp || Language == LK_ObjC; }
>
>/// \brief Language, this format style is targeted at.
>LanguageKind Language;
>
> Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/
> ContinuationIndenter.cpp?rev=299214&r1=299213&r2=299214&view=diff
> 
> ==
> --- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
> +++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Fri Mar 31 08:30:24 2017
> @@ -158,7 +158,7 @@ bool ContinuationIndenter::mustBreak(con
>  return true;
>if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
> (Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) &&
> -Style.IsCpp() &&
> +Style.isCpp() &&
>  // FIXME: This is a temporary workaround for the case where
> clang-format
>  // sets BreakBeforeParameter to avoid bin packing and this
> creates a
>  // completely unnecessary line break after a template type that
> isn't
> @@ -605,7 +605,7 @@ unsigned ContinuationIndenter::addTokenO
>// Any break on this level means that the parent level has been broken
>// and we need to avoid bin packing there.
>bool NestedBlockSpecialCase =
> -  !Style.IsCpp() && Current.is(tok::r_brace) && State.Stack.size() >
> 1 &&
> +  !Style.isCpp() && Current.is(tok::r_brace) && State.Stack.size() >
> 1 &&
>State.Stack[State.Stack.size() - 2].NestedBlockInlined;
>if (!NestedBlockSpecialCase)
>  for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i)
>
> Modified: cfe/trunk/lib/Format/Format.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/
> Format.cpp?rev=299214&r1=299213&r2=299214&view=diff
> 
> ==
> --- cfe/trunk/lib/Format/Format.cpp (original)
> +++ cfe/trunk/lib/Format/Format.cpp Fri Mar 31 08:30:24 2017
> @@ -1671,7 +1671,7 @@ bool isDeletedHeader(llvm::StringRef Hea
>  tooling::Replacements
>  fixCppIncludeInsertions(StringRef Code, const tooling::Replacements
> &Replaces,
>  const FormatStyle &Style) {
> -  if (!Style.IsCpp())
> +  if (!Style.isCpp())
>  return Replaces;
>
>tooling::Replacements HeaderInsertions;
> @@ -1895,7 +1895,7 @@ LangOptions getFormattingLangOpts(const
>LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
>LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
>LangOpts.LineComment = 1;
> -  bool AlternativeOperators = Style.IsCpp();
> +  bool AlternativeOperators = Style.isCpp();
>LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;
>LangOpts.Bool = 1;
>LangOpts.ObjC1 = 1;
>
> Modified: cfe/trunk/lib/Format/FormatTokenLexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/
> FormatTokenLexer.cpp?rev=299214&r1=299213&r2=299214&view=diff
> 
> ==
> --- cfe/trunk/lib/Format/FormatTokenLexer.cpp (original)
> +++ cfe/trunk/lib/Format/FormatTokenLexer.cpp Fri Mar 31 08:30:24 2017
> @@ -560,7 +560,7 @@ FormatToken *FormatTokenLexer::getNextTo
>  Column = FormatTok->LastLineColumnWidth;
>}
>
> -  if (Style.IsCpp()) {
> +  if (Style.isCpp()) {
>  if (!(Tokens.size() > 0 && Tokens.back()->Tok.getIdentifierInfo() &&
>Tokens.back()->Tok.getIdentifierInfo()->getPPKeywordID() ==
>tok::pp_define) &&
>
> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/l

[PATCH] D29339: [OpenMP] Add support for auxiliary triple specification

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 93643.
gtbercea added a comment.

Re-order conditions and run clang-format.


Repository:
  rL LLVM

https://reviews.llvm.org/D29339

Files:
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInstance.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/InitPreprocessor.cpp
  test/Driver/openmp-offload.c

Index: test/Driver/openmp-offload.c
===
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -248,32 +248,32 @@
 //
 // Compile for the powerpc device.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-aux-triple" "powerpc64le--linux" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-SAME: [[T1OBJ:[^\\/]+\.o]]" "-x" "c" "{{.*}}[[INPUT]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
 // CHK-COMMANDS: ld{{(\.exe)?}}" {{.*}}"-o" "
 // CHK-COMMANDS-SAME: [[T1BIN:[^\\/]+\.out]]" {{.*}}"{{.*}}[[T1OBJ]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-aux-triple" "powerpc64le--linux" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1PP:[^\\/]+\.i]]" "-x" "c" "{{.*}}[[INPUT]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-aux-triple" "powerpc64le--linux" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1BC:[^\\/]+\.bc]]" "-x" "cpp-output" "{{.*}}[[T1PP]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-aux-triple" "powerpc64le--linux" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1ASM:[^\\/]+\.s]]" "-x" "ir" "{{.*}}[[T1BC]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" "powerpc64le-ibm-linux-gnu" "-filetype" "obj" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1OBJ:[^\\/]+\.o]]" "{{.*}}[[T1ASM]]"
 // CHK-COMMANDS-ST: ld{{(\.exe)?}}" {{.*}}"-shared" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1BIN:[^\\/]+\.out-openmp-powerpc64le-ibm-linux-gnu]]" {{.*}}"{{.*}}[[T1OBJ]]"
 //
 // Compile for the x86 device.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp"  {{.*}}"-o" "
+// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-aux-triple" "powerpc64le--linux" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp"  {{.*}}"-o" "
 // CHK-COMMANDS-SAME: [[T2OBJ:[^\\/]+\.o]]" "-x" "c" "{{.*}}[[INPUT]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
 // CHK-COMMANDS: ld{{(\.exe)?}}" {{.*}}"-o" "
 // CHK-COMMANDS-SAME: [[T2BIN:[^\\/]+\.out]]" {{.*}}"{{.*}}[[T2OBJ]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-aux-triple" "powerpc64le--linux" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T2PP:[^\\/]+\.i]]" "-x" "c" "{{.*}}[[INPUT]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-aux-triple" "powerpc64le--linux" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T2BC:[^\\/]+\.bc]]" "-x" "cpp-output" "{{.*}}[[T2PP]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-aux-triple" "powerpc64le--linux" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T2ASM:[^\\/]+\.s]]" "-x" "ir" "{{.*}}[[T2BC]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" "x86_64-pc-linux-gnu" "-filetype" "obj" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T2OBJ:[^\\/]+\.o]]" "{{.*}}[[T2ASM]]"
@@ -396,25 +396,25 @@
 // CHK-BUJOBS-ST-SAME: [[HOSTBC:[^\\/]+\.bc]]" "-x" "cpp-output" "{{.*}}[[HOSTPP]]" "-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
 
 // Create target 1 object.
-// CHK-BUJOBS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-obj" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-BUJOBS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-aux-triple" "powerpc64le--li

[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:619
+
+llvm::APSInt Int = llvm::APSInt(Float.bitcastToAPInt(), true);
+Z3Expr Z3Int = Z3Expr::fromAPSInt(Int);

@ddcc Why use APSInt here? Why not APInt, we are looking at raw bits and don't 
want to interpret the most significant bit in a special way.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:668
+default:
+  llvm_unreachable("Unsupported sort to integer!");
+case Z3_BV_SORT: {

Is `Z3_FLOATING_POINT_SORT` possible in your implementation?


https://reviews.llvm.org/D28952



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


[PATCH] D31501: [RFC] Integrate clang -cc1as diagnostics into DiagnosticsEngine

2017-03-31 Thread Oliver Stannard via Phabricator via cfe-commits
olista01 added a comment.

What advantages does this have over the current way of printing diagnostics? If 
this is just to get -w and -Werror working, would it not be easier to pass 
those through to the assembler, than to send all diagnostics back through 
clang? We already have some flags in MCTargetOptions that should be able to to 
the same things -w and -Werror do.

On the other hand, if this would enable other features, like -W options to 
promote/suppress categories of assembler warnings, than this might allow us to 
avoid duplicating a lot of clang's diagnostic system in the LLVM SourceMgr. Do 
you have any ideas for how this could be done?


https://reviews.llvm.org/D31501



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


[PATCH] D31078: [libunwind] Clean up macro usage.

2017-03-31 Thread Ranjeet Singh via Phabricator via cfe-commits
rs updated this revision to Diff 93646.
rs marked 6 inline comments as done.

https://reviews.llvm.org/D31078

Files:
  include/__libunwind_config.h
  include/libunwind.h
  include/unwind.h
  src/AddressSpace.hpp
  src/Unwind-EHABI.cpp
  src/Unwind-EHABI.h
  src/Unwind-sjlj.c
  src/UnwindCursor.hpp
  src/UnwindLevel1-gcc-ext.c
  src/UnwindLevel1.c
  src/Unwind_AppleExtras.cpp
  src/config.h
  src/libunwind.cpp
  src/libunwind_ext.h

Index: src/libunwind_ext.h
===
--- src/libunwind_ext.h
+++ src/libunwind_ext.h
@@ -33,7 +33,7 @@
 extern void _unw_add_dynamic_fde(unw_word_t fde);
 extern void _unw_remove_dynamic_fde(unw_word_t fde);
 
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
 extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*);
 extern _Unwind_Reason_Code _Unwind_VRS_Interpret(_Unwind_Context *context,
  const uint32_t *data,
Index: src/libunwind.cpp
===
--- src/libunwind.cpp
+++ src/libunwind.cpp
@@ -54,7 +54,7 @@
 # define REGISTER_KIND Registers_ppc
 #elif defined(__aarch64__)
 # define REGISTER_KIND Registers_arm64
-#elif _LIBUNWIND_ARM_EHABI
+#elif defined(_LIBUNWIND_ARM_EHABI)
 # define REGISTER_KIND Registers_arm
 #elif defined(__or1k__)
 # define REGISTER_KIND Registers_or1k
@@ -207,7 +207,7 @@
 /// Set value of specified float register at cursor position in stack frame.
 _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
 unw_fpreg_t value) {
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
   _LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)",
static_cast(cursor), regNum, value);
 #else
@@ -306,7 +306,7 @@
 #endif
 
 
-#if _LIBUNWIND_SUPPORT_DWARF_UNWIND
+#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
 /// SPI: walks cached DWARF entries
 _LIBUNWIND_EXPORT void unw_iterate_dwarf_unwind_cache(void (*func)(
 unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh)) {
@@ -340,7 +340,7 @@
   // fde is own mh_group
   DwarfFDECache::removeAllIn((LocalAddressSpace::pint_t)fde);
 }
-#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND
+#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
 
 
 
Index: src/config.h
===
--- src/config.h
+++ src/config.h
@@ -32,50 +32,36 @@
 // Platform specific configuration defines.
 #ifdef __APPLE__
   #if defined(FOR_DYLD)
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
-#define _LIBUNWIND_SUPPORT_DWARF_UNWIND   0
-#define _LIBUNWIND_SUPPORT_DWARF_INDEX0
+#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
   #else
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
+#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND   1
-#define _LIBUNWIND_SUPPORT_DWARF_INDEX0
   #endif
 #else
   #if defined(__ARM_DWARF_EH__) || !defined(__arm__)
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1
-  #else
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
-#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0
-#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
   #endif
 #endif
 
 // FIXME: these macros are not correct for COFF targets
 #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
 #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
 
 #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
-#define _LIBUNWIND_BUILD_SJLJ_APIS 1
-#else
-#define _LIBUNWIND_BUILD_SJLJ_APIS 0
+#define _LIBUNWIND_BUILD_SJLJ_APIS
 #endif
 
 #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__)
-#define _LIBUNWIND_SUPPORT_FRAME_APIS 1
-#else
-#define _LIBUNWIND_SUPPORT_FRAME_APIS 0
+#define _LIBUNWIND_SUPPORT_FRAME_APIS
 #endif
 
 #if defined(__i386__) || defined(__x86_64__) ||\
 defined(__ppc__) || defined(__ppc64__) ||  \
 (!defined(__APPLE__) && defined(__arm__)) ||   \
 (defined(__arm64__) || defined(__aarch64__)) ||\
 (defined(__APPLE__) && defined(__mips__))
-#define _LIBUNWIND_BUILD_ZERO_COST_APIS 1
-#else
-#define _LIBUNWIND_BUILD_ZERO_COST_APIS 0
+#define _LIBUNWIND_BUILD_ZERO_COST_APIS
 #endif
 
 #if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL)
Index: src/Unwind_AppleExtras.cpp
===
--- src/Unwind_AppleExtras.cpp
+++ src/Unwind_AppleExtras.cpp
@@ -77,7 +77,7 @@
 #endif
 
 
-#if _LIBUNWIND_BUILD_ZERO_COST_APIS
+#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
 
 //
 // symbols in libSystem.dylib in 10.6 and later, but are in libgcc_s.dylib in
@@ -116,12 +116,12 @@
 NEVER_HERE(__deregister_fr

[libunwind] r299225 - [libunwind] Clean up macro usage.

2017-03-31 Thread Ranjeet Singh via cfe-commits
Author: rsingh
Date: Fri Mar 31 10:28:06 2017
New Revision: 299225

URL: http://llvm.org/viewvc/llvm-project?rev=299225&view=rev
Log:
[libunwind] Clean up macro usage.

Convention in libunwind is to use !defined(FOOT) not !FOO.

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


Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/include/unwind.h
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/Unwind-EHABI.cpp
libunwind/trunk/src/Unwind-EHABI.h
libunwind/trunk/src/Unwind-sjlj.c
libunwind/trunk/src/UnwindCursor.hpp
libunwind/trunk/src/UnwindLevel1-gcc-ext.c
libunwind/trunk/src/UnwindLevel1.c
libunwind/trunk/src/Unwind_AppleExtras.cpp
libunwind/trunk/src/config.h
libunwind/trunk/src/libunwind.cpp
libunwind/trunk/src/libunwind_ext.h

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=299225&r1=299224&r2=299225&view=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Fri Mar 31 10:28:06 2017
@@ -12,14 +12,12 @@
 
 #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
 !defined(__ARM_DWARF_EH__)
-#define _LIBUNWIND_ARM_EHABI 1
-#else
-#define _LIBUNWIND_ARM_EHABI 0
+#define _LIBUNWIND_ARM_EHABI
 #endif
 
 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
 # if defined(__i386__)
-#  define _LIBUNWIND_TARGET_I386 1
+#  define _LIBUNWIND_TARGET_I386
 #  define _LIBUNWIND_CONTEXT_SIZE 8
 #  define _LIBUNWIND_CURSOR_SIZE 19
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 9
@@ -57,7 +55,7 @@
 #  error "Unsupported architecture."
 # endif
 #else // !_LIBUNWIND_IS_NATIVE_ONLY
-# define _LIBUNWIND_TARGET_I386 1
+# define _LIBUNWIND_TARGET_I386
 # define _LIBUNWIND_TARGET_X86_64 1
 # define _LIBUNWIND_TARGET_PPC 1
 # define _LIBUNWIND_TARGET_AARCH64 1

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=299225&r1=299224&r2=299225&view=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Fri Mar 31 10:28:06 2017
@@ -72,7 +72,7 @@ typedef struct unw_cursor_t unw_cursor_t
 typedef struct unw_addr_space *unw_addr_space_t;
 
 typedef int unw_regnum_t;
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
 typedef uint32_t unw_word_t;
 typedef uint64_t unw_fpreg_t;
 #else

Modified: libunwind/trunk/include/unwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/unwind.h?rev=299225&r1=299224&r2=299225&view=diff
==
--- libunwind/trunk/include/unwind.h (original)
+++ libunwind/trunk/include/unwind.h Fri Mar 31 10:28:06 2017
@@ -36,7 +36,7 @@ typedef enum {
   _URC_HANDLER_FOUND = 6,
   _URC_INSTALL_CONTEXT = 7,
   _URC_CONTINUE_UNWIND = 8,
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
   _URC_FAILURE = 9
 #endif
 } _Unwind_Reason_Code;
@@ -51,7 +51,7 @@ typedef enum {
 
 typedef struct _Unwind_Context _Unwind_Context;   // opaque
 
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
 typedef uint32_t _Unwind_State;
 
 static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME   = 0;
@@ -168,7 +168,7 @@ extern void _Unwind_Resume(_Unwind_Excep
 #endif
 extern void _Unwind_DeleteException(_Unwind_Exception *exception_object);
 
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
 typedef enum {
   _UVRSC_CORE = 0, /* integer register */
   _UVRSC_VFP = 1, /* vfp */
@@ -208,7 +208,7 @@ _Unwind_VRS_Pop(_Unwind_Context *context
 _Unwind_VRS_DataRepresentation representation);
 #endif
 
-#if !_LIBUNWIND_ARM_EHABI
+#if !defined(_LIBUNWIND_ARM_EHABI)
 
 extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index);
 extern void _Unwind_SetGR(struct _Unwind_Context *context, int index,
@@ -216,7 +216,7 @@ extern void _Unwind_SetGR(struct _Unwind
 extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);
 extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);
 
-#else  // _LIBUNWIND_ARM_EHABI
+#else  // defined(_LIBUNWIND_ARM_EHABI)
 
 #if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE)
 #define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern
@@ -255,7 +255,7 @@ void _Unwind_SetIP(struct _Unwind_Contex
   uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);
   _Unwind_SetGR(context, 15, value | thumb_bit);
 }
-#endif  // _LIBUNWIND_ARM_EHABI
+#endif  // defined(_LIBUNWIND_ARM_EHABI)
 
 extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
 extern uintptr_t

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp

[PATCH] D31078: [libunwind] Clean up macro usage.

2017-03-31 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299225: [libunwind] Clean up macro usage. (authored by 
rsingh).

Changed prior to commit:
  https://reviews.llvm.org/D31078?vs=93646&id=93647#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31078

Files:
  libunwind/trunk/include/__libunwind_config.h
  libunwind/trunk/include/libunwind.h
  libunwind/trunk/include/unwind.h
  libunwind/trunk/src/AddressSpace.hpp
  libunwind/trunk/src/Unwind-EHABI.cpp
  libunwind/trunk/src/Unwind-EHABI.h
  libunwind/trunk/src/Unwind-sjlj.c
  libunwind/trunk/src/UnwindCursor.hpp
  libunwind/trunk/src/UnwindLevel1-gcc-ext.c
  libunwind/trunk/src/UnwindLevel1.c
  libunwind/trunk/src/Unwind_AppleExtras.cpp
  libunwind/trunk/src/config.h
  libunwind/trunk/src/libunwind.cpp
  libunwind/trunk/src/libunwind_ext.h

Index: libunwind/trunk/src/UnwindLevel1.c
===
--- libunwind/trunk/src/UnwindLevel1.c
+++ libunwind/trunk/src/UnwindLevel1.c
@@ -30,7 +30,7 @@
 #include "unwind.h"
 #include "config.h"
 
-#if !_LIBUNWIND_ARM_EHABI
+#if !defined(_LIBUNWIND_ARM_EHABI)
 
 static _Unwind_Reason_Code
 unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
@@ -503,4 +503,4 @@
   unw_set_reg(cursor, UNW_REG_IP, value);
 }
 
-#endif // !_LIBUNWIND_ARM_EHABI
+#endif // !defined(_LIBUNWIND_ARM_EHABI)
Index: libunwind/trunk/src/Unwind_AppleExtras.cpp
===
--- libunwind/trunk/src/Unwind_AppleExtras.cpp
+++ libunwind/trunk/src/Unwind_AppleExtras.cpp
@@ -77,7 +77,7 @@
 #endif
 
 
-#if _LIBUNWIND_BUILD_ZERO_COST_APIS
+#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
 
 //
 // symbols in libSystem.dylib in 10.6 and later, but are in libgcc_s.dylib in
@@ -116,12 +116,12 @@
 NEVER_HERE(__deregister_frame_info)
 NEVER_HERE(__deregister_frame_info_bases)
 
-#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS
+#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS)
 
 
 
 
-#if _LIBUNWIND_BUILD_SJLJ_APIS
+#if defined(_LIBUNWIND_BUILD_SJLJ_APIS)
 //
 // symbols in libSystem.dylib in iOS 5.0 and later, but are in libgcc_s.dylib in
 // earlier versions
@@ -141,7 +141,7 @@
 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Resume_or_Rethrow)
 NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Unregister)
 
-#endif // _LIBUNWIND_BUILD_SJLJ_APIS
+#endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS)
 
 
 namespace libunwind {
@@ -184,7 +184,7 @@
 }
 
 
-#if !defined(FOR_DYLD) && _LIBUNWIND_BUILD_SJLJ_APIS
+#if !defined(FOR_DYLD) && defined(_LIBUNWIND_BUILD_SJLJ_APIS)
 
 #ifndef _LIBUNWIND_HAS_NO_THREADS
   #include 
Index: libunwind/trunk/src/Unwind-EHABI.cpp
===
--- libunwind/trunk/src/Unwind-EHABI.cpp
+++ libunwind/trunk/src/Unwind-EHABI.cpp
@@ -12,7 +12,7 @@
 
 #include "Unwind-EHABI.h"
 
-#if _LIBUNWIND_ARM_EHABI
+#if defined(_LIBUNWIND_ARM_EHABI)
 
 #include 
 #include 
@@ -987,4 +987,4 @@
   return _URC_OK;
 }
 
-#endif  // _LIBUNWIND_ARM_EHABI
+#endif  // defined(_LIBUNWIND_ARM_EHABI)
Index: libunwind/trunk/src/config.h
===
--- libunwind/trunk/src/config.h
+++ libunwind/trunk/src/config.h
@@ -32,50 +32,36 @@
 // Platform specific configuration defines.
 #ifdef __APPLE__
   #if defined(FOR_DYLD)
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
-#define _LIBUNWIND_SUPPORT_DWARF_UNWIND   0
-#define _LIBUNWIND_SUPPORT_DWARF_INDEX0
+#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
   #else
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
+#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND   1
-#define _LIBUNWIND_SUPPORT_DWARF_INDEX0
   #endif
 #else
   #if defined(__ARM_DWARF_EH__) || !defined(__arm__)
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1
-  #else
-#define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0
-#define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0
-#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
   #endif
 #endif
 
 // FIXME: these macros are not correct for COFF targets
 #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
 #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
 
 #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
-#define _LIBUNWIND_BUILD_SJLJ_APIS 1
-#else
-#define _LIBUNWIND_BUILD_SJLJ_APIS 0
+#define _LIBUNWIND_BUILD_SJLJ_APIS
 #endif
 
 #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__)
-#define _LIBUNWIND_SUPPORT_FRAME_APIS 1
-#else
-#define _LIBUNWIND_SUPPORT_FRAME_APIS 0
+#define _LIBUNWIND_SUPPORT_FRAME_APIS
 #endif
 
 #if defined(__i386__) || defined(__x86_64__) ||\
 defined(__ppc__) || defined(__ppc64__) ||  \
 (!defined(__APPLE__) && defined(__arm__)) |

r299226 - [Modules][PCH] Serialize #pragma pack

2017-03-31 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Mar 31 10:36:21 2017
New Revision: 299226

URL: http://llvm.org/viewvc/llvm-project?rev=299226&view=rev
Log:
[Modules][PCH] Serialize #pragma pack

This patch serializes the state of #pragma pack. It preserves the state of the
pragma from a PCH/from modules in a file that uses that PCH/those modules.

rdar://21359084

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

Added:
cfe/trunk/test/Modules/Inputs/pragma_pack_push.h
cfe/trunk/test/Modules/Inputs/pragma_pack_reset_push.h
cfe/trunk/test/Modules/Inputs/pragma_pack_set.h
cfe/trunk/test/Modules/pragma-pack.c
cfe/trunk/test/PCH/pragma-pack.c
Modified:
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/lib/Sema/SemaAttr.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/Modules/Inputs/module.map

Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=299226&r1=299225&r2=299226&view=diff
==
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Fri Mar 31 10:36:21 2017
@@ -604,6 +604,9 @@ namespace clang {
   OPENCL_EXTENSION_DECLS = 59,
 
   MODULAR_CODEGEN_DECLS = 60,
+
+  /// \brief Record code for \#pragma pack options.
+  PACK_PRAGMA_OPTIONS = 61,
 };
 
 /// \brief Record types used within a source manager block.

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=299226&r1=299225&r2=299226&view=diff
==
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Mar 31 10:36:21 2017
@@ -811,6 +811,17 @@ private:
   int PragmaMSPointersToMembersState = -1;
   SourceLocation PointersToMembersPragmaLocation;
 
+  /// \brief The pragma pack state.
+  Optional PragmaPackCurrentValue;
+  SourceLocation PragmaPackCurrentLocation;
+  struct PragmaPackStackEntry {
+unsigned Value;
+SourceLocation Location;
+StringRef SlotLabel;
+  };
+  llvm::SmallVector PragmaPackStack;
+  llvm::SmallVector PragmaPackStrings;
+
   /// \brief The OpenCL extension settings.
   OpenCLOptions OpenCLExtensions;
 

Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=299226&r1=299225&r2=299226&view=diff
==
--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Mar 31 10:36:21 2017
@@ -485,6 +485,7 @@ private:
   void WriteOptimizePragmaOptions(Sema &SemaRef);
   void WriteMSStructPragmaOptions(Sema &SemaRef);
   void WriteMSPointersToMembersPragmaOptions(Sema &SemaRef);
+  void WritePackPragmaOptions(Sema &SemaRef);
   void WriteModuleFileExtension(Sema &SemaRef,
 ModuleFileExtensionWriter &Writer);
 

Modified: cfe/trunk/lib/Sema/SemaAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAttr.cpp?rev=299226&r1=299225&r2=299226&view=diff
==
--- cfe/trunk/lib/Sema/SemaAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAttr.cpp Fri Mar 31 10:36:21 2017
@@ -215,6 +215,7 @@ void Sema::PragmaStack::Act(S
ValueType Value) {
   if (Action == PSK_Reset) {
 CurrentValue = DefaultValue;
+CurrentPragmaLocation = PragmaLocation;
 return;
   }
   if (Action & PSK_Push)

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=299226&r1=299225&r2=299226&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Mar 31 10:36:21 2017
@@ -3298,6 +3298,28 @@ ASTReader::ReadASTBlock(ModuleFile &F, u
   }
   ForceCUDAHostDeviceDepth = Record[0];
   break;
+
+case PACK_PRAGMA_OPTIONS: {
+  if (Record.size() < 3) {
+Error("invalid pragma pack record");
+return Failure;
+  }
+  PragmaPackCurrentValue = Record[0];
+  PragmaPackCurrentLocation = ReadSourceLocation(F, Record[1]);
+  unsigned NumStackEntries = Record[2];
+  unsigned Idx = 3;
+  // Reset the stack when importing a new module.
+  PragmaPackStack.clear();
+  for (unsigned I = 0; I < NumStackE

[PATCH] D31241: [Modules][PCH] Serialize #pragma pack

2017-03-31 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299226: [Modules][PCH] Serialize #pragma pack (authored by 
arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D31241?vs=92638&id=93650#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31241

Files:
  cfe/trunk/include/clang/Serialization/ASTBitCodes.h
  cfe/trunk/include/clang/Serialization/ASTReader.h
  cfe/trunk/include/clang/Serialization/ASTWriter.h
  cfe/trunk/lib/Sema/SemaAttr.cpp
  cfe/trunk/lib/Serialization/ASTReader.cpp
  cfe/trunk/lib/Serialization/ASTWriter.cpp
  cfe/trunk/test/Modules/Inputs/module.map
  cfe/trunk/test/Modules/Inputs/pragma_pack_push.h
  cfe/trunk/test/Modules/Inputs/pragma_pack_reset_push.h
  cfe/trunk/test/Modules/Inputs/pragma_pack_set.h
  cfe/trunk/test/Modules/pragma-pack.c
  cfe/trunk/test/PCH/pragma-pack.c

Index: cfe/trunk/test/PCH/pragma-pack.c
===
--- cfe/trunk/test/PCH/pragma-pack.c
+++ cfe/trunk/test/PCH/pragma-pack.c
@@ -0,0 +1,90 @@
+// Test this without pch.
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DSET
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DRESET
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DPUSH
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DPUSH_POP
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DPUSH_POP_LABEL
+
+// Test with pch.
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DSET -emit-pch -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DSET -verify -include-pch %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DRESET -emit-pch -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DRESET -verify -include-pch %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH -emit-pch -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH -verify -include-pch %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP -emit-pch -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP -verify -include-pch %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP_LABEL -emit-pch -o %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP_LABEL -verify -include-pch %t
+
+#ifndef HEADER
+#define HEADER
+
+#ifdef SET
+#pragma pack(1)
+#endif
+
+#ifdef RESET
+#pragma pack(2)
+#pragma pack ()
+#endif
+
+#ifdef PUSH
+#pragma pack(1)
+#pragma pack (push, 2)
+#endif
+
+#ifdef PUSH_POP
+#pragma pack (push, 4)
+#pragma pack (push, 2)
+#pragma pack (pop)
+#endif
+
+#ifdef PUSH_POP_LABEL
+#pragma pack (push, a, 4)
+#pragma pack (push, b, 1)
+#pragma pack (push, c, 2)
+#pragma pack (pop, b)
+#endif
+
+#else
+
+#ifdef SET
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}}
+#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
+#endif
+
+#ifdef RESET
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+#pragma ()
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+#endif
+
+#ifdef PUSH
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 2}}
+#pragma pack(pop)
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}}
+#pragma pack ()
+#pragma pack (show) // expected-warning {{value of #pragma pack(show) == 8}}
+#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
+#endif
+
+#ifdef PUSH_POP
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
+#pragma pack(pop)
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
+#endif
+
+#ifdef PUSH_POP_LABEL
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
+#pragma pack(pop, c)
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
+#pragma pack(pop, a)
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+#pragma pack(pop)  // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
+#pragma pack(pop, b) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}}
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+#endif
+
+#endif
Index: cfe/trunk/test/Modules/Inputs/pragma_pack_set.h
===
--- cfe/trunk/test/Modules/Inputs/pragma_pack_set.h
+++ cfe/trunk/test/Modules/Inputs/pragma_pack_set.h
@@ -0,0 +1,3 @@
+
+#pragma pack (1)
+
Index: cfe/trunk/test/Modules/Inputs/pragma_pack_push.h
===
--- cfe/trunk/test/Modules/Inputs/pragma_pack_push.h
+++ cfe/trunk/test/Modules/Inputs/pragma_pack_push.h
@@ -0,0 +1,6 @@
+
+#pragma pack (p

[PATCH] D31538: [analyzer] MisusedMovedObjectChecker: Fix a false positive on state-resetting a base-class sub-object.

2017-03-31 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision.

If a state reset method is defined in a parent class, but called over an object 
of a child class, then the checker doesn't treat this as a state reset, at 
least for the sake of "Copying a 'moved-from' object" warning class.

The patch fixes it, but Peter may have a better fix in mind :)


https://reviews.llvm.org/D31538

Files:
  lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
  test/Analysis/MisusedMovedObject.cpp


Index: test/Analysis/MisusedMovedObject.cpp
===
--- test/Analysis/MisusedMovedObject.cpp
+++ test/Analysis/MisusedMovedObject.cpp
@@ -617,3 +617,11 @@
 a.b.foo();   // no-warning
   }
 }
+
+class C: public A {};
+void resetSuperClass() {
+  C c;
+  C c1 = std::move(c);
+  c.clear();
+  C c2 = c; // no-warning
+}
Index: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
@@ -416,7 +416,14 @@
 return;
 
   if (isStateResetMethod(MethodDecl)) {
-State = State->remove(ThisRegion);
+// A state reset method resets the whole object, not only sub-object
+// of a parent class in which it is defined.
+const MemRegion *WholeObjectRegion = ThisRegion;
+while (const CXXBaseObjectRegion *BR =
+   dyn_cast(WholeObjectRegion))
+  WholeObjectRegion = BR->getSuperRegion();
+
+State = State->remove(WholeObjectRegion);
 C.addTransition(State);
 return;
   }


Index: test/Analysis/MisusedMovedObject.cpp
===
--- test/Analysis/MisusedMovedObject.cpp
+++ test/Analysis/MisusedMovedObject.cpp
@@ -617,3 +617,11 @@
 a.b.foo();   // no-warning
   }
 }
+
+class C: public A {};
+void resetSuperClass() {
+  C c;
+  C c1 = std::move(c);
+  c.clear();
+  C c2 = c; // no-warning
+}
Index: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
@@ -416,7 +416,14 @@
 return;
 
   if (isStateResetMethod(MethodDecl)) {
-State = State->remove(ThisRegion);
+// A state reset method resets the whole object, not only sub-object
+// of a parent class in which it is defined.
+const MemRegion *WholeObjectRegion = ThisRegion;
+while (const CXXBaseObjectRegion *BR =
+   dyn_cast(WholeObjectRegion))
+  WholeObjectRegion = BR->getSuperRegion();
+
+State = State->remove(WholeObjectRegion);
 C.addTransition(State);
 return;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-03-31 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 93658.
xazax.hun marked 11 inline comments as done.
xazax.hun added a comment.

- Fixed some of the review comments and some other cleanups.


https://reviews.llvm.org/D30691

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/Decl.h
  include/clang/AST/Mangle.h
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/ItaniumMangle.cpp
  lib/Basic/SourceManager.cpp
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  lib/StaticAnalyzer/Core/CMakeLists.txt
  lib/StaticAnalyzer/Core/CallEvent.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/Inputs/externalFnMap.txt
  test/Analysis/Inputs/xtu-chain.cpp
  test/Analysis/Inputs/xtu-other.cpp
  test/Analysis/xtu-main.cpp
  tools/CMakeLists.txt
  tools/clang-cmdline-arch-extractor/CMakeLists.txt
  tools/clang-cmdline-arch-extractor/ClangCmdlineArchExtractor.cpp
  tools/clang-func-mapping/CMakeLists.txt
  tools/clang-func-mapping/ClangFnMapGen.cpp
  tools/scan-build-py/libscanbuild/runner.py
  tools/xtu-analysis/xtu-analyze.py
  tools/xtu-analysis/xtu-build.py

Index: tools/xtu-analysis/xtu-build.py
===
--- /dev/null
+++ tools/xtu-analysis/xtu-build.py
@@ -0,0 +1,195 @@
+#!/usr/bin/env python
+
+import argparse
+import io
+import json
+import multiprocessing
+import os
+import re
+import signal
+import subprocess
+import string
+
+threading_factor = int(multiprocessing.cpu_count() * 1.5)
+timeout = 86400
+
+parser = argparse.ArgumentParser(
+description='Executes 1st pass of XTU analysis')
+parser.add_argument('-b', required=True, dest='buildlog',
+metavar='build.json',
+help='Use a JSON Compilation Database')
+parser.add_argument('-p', metavar='preanalyze-dir', dest='xtuindir',
+help='Use directory for generating preanalyzation data '
+ '(default=".xtu")',
+default='.xtu')
+parser.add_argument('-j', metavar='threads', dest='threads',
+help='Number of threads used (default=' +
+str(threading_factor) + ')',
+default=threading_factor)
+parser.add_argument('-v', dest='verbose', action='store_true',
+help='Verbose output of every command executed')
+parser.add_argument('--clang-path', metavar='clang-path', dest='clang_path',
+help='Set path of clang binaries to be used '
+ '(default taken from CLANG_PATH envvar)',
+default=os.environ.get('CLANG_PATH'))
+parser.add_argument('--timeout', metavar='N',
+help='Timeout for build in seconds (default: %d)' %
+timeout,
+default=timeout)
+mainargs = parser.parse_args()
+
+if mainargs.clang_path is None:
+clang_path = ''
+else:
+clang_path = os.path.abspath(mainargs.clang_path)
+if mainargs.verbose:
+print 'XTU uses clang dir: ' + \
+(clang_path if clang_path != '' else '')
+
+buildlog_file = open(mainargs.buildlog, 'r')
+buildlog = json.load(buildlog_file)
+buildlog_file.close()
+
+src_pattern = re.compile('.*\.(C|c|cc|cpp|cxx|ii|m|mm)$', re.IGNORECASE)
+src_2_dir = {}
+src_2_cmd = {}
+src_order = []
+cmd_2_src = {}
+cmd_order = []
+for step in buildlog:
+if src_pattern.match(step['file']):
+if step['file'] not in src_2_dir:
+src_2_dir[step['file']] = step['directory']
+if step['file'] not in src_2_cmd:
+src_2_cmd[step['file']] = step['command']
+src_order.append(step['file'])
+if step['command'] not in cmd_2_src:
+cmd_2_src[step['command']] = [step['file']]
+cmd_order.append(step['command'])
+else:
+cmd_2_src[step['command']].append(step['file'])
+
+
+def clear_file(filename):
+try:
+os.remove(filename)
+except OSError:
+pass
+
+
+def get_command_arguments(cmd):
+had_command = False
+args = []
+for arg in cmd.split():
+if had_command and not src_pattern.match(arg):
+args.append(arg)
+if not had_command and arg.find('=') == -1:
+had_command = True
+return args
+
+
+def generate_ast(source):
+cmd = src_2_cmd[source]
+args = get_command_arguments(cmd)
+arch_command = os.path.join(clang_path, 'clang-cmdline-arch-extractor') + \
+' ' + string.join(args, ' ') + ' ' + source
+if mainargs.verbose:
+print arch_command
+arch_output = subprocess.check_output(arch_command, shell=True)
+arch = arch_output[arch_output.rfind('@')+1:].strip()
+ast_joined_path = os.path.join(mainargs.xtuindir,
+   os.path.join('/

[PATCH] D31540: Prefer non-friend to friend in in redeclaration chain

2017-03-31 Thread Yaron Keren via Phabricator via cfe-commits
yaron.keren created this revision.

Address http://bugs.llvm.org/pr30994 so that a non-friend can properly replace 
a friend, and a visible friend can properly replace an invisible friend but not 
vice verse. This also fixes two FIXME in SemaTemplate/friend-template.cpp.


Repository:
  rL LLVM

https://reviews.llvm.org/D31540

Files:
  tools/clang/include/clang/AST/DeclBase.h
  tools/clang/lib/AST/Decl.cpp
  tools/clang/lib/AST/DeclBase.cpp
  tools/clang/test/SemaTemplate/friend-template.cpp


Index: tools/clang/test/SemaTemplate/friend-template.cpp
===
--- tools/clang/test/SemaTemplate/friend-template.cpp
+++ tools/clang/test/SemaTemplate/friend-template.cpp
@@ -68,17 +68,12 @@
   Foo foo;
 
   template struct X2a;
-
-  template struct X2b;
+  template struct X2b;// expected-note {{previous 
non-type template parameter with type 'int' is here}}
 
   template
   class X3 {
 template friend struct X2a;
-
-// FIXME: the redeclaration note ends up here because redeclaration
-// lookup ends up finding the friend target from X3.
-template friend struct X2b; // expected-error 
{{template non-type parameter has a different type 'long' in template 
redeclaration}} \
-  // expected-note {{previous non-type template parameter with type 'int' 
is here}}
+template friend struct X2b; // expected-error 
{{template non-type parameter has a different type 'long' in template 
redeclaration}} 
   };
 
   X3 x3i; // okay
@@ -297,14 +292,11 @@
   int n = C::D().f();
 
   struct F {
-template struct G;
+template struct G; // expected-note {{previous}}
   };
   template struct H {
-// FIXME: As with cases above, the note here is on an unhelpful 
declaration,
-// and should point to the declaration of G within F.
 template friend struct F::G; // \
-  // expected-error {{different type 'char' in template redeclaration}} \
-  // expected-note {{previous}}
+  // expected-error {{different type 'char' in template redeclaration}}
   };
   H h1; // ok
   H h2; // expected-note {{instantiation}}
Index: tools/clang/lib/AST/DeclBase.cpp
===
--- tools/clang/lib/AST/DeclBase.cpp
+++ tools/clang/lib/AST/DeclBase.cpp
@@ -861,6 +861,21 @@
   return Ty->getAs();
 }
 
+bool Decl::isThisDeclarationADefinition() const {
+  if (auto *TD = dyn_cast(this))
+return TD->isThisDeclarationADefinition();
+  if (auto *FD = dyn_cast(this))
+return FD->isThisDeclarationADefinition();
+  if (auto *VD = dyn_cast(this))
+return VD->isThisDeclarationADefinition();
+  if (auto *CTD = dyn_cast(this))
+return CTD->isThisDeclarationADefinition();
+  if (auto *FTD = dyn_cast(this))
+return FTD->isThisDeclarationADefinition();
+  if (auto *VTD = dyn_cast(this))
+return VTD->isThisDeclarationADefinition();
+  return false;
+}
 
 /// Starting at a given context (a Decl or DeclContext), look for a
 /// code context that is not a closure (a lambda, block, etc.).
Index: tools/clang/lib/AST/Decl.cpp
===
--- tools/clang/lib/AST/Decl.cpp
+++ tools/clang/lib/AST/Decl.cpp
@@ -1536,6 +1536,10 @@
   if (isa(this))
 return false;
 
+  if (getFriendObjectKind() > OldD->getFriendObjectKind() &&
+  !isThisDeclarationADefinition())
+return false;
+
   // For parameters, pick the newer one. This is either an error or (in
   // Objective-C) permitted as an extension.
   if (isa(this))
Index: tools/clang/include/clang/AST/DeclBase.h
===
--- tools/clang/include/clang/AST/DeclBase.h
+++ tools/clang/include/clang/AST/DeclBase.h
@@ -417,6 +417,8 @@
 return const_cast(this)->getTranslationUnitDecl();
   }
 
+  bool isThisDeclarationADefinition() const;
+
   bool isInAnonymousNamespace() const;
 
   bool isInStdNamespace() const;


Index: tools/clang/test/SemaTemplate/friend-template.cpp
===
--- tools/clang/test/SemaTemplate/friend-template.cpp
+++ tools/clang/test/SemaTemplate/friend-template.cpp
@@ -68,17 +68,12 @@
   Foo foo;
 
   template struct X2a;
-
-  template struct X2b;
+  template struct X2b;// expected-note {{previous non-type template parameter with type 'int' is here}}
 
   template
   class X3 {
 template friend struct X2a;
-
-// FIXME: the redeclaration note ends up here because redeclaration
-// lookup ends up finding the friend target from X3.
-template friend struct X2b; // expected-error {{template non-type parameter has a different type 'long' in template redeclaration}} \
-  // expected-note {{previous non-type template parameter with type 'int' is here}}
+template friend struct X2b; // expected-error {{template non-type parameter has a different type 'long' in template redeclaration}} 
   };
 
   X3 x3i; // okay
@@ -297,14 +292,1

[PATCH] D31541: [analyzer] MisusedMovedObjectChecker: Add a printState() method.

2017-03-31 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision.

The `printState()` method adds the checker's information to the 
`State->dump()`. I find it very handy when debugging by looking at the exploded 
graphs, so i think it's great to have this method implemented in all checkers. 
It helped me already.

I think it's not a problem if the graphs become too large when all checkers 
print their state, because since you're always only debugging a few checkers, 
you can easily disable the rest of them.


https://reviews.llvm.org/D31541

Files:
  lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp


Index: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
@@ -56,6 +56,8 @@
  ArrayRef ExplicitRegions,
  ArrayRef Regions,
  const LocationContext *LCtx, const CallEvent *Call) const;
+  void printState(raw_ostream &Out, ProgramStateRef State,
+  const char *NL, const char *Sep) const override;
 
 private:
   class MovedBugVisitor : public BugReporterVisitorImpl {
@@ -476,6 +478,25 @@
   return State;
 }
 
+void MisusedMovedObjectChecker::printState(raw_ostream &Out,
+   ProgramStateRef State,
+   const char *NL,
+   const char *Sep) const {
+
+  TrackedRegionMapTy RS = State->get();
+
+  if (!RS.isEmpty()) {
+Out << Sep << "Moved-from objects :" << NL;
+for (auto I: RS) {
+  I.first->dumpToStream(Out);
+  if (I.second.isMoved())
+Out << ": moved";
+  else
+Out << ": moved and reported";
+  Out << NL;
+}
+  }
+}
 void ento::registerMisusedMovedObjectChecker(CheckerManager &mgr) {
   mgr.registerChecker();
 }


Index: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
@@ -56,6 +56,8 @@
  ArrayRef ExplicitRegions,
  ArrayRef Regions,
  const LocationContext *LCtx, const CallEvent *Call) const;
+  void printState(raw_ostream &Out, ProgramStateRef State,
+  const char *NL, const char *Sep) const override;
 
 private:
   class MovedBugVisitor : public BugReporterVisitorImpl {
@@ -476,6 +478,25 @@
   return State;
 }
 
+void MisusedMovedObjectChecker::printState(raw_ostream &Out,
+   ProgramStateRef State,
+   const char *NL,
+   const char *Sep) const {
+
+  TrackedRegionMapTy RS = State->get();
+
+  if (!RS.isEmpty()) {
+Out << Sep << "Moved-from objects :" << NL;
+for (auto I: RS) {
+  I.first->dumpToStream(Out);
+  if (I.second.isMoved())
+Out << ": moved";
+  else
+Out << ": moved and reported";
+  Out << NL;
+}
+  }
+}
 void ento::registerMisusedMovedObjectChecker(CheckerManager &mgr) {
   mgr.registerChecker();
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29904: [OpenMP] Prevent emission of exception handling code when using OpenMP to offload to NVIDIA devices.

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 93665.
gtbercea added a comment.

Redo regression test.


Repository:
  rL LLVM

https://reviews.llvm.org/D29904

Files:
  lib/Frontend/CompilerInvocation.cpp
  test/OpenMP/target_parallel_no_exceptions.cpp


Index: test/OpenMP/target_parallel_no_exceptions.cpp
===
--- /dev/null
+++ test/OpenMP/target_parallel_no_exceptions.cpp
@@ -0,0 +1,17 @@
+/// Make sure no exception messages are inclided in the llvm output.
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc 
%s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix 
CHK-EXCEPTION
+
+void test_increment(){
+  #pragma omp target
+  {
+[]() { return;}();
+  }
+}
+
+int main(){
+  test_increment();
+  return 0;
+}
+
+//CHK-EXCEPTION-NOT: invoke
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2224,6 +2224,13 @@
 break;
   }
 }
+
+// Set the flag to prevent the implementation from emitting device 
exception
+// handling code for those requiring so.
+if (Opts.OpenMPIsDevice && T.isNVPTX()) {
+  Opts.Exceptions = 0;
+  Opts.CXXExceptions = 0;
+}
   }
 
   // Get the OpenMP target triples if any.


Index: test/OpenMP/target_parallel_no_exceptions.cpp
===
--- /dev/null
+++ test/OpenMP/target_parallel_no_exceptions.cpp
@@ -0,0 +1,17 @@
+/// Make sure no exception messages are inclided in the llvm output.
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHK-EXCEPTION
+
+void test_increment(){
+  #pragma omp target
+  {
+[]() { return;}();
+  }
+}
+
+int main(){
+  test_increment();
+  return 0;
+}
+
+//CHK-EXCEPTION-NOT: invoke
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2224,6 +2224,13 @@
 break;
   }
 }
+
+// Set the flag to prevent the implementation from emitting device exception
+// handling code for those requiring so.
+if (Opts.OpenMPIsDevice && T.isNVPTX()) {
+  Opts.Exceptions = 0;
+  Opts.CXXExceptions = 0;
+}
   }
 
   // Get the OpenMP target triples if any.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29904: [OpenMP] Prevent emission of exception handling code when using OpenMP to offload to NVIDIA devices.

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea marked 2 inline comments as done.
gtbercea added inline comments.



Comment at: lib/Frontend/CompilerInvocation.cpp:2167-2172
+// Set the flag to prevent the implementation from emitting device 
exception
+// handling code for those requiring so.
+if (Opts.OpenMPIsDevice && T.isNVPTX()) {
+  Opts.Exceptions = 0;
+  Opts.CXXExceptions = 0;
+}

gtbercea wrote:
> ABataev wrote:
> > I'm not sure this is the right place for this code.
> Alexey, any suggestion where this code should be moved to?
Alexey, this code is in the function that initializes Opts.Exceptions and 
Opts.CXXExceptions and comes after that initialization so the options are not 
being overwritten by it.


Repository:
  rL LLVM

https://reviews.llvm.org/D29904



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


r299229 - [mips][msa] Range adjustment for ldi_b builtin function operand

2017-03-31 Thread Petar Jovanovic via cfe-commits
Author: petarj
Date: Fri Mar 31 11:16:43 2017
New Revision: 299229

URL: http://llvm.org/viewvc/llvm-project?rev=299229&view=rev
Log:
[mips][msa] Range adjustment for ldi_b builtin function operand

Reasoning behind this change was allowing the function to accept all values
from range [-128, 255] since all of them can be encoded in an 8bit wide
value.
This differs from the prior state where only range [-128, 127] was accepted,
where values were assumed to be signed, whereas now the actual
interpretation of the immediate is deferred to the consumer as required.

Patch by Stefan Maksimovic.

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

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
cfe/trunk/test/CodeGen/builtins-mips-msa.c

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=299229&r1=299228&r2=299229&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Mar 31 11:16:43 2017
@@ -1640,7 +1640,7 @@ bool Sema::CheckMipsBuiltinFunctionCall(
   case Mips::BI__builtin_msa_sldi_d: i = 2; l = 0; u = 1; break;
   // Memory offsets and immediate loads.
   // These intrinsics take a signed 10 bit immediate.
-  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 127; break;
+  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 255; break;
   case Mips::BI__builtin_msa_ldi_h:
   case Mips::BI__builtin_msa_ldi_w:
   case Mips::BI__builtin_msa_ldi_d: i = 0; l = -512; u = 511; break;

Modified: cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-mips-msa-error.c?rev=299229&r1=299228&r2=299229&view=diff
==
--- cfe/trunk/test/CodeGen/builtins-mips-msa-error.c (original)
+++ cfe/trunk/test/CodeGen/builtins-mips-msa-error.c Fri Mar 31 11:16:43 2017
@@ -119,7 +119,7 @@ void test(void) {
   v4i32_r = __msa_ld_w(&v4i32_a, 512);   // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, 512);   // expected-error 
{{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(512);// expected-error 
{{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(256);// expected-error 
{{argument should be a value from -128 to 255}}
   v8i16_r = __msa_ldi_h(512);// expected-error 
{{argument should be a value from -512 to 511}}
   v4i32_r = __msa_ldi_w(512);// expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ldi_d(512);// expected-error 
{{argument should be a value from -512 to 511}}
@@ -310,7 +310,7 @@ void test(void) {
   v4i32_r = __msa_ld_w(&v4i32_a, -513);  // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, -513);  // expected-error 
{{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(-129);   // expected-error 
{{argument should be a value from -128 to 255}}
   v8i16_r = __msa_ldi_h(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
   v4i32_r = __msa_ldi_w(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ldi_d(-513);   // expected-error 
{{argument should be a value from -512 to 511}}

Modified: cfe/trunk/test/CodeGen/builtins-mips-msa.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-mips-msa.c?rev=299229&r1=299228&r2=299229&view=diff
==
--- cfe/trunk/test/CodeGen/builtins-mips-msa.c (original)
+++ cfe/trunk/test/CodeGen/builtins-mips-msa.c Fri Mar 31 11:16:43 2017
@@ -526,6 +526,8 @@ void test(void) {
   v2i64_r = __msa_ld_d(&v2i64_a, 96); // CHECK: call <2  x i64> 
@llvm.mips.ld.d(
 
   v16i8_r = __msa_ldi_b(3); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(-128); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(255); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
   v8i16_r = __msa_ldi_h(3); // CHECK: call <8  x i16> @llvm.mips.ldi.h(
   v4i32_r = __msa_ldi_w(3); // CHECK: call <4  x i32> @llvm.mips.ldi.w(
   v2i64_r = __msa_ldi_d(3); // CHECK: call <2  x i64> @llvm.mips.ldi.d(


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


[PATCH] D31082: [mips][msa] Range adjustment for ldi_b builtin function operand

2017-03-31 Thread Petar Jovanovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299229: [mips][msa] Range adjustment for ldi_b builtin 
function operand (authored by petarj).

Changed prior to commit:
  https://reviews.llvm.org/D31082?vs=92439&id=93669#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31082

Files:
  cfe/trunk/lib/Sema/SemaChecking.cpp
  cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
  cfe/trunk/test/CodeGen/builtins-mips-msa.c


Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -1640,7 +1640,7 @@
   case Mips::BI__builtin_msa_sldi_d: i = 2; l = 0; u = 1; break;
   // Memory offsets and immediate loads.
   // These intrinsics take a signed 10 bit immediate.
-  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 127; break;
+  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 255; break;
   case Mips::BI__builtin_msa_ldi_h:
   case Mips::BI__builtin_msa_ldi_w:
   case Mips::BI__builtin_msa_ldi_d: i = 0; l = -512; u = 511; break;
Index: cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
===
--- cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
+++ cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
@@ -119,7 +119,7 @@
   v4i32_r = __msa_ld_w(&v4i32_a, 512);   // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, 512);   // expected-error 
{{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(512);// expected-error 
{{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(256);// expected-error 
{{argument should be a value from -128 to 255}}
   v8i16_r = __msa_ldi_h(512);// expected-error 
{{argument should be a value from -512 to 511}}
   v4i32_r = __msa_ldi_w(512);// expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ldi_d(512);// expected-error 
{{argument should be a value from -512 to 511}}
@@ -310,7 +310,7 @@
   v4i32_r = __msa_ld_w(&v4i32_a, -513);  // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, -513);  // expected-error 
{{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(-129);   // expected-error 
{{argument should be a value from -128 to 255}}
   v8i16_r = __msa_ldi_h(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
   v4i32_r = __msa_ldi_w(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ldi_d(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
Index: cfe/trunk/test/CodeGen/builtins-mips-msa.c
===
--- cfe/trunk/test/CodeGen/builtins-mips-msa.c
+++ cfe/trunk/test/CodeGen/builtins-mips-msa.c
@@ -526,6 +526,8 @@
   v2i64_r = __msa_ld_d(&v2i64_a, 96); // CHECK: call <2  x i64> 
@llvm.mips.ld.d(
 
   v16i8_r = __msa_ldi_b(3); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(-128); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(255); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
   v8i16_r = __msa_ldi_h(3); // CHECK: call <8  x i16> @llvm.mips.ldi.h(
   v4i32_r = __msa_ldi_w(3); // CHECK: call <4  x i32> @llvm.mips.ldi.w(
   v2i64_r = __msa_ldi_d(3); // CHECK: call <2  x i64> @llvm.mips.ldi.d(


Index: cfe/trunk/lib/Sema/SemaChecking.cpp
===
--- cfe/trunk/lib/Sema/SemaChecking.cpp
+++ cfe/trunk/lib/Sema/SemaChecking.cpp
@@ -1640,7 +1640,7 @@
   case Mips::BI__builtin_msa_sldi_d: i = 2; l = 0; u = 1; break;
   // Memory offsets and immediate loads.
   // These intrinsics take a signed 10 bit immediate.
-  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 127; break;
+  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 255; break;
   case Mips::BI__builtin_msa_ldi_h:
   case Mips::BI__builtin_msa_ldi_w:
   case Mips::BI__builtin_msa_ldi_d: i = 0; l = -512; u = 511; break;
Index: cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
===
--- cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
+++ cfe/trunk/test/CodeGen/builtins-mips-msa-error.c
@@ -119,7 +119,7 @@
   v4i32_r = __msa_ld_w(&v4i32_a, 512);   // expected-error {{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, 512);   // expected-error {{argument should be a value from -51

[PATCH] D29904: [OpenMP] Prevent emission of exception handling code when using OpenMP to offload to NVIDIA devices.

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 93670.
gtbercea added a comment.

run clang-format on test.


Repository:
  rL LLVM

https://reviews.llvm.org/D29904

Files:
  lib/Frontend/CompilerInvocation.cpp
  test/OpenMP/target_parallel_no_exceptions.cpp


Index: test/OpenMP/target_parallel_no_exceptions.cpp
===
--- /dev/null
+++ test/OpenMP/target_parallel_no_exceptions.cpp
@@ -0,0 +1,17 @@
+/// Make sure no exception messages are inclided in the llvm output.
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc 
%s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64-unknown-unknown 
-fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix 
CHK-EXCEPTION
+
+void test_increment() {
+#pragma omp target
+  {
+[]() { return; }();
+  }
+}
+
+int main() {
+  test_increment();
+  return 0;
+}
+
+//CHK-EXCEPTION-NOT: invoke
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2224,6 +2224,13 @@
 break;
   }
 }
+
+// Set the flag to prevent the implementation from emitting device 
exception
+// handling code for those requiring so.
+if (Opts.OpenMPIsDevice && T.isNVPTX()) {
+  Opts.Exceptions = 0;
+  Opts.CXXExceptions = 0;
+}
   }
 
   // Get the OpenMP target triples if any.


Index: test/OpenMP/target_parallel_no_exceptions.cpp
===
--- /dev/null
+++ test/OpenMP/target_parallel_no_exceptions.cpp
@@ -0,0 +1,17 @@
+/// Make sure no exception messages are inclided in the llvm output.
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHK-EXCEPTION
+
+void test_increment() {
+#pragma omp target
+  {
+[]() { return; }();
+  }
+}
+
+int main() {
+  test_increment();
+  return 0;
+}
+
+//CHK-EXCEPTION-NOT: invoke
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2224,6 +2224,13 @@
 break;
   }
 }
+
+// Set the flag to prevent the implementation from emitting device exception
+// handling code for those requiring so.
+if (Opts.OpenMPIsDevice && T.isNVPTX()) {
+  Opts.Exceptions = 0;
+  Opts.CXXExceptions = 0;
+}
   }
 
   // Get the OpenMP target triples if any.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29642: [OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 93672.
gtbercea marked an inline comment as done.
gtbercea added a comment.

Fix prefix.


Repository:
  rL LLVM

https://reviews.llvm.org/D29642

Files:
  lib/Driver/ToolChains/Cuda.cpp
  test/Driver/openmp-offload.c


Index: test/Driver/openmp-offload.c
===
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -587,3 +587,11 @@
 // CHK-UBUJOBS-ST-SAME: [[HOSTOBJ:[^\\/]+\.o]]" "{{.*}}[[HOSTASM]]"
 // CHK-UBUJOBS-ST: clang-offload-bundler{{.*}}" "-type=o" 
"-targets=openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu,host-powerpc64le--linux"
 "-outputs=
 // CHK-UBUJOBS-ST-SAME: [[RES:[^\\/]+\.o]]" 
"-inputs={{.*}}[[T1OBJ]],{{.*}}[[T2OBJ]],{{.*}}[[HOSTOBJ]]"
+
+/// ###
+
+/// Check PTXAS is passed -c flag when offloading to an NVIDIA device using 
OpenMP.
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
-save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PTXAS-DEFAULT %s
+
+// CHK-PTXAS-DEFAULT: ptxas{{.*}}" "-c"
Index: lib/Driver/ToolChains/Cuda.cpp
===
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -272,6 +272,10 @@
   for (const auto& A : Args.getAllArgValues(options::OPT_Xcuda_ptxas))
 CmdArgs.push_back(Args.MakeArgString(A));
 
+  // In OpenMP we need to generate relocatable code.
+  if (JA.isOffloading(Action::OFK_OpenMP))
+CmdArgs.push_back("-c");
+
   const char *Exec;
   if (Arg *A = Args.getLastArg(options::OPT_ptxas_path_EQ))
 Exec = A->getValue();


Index: test/Driver/openmp-offload.c
===
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -587,3 +587,11 @@
 // CHK-UBUJOBS-ST-SAME: [[HOSTOBJ:[^\\/]+\.o]]" "{{.*}}[[HOSTASM]]"
 // CHK-UBUJOBS-ST: clang-offload-bundler{{.*}}" "-type=o" "-targets=openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu,host-powerpc64le--linux" "-outputs=
 // CHK-UBUJOBS-ST-SAME: [[RES:[^\\/]+\.o]]" "-inputs={{.*}}[[T1OBJ]],{{.*}}[[T2OBJ]],{{.*}}[[HOSTOBJ]]"
+
+/// ###
+
+/// Check PTXAS is passed -c flag when offloading to an NVIDIA device using OpenMP.
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PTXAS-DEFAULT %s
+
+// CHK-PTXAS-DEFAULT: ptxas{{.*}}" "-c"
Index: lib/Driver/ToolChains/Cuda.cpp
===
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -272,6 +272,10 @@
   for (const auto& A : Args.getAllArgValues(options::OPT_Xcuda_ptxas))
 CmdArgs.push_back(Args.MakeArgString(A));
 
+  // In OpenMP we need to generate relocatable code.
+  if (JA.isOffloading(Action::OFK_OpenMP))
+CmdArgs.push_back("-c");
+
   const char *Exec;
   if (Arg *A = Args.getLastArg(options::OPT_ptxas_path_EQ))
 Exec = A->getValue();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29644: [OpenMP] Pass -v to PTXAS if it was passed to the driver.

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 93676.
gtbercea added a comment.

Move test.


Repository:
  rL LLVM

https://reviews.llvm.org/D29644

Files:
  lib/Driver/ToolChains/Cuda.cpp
  test/Driver/cuda-external-tools.cu


Index: test/Driver/cuda-external-tools.cu
===
--- test/Driver/cuda-external-tools.cu
+++ test/Driver/cuda-external-tools.cu
@@ -65,6 +65,10 @@
 // RUN: %clang -### -target x86_32-apple-macosx -c %s 2>&1 \
 // RUN: | FileCheck -check-prefix ARCH32 -check-prefix SM20 %s
 
+// Check that CLANG forwards the -v flag to PTXAS.
+// RUN:   %clang -### -save-temps -no-canonical-prefixes -v %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PTXAS-VERBOSE %s
+
 // Match clang job that produces PTX assembly.
 // CHECK: "-cc1" "-triple" "nvptx64-nvidia-cuda"
 // SM20: "-target-cpu" "sm_20"
@@ -110,3 +114,5 @@
 // Match the clang job for host compilation.
 // CHECK: "-cc1" "-triple" "x86_64--linux-gnu"
 // CHECK-SAME: "-fcuda-include-gpubinary" "[[FATBINARY]]"
+
+// CHK-PTXAS-VERBOSE: ptxas{{.*}}" "-v"
Index: lib/Driver/ToolChains/Cuda.cpp
===
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -262,6 +262,10 @@
 CmdArgs.push_back("-O0");
   }
 
+  // Pass -v to ptxas if it was passed to the driver.
+  if (Args.hasArg(options::OPT_v))
+CmdArgs.push_back("-v");
+
   CmdArgs.push_back("--gpu-name");
   CmdArgs.push_back(Args.MakeArgString(CudaArchToString(gpu_arch)));
   CmdArgs.push_back("--output-file");


Index: test/Driver/cuda-external-tools.cu
===
--- test/Driver/cuda-external-tools.cu
+++ test/Driver/cuda-external-tools.cu
@@ -65,6 +65,10 @@
 // RUN: %clang -### -target x86_32-apple-macosx -c %s 2>&1 \
 // RUN: | FileCheck -check-prefix ARCH32 -check-prefix SM20 %s
 
+// Check that CLANG forwards the -v flag to PTXAS.
+// RUN:   %clang -### -save-temps -no-canonical-prefixes -v %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PTXAS-VERBOSE %s
+
 // Match clang job that produces PTX assembly.
 // CHECK: "-cc1" "-triple" "nvptx64-nvidia-cuda"
 // SM20: "-target-cpu" "sm_20"
@@ -110,3 +114,5 @@
 // Match the clang job for host compilation.
 // CHECK: "-cc1" "-triple" "x86_64--linux-gnu"
 // CHECK-SAME: "-fcuda-include-gpubinary" "[[FATBINARY]]"
+
+// CHK-PTXAS-VERBOSE: ptxas{{.*}}" "-v"
Index: lib/Driver/ToolChains/Cuda.cpp
===
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -262,6 +262,10 @@
 CmdArgs.push_back("-O0");
   }
 
+  // Pass -v to ptxas if it was passed to the driver.
+  if (Args.hasArg(options::OPT_v))
+CmdArgs.push_back("-v");
+
   CmdArgs.push_back("--gpu-name");
   CmdArgs.push_back(Args.MakeArgString(CudaArchToString(gpu_arch)));
   CmdArgs.push_back("--output-file");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31404: [OpenCL] Allow alloca return non-zero private pointer

2017-03-31 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In https://reviews.llvm.org/D31404#714906, @yaxunl wrote:

> In https://reviews.llvm.org/D31404#714244, @Anastasia wrote:
>
> > I can't see clearly why the alloca has to be extended to accommodate the 
> > address space too? Couldn't  the address space for alloca just be taken 
> > directly from the data layout?
> >
> > In fact is seems from the LLVM review, an address space for alloca doesn't 
> > go into the bitcode.
>
>
> In the latest comments of the LLVM review, reviewers have agreed that address 
> space of alloca goes into the bitcode.
>
> I am not quite get your first question. Do you mean why the API of alloca has 
> to have an address space parameter? Or do you question the necessity to let 
> alloca returning a pointer pointing to non-zero address space?


I am asking mainly about the motivation of extending alloca instruction syntax 
with an extra address space. It seems to me that the address space for alloca 
could just be taken from the data layout without any modification to the 
instruction itself.




Comment at: include/clang/Basic/AddressSpaces.h:28
 enum ID {
-  Offset = 0x7FFF00,
+  Default = 0,
 

yaxunl wrote:
> Anastasia wrote:
> > Somehow I wish that opencl_private would be represented explicitly instead 
> > and then an absence of an address space attribute would signify the default 
> > one to be used. But since opencl_private has always been represented as an 
> > absence of an address space attribute not only in AST but in IR as well, I 
> > believe it might be a bigger change now. However, how does this default 
> > address space align with default AS we put during type parsing in 
> > processTypeAttrs (https://reviews.llvm.org/D13168). I think after this step 
> > we shouldn't need default AS explicitly any longer? 
> Currently in Clang having an address space qualifier value of 0 is equivalent 
> to having no address space qualifier. This is due to the internal 
> representation of address space qualifier as bits in a mask. Therefore 
> although there are separate API's for hasAddressSpace() and 
> getAddressSpace(), in many many places people just do not use 
> hasAddressSpace() and only use getAddressSpace(). In a way, this is 
> convenient, since it allows people to use just one unsigned to represent that 
> whether a type has an address space qualifier and the value of the qualifier 
> if it has one. That's why value 0 of address space qualifier is called 
> `Default`, since it indicates `no address space qualifier`, which is the 
> default situation. Here we give it the name `Default`, just to emphasise the 
> existing reality, that is, 0 is truely the default value of address space 
> qualifier. This also matches most languages' view of address space, that is, 
> if not explicitly specified, 0 is the default address space qualifier since 
> it means `no address space qualifier`.
> 
> For OpenCL 1.2, this matches perfectly to private address space, since if no 
> address space qualifier implies private address space. For OpenCL 2.0, things 
> become complicated. 'no address space qualifier' in the source code no longer 
> ends up with a fixed address space qualifier in AST. What address space 
> qualifier we get in AST depends on scope of the variable. To be consistent 
> with the AST of OpenCL 1.2, we continue to use 'no address space qualifier 
> (or 0 value address space qualifier)' in AST to represent private address 
> space in OpenCL source language. This is non-ideal but it works fine. 
> Therefore although it is not written, in fact opencl_private is 0.
> 
> Since address space 0 in AST always represents the private address space in 
> OpenCL and the default address space in other languages, it cannot be used 
> for other address spaces of OpenCL. Also, when mapped to target address 
> space, for OpenCL, address space 0 in AST should map to target private 
> address space or alloca address space; for other languages, address space 0 
> in AST should map to target generic address space. It would be clearer to 
> have an enum value for 0 instead of using 0 directly.
I see a little value adding //Default// explicitly here, also because default 
AS is an OpenCL specific thing in my opinion. In C objects are just allowed to 
have no AS and it's fine. In fact the only use of //Default// in your patch is 
synonym to //opencl_private//. Unless we find another use for this, I would 
prefer not to add code for potential future use cases because it adds confusion 
and can be easily misused or create complications for adding new features.

I would rather say that Clang is missing an explicit representation of 
//opencl_private// at the moment. Mainly because private was used as default AS 
before OpenCL 2.0. So it was just the same thing. In OpenCL2.0 we worked around 
the fact that private is not represented explicitly by adding 'missing' ASes in 
//processTypeAttrs//. But it created some issues (for example in d

[PATCH] D29658: [OpenMP] Customize CUDA-based tool chain selection

2017-03-31 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 93679.
gtbercea added a comment.
Herald added a subscriber: rengolin.

Split patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D29658

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Driver/Driver.cpp
  test/OpenMP/target_messages.cpp


Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -4,6 +4,8 @@
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 
2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 
2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target 
'{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host 
target.
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=hexagon-linux-gnu 
-o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-DEVICE-TARGET %s
+// CHECK-UNSUPPORTED-DEVICE-TARGET: The target 'hexagon-linux-gnu' is not a 
supported OpenMP device target.
 
 void foo() {
 }
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -553,8 +553,22 @@
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diag(clang::diag::err_drv_invalid_omp_target) << Val;
   else {
-const ToolChain &TC = getToolChain(C.getInputArgs(), TT);
-C.addOffloadDeviceToolChain(&TC, Action::OFK_OpenMP);
+const ToolChain *TC = nullptr;
+// CUDA toolchains have to be selected differently. They pair host
+// and device in their implementation.
+if (TT.isNVPTX()) {
+  const ToolChain *HostTC =
+  C.getSingleOffloadToolChain();
+  assert(HostTC && "Host toolchain should be always defined.");
+  auto &CudaTC =
+  ToolChains[TT.str() + "/" + HostTC->getTriple().normalize()];
+  if (!CudaTC)
+CudaTC = llvm::make_unique(
+*this, TT, *HostTC, C.getInputArgs());
+  TC = CudaTC.get();
+} else
+  TC = &getToolChain(C.getInputArgs(), TT);
+C.addOffloadDeviceToolChain(TC, Action::OFK_OpenMP);
   }
 }
   } else
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -162,6 +162,8 @@
   "The provided host compiler IR file '%0' is required to generate code for 
OpenMP target regions but cannot be found.">;
 def err_drv_omp_host_target_not_supported : Error<
   "The target '%0' is not a supported OpenMP host target.">;
+def err_drv_omp_device_target_not_supported : Error<
+  "The target '%0' is not a supported OpenMP device target.">;
 def err_drv_expecting_fopenmp_with_fopenmp_targets : Error<
   "The option -fopenmp-targets must be used in conjunction with a -fopenmp 
option compatible with offloading, please use -fopenmp=libomp or 
-fopenmp=libiomp5.">;
 def warn_drv_omp_offload_target_duplicate : Warning<


Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -4,6 +4,8 @@
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx64-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // RUN: not %clang_cc1 -fopenmp -std=c++11 -triple nvptx-nvidia-cuda -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-HOST-TARGET %s
 // CHECK-UNSUPPORTED-HOST-TARGET: error: The target '{{nvptx64-nvidia-cuda|nvptx-nvidia-cuda}}' is not a supported OpenMP host target.
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=hexagon-linux-gnu -o - %s 2>&1 | FileCheck --check-prefix CHECK-UNSUPPORTED-DEVICE-TARGET %s
+// CHECK-UNSUPPORTED-DEVICE-TARGET: The target 'hexagon-linux-gnu' is not a supported OpenMP device target.
 
 void foo() {
 }
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -553,8 +553,22 @@
   if (TT.getArch() == llvm::Triple::UnknownArch)
 Diag(clang::diag::err_drv_invalid_omp_target) << Val;
   else {
-const ToolChain &TC = getToolChain(C.getInputArgs(), TT);
-C.addOffloadDeviceToolChain(&TC, Action::OFK_OpenMP);
+const ToolChain *TC = nullptr;
+// CUDA toolchains have to be selected differently. They pair host
+// and device in their implementation.
+if (TT.isNVPTX()) {
+  const ToolChain *HostTC =
+  C.getSingleOf

[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dominic Chen via Phabricator via cfe-commits
ddcc added inline comments.



Comment at: cmake/modules/FindZ3.cmake:3
+# in the find_path() and find_library() calls
+find_package(PkgConfig QUIET)
+PKG_CHECK_MODULES(PC_Z3 QUIET libz3)

delcypher wrote:
> @ddcc Seeing as you don't want to use the new upstream Z3 CMake package 
> config files I'll try to review this.
> 
> Upstream Z3 does not come with pkg-config files for the native library so I'm 
> wondering where you expect this to work. Does a Linux distro add their own 
> `.pc` files?
> 
> It looks like you only use these paths as hints so this so this looks like 
> it'll work even without the pkg-config files.
See below.



Comment at: cmake/modules/FindZ3.cmake:5
+PKG_CHECK_MODULES(PC_Z3 QUIET libz3)
+set(Z3_DEFINITIONS ${PC_LIBZ3_CFLAGS_OTHER})
+

delcypher wrote:
> @ddcc This CMake variable is set but never used. Also based on the name it 
> suggests that they are compiler definitions rather than other compiler flags. 
> Does `_CFLAGS_OTHER` have those semantics? It's unclear from 
> https://cmake.org/cmake/help/v3.7/module/FindPkgConfig.html#command:pkg_check_modules
>  what they are supposed to be.
> 
> To consume these flags you could add `target_compile_definitions()` and 
> `target_compile_options()` to all users of Z3. A more elegant way of doing 
> this is to create an imported library target (e.g. `z3::libz3`) and set 
> compile definitions, compile options and include directories on this imported 
> target with `INTERFACE` visibility so that these usage requirements 
> implicitly propagate to all users of `z3::libz3`.
I'm not very familiar with CMake, so I based it off of the FindLibXml2.cmake 
from the upstream CMake repository. The `pkg-config` part isn't used currently, 
but I left it in case z3 does get a proper package.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:619
+
+llvm::APSInt Int = llvm::APSInt(Float.bitcastToAPInt(), true);
+Z3Expr Z3Int = Z3Expr::fromAPSInt(Int);

delcypher wrote:
> @ddcc Why use APSInt here? Why not APInt, we are looking at raw bits and 
> don't want to interpret the most significant bit in a special way.
Since the rest of the code already handles `APSInt`, I just reused that instead 
of implementing another method for `APInt`. The overhead is one additional bool 
used to store the sign, which doesn't make much difference, since it needs to 
be specified anyway with `APInt::toString*()`.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:668
+default:
+  llvm_unreachable("Unsupported sort to integer!");
+case Z3_BV_SORT: {

delcypher wrote:
> Is `Z3_FLOATING_POINT_SORT` possible in your implementation?
I don't think so. Things change around a bit with D28954, but by the time this 
method is called, the casting should have already been handled elsewhere.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:674
+  // are the same size.
+  Z3_get_numeral_uint64(Z3Context::ZC, AST,
+reinterpret_cast<__uint64 *>(&Value));

The only problem I see now is that if a IEEEquad is fed in, it will generate a 
128-bit bitvector, which will be truncated at this point. But the z3 API 
doesn't support retrieving a rational into anything larger than 64-bit, so 
perhaps converting it to string is the way to go here.


https://reviews.llvm.org/D28952



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


[PATCH] D30643: [OpenCL] Extended diagnostics for atomic initialization

2017-03-31 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added inline comments.



Comment at: test/SemaOpenCL/atomic-init.cl:6
+kernel void test_atomic_initialization() {
+  a1 = 1; // expected-error {{atomic variable can only be assigned to a 
compile time constant}}
+  atomic_int a2 = 0; // expected-error {{atomic variable can be initialized to 
a variable only in global address space}}

This diagnostic seems wrong! How is 1 not a compile time constant?

Didn't we agree to drop the constant bit from the error message and just keep 
reporting about the program (global visibility) scope? I think the restriction 
about the scope holds for both initialization and assignment and therefore I 
have asked to unify the diagnostic...


https://reviews.llvm.org/D30643



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


[PATCH] D31538: [analyzer] MisusedMovedObjectChecker: Fix a false positive on state-resetting a base-class sub-object.

2017-03-31 Thread Peter Szecsi via Phabricator via cfe-commits
szepet added a comment.

Thank you for working on that, Artem!
The changes look good, just one comment about that suspicious remove.




Comment at: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp:426
+
+State = State->remove(WholeObjectRegion);
 C.addTransition(State);

I am wondering if I made a mistake but I think this should be removeFromState() 
function call. (We should remove every marked subregions of the object too.)
So I suspect a code like this would result a false positive:
```
struct A{
B b;
void clear();
};

void test(){
A a;
B b = std::move(a.b);
a.clear();
b = std::move(a); //report a bug
}
```

I mean it is probably a report we do not want to have.


https://reviews.llvm.org/D31538



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


r299233 - [Sema][X86] Update immediate check for gather/scatter prefetch instructions to match the _MM_HINT_T0/T1 constant definitions

2017-03-31 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri Mar 31 12:22:30 2017
New Revision: 299233

URL: http://llvm.org/viewvc/llvm-project?rev=299233&view=rev
Log:
[Sema][X86] Update immediate check for gather/scatter prefetch instructions to 
match the _MM_HINT_T0/T1 constant definitions

Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or 
Intel documentation. Interestingly gcc had this same bug on their 
implementation of the gather/scatter builtins at one point too.

Fixes PR32411.


Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/avx512pf-builtins.c
cfe/trunk/test/Sema/builtins-x86.c

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=299233&r1=299232&r2=299233&view=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Mar 31 12:22:30 2017
@@ -2308,7 +2308,7 @@ bool Sema::CheckX86BuiltinFunctionCall(u
   case X86::BI__builtin_ia32_scatterpfdps:
   case X86::BI__builtin_ia32_scatterpfqpd:
   case X86::BI__builtin_ia32_scatterpfqps:
-i = 4; l = 1; u = 2;
+i = 4; l = 2; u = 3;
 break;
   case X86::BI__builtin_ia32_pcmpestrm128:
   case X86::BI__builtin_ia32_pcmpestri128:

Modified: cfe/trunk/test/CodeGen/avx512pf-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512pf-builtins.c?rev=299233&r1=299232&r2=299233&view=diff
==
--- cfe/trunk/test/CodeGen/avx512pf-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512pf-builtins.c Fri Mar 31 12:22:30 2017
@@ -6,95 +6,95 @@
 void test_mm512_mask_prefetch_i32gather_pd(__m256i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.dpd
-  return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, 1); 
+  return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr, int 
hint) {
   // CHECK-LABEL: @test_mm512_prefetch_i32gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.dpd
-  return _mm512_prefetch_i32gather_pd(index, addr, 2, 1); 
+  return _mm512_prefetch_i32gather_pd(index, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.dps
-  return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, 1); 
+  return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_prefetch_i32gather_ps(__m512i index,  void const *addr, int 
hint) {
   // CHECK-LABEL: @test_mm512_prefetch_i32gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.dps
-  return _mm512_prefetch_i32gather_ps(index, addr, 2, 1); 
+  return _mm512_prefetch_i32gather_ps(index, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.qpd
-  return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, 1); 
+  return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr, int 
hint) {
   // CHECK-LABEL: @test_mm512_prefetch_i64gather_pd
   // CHECK: @llvm.x86.avx512.gatherpf.qpd
-  return _mm512_prefetch_i64gather_pd(index, addr, 2, 1); 
+  return _mm512_prefetch_i64gather_pd(index, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void 
const *addr, int hint) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.qps
-  return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, 1); 
+  return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_prefetch_i64gather_ps(__m512i index, void const *addr, int 
hint) {
   // CHECK-LABEL: @test_mm512_prefetch_i64gather_ps
   // CHECK: @llvm.x86.avx512.gatherpf.qps
-  return _mm512_prefetch_i64gather_ps(index, addr, 2, 1); 
+  return _mm512_prefetch_i64gather_ps(index, addr, 2, _MM_HINT_T0); 
 }
 
 void test_mm512_prefetch_i32scatter_pd(void *addr, __m256i index) {
   // CHECK-LABEL: @test_mm512_prefetch_i32scatter_pd
   // CHECK: @llvm.x86.avx512.scatterpf.dpd.512
-  return _mm512_prefetch_i32scatter_pd(addr, index, 1, 2); 
+  return _mm512_prefetch_i32scatter_pd(addr, index, 1, _MM_HINT_T1); 
 }
 
 void test_mm512_mask_prefetch_i32scatter_pd(void *addr, __mmask8 mask, __m256i 
index) {
   // CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_pd
   // CHECK: @llvm.x86.avx512.scatterpf.dpd.512
-  return _mm512_mask_prefetch_i32sc

[PATCH] D31538: [analyzer] MisusedMovedObjectChecker: Fix a false positive on state-resetting a base-class sub-object.

2017-03-31 Thread Peter Szecsi via Phabricator via cfe-commits
szepet added inline comments.



Comment at: lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp:426
+
+State = State->remove(WholeObjectRegion);
 C.addTransition(State);

szepet wrote:
> I am wondering if I made a mistake but I think this should be 
> removeFromState() function call. (We should remove every marked subregions of 
> the object too.)
> So I suspect a code like this would result a false positive:
> ```
> struct A{
> B b;
> void clear();
> };
> 
> void test(){
> A a;
> B b = std::move(a.b);
> a.clear();
> b = std::move(a); //report a bug
> }
> ```
> 
> I mean it is probably a report we do not want to have.
Shame on the test file writer that he does not covered this, though. ^^


https://reviews.llvm.org/D31538



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


[libcxx] r299236 - Use strong enums independently of -fobjc-arc

2017-03-31 Thread Duncan P. N. Exon Smith via cfe-commits
Author: dexonsmith
Date: Fri Mar 31 12:39:56 2017
New Revision: 299236

URL: http://llvm.org/viewvc/llvm-project?rev=299236&view=rev
Log:
Use strong enums independently of -fobjc-arc

r145698 introduced _LIBCPP_HAS_NO_STRONG_ENUMS by copy-pasting the
__has_feature check from objc_arc_weak/_LIBCPP_HAS_OBJC_ARC_WEAK, and
accidentally started defining _LIBCPP_HAS_NO_STRONG_ENUMS whenever
__has_feature(objc_arc_weak).  This is totally bogus, and means that
Libc++ thinks Objective-C++ compilations with -fobjc-arc don't have
strong enums.

Delete the accidental line.

I thought about adding a test, but it would be entirely duplicative of
the patch (if has-feature strong enums, check that has-no-strong-enums
is not defined).

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=299236&r1=299235&r2=299236&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Mar 31 12:39:56 2017
@@ -348,7 +348,6 @@ typedef __char32_t char32_t;
 
 #if __has_feature(objc_arc_weak)
 #define _LIBCPP_HAS_OBJC_ARC_WEAK
-#define _LIBCPP_HAS_NO_STRONG_ENUMS
 #endif
 
 #if !(__has_feature(cxx_constexpr))


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


[PATCH] D31544: Add AllowReparse parameter to ASTUnit::Reparse

2017-03-31 Thread Igor Bronshteyn via Phabricator via cfe-commits
ibronstein created this revision.
ibronstein added a project: clang-c.

An idea behind the commit is to have an option (AllowReparse = false)  in 
ASTUnit::Reparse() which will disallow rebuilding the precompiled preamble.


https://reviews.llvm.org/D31544

Files:
  include/clang/Frontend/ASTUnit.h
  lib/Frontend/ASTUnit.cpp


Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -2037,7 +2037,8 @@
 }
 
 bool ASTUnit::Reparse(std::shared_ptr PCHContainerOps,
-  ArrayRef RemappedFiles) {
+  ArrayRef RemappedFiles,
+  bool AllowRebuild) {
   if (!Invocation)
 return true;
 
@@ -2060,9 +2061,12 @@
   // If we have a preamble file lying around, or if we might try to
   // build a precompiled preamble, do so now.
   std::unique_ptr OverrideMainBuffer;
-  if (!getPreambleFile(this).empty() || PreambleRebuildCounter > 0)
+  if (!getPreambleFile(this).empty() || PreambleRebuildCounter > 0) {
 OverrideMainBuffer =
-getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation);
+getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation, 
AllowRebuild);
+if (!AllowRebuild && !OverrideMainBuffer)
+  return false;
+  }
 
   // Clear out the diagnostics state.
   FileMgr.reset();
Index: include/clang/Frontend/ASTUnit.h
===
--- include/clang/Frontend/ASTUnit.h
+++ include/clang/Frontend/ASTUnit.h
@@ -856,7 +856,8 @@
   /// \returns True if a failure occurred that causes the ASTUnit not to
   /// contain any translation-unit information, false otherwise.
   bool Reparse(std::shared_ptr PCHContainerOps,
-   ArrayRef RemappedFiles = None);
+   ArrayRef RemappedFiles = None,
+   bool AllowRebuild = true);
 
   /// \brief Perform code completion at the given file, line, and
   /// column within this translation unit.


Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -2037,7 +2037,8 @@
 }
 
 bool ASTUnit::Reparse(std::shared_ptr PCHContainerOps,
-  ArrayRef RemappedFiles) {
+  ArrayRef RemappedFiles,
+  bool AllowRebuild) {
   if (!Invocation)
 return true;
 
@@ -2060,9 +2061,12 @@
   // If we have a preamble file lying around, or if we might try to
   // build a precompiled preamble, do so now.
   std::unique_ptr OverrideMainBuffer;
-  if (!getPreambleFile(this).empty() || PreambleRebuildCounter > 0)
+  if (!getPreambleFile(this).empty() || PreambleRebuildCounter > 0) {
 OverrideMainBuffer =
-getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation);
+getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation, AllowRebuild);
+if (!AllowRebuild && !OverrideMainBuffer)
+  return false;
+  }
 
   // Clear out the diagnostics state.
   FileMgr.reset();
Index: include/clang/Frontend/ASTUnit.h
===
--- include/clang/Frontend/ASTUnit.h
+++ include/clang/Frontend/ASTUnit.h
@@ -856,7 +856,8 @@
   /// \returns True if a failure occurred that causes the ASTUnit not to
   /// contain any translation-unit information, false otherwise.
   bool Reparse(std::shared_ptr PCHContainerOps,
-   ArrayRef RemappedFiles = None);
+   ArrayRef RemappedFiles = None,
+   bool AllowRebuild = true);
 
   /// \brief Perform code completion at the given file, line, and
   /// column within this translation unit.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31541: [analyzer] MisusedMovedObjectChecker: Add a printState() method.

2017-03-31 Thread Peter Szecsi via Phabricator via cfe-commits
szepet accepted this revision.
szepet added a comment.
This revision is now accepted and ready to land.

LGTM, thank you (again)!


https://reviews.llvm.org/D31541



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


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:674
+  // are the same size.
+  Z3_get_numeral_uint64(Z3Context::ZC, AST,
+reinterpret_cast<__uint64 *>(&Value));

ddcc wrote:
> The only problem I see now is that if a IEEEquad is fed in, it will generate 
> a 128-bit bitvector, which will be truncated at this point. But the z3 API 
> doesn't support retrieving a rational into anything larger than 64-bit, so 
> perhaps converting it to string is the way to go here.
@ddcc I'm heavily against using the string method due to rounding problems it 
might introduce. The trick to handling types wider than 64 bits is to construct 
a new Z3_ast that does an `Z3_mk_extract()` to pull out the bits you want and 
then call `Z3_get_numeral_uint64()` on that. In the case of IEEE-754 quad you 
would need to pull out the lower order bits and then the higher order bits, 
then put these into an array and build an `APInt` from that.


https://reviews.llvm.org/D28952



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


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-31 Thread Dan Liew via Phabricator via cfe-commits
delcypher added inline comments.



Comment at: cmake/modules/FindZ3.cmake:5
+PKG_CHECK_MODULES(PC_Z3 QUIET libz3)
+set(Z3_DEFINITIONS ${PC_LIBZ3_CFLAGS_OTHER})
+

ddcc wrote:
> delcypher wrote:
> > @ddcc This CMake variable is set but never used. Also based on the name it 
> > suggests that they are compiler definitions rather than other compiler 
> > flags. Does `_CFLAGS_OTHER` have those semantics? It's unclear from 
> > https://cmake.org/cmake/help/v3.7/module/FindPkgConfig.html#command:pkg_check_modules
> >  what they are supposed to be.
> > 
> > To consume these flags you could add `target_compile_definitions()` and 
> > `target_compile_options()` to all users of Z3. A more elegant way of doing 
> > this is to create an imported library target (e.g. `z3::libz3`) and set 
> > compile definitions, compile options and include directories on this 
> > imported target with `INTERFACE` visibility so that these usage 
> > requirements implicitly propagate to all users of `z3::libz3`.
> I'm not very familiar with CMake, so I based it off of the FindLibXml2.cmake 
> from the upstream CMake repository. The `pkg-config` part isn't used 
> currently, but I left it in case z3 does get a proper package.
I'm not a huge fan of leaving around dead code. I don't have any intention of 
implementing pkg-config files for Z3 so I think it's unlikely that support will 
ever happen.  So personally I'd rather you removed the pkg-config stuff here.


https://reviews.llvm.org/D28952



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


[PATCH] D31404: [OpenCL] Allow alloca return non-zero private pointer

2017-03-31 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked 3 inline comments as done.
yaxunl added inline comments.



Comment at: lib/AST/ASTContext.cpp:9553
+  // alloca.
+  if (AS == LangAS::Default && LangOpts.OpenCL)
+return getTargetInfo().getDataLayout().getAllocaAddrSpace();

Anastasia wrote:
> yaxunl wrote:
> > Anastasia wrote:
> > > Here it seems that LangAS::Default is indeed opencl_private?
> > For OpenCL, that's true, however LangAS::Default may also be used by other 
> > languages to represent the default address space (i.e. no address space).
> Do we know what the other use cases could be?
It is used in the address space mapping to allow the default address space in 
AST to be mapped to target specified address space for non-OpenCL languages. 
For AMDGPU target, this maps to address space 4 for the non-amdgiz environment.



Comment at: test/Sema/invalid-assignment-constant-address-space.c:4
-#define OPENCL_CONSTANT 8388354
-int __attribute__((address_space(OPENCL_CONSTANT))) c[3] = {0};
 

Anastasia wrote:
> yaxunl wrote:
> > Anastasia wrote:
> > > Is this test even correct? I don't think we can assume that C address 
> > > spaces inherit the same restrictions as OpenCL. Especially that the 
> > > notion of private/local/constant/global is an OpenCL specific thing.
> > > 
> > > I feel like Clang doesn't behave correctly for C address spaces now.
> > > 
> > > As for OpenCL I don't see why would anyone use 
> > > __attribute__((address_space())) for constant AS. Especially that it's 
> > > not part of the spec.
> > I agree. There is no guarantee that in C language a user specified address 
> > space which happens to have the same address space value as OpenCL constant 
> > in AST will have the same semantics as OpenCL constant, because we only 
> > guarantee the semantics in OpenCL. For example, if we add a check for 
> > language for this diagnostic, this test will fail.
> > 
> > A user should not expect the same semantics. Only the target address space 
> > in the generated IR is guaranteed.
> I think we should move this tests into CL and use __constant. Also it would 
> be nice to add LangOpts.OpenCL check to where we give the error.
Will do.


https://reviews.llvm.org/D31404



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


[PATCH] D31534: [ThinLTO] Handle -emit-llvm* in ThinLTO backends

2017-03-31 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added a comment.

Why not call `Module::print()` or `WriteBitcodeToFile` directly instead of 
creating a pass manager?


https://reviews.llvm.org/D31534



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


[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-03-31 Thread Zoltán Gera via Phabricator via cfe-commits
gerazo added inline comments.



Comment at: tools/xtu-analysis/xtu-analyze.py:29
+
+threading_factor = int(multiprocessing.cpu_count() * 1.5)
+analyser_output_formats = ['plist-multi-file', 'plist', 'plist-html',

danielmarjamaki wrote:
> does this mean that if there are 4 cores this script will by default use 6 
> threads? isn't that too aggressive?
Yes, it does mean that. You are right, it is aggressive. To be honest, the 
xtu-build step is more io intensive where it really makes sense. In the 
xtu-analyze step, it is marginal when big files are compiled (more cpu, less 
io).  We will put this one back to 1.0 instead.


https://reviews.llvm.org/D30691



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


[PATCH] D31534: [ThinLTO] Handle -emit-llvm* in ThinLTO backends

2017-03-31 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson updated this revision to Diff 93695.
tejohnson added a comment.

Implement review suggestions


https://reviews.llvm.org/D31534

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/thinlto-emit-llvm.c


Index: test/CodeGen/thinlto-emit-llvm.c
===
--- /dev/null
+++ test/CodeGen/thinlto-emit-llvm.c
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o 
- | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc 
-o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -994,9 +994,30 @@
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  M->print(*OS, nullptr, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  WriteBitcodeToFile(M, *OS, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {


Index: test/CodeGen/thinlto-emit-llvm.c
===
--- /dev/null
+++ test/CodeGen/thinlto-emit-llvm.c
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc -o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -994,9 +994,30 @@
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  M->print(*OS, nullptr, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  WriteBitcodeToFile(M, *OS, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31534: [ThinLTO] Handle -emit-llvm* in ThinLTO backends

2017-03-31 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc accepted this revision.
pcc added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D31534



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


[PATCH] D29654: [OpenMP] Integrate OpenMP target region cubin into host binary

2017-03-31 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: lib/Driver/ToolChains/Cuda.cpp:324
+ "CUDA toolchain not expected for an OpenMP host device.");
+  if (JA.isDeviceOffloading(Action::OFK_OpenMP)) {
+if (Output.isFilename()) {

This entire if block constructs a completely unrelated link line from the rest 
of the function. They should be separate functions. In fact, 
`CudaToolChain::buildLinker()` should probably return a different tool 
depending on whether you're using OpenMP or not, and this logic should be in a 
different tool. Maybe NVPTX::Linker should be called NVPTX::FatLink as well.



Comment at: lib/Driver/ToolChains/Cuda.cpp:388-394
+  const char *CopyExec = Args.MakeArgString(getToolChain().GetProgramPath(
+  C.getDriver().IsCLMode() ? "copy" : "cp"));
+  ArgStringList CopyCmdArgs;
+  CopyCmdArgs.push_back(II.getFilename());
+  CopyCmdArgs.push_back(CubinF);
+  C.addCommand(
+  llvm::make_unique(JA, *this, CopyExec, CopyCmdArgs, 
Inputs));

Hahnfeld wrote:
> Copying files around would be something new in Clang that someone more 
> experienced has to weight. @rnk, @hfinkel?
I don't think `copy` is an actual binary on Windows, it's a builtin cmd 
command. At least, that's what where copy suggests. clang-cl can also run on 
Linux, so you probably want to check `#ifdef LLVM_ON_WIN32` for this.

Honestly, I'd prefer it if you instead found a way to get the driver to rename 
the inputs right before executing nvlink. We have cross-platform utilities in 
Support for doing renames. You can probably make some kind of custom Command to 
do this.



Comment at: test/Driver/openmp-offload.c:594
+/// Check cubin file generation and usage by nvlink
+// RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda 
-save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-CUBIN %s

In this case, it would be nicer if you arranged for ptxas to output to a .cubin 
file.



Comment at: test/Driver/openmp-offload.c:601
+// CHK-CUBIN-NEXT: nvlink" "-o" "{{.*}}-openmp-nvptx64-nvidia-cuda" "{{.*}}" 
"{{.*}}-openmp-nvptx64-nvidia-cuda-{{.*}}.cubin"
+
+/// ###

Can you add a test that links two input ptxas .o files into a binary? You can 
use `touch` to make the .o files.


Repository:
  rL LLVM

https://reviews.llvm.org/D29654



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


Re: [libcxx] r299236 - Use strong enums independently of -fobjc-arc

2017-03-31 Thread Eric Fiselier via cfe-commits
This will be ABI breaking for Objective-C++ users. I'm not objecting to
fixing the bogus configuration, but I just wanted to point it out.

/Eric

On Fri, Mar 31, 2017 at 11:39 AM, Duncan P. N. Exon Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: dexonsmith
> Date: Fri Mar 31 12:39:56 2017
> New Revision: 299236
>
> URL: http://llvm.org/viewvc/llvm-project?rev=299236&view=rev
> Log:
> Use strong enums independently of -fobjc-arc
>
> r145698 introduced _LIBCPP_HAS_NO_STRONG_ENUMS by copy-pasting the
> __has_feature check from objc_arc_weak/_LIBCPP_HAS_OBJC_ARC_WEAK, and
> accidentally started defining _LIBCPP_HAS_NO_STRONG_ENUMS whenever
> __has_feature(objc_arc_weak).  This is totally bogus, and means that
> Libc++ thinks Objective-C++ compilations with -fobjc-arc don't have
> strong enums.
>
> Delete the accidental line.
>
> I thought about adding a test, but it would be entirely duplicative of
> the patch (if has-feature strong enums, check that has-no-strong-enums
> is not defined).
>
> Modified:
> libcxx/trunk/include/__config
>
> Modified: libcxx/trunk/include/__config
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_
> _config?rev=299236&r1=299235&r2=299236&view=diff
> 
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Fri Mar 31 12:39:56 2017
> @@ -348,7 +348,6 @@ typedef __char32_t char32_t;
>
>  #if __has_feature(objc_arc_weak)
>  #define _LIBCPP_HAS_OBJC_ARC_WEAK
> -#define _LIBCPP_HAS_NO_STRONG_ENUMS
>  #endif
>
>  #if !(__has_feature(cxx_constexpr))
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31513: [Sema] Add __is_aggregate type-trait and implement LWG 2015

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93709.
EricWF added a comment.

- Update the doc to reflect that GCC has implemented this trait (and to assume 
MS will as well).
- Rewrite the tests using static_assert over god-awful old style array asserts.


https://reviews.llvm.org/D31513

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/TokenKinds.def
  include/clang/Basic/TypeTraits.h
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  test/PCH/cxx-traits.cpp
  test/PCH/cxx-traits.h
  test/SemaCXX/type-traits.cpp

Index: test/SemaCXX/type-traits.cpp
===
--- test/SemaCXX/type-traits.cpp
+++ test/SemaCXX/type-traits.cpp
@@ -1,4 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++11 -fms-extensions -Wno-microsoft %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++14 -fms-extensions -Wno-microsoft %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++1z -fms-extensions -Wno-microsoft %s
+
 #define T(b) (b) ? 1 : -1
 #define F(b) (b) ? -1 : 1
 
@@ -9,12 +12,14 @@
 struct POD { Enum e; int i; float f; NonPOD* p; };
 struct Empty {};
 typedef Empty EmptyAr[10];
+typedef Empty EmptyArNB[];
+typedef Empty EmptyArMB[1][2];
 typedef int Int;
 typedef Int IntAr[10];
 typedef Int IntArNB[];
 class Statics { static int priv; static NonPOD np; };
 union EmptyUnion {};
-union IncompleteUnion;
+union IncompleteUnion; // expected-note {{forward declaration of 'IncompleteUnion'}}
 union Union { int i; float f; };
 struct HasFunc { void f (); };
 struct HasOp { void operator *(); };
@@ -38,6 +43,10 @@
 typedef Derives DerivesArNB[];
 struct DerivesEmpty : Empty {};
 struct HasCons { HasCons(int); };
+struct HasDefaultCons { HasDefaultCons() = default; };
+struct HasExplicitDefaultCons { explicit HasExplicitDefaultCons() = default; };
+struct HasInheritedCons : HasDefaultCons { using HasDefaultCons::HasDefaultCons; };
+struct HasNoInheritedCons : HasCons {};
 struct HasCopyAssign { HasCopyAssign operator =(const HasCopyAssign&); };
 struct HasMoveAssign { HasMoveAssign operator =(const HasMoveAssign&&); };
 struct HasNoThrowMoveAssign { 
@@ -48,8 +57,15 @@
 const HasNoExceptNoThrowMoveAssign&&) noexcept; 
 };
 struct HasThrowMoveAssign { 
-  HasThrowMoveAssign& operator=(
-const HasThrowMoveAssign&&) throw(POD); };
+  HasThrowMoveAssign& operator=(const HasThrowMoveAssign&&)
+#if __cplusplus <= 201402L
+  throw(POD);
+#else
+  noexcept(false);
+#endif
+};
+
+
 struct HasNoExceptFalseMoveAssign { 
   HasNoExceptFalseMoveAssign& operator=(
 const HasNoExceptFalseMoveAssign&&) noexcept(false); };
@@ -81,6 +97,7 @@
 class  HasPriv { int priv; };
 class  HasProt { protected: int prot; };
 struct HasRef { int i; int& ref; HasRef() : i(0), ref(i) {} };
+struct HasRefAggregate { int i; int& ref; };
 struct HasNonPOD { NonPOD np; };
 struct HasVirt { virtual void Virt() {}; };
 typedef NonPOD NonPODAr[10];
@@ -152,7 +169,12 @@
 };
 
 struct ThrowingDtor {
-  ~ThrowingDtor() throw(int);
+  ~ThrowingDtor()
+#if __cplusplus <= 201402L
+  throw(int);
+#else
+  noexcept(false);
+#endif
 };
 
 struct NoExceptDtor {
@@ -163,6 +185,20 @@
   ~NoThrowDtor() throw();
 };
 
+struct ACompleteType {};
+struct AnIncompleteType; // expected-note 4 {{forward declaration of 'AnIncompleteType'}}
+typedef AnIncompleteType AnIncompleteTypeAr[42];
+typedef AnIncompleteType AnIncompleteTypeArNB[];
+typedef AnIncompleteType AnIncompleteTypeArMB[1][10];
+
+struct HasInClassInit {
+  int x = 42;
+};
+
+struct HasPrivateBase : private ACompleteType {};
+struct HasProtectedBase : protected ACompleteType {};
+struct HasVirtBase : virtual ACompleteType {};
+
 void is_pod()
 {
   { int arr[T(__is_pod(int))]; }
@@ -452,6 +488,71 @@
   int t31[F(__is_floating_point(IntArNB))];
 }
 
+template 
+struct AggregateTemplate {
+  T value;
+};
+
+template 
+struct NonAggregateTemplate {
+  T value;
+  NonAggregateTemplate();
+};
+
+void is_aggregate()
+{
+  constexpr bool TrueAfterCpp11 = __cplusplus > 201103L;
+  constexpr bool TrueAfterCpp14 = __cplusplus > 201402L;
+
+  static_assert(!__is_aggregate(NonPOD), "");
+  static_assert(!__is_aggregate(Enum), "");
+  static_assert(__is_aggregate(POD), "");
+  static_assert(__is_aggregate(Empty), "");
+  static_assert(__is_aggregate(EmptyAr), "");
+  static_assert(__is_aggregate(EmptyArNB), "");
+  static_assert(__is_aggregate(EmptyArMB), "");
+  static_assert(!__is_aggregate(AnIncompleteType), ""); // expected-error {{incomplete type 'AnIncompleteType' used in type trait expression}}
+  static_assert(!__is_aggregate(AnIncompleteTypeAr), ""); // expected-error {{incomplete type 'AnIncompleteType' used in type trait expression}}
+  static_assert(!__is_aggregate(AnIncompleteTypeArNB), ""); // expected-error {{incomplete type 'AnIncompleteType' used in type trait expression}}
+  static_assert(!__is_aggregate(AnIncompleteTyp

[PATCH] D31406: [clang-tidy] Reuse FileID in getLocation

2017-03-31 Thread Chih-Hung Hsieh via Phabricator via cfe-commits
chh reopened this revision.
chh added a comment.
This revision is now accepted and ready to land.

This was reverted due to one failed test case clang-tidy/llvm-include-order.cpp 
on Windows:

Assertion failed: EndColNo <= map.getSourceLine().size() && "Invalid range!", 
file 
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\lib\Frontend\TextDiagnostic.cpp,
 line 999


Repository:
  rL LLVM

https://reviews.llvm.org/D31406



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


Re: [libcxx] r299236 - Use strong enums independently of -fobjc-arc

2017-03-31 Thread Duncan P. N. Exon Smith via cfe-commits
Thanks.  Unfortunately that's one of the ways we figured it out :(.

The status quo, before this commit, was an ABI difference between Objective-C++ 
(-fobjc-arc) and C++/Objective-C++ (-fno-objc-arc), which is... really bad.  
But rare enough I guess it took a couple of years to find.

I suspect/hope the break from this commit will be even more rare in practice, 
since it's somewhat odd to vend Objective-C++ APIs.  Usually the 
(Objective-)C++ parts are implementation details beneath a pure Objective-C 
API, and if you recompile one TU you'll recompile the rest.

Since you brought up the ABI difference... there's still at least one lurking: 
C++98/C++03 vs. C++11 are ABI-incompatible for things like std::cv_status.  I'm 
not sure how (or whether we should bother) to fix that; it's a little strange 
that we expose strong enums to pre-C++11 at all.

> On Mar 31, 2017, at 13:37, Eric Fiselier  wrote:
> 
> This will be ABI breaking for Objective-C++ users. I'm not objecting to 
> fixing the bogus configuration, but I just wanted to point it out.
> 
> /Eric
> 
> On Fri, Mar 31, 2017 at 11:39 AM, Duncan P. N. Exon Smith via cfe-commits 
> mailto:cfe-commits@lists.llvm.org>> wrote:
> Author: dexonsmith
> Date: Fri Mar 31 12:39:56 2017
> New Revision: 299236
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=299236&view=rev 
> 
> Log:
> Use strong enums independently of -fobjc-arc
> 
> r145698 introduced _LIBCPP_HAS_NO_STRONG_ENUMS by copy-pasting the
> __has_feature check from objc_arc_weak/_LIBCPP_HAS_OBJC_ARC_WEAK, and
> accidentally started defining _LIBCPP_HAS_NO_STRONG_ENUMS whenever
> __has_feature(objc_arc_weak).  This is totally bogus, and means that
> Libc++ thinks Objective-C++ compilations with -fobjc-arc don't have
> strong enums.
> 
> Delete the accidental line.
> 
> I thought about adding a test, but it would be entirely duplicative of
> the patch (if has-feature strong enums, check that has-no-strong-enums
> is not defined).
> 
> Modified:
> libcxx/trunk/include/__config
> 
> Modified: libcxx/trunk/include/__config
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=299236&r1=299235&r2=299236&view=diff
>  
> 
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Fri Mar 31 12:39:56 2017
> @@ -348,7 +348,6 @@ typedef __char32_t char32_t;
> 
>  #if __has_feature(objc_arc_weak)
>  #define _LIBCPP_HAS_OBJC_ARC_WEAK
> -#define _LIBCPP_HAS_NO_STRONG_ENUMS
>  #endif
> 
>  #if !(__has_feature(cxx_constexpr))
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits 
> 
> 

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


[PATCH] D31513: [Sema] Add __is_aggregate type-trait and implement LWG 2015

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93715.
EricWF added a comment.

- Correctly report array types as aggregates. (Woops!)

- Also report vector types as aggregates. This behavior mirrors GCC.

- report _Complex int and _Complex float as aggregates as well. Currently GCC 
does not have this behavior, but since they support aggregate initialization I 
think it makes sense to support them as aggregates.


https://reviews.llvm.org/D31513

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/TokenKinds.def
  include/clang/Basic/TypeTraits.h
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  test/PCH/cxx-traits.cpp
  test/PCH/cxx-traits.h
  test/SemaCXX/type-traits.cpp

Index: test/SemaCXX/type-traits.cpp
===
--- test/SemaCXX/type-traits.cpp
+++ test/SemaCXX/type-traits.cpp
@@ -1,20 +1,28 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++11 -fms-extensions -Wno-microsoft %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++14 -fms-extensions -Wno-microsoft %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++1z -fms-extensions -Wno-microsoft %s
+
 #define T(b) (b) ? 1 : -1
 #define F(b) (b) ? -1 : 1
 
 struct NonPOD { NonPOD(int); };
+typedef NonPOD NonPODAr[10];
+typedef NonPOD NonPODArNB[];
+typedef NonPOD NonPODArMB[10][2];
 
 // PODs
 enum Enum { EV };
 struct POD { Enum e; int i; float f; NonPOD* p; };
 struct Empty {};
 typedef Empty EmptyAr[10];
+typedef Empty EmptyArNB[];
+typedef Empty EmptyArMB[1][2];
 typedef int Int;
 typedef Int IntAr[10];
 typedef Int IntArNB[];
 class Statics { static int priv; static NonPOD np; };
 union EmptyUnion {};
-union IncompleteUnion;
+union IncompleteUnion; // expected-note {{forward declaration of 'IncompleteUnion'}}
 union Union { int i; float f; };
 struct HasFunc { void f (); };
 struct HasOp { void operator *(); };
@@ -31,13 +39,20 @@
 typedef int Vector __attribute__((vector_size(16)));
 typedef int VectorExt __attribute__((ext_vector_type(4)));
 
+using ComplexFloat = _Complex float;
+using ComplexInt = _Complex int;
+
 // Not PODs
 typedef const void cvoid;
 struct Derives : POD {};
 typedef Derives DerivesAr[10];
 typedef Derives DerivesArNB[];
 struct DerivesEmpty : Empty {};
 struct HasCons { HasCons(int); };
+struct HasDefaultCons { HasDefaultCons() = default; };
+struct HasExplicitDefaultCons { explicit HasExplicitDefaultCons() = default; };
+struct HasInheritedCons : HasDefaultCons { using HasDefaultCons::HasDefaultCons; };
+struct HasNoInheritedCons : HasCons {};
 struct HasCopyAssign { HasCopyAssign operator =(const HasCopyAssign&); };
 struct HasMoveAssign { HasMoveAssign operator =(const HasMoveAssign&&); };
 struct HasNoThrowMoveAssign { 
@@ -48,8 +63,15 @@
 const HasNoExceptNoThrowMoveAssign&&) noexcept; 
 };
 struct HasThrowMoveAssign { 
-  HasThrowMoveAssign& operator=(
-const HasThrowMoveAssign&&) throw(POD); };
+  HasThrowMoveAssign& operator=(const HasThrowMoveAssign&&)
+#if __cplusplus <= 201402L
+  throw(POD);
+#else
+  noexcept(false);
+#endif
+};
+
+
 struct HasNoExceptFalseMoveAssign { 
   HasNoExceptFalseMoveAssign& operator=(
 const HasNoExceptFalseMoveAssign&&) noexcept(false); };
@@ -81,6 +103,7 @@
 class  HasPriv { int priv; };
 class  HasProt { protected: int prot; };
 struct HasRef { int i; int& ref; HasRef() : i(0), ref(i) {} };
+struct HasRefAggregate { int i; int& ref; };
 struct HasNonPOD { NonPOD np; };
 struct HasVirt { virtual void Virt() {}; };
 typedef NonPOD NonPODAr[10];
@@ -152,7 +175,12 @@
 };
 
 struct ThrowingDtor {
-  ~ThrowingDtor() throw(int);
+  ~ThrowingDtor()
+#if __cplusplus <= 201402L
+  throw(int);
+#else
+  noexcept(false);
+#endif
 };
 
 struct NoExceptDtor {
@@ -163,6 +191,20 @@
   ~NoThrowDtor() throw();
 };
 
+struct ACompleteType {};
+struct AnIncompleteType; // expected-note 4 {{forward declaration of 'AnIncompleteType'}}
+typedef AnIncompleteType AnIncompleteTypeAr[42];
+typedef AnIncompleteType AnIncompleteTypeArNB[];
+typedef AnIncompleteType AnIncompleteTypeArMB[1][10];
+
+struct HasInClassInit {
+  int x = 42;
+};
+
+struct HasPrivateBase : private ACompleteType {};
+struct HasProtectedBase : protected ACompleteType {};
+struct HasVirtBase : virtual ACompleteType {};
+
 void is_pod()
 {
   { int arr[T(__is_pod(int))]; }
@@ -452,6 +494,82 @@
   int t31[F(__is_floating_point(IntArNB))];
 }
 
+template 
+struct AggregateTemplate {
+  T value;
+};
+
+template 
+struct NonAggregateTemplate {
+  T value;
+  NonAggregateTemplate();
+};
+
+void is_aggregate()
+{
+  constexpr bool TrueAfterCpp11 = __cplusplus > 201103L;
+  constexpr bool TrueAfterCpp14 = __cplusplus > 201402L;
+
+  static_assert(!__is_aggregate(NonPOD), "");
+  static_assert(__is_aggregate(NonPODAr), "");
+  static_assert(__is_aggregate(NonPODArNB), "");
+  static_assert(__is_aggregate(NonPODArMB), "");
+
+  static_assert(!__is_a

r299269 - Add/update PIE defaults for OpenBSD.

2017-03-31 Thread Brad Smith via cfe-commits
Author: brad
Date: Fri Mar 31 17:13:17 2017
New Revision: 299269

URL: http://llvm.org/viewvc/llvm-project?rev=299269&view=rev
Log:
Add/update PIE defaults for OpenBSD.

Modified:
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/test/Driver/pic.c

Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=299269&r1=299268&r2=299269&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Fri Mar 31 17:13:17 2017
@@ -737,9 +737,10 @@ tools::ParsePICArgs(const ToolChain &Too
   // OpenBSD-specific defaults for PIE
   if (Triple.getOS() == llvm::Triple::OpenBSD) {
 switch (ToolChain.getArch()) {
+case llvm::Triple::arm:
+case llvm::Triple::aarch64:
 case llvm::Triple::mips64:
 case llvm::Triple::mips64el:
-case llvm::Triple::sparcel:
 case llvm::Triple::x86:
 case llvm::Triple::x86_64:
   IsPICLevelTwo = false; // "-fpie"
@@ -747,6 +748,7 @@ tools::ParsePICArgs(const ToolChain &Too
 
 case llvm::Triple::ppc:
 case llvm::Triple::sparc:
+case llvm::Triple::sparcel:
 case llvm::Triple::sparcv9:
   IsPICLevelTwo = true; // "-fPIE"
   break;

Modified: cfe/trunk/test/Driver/pic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/pic.c?rev=299269&r1=299268&r2=299269&view=diff
==
--- cfe/trunk/test/Driver/pic.c (original)
+++ cfe/trunk/test/Driver/pic.c Fri Mar 31 17:13:17 2017
@@ -227,6 +227,10 @@
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
 // RUN: %clang -c %s -target i386-pc-openbsd -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
+// RUN: %clang -c %s -target aarch64-unknown-openbsd -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
+// RUN: %clang -c %s -target arm-unknown-openbsd -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
 // RUN: %clang -c %s -target mips64-unknown-openbsd -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
 // RUN: %clang -c %s -target mips64el-unknown-openbsd -### 2>&1 \


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


Re: [libcxx] r299236 - Use strong enums independently of -fobjc-arc

2017-03-31 Thread Eric Fiselier via cfe-commits
On Fri, Mar 31, 2017 at 4:17 PM, Duncan P. N. Exon Smith <
dexonsm...@apple.com> wrote:

> Thanks.  Unfortunately that's one of the ways we figured it out :(.
>
> The status quo, before this commit, was an ABI difference between
> Objective-C++ (-fobjc-arc) and C++/Objective-C++ (-fno-objc-arc), which
> is... really bad.  But rare enough I guess it took a couple of years to
> find.
>
> I suspect/hope the break from this commit will be even more rare in
> practice, since it's somewhat odd to vend Objective-C++ APIs.  Usually the
> (Objective-)C++ parts are implementation details beneath a pure Objective-C
> API, and if you recompile one TU you'll recompile the rest.
>
> Since you brought up the ABI difference... there's still at least one
> lurking: C++98/C++03 vs. C++11 are ABI-incompatible for things like
> std::cv_status.  I'm not sure how (or whether we should bother) to fix
> that; it's a little strange that we expose strong enums to pre-C++11 at all.
>

Libc++ exposes almost all of the C++11 library pre-C++11, so that's why
cv_status has a C++03 compatible definitions. And Unfortunatly using
unscoped enumerations as a fallback won't work, even though they would be
ABI compatible.

The much more egregious C++03 vs C++11 ABI incompatibility is `nullptr`. In
C++03 libc++ emulates nullptr_t using a class type and then #define's
nullptr. This is obviously ABI incompatible with C++11s version.
Thankfully Clang provides an alternative keyword, __nullptr, in C++03,
which I've used to implement a fix in ABI v2 or by
defining _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR.

If Apple is concerned about these sorts of ABI incompatibilities you should
consider cherry picking _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR in the next
release.

/Eric



> On Mar 31, 2017, at 13:37, Eric Fiselier  wrote:
>
> This will be ABI breaking for Objective-C++ users. I'm not objecting to
> fixing the bogus configuration, but I just wanted to point it out.
>
> /Eric
>
> On Fri, Mar 31, 2017 at 11:39 AM, Duncan P. N. Exon Smith via cfe-commits
>  wrote:
>
>> Author: dexonsmith
>> Date: Fri Mar 31 12:39:56 2017
>> New Revision: 299236
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=299236&view=rev
>> Log:
>> Use strong enums independently of -fobjc-arc
>>
>> r145698 introduced _LIBCPP_HAS_NO_STRONG_ENUMS by copy-pasting the
>> __has_feature check from objc_arc_weak/_LIBCPP_HAS_OBJC_ARC_WEAK, and
>> accidentally started defining _LIBCPP_HAS_NO_STRONG_ENUMS whenever
>> __has_feature(objc_arc_weak).  This is totally bogus, and means that
>> Libc++ thinks Objective-C++ compilations with -fobjc-arc don't have
>> strong enums.
>>
>> Delete the accidental line.
>>
>> I thought about adding a test, but it would be entirely duplicative of
>> the patch (if has-feature strong enums, check that has-no-strong-enums
>> is not defined).
>>
>> Modified:
>> libcxx/trunk/include/__config
>>
>> Modified: libcxx/trunk/include/__config
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__
>> config?rev=299236&r1=299235&r2=299236&view=diff
>> 
>> ==
>> --- libcxx/trunk/include/__config (original)
>> +++ libcxx/trunk/include/__config Fri Mar 31 12:39:56 2017
>> @@ -348,7 +348,6 @@ typedef __char32_t char32_t;
>>
>>  #if __has_feature(objc_arc_weak)
>>  #define _LIBCPP_HAS_OBJC_ARC_WEAK
>> -#define _LIBCPP_HAS_NO_STRONG_ENUMS
>>  #endif
>>
>>  #if !(__has_feature(cxx_constexpr))
>>
>>
>> ___
>> 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


r299274 - [ThinLTO] Handle -emit-llvm* in ThinLTO backends

2017-03-31 Thread Teresa Johnson via cfe-commits
Author: tejohnson
Date: Fri Mar 31 17:35:47 2017
New Revision: 299274

URL: http://llvm.org/viewvc/llvm-project?rev=299274&view=rev
Log:
[ThinLTO] Handle -emit-llvm* in ThinLTO backends

Summary:
Use PreCodeGenModuleHook to invoke the correct writer when emitting LLVM
IR, returning false to skip codegen from within thinBackend.

Reviewers: pcc, mehdi_amini

Subscribers: Prazek, cfe-commits

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

Added:
cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=299274&r1=299273&r2=299274&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Mar 31 17:35:47 2017
@@ -994,9 +994,30 @@ static void runThinLTOBackend(ModuleSumm
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  M->print(*OS, nullptr, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  WriteBitcodeToFile(M, *OS, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {

Added: cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-emit-llvm.c?rev=299274&view=auto
==
--- cfe/trunk/test/CodeGen/thinlto-emit-llvm.c (added)
+++ cfe/trunk/test/CodeGen/thinlto-emit-llvm.c Fri Mar 31 17:35:47 2017
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o 
- | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc 
-o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}


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


[PATCH] D31534: [ThinLTO] Handle -emit-llvm* in ThinLTO backends

2017-03-31 Thread Teresa Johnson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299274: [ThinLTO] Handle -emit-llvm* in ThinLTO backends 
(authored by tejohnson).

Changed prior to commit:
  https://reviews.llvm.org/D31534?vs=93695&id=93722#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31534

Files:
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/test/CodeGen/thinlto-emit-llvm.c


Index: cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
===
--- cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
+++ cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o 
- | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc 
-o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}
Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -994,9 +994,30 @@
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  M->print(*OS, nullptr, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  WriteBitcodeToFile(M, *OS, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {


Index: cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
===
--- cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
+++ cfe/trunk/test/CodeGen/thinlto-emit-llvm.c
@@ -0,0 +1,10 @@
+// Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
+// ThinLTO backend path.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -O2 -x ir %t.o -fthinlto-index=%t.thinlto.bc -emit-llvm-bc -o - | llvm-dis -o - | FileCheck %s
+
+// CHECK: define void @foo()
+void foo() {
+}
Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -994,9 +994,30 @@
   Conf.MAttrs = TOpts.Features;
   Conf.RelocModel = getRelocModel(CGOpts);
   Conf.CGOptLevel = getCGOptLevel(CGOpts);
-  Conf.CGFileType = getCodeGenFileType(Action);
   initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
   Conf.SampleProfile = std::move(SampleProfile);
+  switch (Action) {
+  case Backend_EmitNothing:
+Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
+  return false;
+};
+break;
+  case Backend_EmitLL:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  M->print(*OS, nullptr, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  case Backend_EmitBC:
+Conf.PreCodeGenModuleHook = [&](size_t Task, const Module &Mod) {
+  WriteBitcodeToFile(M, *OS, CGOpts.EmitLLVMUseLists);
+  return false;
+};
+break;
+  default:
+Conf.CGFileType = getCodeGenFileType(Action);
+break;
+  }
   if (Error E = thinBackend(
   Conf, 0, AddStream, *M, *CombinedIndex, ImportList,
   ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30435: [clang-import-test] Lookup inside entities

2017-03-31 Thread Sean Callanan via Phabricator via cfe-commits
spyffe updated this revision to Diff 93721.
spyffe added a comment.

• Removed namespace qualification of `cast` across the board.
• Standardized on `SmallVector`
• Factored out the filtering of forward declarations
• Fixed a loop as requested.
• Made a Origin<> wrapper for arbitrary AST objects that makes it clear where 
they live, so importation and searching gets a little clearer.


Repository:
  rL LLVM

https://reviews.llvm.org/D30435

Files:
  test/Import/forward-declared-struct/Inputs/S1.c
  test/Import/forward-declared-struct/Inputs/S2.c
  test/Import/forward-declared-struct/test.c
  test/Import/member-in-struct/Inputs/S.c
  test/Import/member-in-struct/test.c
  test/Import/multiple-forward-declarations/Inputs/S1.c
  test/Import/multiple-forward-declarations/Inputs/S2.c
  test/Import/multiple-forward-declarations/test.c
  test/Import/overloaded-function/Inputs/F1.c
  test/Import/overloaded-function/Inputs/F2.c
  test/Import/overloaded-function/test.c
  test/Import/struct-in-namespace/Inputs/N1.cpp
  test/Import/struct-in-namespace/Inputs/N2.cpp
  test/Import/struct-in-namespace/Inputs/N3.cpp
  test/Import/struct-in-namespace/test.cpp
  test/Import/template-specialization/Inputs/T.cpp
  test/Import/template-specialization/test.cpp
  tools/clang-import-test/clang-import-test.cpp

Index: tools/clang-import-test/clang-import-test.cpp
===
--- tools/clang-import-test/clang-import-test.cpp
+++ tools/clang-import-test/clang-import-test.cpp
@@ -9,6 +9,7 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTImporter.h"
+#include "clang/AST/DeclObjC.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/SourceLocation.h"
@@ -189,19 +190,90 @@
 } // end namespace
 
 namespace {
+
+template  struct Source {
+  T t;
+  Source(T &&t) : t(std::move(t)) {}
+  operator T() { return t; }
+  template  U &get() { return t; }
+  template  const U &get() const { return t; }
+  template  operator Source() { return Source(t); }
+};
+
+typedef std::pair, ASTImporter *> Candidate;
+
+class TestASTImporter : public ASTImporter {
+public:
+  TestASTImporter(ASTContext &ToContext, FileManager &ToFileManager,
+  ASTContext &FromContext, FileManager &FromFileManager,
+  bool MinimalImport)
+  : ASTImporter(ToContext, ToFileManager, FromContext, FromFileManager,
+MinimalImport) {}
+  Decl *Imported(Decl *From, Decl *To) override {
+if (auto ToTag = dyn_cast(To)) {
+  ToTag->setHasExternalLexicalStorage();
+} else if (auto ToNamespace = dyn_cast(To)) {
+  ToNamespace->setHasExternalVisibleStorage();
+}
+return ASTImporter::Imported(From, To);
+  }
+};
+
+Source
+LookupSameContext(Source SourceTU, const DeclContext *DC,
+  ASTImporter &ReverseImporter) {
+  if (DC->isTranslationUnit()) {
+return SourceTU;
+  }
+  Source SourceParentDC =
+  LookupSameContext(SourceTU, DC->getParent(), ReverseImporter);
+  if (!SourceParentDC) {
+// If we couldn't find the parent DC in this TranslationUnit, give up.
+return nullptr;
+  }
+  auto ND = cast(DC);
+  DeclarationName Name = ND->getDeclName();
+  Source SourceName = ReverseImporter.Import(Name);
+  DeclContext::lookup_result SearchResult =
+  SourceParentDC.get()->lookup(SourceName.get());
+  size_t SearchResultSize = SearchResult.size();
+  // Handle multiple candidates once we have a test for it.
+  // This may turn up when we import template specializations correctly.
+  assert(SearchResultSize < 2);
+  if (SearchResultSize == 0) {
+// couldn't find the name, so we have to give up
+return nullptr;
+  } else {
+NamedDecl *SearchResultDecl = SearchResult[0];
+return dyn_cast(SearchResultDecl);
+  }
+}
+
+bool IsForwardDeclaration(Decl *D) {
+  assert(!isa(D)); // TODO handle this case
+  if (auto TD = dyn_cast(D)) {
+return !TD->isThisDeclarationADefinition();
+  } else if (auto FD = dyn_cast(D)) {
+return !FD->isThisDeclarationADefinition();
+  } else {
+return false;
+  }
+}
+
 class TestExternalASTSource : public ExternalASTSource {
 private:
   llvm::ArrayRef> ImportCIs;
-  std::map> ForwardImporters;
+  std::map>
+  ForwardImporters;
   std::map> ReverseImporters;
 
 public:
   TestExternalASTSource(
   CompilerInstance &ExpressionCI,
   llvm::ArrayRef> ImportCIs)
   : ImportCIs(ImportCIs) {
 for (const std::unique_ptr &ImportCI : ImportCIs) {
-  ForwardImporters[ImportCI.get()] = llvm::make_unique(
+  ForwardImporters[ImportCI.get()] = llvm::make_unique(
   ExpressionCI.getASTContext(), ExpressionCI.getFileManager(),
   ImportCI->getASTContext(), ImportCI->getFileManager(),
   /*MinimalImport=*/true);
@@ -212,29 +284,93 @@
 }
   }
 
+  void
+  ForEachMatchingDC(const DeclContext *DC,
+std::function SourceDC)>
+Callback) {
+ 

r299281 - [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

2017-03-31 Thread Gor Nishanov via cfe-commits
Author: gornishanov
Date: Fri Mar 31 19:22:47 2017
New Revision: 299281

URL: http://llvm.org/viewvc/llvm-project?rev=299281&view=rev
Log:
[coroutines] Add cleanup for compiler injected objects/allocations in coroutine 
body

Summary:
* Use pushCleanup to emit freeing coroutine memory on normal and EH exits.
* Surround emitted code with CodeGenFunction::RunCleanupsScope.

Reviewers: rsmith, rnk, EricWF

Reviewed By: rnk

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCoroutine.cpp
cfe/trunk/test/CodeGenCoroutines/coro-return.cpp

Modified: cfe/trunk/lib/CodeGen/CGCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCoroutine.cpp?rev=299281&r1=299280&r2=299281&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCoroutine.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCoroutine.cpp Fri Mar 31 19:22:47 2017
@@ -215,6 +215,24 @@ void CodeGenFunction::EmitCoreturnStmt(C
   EmitBranchThroughCleanup(CurCoro.Data->FinalJD);
 }
 
+namespace {
+// Make sure to call coro.delete on scope exit.
+struct CallCoroDelete final : public EHScopeStack::Cleanup {
+  Stmt *Deallocate;
+
+  // TODO: Wrap deallocate in if(coro.free(...)) Deallocate.
+  void Emit(CodeGenFunction &CGF, Flags) override {
+// Note: That deallocation will be emitted twice: once for a normal exit 
and
+// once for exceptional exit. This usage is safe because Deallocate does 
not
+// contain any declarations. The SubStmtBuilder::makeNewAndDeleteExpr()
+// builds a single call to a deallocation function which is safe to emit
+// multiple times.
+CGF.EmitStmt(Deallocate);
+  }
+  explicit CallCoroDelete(Stmt *DeallocStmt) : Deallocate(DeallocStmt) {}
+};
+}
+
 void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) {
   auto *NullPtr = llvm::ConstantPointerNull::get(Builder.getInt8PtrTy());
   auto &TI = CGM.getContext().getTargetInfo();
@@ -248,26 +266,28 @@ void CodeGenFunction::EmitCoroutineBody(
 EmitBlock(InitBB);
   }
 
-  // FIXME: Setup cleanup scopes.
-
-  EmitStmt(S.getPromiseDeclStmt());
-
   CurCoro.Data->CleanupJD = getJumpDestInCurrentScope(RetBB);
-  CurCoro.Data->FinalJD = getJumpDestInCurrentScope(FinalBB);
-
-  // FIXME: Emit initial suspend and more before the body.
-
-  CurCoro.Data->CurrentAwaitKind = AwaitKind::Normal;
-  EmitStmt(S.getBody());
-
-  // See if we need to generate final suspend.
-  const bool CanFallthrough = Builder.GetInsertBlock();
-  const bool HasCoreturns = CurCoro.Data->CoreturnCount > 0;
-  if (CanFallthrough || HasCoreturns) {
-EmitBlock(FinalBB);
-// FIXME: Emit final suspend.
+  {
+CodeGenFunction::RunCleanupsScope ResumeScope(*this);
+EHStack.pushCleanup(NormalAndEHCleanup, S.getDeallocate());
+
+EmitStmt(S.getPromiseDeclStmt());
+
+CurCoro.Data->FinalJD = getJumpDestInCurrentScope(FinalBB);
+
+// FIXME: Emit initial suspend and more before the body.
+
+CurCoro.Data->CurrentAwaitKind = AwaitKind::Normal;
+EmitStmt(S.getBody());
+
+// See if we need to generate final suspend.
+const bool CanFallthrough = Builder.GetInsertBlock();
+const bool HasCoreturns = CurCoro.Data->CoreturnCount > 0;
+if (CanFallthrough || HasCoreturns) {
+  EmitBlock(FinalBB);
+  // FIXME: Emit final suspend.
+}
   }
-  EmitStmt(S.getDeallocate());
 
   EmitBlock(RetBB);
 

Added: cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp?rev=299281&view=auto
==
--- cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp (added)
+++ cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp Fri Mar 31 19:22:47 2017
@@ -0,0 +1,74 @@
+// Verify that coroutine promise and allocated memory are freed up on 
exception.
+// RUN: %clang_cc1 -std=c++1z -fcoroutines-ts -triple=x86_64-unknown-linux-gnu 
-emit-llvm -o - %s -fexceptions -fcxx-exceptions -disable-llvm-passes | 
FileCheck %s
+
+namespace std::experimental {
+template  struct coroutine_traits;
+
+template  struct coroutine_handle {
+  coroutine_handle() = default;
+  static coroutine_handle from_address(void *) { return {}; }
+};
+template <> struct coroutine_handle {
+  static coroutine_handle from_address(void *) { return {}; }
+  coroutine_handle() = default;
+  template 
+  coroutine_handle(coroutine_handle) {}
+};
+}
+
+struct suspend_always {
+  bool await_ready();
+  void await_suspend(std::experimental::coroutine_handle<>);
+  void await_resume();
+};
+
+template <> struct std::experimental::coroutine_traits {
+  struct promise_type {
+void get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+void return_void();
+promise_type();
+~promise_type();
+

[PATCH] D31460: [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

2017-03-31 Thread Gor Nishanov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299281: [coroutines] Add cleanup for compiler injected 
objects/allocations in coroutine… (authored by GorNishanov).

Changed prior to commit:
  https://reviews.llvm.org/D31460?vs=93370&id=93728#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31460

Files:
  cfe/trunk/lib/CodeGen/CGCoroutine.cpp
  cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp
  cfe/trunk/test/CodeGenCoroutines/coro-return.cpp

Index: cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp
===
--- cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp
+++ cfe/trunk/test/CodeGenCoroutines/coro-cleanup.cpp
@@ -0,0 +1,74 @@
+// Verify that coroutine promise and allocated memory are freed up on exception.
+// RUN: %clang_cc1 -std=c++1z -fcoroutines-ts -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s -fexceptions -fcxx-exceptions -disable-llvm-passes | FileCheck %s
+
+namespace std::experimental {
+template  struct coroutine_traits;
+
+template  struct coroutine_handle {
+  coroutine_handle() = default;
+  static coroutine_handle from_address(void *) { return {}; }
+};
+template <> struct coroutine_handle {
+  static coroutine_handle from_address(void *) { return {}; }
+  coroutine_handle() = default;
+  template 
+  coroutine_handle(coroutine_handle) {}
+};
+}
+
+struct suspend_always {
+  bool await_ready();
+  void await_suspend(std::experimental::coroutine_handle<>);
+  void await_resume();
+};
+
+template <> struct std::experimental::coroutine_traits {
+  struct promise_type {
+void get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+void return_void();
+promise_type();
+~promise_type();
+void unhandled_exception();
+  };
+};
+
+struct Cleanup { ~Cleanup(); };
+void may_throw();
+
+// CHECK: define void @_Z1fv(
+void f() {
+  // CHECK: call i8* @_Znwm(i64
+
+  // If promise constructor throws, check that we free the memory.
+
+  // CHECK: invoke void @_ZNSt12experimental16coroutine_traitsIJvEE12promise_typeC1Ev(
+  // CHECK-NEXT: to label %{{.+}} unwind label %[[DeallocPad:.+]]
+
+  Cleanup cleanup;
+  may_throw();
+
+  // if may_throw throws, check that we destroy the promise and free the memory.
+
+  // CHECK: invoke void @_Z9may_throwv(
+  // CHECK-NEXT: to label %{{.+}} unwind label %[[PromDtorPad:.+]]
+
+  // CHECK: [[DeallocPad]]:
+  // CHECK-NEXT: landingpad
+  // CHECK-NEXT:   cleanup
+  // CHECK: br label %[[Dealloc:.+]]
+
+  // CHECK: [[PromDtorPad]]:
+  // CHECK-NEXT: landingpad
+  // CHECK-NEXT:   cleanup
+  // CHECK: call void @_ZN7CleanupD1Ev(%struct.Cleanup*
+  // CHECK: call void @_ZNSt12experimental16coroutine_traitsIJvEE12promise_typeD1Ev(
+  // CHECK: br label %[[Dealloc]]
+
+  // CHECK: [[Dealloc]]:
+  // CHECK:   %[[Mem:.+]] = call i8* @llvm.coro.free(
+  // CHECK:   call void @_ZdlPv(i8* %[[Mem]])
+
+  co_return;
+}
Index: cfe/trunk/test/CodeGenCoroutines/coro-return.cpp
===
--- cfe/trunk/test/CodeGenCoroutines/coro-return.cpp
+++ cfe/trunk/test/CodeGenCoroutines/coro-return.cpp
@@ -1,35 +1,27 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++1z -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
 
-namespace std {
-namespace experimental {
-template 
-struct coroutine_traits;
+namespace std::experimental {
+template  struct coroutine_traits;
 
-template 
-struct coroutine_handle {
+template  struct coroutine_handle {
   coroutine_handle() = default;
   static coroutine_handle from_address(void *) { return {}; }
 };
-
-template <>
-struct coroutine_handle {
+template <> struct coroutine_handle {
   static coroutine_handle from_address(void *) { return {}; }
   coroutine_handle() = default;
   template 
   coroutine_handle(coroutine_handle) {}
 };
-
-}
 }
 
 struct suspend_always {
   bool await_ready();
   void await_suspend(std::experimental::coroutine_handle<>);
   void await_resume();
 };
 
-template<>
-struct std::experimental::coroutine_traits {
+template <> struct std::experimental::coroutine_traits {
   struct promise_type {
 void get_return_object();
 suspend_always initial_suspend();
Index: cfe/trunk/lib/CodeGen/CGCoroutine.cpp
===
--- cfe/trunk/lib/CodeGen/CGCoroutine.cpp
+++ cfe/trunk/lib/CodeGen/CGCoroutine.cpp
@@ -215,6 +215,24 @@
   EmitBranchThroughCleanup(CurCoro.Data->FinalJD);
 }
 
+namespace {
+// Make sure to call coro.delete on scope exit.
+struct CallCoroDelete final : public EHScopeStack::Cleanup {
+  Stmt *Deallocate;
+
+  // TODO: Wrap deallocate in if(coro.free(...)) Deallocate.
+  void Emit(CodeGenFunction &CGF, Flags) override {
+// Note: That deallocation will be emit

[PATCH] D31561: cmath: Skip Libc for integral types in isinf, etc.

2017-03-31 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith created this revision.

For std::isinf, the standard requires effectively calling isinf as
double from Libc for integral types.  But integral types are never
infinite; we don't need to call Libc to return false.

  

Also short-circuit other functions where Libc won't have interesting
answers: signbit, fpclassify, isfinite, isnan, and isnormal.

  

I added correctness tests for integral types since we're no longer
deferring to Libc.


https://reviews.llvm.org/D31561

Files:
  libcxx/include/math.h
  libcxx/test/std/numerics/c.math/cmath.pass.cpp

Index: libcxx/test/std/numerics/c.math/cmath.pass.cpp
===
--- libcxx/test/std/numerics/c.math/cmath.pass.cpp
+++ libcxx/test/std/numerics/c.math/cmath.pass.cpp
@@ -10,6 +10,7 @@
 // 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -551,6 +552,13 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 assert(std::signbit(-1.0) == true);
+assert(std::signbit(0u) == false);
+assert(std::signbit(std::numeric_limits::max()) == false);
+assert(std::signbit(0) == false);
+assert(std::signbit(1) == false);
+assert(std::signbit(-1) == true);
+assert(std::signbit(std::numeric_limits::max()) == false);
+assert(std::signbit(std::numeric_limits::min()) == true);
 }
 
 void test_fpclassify()
@@ -564,6 +572,11 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 assert(std::fpclassify(-1.0) == FP_NORMAL);
+assert(std::fpclassify(0) == FP_ZERO);
+assert(std::fpclassify(1) == FP_NORMAL);
+assert(std::fpclassify(-1) == FP_NORMAL);
+assert(std::fpclassify(std::numeric_limits::max()) == FP_NORMAL);
+assert(std::fpclassify(std::numeric_limits::min()) == FP_NORMAL);
 }
 
 void test_isfinite()
@@ -577,6 +590,11 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 assert(std::isfinite(-1.0) == true);
+assert(std::isfinite(0) == true);
+assert(std::isfinite(1) == true);
+assert(std::isfinite(-1) == true);
+assert(std::isfinite(std::numeric_limits::max()) == true);
+assert(std::isfinite(std::numeric_limits::min()) == true);
 }
 
 void test_isnormal()
@@ -590,6 +608,11 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 assert(std::isnormal(-1.0) == true);
+assert(std::isnormal(0) == false);
+assert(std::isnormal(1) == true);
+assert(std::isnormal(-1) == true);
+assert(std::isnormal(std::numeric_limits::max()) == true);
+assert(std::isnormal(std::numeric_limits::min()) == true);
 }
 
 void test_isgreater()
@@ -651,6 +674,11 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 assert(std::isinf(-1.0) == false);
+assert(std::isinf(0) == false);
+assert(std::isinf(1) == false);
+assert(std::isinf(-1) == false);
+assert(std::isinf(std::numeric_limits::max()) == false);
+assert(std::isinf(std::numeric_limits::min()) == false);
 }
 
 void test_isless()
@@ -731,6 +759,11 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 assert(std::isnan(-1.0) == false);
+assert(std::isnan(0) == false);
+assert(std::isnan(1) == false);
+assert(std::isnan(-1) == false);
+assert(std::isnan(std::numeric_limits::max()) == false);
+assert(std::isnan(std::numeric_limits::min()) == false);
 }
 
 void test_isunordered()
Index: libcxx/include/math.h
===
--- libcxx/include/math.h
+++ libcxx/include/math.h
@@ -327,22 +327,50 @@
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if::value, bool>::type
+typename std::enable_if::value, bool>::type
 signbit(_A1 __lcpp_x) _NOEXCEPT
 {
 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x < 0; }
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
+signbit(_A1) _NOEXCEPT
+{ return false; }
+
 #elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
 
 template 
 inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if::value, bool>::type
+typename std::enable_if::value, bool>::type
 signbit(_A1 __lcpp_x) _NOEXCEPT
 {
   return ::signbit(static_cast::type>(__lcpp_x));
 }
 
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x < 0; }
+
+template 
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+std::is_integral<_A

[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93737.
EricWF added a comment.

- general cleanup.


https://reviews.llvm.org/D31562

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCoroutine.cpp
  test/SemaCXX/coroutines.cpp

Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -654,6 +654,20 @@
   co_return; //expected-note {{function is a coroutine due to use of 'co_return' here}}
 }
 
+namespace std {
+  struct nothrow_t {};
+  constexpr nothrow_t nothrow = {};
+}
+
+using SizeT = decltype(sizeof(int));
+
+void* operator new(SizeT __sz, const std::nothrow_t&) noexcept;
+void  operator delete(void* __p, const std::nothrow_t&) noexcept;
+
+void* operator new[](SizeT __sz, const std::nothrow_t&) noexcept;
+void  operator delete[](void* __p, const std::nothrow_t&) noexcept;
+
+
 struct promise_on_alloc_failure_tag {};
 
 template<>
@@ -694,3 +708,25 @@
 }
 template coro dependent_private_alloc_failure_handler(bad_promise_11);
 // expected-note@-1 {{requested here}}
+
+
+struct bad_promise_12 {
+  coro get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void unhandled_exception();
+  void return_void();
+  static coro get_return_object_on_allocation_failure();
+
+  static void* operator new(SizeT);
+  // expected-error@-1 2 {{'operator new' is required to have a non-throwing noexcept specification when the promise type declares 'get_return_object_on_allocation_failure()'}}
+};
+coro throwing_in_class_new() { // expected-note {{call to 'operator new' implicitly required by coroutine function here}}
+  co_return;
+}
+
+template 
+coro dependent_throwing_in_class_new(T) { // expected-note {{call to 'operator new' implicitly required by coroutine function here}}
+   co_return;
+}
+template coro dependent_throwing_in_class_new(bad_promise_12); // expected-note {{requested here}}
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -454,7 +454,7 @@
  /*IsImplicit*/ true);
 Suspend = S.ActOnFinishFullExpr(Suspend.get());
 if (Suspend.isInvalid()) {
-  S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
+  S.Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required)
   << ((Name == "initial_suspend") ? 0 : 1);
   S.Diag(KWLoc, diag::note_declared_coroutine_here) << Keyword;
   return StmtError();
@@ -660,6 +660,37 @@
   return Res;
 }
 
+/// Look up the std::nothrow object.
+static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) {
+  NamespaceDecl *Std = S.getStdNamespace();
+  assert(Std && "Should already be diagnosed");
+
+  LookupResult Result(S, &S.PP.getIdentifierTable().get("nothrow"), Loc,
+  Sema::LookupOrdinaryName);
+  if (!S.LookupQualifiedName(Result, Std)) {
+// FIXME:  should have been included already.
+// If we require it to include  then this diagnostic is no longer
+// needed.
+S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found);
+return nullptr;
+  }
+
+  auto *VD = Result.getAsSingle();
+  if (!VD) {
+Result.suppressDiagnostics();
+// We found something weird. Complain about the first thing we found.
+NamedDecl *Found = *Result.begin();
+S.Diag(Found->getLocation(), diag::err_malformed_std_nothrow);
+return nullptr;
+  }
+
+  ExprResult DR = S.BuildDeclRefExpr(VD, VD->getType(), VK_LValue, Loc);
+  if (DR.isInvalid())
+return nullptr;
+
+  return DR.get();
+}
+
 // Find an appropriate delete for the promise.
 static FunctionDecl *findDeleteForPromise(Sema &S, SourceLocation Loc,
   QualType PromiseType) {
@@ -815,23 +846,51 @@
   if (S.RequireCompleteType(Loc, PromiseType, diag::err_incomplete_type))
 return false;
 
-  // FIXME: Add nothrow_t placement arg for global alloc
-  //if ReturnStmtOnAllocFailure != nullptr.
+  const bool RequiresNoThrowAlloc = ReturnStmtOnAllocFailure != nullptr;
+
   // FIXME: Add support for stateful allocators.
 
   FunctionDecl *OperatorNew = nullptr;
   FunctionDecl *OperatorDelete = nullptr;
   FunctionDecl *UnusedResult = nullptr;
   bool PassAlignment = false;
+  MultiExprArg PlacementArgs = None;
 
   S.FindAllocationFunctions(Loc, SourceRange(),
 /*UseGlobal*/ false, PromiseType,
-/*isArray*/ false, PassAlignment,
-/*PlacementArgs*/ None, OperatorNew, UnusedResult);
+/*isArray*/ false, PassAlignment, PlacementArgs,
+OperatorNew, UnusedResult);
+
+  bool IsGlobalOverload =
+  OperatorNew && !isa(OperatorNew->getDeclContext());
+  // If we didn't find a class-local new declaration and non-throwing new
+  /

[PATCH] D31564: string: Remove always_inline from basic_string::__init

2017-03-31 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith created this revision.
Herald added subscribers: rengolin, aemerson.

This is effectively a partial revert of r278356, which started inlining
basic_string::__init.  Even if we want to help the compiler along with
an inlinehint, we shouldn't hamstring it by forcing it to inline all the
time.

Libc++ uses always_inline widely as a limit-the-ABI-hack, but since
__init is already on the dylib boundary, it makes no sense here and just
harms the debugging experience at -O0.


https://reviews.llvm.org/D31564

Files:
  libcxx/include/string


Index: libcxx/include/string
===
--- libcxx/include/string
+++ libcxx/include/string
@@ -1338,24 +1338,24 @@
  __align_it (__s+1)) - 1;}
 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(const value_type* __s, size_type __sz, size_type __reserve);
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(const value_type* __s, size_type __sz);
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(size_type __n, value_type __c);
 
 template 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 typename enable_if
 <
 __is_exactly_input_iterator<_InputIterator>::value,
 void
 >::type
 __init(_InputIterator __first, _InputIterator __last);
 
 template 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 typename enable_if
 <
 __is_forward_iterator<_ForwardIterator>::value,


Index: libcxx/include/string
===
--- libcxx/include/string
+++ libcxx/include/string
@@ -1338,24 +1338,24 @@
  __align_it (__s+1)) - 1;}
 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(const value_type* __s, size_type __sz, size_type __reserve);
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(const value_type* __s, size_type __sz);
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(size_type __n, value_type __c);
 
 template 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 typename enable_if
 <
 __is_exactly_input_iterator<_InputIterator>::value,
 void
 >::type
 __init(_InputIterator __first, _InputIterator __last);
 
 template 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 typename enable_if
 <
 __is_forward_iterator<_ForwardIterator>::value,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31562: [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-03-31 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 93739.
EricWF added a comment.

- Remove incorrectly added changes.

Note that this patch is built on top of https://reviews.llvm.org/D31487 and not 
trunk.


https://reviews.llvm.org/D31562

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCoroutine.cpp
  test/SemaCXX/coroutines.cpp

Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -654,6 +654,20 @@
   co_return; //expected-note {{function is a coroutine due to use of 'co_return' here}}
 }
 
+namespace std {
+  struct nothrow_t {};
+  constexpr nothrow_t nothrow = {};
+}
+
+using SizeT = decltype(sizeof(int));
+
+void* operator new(SizeT __sz, const std::nothrow_t&) noexcept;
+void  operator delete(void* __p, const std::nothrow_t&) noexcept;
+
+void* operator new[](SizeT __sz, const std::nothrow_t&) noexcept;
+void  operator delete[](void* __p, const std::nothrow_t&) noexcept;
+
+
 struct promise_on_alloc_failure_tag {};
 
 template<>
@@ -694,3 +708,25 @@
 }
 template coro dependent_private_alloc_failure_handler(bad_promise_11);
 // expected-note@-1 {{requested here}}
+
+
+struct bad_promise_12 {
+  coro get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void unhandled_exception();
+  void return_void();
+  static coro get_return_object_on_allocation_failure();
+
+  static void* operator new(SizeT);
+  // expected-error@-1 2 {{'operator new' is required to have a non-throwing noexcept specification when the promise type declares 'get_return_object_on_allocation_failure()'}}
+};
+coro throwing_in_class_new() { // expected-note {{call to 'operator new' implicitly required by coroutine function here}}
+  co_return;
+}
+
+template 
+coro dependent_throwing_in_class_new(T) { // expected-note {{call to 'operator new' implicitly required by coroutine function here}}
+   co_return;
+}
+template coro dependent_throwing_in_class_new(bad_promise_12); // expected-note {{requested here}}
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -454,7 +454,7 @@
  /*IsImplicit*/ true);
 Suspend = S.ActOnFinishFullExpr(Suspend.get());
 if (Suspend.isInvalid()) {
-  S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
+  S.Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required)
   << ((Name == "initial_suspend") ? 0 : 1);
   S.Diag(KWLoc, diag::note_declared_coroutine_here) << Keyword;
   return StmtError();
@@ -660,6 +660,37 @@
   return Res;
 }
 
+/// Look up the std::nothrow object.
+static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) {
+  NamespaceDecl *Std = S.getStdNamespace();
+  assert(Std && "Should already be diagnosed");
+
+  LookupResult Result(S, &S.PP.getIdentifierTable().get("nothrow"), Loc,
+  Sema::LookupOrdinaryName);
+  if (!S.LookupQualifiedName(Result, Std)) {
+// FIXME:  should have been included already.
+// If we require it to include  then this diagnostic is no longer
+// needed.
+S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found);
+return nullptr;
+  }
+
+  auto *VD = Result.getAsSingle();
+  if (!VD) {
+Result.suppressDiagnostics();
+// We found something weird. Complain about the first thing we found.
+NamedDecl *Found = *Result.begin();
+S.Diag(Found->getLocation(), diag::err_malformed_std_nothrow);
+return nullptr;
+  }
+
+  ExprResult DR = S.BuildDeclRefExpr(VD, VD->getType(), VK_LValue, Loc);
+  if (DR.isInvalid())
+return nullptr;
+
+  return DR.get();
+}
+
 // Find an appropriate delete for the promise.
 static FunctionDecl *findDeleteForPromise(Sema &S, SourceLocation Loc,
   QualType PromiseType) {
@@ -815,23 +846,51 @@
   if (S.RequireCompleteType(Loc, PromiseType, diag::err_incomplete_type))
 return false;
 
-  // FIXME: Add nothrow_t placement arg for global alloc
-  //if ReturnStmtOnAllocFailure != nullptr.
+  const bool RequiresNoThrowAlloc = ReturnStmtOnAllocFailure != nullptr;
+
   // FIXME: Add support for stateful allocators.
 
   FunctionDecl *OperatorNew = nullptr;
   FunctionDecl *OperatorDelete = nullptr;
   FunctionDecl *UnusedResult = nullptr;
   bool PassAlignment = false;
+  MultiExprArg PlacementArgs = None;
 
   S.FindAllocationFunctions(Loc, SourceRange(),
 /*UseGlobal*/ false, PromiseType,
-/*isArray*/ false, PassAlignment,
-/*PlacementArgs*/ None, OperatorNew, UnusedResult);
+/*isArray*/ false, PassAlignment, PlacementArgs,
+OperatorNew, UnusedResult);
+
+  bool IsGlobalOverload =
+  OperatorNew && !isa(Opera

[PATCH] D31564: string: Remove always_inline from basic_string::__init

2017-03-31 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith closed this revision.
dexonsmith added a comment.

Committed in r299290.


https://reviews.llvm.org/D31564



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


[libcxx] r299290 - string: Remove always_inline from basic_string::__init

2017-03-31 Thread Duncan P. N. Exon Smith via cfe-commits
Author: dexonsmith
Date: Fri Mar 31 22:20:48 2017
New Revision: 299290

URL: http://llvm.org/viewvc/llvm-project?rev=299290&view=rev
Log:
string: Remove always_inline from basic_string::__init

This is effectively a partial revert of r278356, which started inlining
basic_string::__init.  Even if we want to help the compiler along with
an inlinehint, we shouldn't hamstring it by forcing it to inline all the
time.

Libc++ uses always_inline widely as a limit-the-ABI-hack, but since
__init is already on the dylib boundary, it makes no sense here and just
harms the debugging experience at -O0.

rdar://problem/31013102

Modified:
libcxx/trunk/include/string

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=299290&r1=299289&r2=299290&view=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Fri Mar 31 22:20:48 2017
@@ -1338,15 +1338,15 @@ private:
  __align_it (__s+1)) - 1;}
 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(const value_type* __s, size_type __sz, size_type __reserve);
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(const value_type* __s, size_type __sz);
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 void __init(size_type __n, value_type __c);
 
 template 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 typename enable_if
 <
 __is_exactly_input_iterator<_InputIterator>::value,
@@ -1355,7 +1355,7 @@ private:
 __init(_InputIterator __first, _InputIterator __last);
 
 template 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+inline
 typename enable_if
 <
 __is_forward_iterator<_ForwardIterator>::value,


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