[PATCH] D25640: [CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on functions without bodies.

2016-10-14 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added reviewers: rsmith, tra.
jlebar added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

In CUDA compilation, we call isInlineDefinitionExternallyVisible (via
getGVALinkageForFunction) on functions while parsing their definitions.

At the point in time when we call getGVALinkageForFunction, the function
may not have a body, so we trip this assert.  But as far as I can tell,
this is harmless.

It is not clear to me whether it's possible to replace this assert with
something slightly weaker.


https://reviews.llvm.org/D25640

Files:
  clang/lib/AST/Decl.cpp
  clang/test/SemaCUDA/gnu-inline.cu


Index: clang/test/SemaCUDA/gnu-inline.cu
===
--- /dev/null
+++ clang/test/SemaCUDA/gnu-inline.cu
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include "Inputs/cuda.h"
+
+// expected-no-diagnostics
+
+// Check that we can handle gnu_inline functions when compiling in CUDA mode.
+
+void foo();
+inline __attribute__((gnu_inline)) void bar() { foo(); }
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -3048,7 +3048,6 @@
 /// an externally visible symbol, but "extern inline" will not create an 
 /// externally visible symbol.
 bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
-  assert(doesThisDeclarationHaveABody() && "Must have the function 
definition");
   assert(isInlined() && "Function must be inline");
   ASTContext  = getASTContext();
   


Index: clang/test/SemaCUDA/gnu-inline.cu
===
--- /dev/null
+++ clang/test/SemaCUDA/gnu-inline.cu
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include "Inputs/cuda.h"
+
+// expected-no-diagnostics
+
+// Check that we can handle gnu_inline functions when compiling in CUDA mode.
+
+void foo();
+inline __attribute__((gnu_inline)) void bar() { foo(); }
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -3048,7 +3048,6 @@
 /// an externally visible symbol, but "extern inline" will not create an 
 /// externally visible symbol.
 bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
-  assert(doesThisDeclarationHaveABody() && "Must have the function definition");
   assert(isInlined() && "Function must be inline");
   ASTContext  = getASTContext();
   
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

2016-10-14 Thread John McCall via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGExpr.cpp:1650
+}
+
 switch (Lifetime) {

I think you can fold this a bit more. :)  You have exactly the same switch 
statement below, and several of the cases are identical; for the others, you 
can just sink the isInit check into the case.

Note that calling EmitStoreOfScalar and returning has the same behavior as 
"falling into the normal path".  isObjCWeak() / isObjCStrong() are checking for 
the GC qualifiers, which are exclusive with ARC lifetime.


https://reviews.llvm.org/D25547



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


r284300 - Disable a silly GCC diagnostic for combining a scanf length specifier with the

2016-10-14 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Oct 14 20:59:52 2016
New Revision: 284300

URL: http://llvm.org/viewvc/llvm-project?rev=284300=rev
Log:
Disable a silly GCC diagnostic for combining a scanf length specifier with the
'*' specifier. Apparently the GNU folks want to discourage self-documenting
code.

Modified:
cfe/trunk/tools/driver/cc1_main.cpp

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=284300=284299=284300=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Fri Oct 14 20:59:52 2016
@@ -90,12 +90,22 @@ static size_t getCurrentStackAllocation(
 // program name) after the environment, but this is close enough (we only
 // need to be within 100K or so).
 unsigned long StackPtr, EnvEnd;
+// Disable silly GCC -Wformat warning that complains about length
+// modifiers on ignored format specifiers. We want to retain these
+// for documentation purposes even though they have no effect.
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
+#endif
 if (fscanf(StatFile,
"%*d %*s %*c %*d %*d %*d %*d %*d %*u %*lu %*lu %*lu %*lu %*lu "
"%*lu %*ld %*ld %*ld %*ld %*ld %*ld %*llu %*lu %*ld %*lu %*lu "
"%*lu %*lu %lu %*lu %*lu %*lu %*lu %*lu %*llu %*lu %*lu %*d %*d 
"
"%*u %*u %*llu %*lu %*ld %*lu %*lu %*lu %*lu %*lu %*lu %lu %*d",
, ) == 2) {
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
   Usage = StackPtr < EnvEnd ? EnvEnd - StackPtr : StackPtr - EnvEnd;
 }
 fclose(StatFile);


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


Re: r284256 - Link static PIE programs against rcrt0.o on OpenBSD

2016-10-14 Thread Brad Smith via cfe-commits
On Fri, Oct 14, 2016 at 05:59:54PM -, Ed Maste via cfe-commits wrote:
> Author: emaste
> Date: Fri Oct 14 12:59:53 2016
> New Revision: 284256
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=284256=rev
> Log:
> Link static PIE programs against rcrt0.o on OpenBSD
> 
> Patch by Stefan Kempf.
> 
> Differential Revision:https://reviews.llvm.org/D22130
> 
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/Driver/openbsd.c
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=284256=284255=284256=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 14 12:59:53 2016
> @@ -8519,6 +8519,10 @@ void openbsd::Linker::ConstructJob(Compi
>if (Args.hasArg(options::OPT_pg))
>  CmdArgs.push_back(
>  Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
> +  else if (Args.hasArg(options::OPT_static) &&
> +   !Args.hasArg(options::OPT_nopie))
> +CmdArgs.push_back(
> +Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
>else
>  CmdArgs.push_back(
>  Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
> 
> Modified: cfe/trunk/test/Driver/openbsd.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=284256=284255=284256=diff
> ==
> --- cfe/trunk/test/Driver/openbsd.c (original)
> +++ cfe/trunk/test/Driver/openbsd.c Fri Oct 14 12:59:53 2016
> @@ -67,3 +67,26 @@
>  // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
>  // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
>  // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
> +
> +// Check linking against correct startup code when (not) using PIE
> +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
> +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s 
> -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
> +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s 
> -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
> +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static 
> -fno-pie %s -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
> +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -nopie %s -### 
> 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
> +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -nopie 
> %s -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
> +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -static -nopie 
> %s -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
> +// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -static 
> -nopie %s -### 2>&1 \
> +// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
> +// CHECK-PIE: "/usr/lib/crt0.o"
> +// CHECK-PIE-NOT: "-nopie"
> +// CHECK-STATIC-PIE: "/usr/lib/rcrt0.o"
> +// CHECK-STATIC-PIE-NOT: "-nopie"
> +// CHECK-NOPIE: "-nopie" {{.*}}"/usr/lib/crt0.o"

Ok, I see the obvious issue with -no-canonical-prefix vs -no-canonical-prefixes
and fix the typo with the target triples.


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp(revision 284299)
+++ lib/Driver/Tools.cpp(working copy)
@@ -8519,6 +8519,10 @@
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+  else if (Args.hasArg(options::OPT_static) &&
+   !Args.hasArg(options::OPT_nopie))
+CmdArgs.push_back(
+Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
   else
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
Index: test/Driver/openbsd.c
===
--- test/Driver/openbsd.c   (revision 284299)
+++ test/Driver/openbsd.c   (working copy)
@@ -67,3 +67,26 @@
 // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
 // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
 // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
+
+// Check linking against correct startup code when (not) using PIE
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 
2>&1 \
+// RUN:   | FileCheck 

[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-14 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Looks that somehow the current directory doesn't exit anymore OR it's non empty 
but only contains spaces or something like that. Besides the snippet below, 
RedirectingFileSystem::lookupPath(llvm::Twine const&) also calls `makeAbsolute` 
before `remove_dots`. Can you try to print `FileSystemOpts.WorkingDir`?



 
  bool FileManager::getStatValue(StringRef Path, FileData , bool isFile,   



   std::unique_ptr *F) { 


  
  // FIXME: FileSystemOpts shouldn't be passed in here, all paths should be 


  
  // absolute!  


  
  if (FileSystemOpts.WorkingDir.empty())


  
return FileSystemStatCache::get(Path, Data, isFile, F,StatCache.get(), 
*FS);   

   



  
  SmallString<128> FilePath(Path);  


  
  FixupRelativePath(FilePath);  


  



  
  return FileSystemStatCache::get(FilePath.c_str(), Data, isFile, F,


  
  StatCache.get(), *FS);


  

}


https://reviews.llvm.org/D25597



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


[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-14 Thread Petr Hosek via cfe-commits
phosek added a comment.

Ping, do you have any other comments?


Repository:
  rL LLVM

https://reviews.llvm.org/D25491



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


[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

2016-10-14 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 74760.
ahatanak added a comment.

Fold EmitScalarInit into EmitStoreThroughLValue and remove EmitScalarInit.

I don't think ElementType in EmitObjCCollectionLiteral has a lifetime 
qualifier, so it should be safe to call EmitStoreThroughLValue instead of 
EmitScalarInit in that function.


https://reviews.llvm.org/D25547

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenObjCXX/arc-constexpr.mm

Index: test/CodeGenObjCXX/arc-constexpr.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-constexpr.mm
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - -std=c++11 %s | FileCheck %s
+
+// CHECK: %[[TYPE:[a-z0-9]+]] = type opaque
+// CHECK: @[[CFSTRING:[a-z0-9_]+]] = private global %struct.__NSConstantString_tag
+
+// CHECK: define void @_Z5test1v
+// CHECK:   %[[ALLOCA:[A-Z]+]] = alloca %[[TYPE]]*
+// CHECK:   %[[V0:[0-9]+]] = call i8* @objc_retain(i8* bitcast (%struct.__NSConstantString_tag* @[[CFSTRING]]
+// CHECK:   %[[V1:[0-9]+]] = bitcast i8* %[[V0]] to %[[TYPE]]*
+// CHECK:   store %[[TYPE]]* %[[V1]], %[[TYPE]]** %[[ALLOCA]]
+// CHECK:   %[[V2:[0-9]+]] = bitcast %[[TYPE]]** %[[ALLOCA]]
+// CHECK:   call void @objc_storeStrong(i8** %[[V2]], i8* null)
+
+@class NSString;
+
+void test1() {
+  constexpr NSString *S = @"abc";
+}
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2118,7 +2118,6 @@
 
   void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue,
   bool capturedByInit);
-  void EmitScalarInit(llvm::Value *init, LValue lvalue);
 
   typedef void SpecialInitFn(CodeGenFunction , const VarDecl ,
  llvm::Value *Address);
Index: lib/CodeGen/CGStmtOpenMP.cpp
===
--- lib/CodeGen/CGStmtOpenMP.cpp
+++ lib/CodeGen/CGStmtOpenMP.cpp
@@ -188,7 +188,7 @@
 auto *RefVal = TmpAddr.getPointer();
 TmpAddr = CGF.CreateMemTemp(RefType, Twine(Name) + ".ref");
 auto TmpLVal = CGF.MakeAddrLValue(TmpAddr, RefType);
-CGF.EmitScalarInit(RefVal, TmpLVal);
+CGF.EmitStoreThroughLValue(RValue::get(RefVal), TmpLVal, true);
   }
 
   return TmpAddr;
@@ -2179,7 +2179,7 @@
 llvm::Value *Init = nullptr) {
   auto LVal = CGF.MakeAddrLValue(CGF.CreateMemTemp(Ty, Name), Ty);
   if (Init)
-CGF.EmitScalarInit(Init, LVal);
+CGF.EmitStoreThroughLValue(RValue::get(Init), LVal, true);
   return LVal;
 }
 
Index: lib/CodeGen/CGObjC.cpp
===
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -1662,7 +1662,7 @@
 elementLValue = EmitLValue(cast(S.getElement()));
 EmitStoreThroughLValue(RValue::get(CurrentItem), elementLValue);
   } else {
-EmitScalarInit(CurrentItem, elementLValue);
+EmitStoreThroughLValue(RValue::get(CurrentItem), elementLValue, true);
   }
 
   // If we do have an element variable, this assignment is the end of
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -1620,6 +1620,34 @@
 
   // There's special magic for assigning into an ARC-qualified l-value.
   if (Qualifiers::ObjCLifetime Lifetime = Dst.getQuals().getObjCLifetime()) {
+if (isInit) {
+  llvm::Value *Init = Src.getScalarVal();
+  switch (Lifetime) {
+  case Qualifiers::OCL_None:
+llvm_unreachable("present but none");
+
+  case Qualifiers::OCL_ExplicitNone:
+// nothing to do
+break;
+
+  case Qualifiers::OCL_Strong:
+Init = EmitARCRetain(Dst.getType(), Src.getScalarVal());
+break;
+
+  case Qualifiers::OCL_Weak:
+// Initialize and then skip the primitive store.
+EmitARCInitWeak(Dst.getAddress(), Src.getScalarVal());
+return;
+
+  case Qualifiers::OCL_Autoreleasing:
+Init = EmitARCRetainAutorelease(Dst.getType(), Src.getScalarVal());
+break;
+  }
+
+  EmitStoreOfScalar(Init, Dst, /* isInitialization */ true);
+  return;
+}
+
 switch (Lifetime) {
 case Qualifiers::OCL_None:
   llvm_unreachable("present but none");
Index: lib/CodeGen/CGDecl.cpp
===
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -774,37 +774,6 @@
   EmitStoreOfScalar(value, lvalue, /* isInitialization */ true);
 }
 
-/// EmitScalarInit - Initialize the given lvalue with the given object.
-void CodeGenFunction::EmitScalarInit(llvm::Value *init, LValue lvalue) {
-  Qualifiers::ObjCLifetime lifetime = lvalue.getObjCLifetime();
-  if (!lifetime)
-return 

[PATCH] D19996: New clang option -mpie-copy-relocationss to indicate support for linker copy relocations when linking as PIE

2016-10-14 Thread Sriraman Tallam via cfe-commits
tmsriram retitled this revision from "New clang option -mpiecopyrelocs to 
indicate support for linker copy relocations when linking as PIE" to "New clang 
option -mpie-copy-relocationss to indicate support for linker copy relocations 
when linking as PIE".
tmsriram updated the summary for this revision.
tmsriram added a reviewer: davide.
tmsriram updated this revision to Diff 74757.
tmsriram added a comment.

- Option name changed to  -mpie-copy-relocations
- Option sets MCPIECopyRelocations in MCOptions


https://reviews.llvm.org/D19996

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/BackendUtil.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -586,6 +586,8 @@
   Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
   Opts.IncrementalLinkerCompatible =
   Args.hasArg(OPT_mincremental_linker_compatible);
+  Opts.PIECopyRelocations =
+  Args.hasArg(OPT_mpie_copy_relocations);
   Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
   Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
   Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4499,6 +4499,11 @@
 CmdArgs.push_back("-mms-bitfields");
   }
 
+  if (Args.hasFlag(options::OPT_mpie_copy_relocations, 
options::OPT_mno_pie_copy_relocations,
+   false)) {
+CmdArgs.push_back("-mpie-copy-relocations");
+  }
+
   // This is a coarse approximation of what llvm-gcc actually does, both
   // -fasynchronous-unwind-tables and -fnon-call-exceptions interact in more
   // complicated ways.
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -595,6 +595,8 @@
   Options.MCOptions.MCNoExecStack = CodeGenOpts.NoExecStack;
   Options.MCOptions.MCIncrementalLinkerCompatible =
   CodeGenOpts.IncrementalLinkerCompatible;
+  Options.MCOptions.MCPIECopyRelocations =
+  CodeGenOpts.PIECopyRelocations;
   Options.MCOptions.MCFatalWarnings = CodeGenOpts.FatalWarnings;
   Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose;
   Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments;
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -252,6 +252,9 @@
 /// Whether to report the hotness of the code region for optimization remarks.
 CODEGENOPT(DiagnosticsWithHotness, 1, 0)
 
+/// Whether copy relocations support is available when building as PIE.
+CODEGENOPT(PIECopyRelocations, 1, 0)
+
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1691,6 +1691,12 @@
 def mimplicit_float : Flag<["-"], "mimplicit-float">, Group;
 def mrecip : Flag<["-"], "mrecip">, Group;
 def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group, 
Flags<[CC1Option]>;
+def mpie_copy_relocations : Flag<["-"], "mpie-copy-relocations">, 
Group,
+  Flags<[CC1Option]>,
+  HelpText<"Copy Relocations support for PIE builds">;
+def mno_pie_copy_relocations : Flag<["-"], "mno-pie-copy-relocations">, 
Group,
+  Flags<[CC1Option]>,
+  HelpText<"No Copy Relocations support for PIE builds">;
 def mx87 : Flag<["-"], "mx87">, Group;
 def m80387 : Flag<["-"], "m80387">, Alias;
 def msse2 : Flag<["-"], "msse2">, Group;


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -586,6 +586,8 @@
   Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
   Opts.IncrementalLinkerCompatible =
   Args.hasArg(OPT_mincremental_linker_compatible);
+  Opts.PIECopyRelocations =
+  Args.hasArg(OPT_mpie_copy_relocations);
   Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
   Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
   Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4499,6 +4499,11 @@
 CmdArgs.push_back("-mms-bitfields");
   }
 
+  if (Args.hasFlag(options::OPT_mpie_copy_relocations, options::OPT_mno_pie_copy_relocations,
+   false)) {
+CmdArgs.push_back("-mpie-copy-relocations");
+  }
+
   // This is a coarse 

[libcxxabi] r284295 - Fix typo in comment

2016-10-14 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Fri Oct 14 19:02:20 2016
New Revision: 284295

URL: http://llvm.org/viewvc/llvm-project?rev=284295=rev
Log:
Fix typo in comment

Modified:
libcxxabi/trunk/src/cxa_thread_atexit.cpp

Modified: libcxxabi/trunk/src/cxa_thread_atexit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_thread_atexit.cpp?rev=284295=284294=284295=diff
==
--- libcxxabi/trunk/src/cxa_thread_atexit.cpp (original)
+++ libcxxabi/trunk/src/cxa_thread_atexit.cpp Fri Oct 14 19:02:20 2016
@@ -99,7 +99,7 @@ namespace {
   };
 } // namespace
 
-#endif // HAVE__CXA_THREAD_ATEXIT_IMPL
+#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
 
 extern "C" {
 


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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-14 Thread Sebastian Pop via cfe-commits
sebpop added a comment.

If I remember correctly, we pushed the fix after 3.9 was released.
Could you please explain the problem of requiring trunk LLVM to build trunk 
libcxx?


https://reviews.llvm.org/D25624



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


[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In https://reviews.llvm.org/D24864#570954, @vitalybuka wrote:

> Thanks, done https://reviews.llvm.org/D25636


Thanks for the fix!

/ Asiri


https://reviews.llvm.org/D24864



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


[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Vitaly Buka via cfe-commits
vitalybuka added a comment.

Thanks, done https://reviews.llvm.org/D25636


https://reviews.llvm.org/D24864



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

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

Has the fix been merged into the 3.9 branch? Does re-adding this attribute mean 
that Clang 4.0 is required to build LLVM w/ libc++?


https://reviews.llvm.org/D25624



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


[libcxxabi] r284294 - Don't compile cxa_thread_atexit.cpp with -DLIBCXX_ENABLE_THREADS=OFF

2016-10-14 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Fri Oct 14 18:51:41 2016
New Revision: 284294

URL: http://llvm.org/viewvc/llvm-project?rev=284294=rev
Log:
Don't compile cxa_thread_atexit.cpp with -DLIBCXX_ENABLE_THREADS=OFF

Reviewers: rmaprath

Subscribers: beanz, mgorny

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

Modified:
libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=284294=284293=284294=diff
==
--- libcxxabi/trunk/src/CMakeLists.txt (original)
+++ libcxxabi/trunk/src/CMakeLists.txt Fri Oct 14 18:51:41 2016
@@ -25,7 +25,7 @@ else()
   list(APPEND LIBCXXABI_SOURCES cxa_noexception.cpp)
 endif()
 
-if (UNIX AND NOT (APPLE OR CYGWIN))
+if (LIBCXXABI_ENABLE_THREADS AND UNIX AND NOT (APPLE OR CYGWIN))
   list(APPEND LIBCXXABI_SOURCES cxa_thread_atexit.cpp)
 endif()
 


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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-14 Thread Sebastian Pop via cfe-commits
sebpop accepted this revision.
sebpop added a reviewer: sebpop.
sebpop added a comment.
This revision is now accepted and ready to land.

This got approved in the past review.
Let's commit it now that the clang bug was fixed.
Thanks Aditya for keeping track of this.


https://reviews.llvm.org/D25624



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


[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In https://reviews.llvm.org/D24864#570935, @vitalybuka wrote:

> Maybe?
>
>   - if (UNIX AND NOT (APPLE OR CYGWIN))
>   + if (LIBCXXABI_ENABLE_THREADS AND UNIX AND NOT (APPLE OR CYGWIN))
>   list(APPEND LIBCXXABI_SOURCES cxa_thread_atexit.cpp)
>   endif()
>


Yes!

I was just about to say I don't know why it's even trying to build this, given 
that the library is configured with `-DLIBCXXABI_ENABLE_THREADS=OFF`.

Feel free to commit a fix :)

Cheers,

/ Asiri


https://reviews.llvm.org/D24864



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


[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Vitaly Buka via cfe-commits
vitalybuka added a comment.

Maybe?

- if (UNIX AND NOT (APPLE OR CYGWIN))

+ if (LIBCXXABI_ENABLE_THREADS AND UNIX AND NOT (APPLE OR CYGWIN))

  list(APPEND LIBCXXABI_SOURCES cxa_thread_atexit.cpp)

endif()


https://reviews.llvm.org/D24864



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


[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In https://reviews.llvm.org/D24864#570924, @vitalybuka wrote:

> So there is:
>
> - Looking for __cxa_thread_atexit_impl in c
> - Looking for __cxa_thread_atexit_impl in c - not found
>
>   and libcxx is configured with -DLIBCXX_ENABLE_THREADS=OFF


I think, the problem here is that `cxa_thread_atexit.cpp` is not properly 
guarded against the non-threaded use-case. If you look at the source prior to 
this patch, it refers to `pthread.h` and `pthread_key_t` unconditionally, it 
may have worked because pthread was somehow linked in.

The fix should be fairly straightforward. I will do a patch tomorrow (bit late 
in the day here), hope that's OK?

Cheers,

/ Asiri


https://reviews.llvm.org/D24864



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


r284293 - [Coverage] Support for C++17 if initializers

2016-10-14 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Fri Oct 14 18:38:16 2016
New Revision: 284293

URL: http://llvm.org/viewvc/llvm-project?rev=284293=rev
Log:
[Coverage] Support for C++17 if initializers

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

Added:
cfe/trunk/test/CoverageMapping/if.cpp
  - copied, changed from r284292, cfe/trunk/test/CoverageMapping/if.c
Removed:
cfe/trunk/test/CoverageMapping/if.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/test/Profile/cxx-stmt-initializers.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=284293=284292=284293=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri Oct 14 18:38:16 2016
@@ -490,6 +490,8 @@ struct ComputeRegionCounts : public Cons
   void VisitIfStmt(const IfStmt *S) {
 RecordStmtCount(S);
 uint64_t ParentCount = CurrentCount;
+if (S->getInit())
+  Visit(S->getInit());
 Visit(S->getCond());
 
 // Counter tracks the "then" part of an if statement. The count for

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=284293=284292=284293=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Fri Oct 14 18:38:16 2016
@@ -875,6 +875,9 @@ struct CounterCoverageMappingBuilder
 
   void VisitIfStmt(const IfStmt *S) {
 extendRegion(S);
+if (S->getInit())
+  Visit(S->getInit());
+
 // Extend into the condition before we propagate through it below - this is
 // needed to handle macros that generate the "if" but not the condition.
 extendRegion(S->getCond());

Removed: cfe/trunk/test/CoverageMapping/if.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/if.c?rev=284292=auto
==
--- cfe/trunk/test/CoverageMapping/if.c (original)
+++ cfe/trunk/test/CoverageMapping/if.c (removed)
@@ -1,28 +0,0 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping 
-dump-coverage-mapping -emit-llvm-only -main-file-name if.c %s | FileCheck %s
-
-int main() {// CHECK: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 
= #0
-  int i = 0;
-// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> 
[[@LINE+1]]:12 = #0
-  if(i == 0) i = 1; // CHECK-NEXT: File 0, [[@LINE]]:14 -> 
[[@LINE]]:19 = #1
-// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> 
[[@LINE+1]]:12 = #0
-  if(i == 1)
-i = 2;  // CHECK-NEXT: File 0, [[@LINE]]:5 -> 
[[@LINE]]:10 = #2
-// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> 
[[@LINE+1]]:12 = #0
-  if(i == 0) { i = 1;   // CHECK-NEXT: File 0, [[@LINE]]:14 -> 
[[@LINE+2]]:4 = #3
-i = 2;
-  }
-// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> 
[[@LINE+1]]:12 = #0
-  if(i != 0) {  // CHECK-NEXT: File 0, [[@LINE]]:14 -> 
[[@LINE+2]]:4 = #4
-i = 1;
-  } else {  // CHECK-NEXT: File 0, [[@LINE]]:10 -> 
[[@LINE+2]]:4 = (#0 - #4)
-i = 3;
-  }
-
-  i = i == 0?
-i + 1 : // CHECK-NEXT: File 0, [[@LINE]]:9 -> 
[[@LINE]]:14 = #5
-i + 2;  // CHECK-NEXT: File 0, [[@LINE]]:9 -> 
[[@LINE]]:14 = (#0 - #5)
-// CHECK-NEXT: File 0, [[@LINE+1]]:14 -> 
[[@LINE+1]]:20 = #6
-  i = i == 0?i + 12:i + 10; // CHECK-NEXT: File 0, [[@LINE]]:21 -> 
[[@LINE]]:27 = (#0 - #6)
-
-  return 0;
-}

Copied: cfe/trunk/test/CoverageMapping/if.cpp (from r284292, 
cfe/trunk/test/CoverageMapping/if.c)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/if.cpp?p2=cfe/trunk/test/CoverageMapping/if.cpp=cfe/trunk/test/CoverageMapping/if.c=284292=284293=284293=diff
==
--- cfe/trunk/test/CoverageMapping/if.c (original)
+++ cfe/trunk/test/CoverageMapping/if.cpp Fri Oct 14 18:38:16 2016
@@ -1,5 +1,16 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping 
-dump-coverage-mapping -emit-llvm-only -main-file-name if.c %s | FileCheck %s
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping 
-dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple 
-main-file-name if.cpp %s | FileCheck %s
 
+int nop() { return 0; }
+
+// CHECK-LABEL: _Z3foov:
+void foo() {// CHECK-NEXT: [[@LINE]]:12 -> [[@LINE+5]]:2 = 
#0
+  if (int j = true ? nop()  // CHECK-NEXT: [[@LINE]]:22 -> [[@LINE]]:27 = 
#2
+   : nop(); // CHECK-NEXT: [[@LINE]]:22 -> 

[PATCH] D25572: [Coverage] Support for C++17 if initializers

2016-10-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284293: [Coverage] Support for C++17 if initializers 
(authored by vedantk).

Changed prior to commit:
  https://reviews.llvm.org/D25572?vs=74559=74753#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25572

Files:
  cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
  cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
  cfe/trunk/test/CoverageMapping/if.c
  cfe/trunk/test/CoverageMapping/if.cpp
  cfe/trunk/test/Profile/cxx-stmt-initializers.cpp

Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
@@ -875,6 +875,9 @@
 
   void VisitIfStmt(const IfStmt *S) {
 extendRegion(S);
+if (S->getInit())
+  Visit(S->getInit());
+
 // Extend into the condition before we propagate through it below - this is
 // needed to handle macros that generate the "if" but not the condition.
 extendRegion(S->getCond());
Index: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
@@ -490,6 +490,8 @@
   void VisitIfStmt(const IfStmt *S) {
 RecordStmtCount(S);
 uint64_t ParentCount = CurrentCount;
+if (S->getInit())
+  Visit(S->getInit());
 Visit(S->getCond());
 
 // Counter tracks the "then" part of an if statement. The count for
Index: cfe/trunk/test/Profile/cxx-stmt-initializers.cpp
===
--- cfe/trunk/test/Profile/cxx-stmt-initializers.cpp
+++ cfe/trunk/test/Profile/cxx-stmt-initializers.cpp
@@ -4,6 +4,7 @@
 // RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s
 
 // PGOGEN: @[[SIC:__profc__Z11switch_initv]] = private global [3 x i64] zeroinitializer
+// PGOGEN: @[[IIC:__profc__Z7if_initv]] = private global [3 x i64] zeroinitializer
 
 // Note: We expect counters for the function entry block, the condition in the
 // switch initializer, and the switch successor block.
@@ -15,3 +16,14 @@
   // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 2
   // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 1
 }
+
+// Note: We expect counters for the function entry block, the condition in the
+// if initializer, and the if successor block.
+//
+// CHECK-LABEL: define {{.*}}void @_Z7if_initv()
+// PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 0
+void if_init() {
+  if (int i = true ? 0 : 1; i) {}
+  // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 2
+  // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 1
+}
Index: cfe/trunk/test/CoverageMapping/if.cpp
===
--- cfe/trunk/test/CoverageMapping/if.cpp
+++ cfe/trunk/test/CoverageMapping/if.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name if.cpp %s | FileCheck %s
+
+int nop() { return 0; }
+
+// CHECK-LABEL: _Z3foov:
+void foo() {// CHECK-NEXT: [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
+  if (int j = true ? nop()  // CHECK-NEXT: [[@LINE]]:22 -> [[@LINE]]:27 = #2
+   : nop(); // CHECK-NEXT: [[@LINE]]:22 -> [[@LINE]]:27 = (#0 - #2)
+  j)// CHECK-NEXT: [[@LINE]]:7 -> [[@LINE]]:8 = #0
+++j;// CHECK-NEXT: [[@LINE]]:5 -> [[@LINE]]:8 = #1
+}
+
+// CHECK-LABEL: main:
+int main() {// CHECK: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
+  int i = 0;
+// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
+  if(i == 0) i = 1; // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE]]:19 = #1
+// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
+  if(i == 1)
+i = 2;  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = #2
+// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
+  if(i == 0) { i = 1;   // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #3
+i = 2;
+  }
+// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
+  if(i != 0) {  // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #4
+i = 1;
+  } else {  // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE+2]]:4 = (#0 - #4)
+i = 3;
+  }
+
+  i = i == 0?
+i + 1 : // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:14 = #5
+i + 2;  // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:14 = (#0 - #5)
+// CHECK-NEXT: File 0, [[@LINE+1]]:14 -> [[@LINE+1]]:20 = #6
+  i = i == 0?i + 12:i + 10; // CHECK-NEXT: File 0, [[@LINE]]:21 -> [[@LINE]]:27 = (#0 - #6)
+
+  return 0;
+}

[PATCH] D25539: [Coverage] Support for C++17 switch initializers

2016-10-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284292: [Coverage] Support for C++17 switch initializers 
(authored by vedantk).

Changed prior to commit:
  https://reviews.llvm.org/D25539?vs=74552=74752#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25539

Files:
  cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
  cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
  cfe/trunk/test/CoverageMapping/switch.c
  cfe/trunk/test/CoverageMapping/switch.cpp
  cfe/trunk/test/Profile/cxx-stmt-initializers.cpp

Index: cfe/trunk/test/CoverageMapping/switch.cpp
===
--- cfe/trunk/test/CoverageMapping/switch.cpp
+++ cfe/trunk/test/CoverageMapping/switch.cpp
@@ -0,0 +1,83 @@
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s
+
+// CHECK: foo
+void foo(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0
+  switch(i) {
+  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #2
+return;
+  case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #3
+break;
+  }
+  int x = 0;// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
+}
+
+int nop() { return 0; }
+
+// CHECK: bar
+void bar(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+20]]:2 = #0
+  switch (i)
+;   // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:6 = 0
+
+  switch (i) {  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+16]]:2 = #1
+  }
+
+  switch (i)// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2 = #2
+nop();  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = 0
+
+  switch (i)// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+10]]:2 = #3
+  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #5
+nop();
+
+  switch (i) {  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:2 = #4
+nop();  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:10 = 0
+  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #7
+nop();
+  }
+  nop();// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #6
+}
+
+// CHECK: baz
+void baz() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
+  switch (int i = true ? nop()  // CHECK-NEXT: [[@LINE]]:26 -> [[@LINE]]:31 = #2
+   : nop(); // CHECK-NEXT: [[@LINE]]:26 -> [[@LINE]]:31 = (#0 - #2)
+  i) {}
+  nop();// CHECK-NEXT: [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
+}
+
+// CHECK-NEXT: main
+int main() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+35]]:2 = #0
+  int i = 0;
+  switch(i) {
+  case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+7]]:10 = #2
+i = 1;
+break;
+  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:10 = #3
+i = 2;
+break;
+  default:  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #4
+break;
+  }
+  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+23]]:2 = #1
+  case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:10 = #6
+i = 1;
+break;
+  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #7
+i = 2;
+  default:  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = (#7 + #8)
+break;
+  }
+
+  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2 = #5
+  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:11 = #10
+  case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:11 = (#10 + #11)
+i = 11;
+  case 3:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11 = ((#10 + #11) + #12)
+  case 4:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:11 = (((#10 + #11) + #12) + #13)
+i = 99;
+  }
+
+  foo(1);   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:11 = #9
+  bar(1);
+  baz();
+  return 0;
+}
Index: cfe/trunk/test/CoverageMapping/switch.c
===
--- cfe/trunk/test/CoverageMapping/switch.c
+++ cfe/trunk/test/CoverageMapping/switch.c
@@ -1,73 +0,0 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name switch.c %s | FileCheck %s
-// CHECK: foo
-void foo(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0
-  switch(i) {
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #2
-return;
-  case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #3
-break;
-  }
-  int x = 0;// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
-}
-
-void nop() {}
-
-// CHECK: bar
-void bar(int i) {   // 

r284292 - [Coverage] Support for C++17 switch initializers

2016-10-14 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Fri Oct 14 18:38:13 2016
New Revision: 284292

URL: http://llvm.org/viewvc/llvm-project?rev=284292=rev
Log:
[Coverage] Support for C++17 switch initializers

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

Added:
cfe/trunk/test/CoverageMapping/switch.cpp
  - copied, changed from r284288, cfe/trunk/test/CoverageMapping/switch.c
cfe/trunk/test/Profile/cxx-stmt-initializers.cpp
Removed:
cfe/trunk/test/CoverageMapping/switch.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=284292=284291=284292=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri Oct 14 18:38:13 2016
@@ -458,6 +458,8 @@ struct ComputeRegionCounts : public Cons
 
   void VisitSwitchStmt(const SwitchStmt *S) {
 RecordStmtCount(S);
+if (S->getInit())
+  Visit(S->getInit());
 Visit(S->getCond());
 CurrentCount = 0;
 BreakContinueStack.push_back(BreakContinue());

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=284292=284291=284292=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Fri Oct 14 18:38:13 2016
@@ -813,6 +813,8 @@ struct CounterCoverageMappingBuilder
 
   void VisitSwitchStmt(const SwitchStmt *S) {
 extendRegion(S);
+if (S->getInit())
+  Visit(S->getInit());
 Visit(S->getCond());
 
 BreakContinueStack.push_back(BreakContinue());

Removed: cfe/trunk/test/CoverageMapping/switch.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/switch.c?rev=284291=auto
==
--- cfe/trunk/test/CoverageMapping/switch.c (original)
+++ cfe/trunk/test/CoverageMapping/switch.c (removed)
@@ -1,73 +0,0 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping 
-dump-coverage-mapping -emit-llvm-only -main-file-name switch.c %s | FileCheck 
%s
-// CHECK: foo
-void foo(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0
-  switch(i) {
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #2
-return;
-  case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #3
-break;
-  }
-  int x = 0;// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
-}
-
-void nop() {}
-
-// CHECK: bar
-void bar(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+20]]:2 = #0
-  switch (i)
-;   // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:6 = 0
-
-  switch (i) {  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+16]]:2 = #1
-  }
-
-  switch (i)// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2 = #2
-nop();  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:10 = 0
-
-  switch (i)// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+10]]:2 = #3
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #5
-nop();
-
-  switch (i) {  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:2 = #4
-nop();  // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:10 = 0
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #7
-nop();
-  }
-  nop();// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #6
-}
-
-// CHECK-NEXT: main
-int main() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+34]]:2 = #0
-  int i = 0;
-  switch(i) {
-  case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+7]]:10 = #2
-i = 1;
-break;
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:10 = #3
-i = 2;
-break;
-  default:  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #4
-break;
-  }
-  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+22]]:2 = #1
-  case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:10 = #6
-i = 1;
-break;
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:10 = #7
-i = 2;
-  default:  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = (#7 
+ #8)
-break;
-  }
-
-  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+12]]:2 = #5
-  case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:11 = #10
-  case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:11 = 
(#10 + #11)
-i = 11;
-  case 3:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11 = 
((#10 + #11) + #12)
-  case 4:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:11 

[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Vitaly Buka via cfe-commits
vitalybuka added a comment.

So there is:

- Looking for __cxa_thread_atexit_impl in c
- Looking for __cxa_thread_atexit_impl in c - not found

and libcxx is configured with -DLIBCXX_ENABLE_THREADS=OFF


https://reviews.llvm.org/D24864



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


[PATCH] D24864: [libcxxabi] Refactor pthread usage into a separate API

2016-10-14 Thread Vitaly Buka via cfe-commits
vitalybuka added a comment.

This change breaks 
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/25625/steps/build%2032-bit%20symbolizer%20for%20compiler_rt_build/logs/stdio


https://reviews.llvm.org/D24864



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


[PATCH] D25586: [clang-move] Use cl::list and cl::CommaSeparated for the list of names.

2016-10-14 Thread Alexander Shaposhnikov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284291: [clang-move] Use cl::list for the list of names 
(authored by alexshap).

Changed prior to commit:
  https://reviews.llvm.org/D25586?vs=74599=74749#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25586

Files:
  clang-tools-extra/trunk/clang-move/ClangMove.cpp
  clang-tools-extra/trunk/clang-move/ClangMove.h
  clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
  clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp


Index: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
===
--- clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
+++ clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
@@ -213,7 +213,7 @@
 
 TEST(ClangMove, MoveHeaderAndCC) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "a::b::Foo";
+  Spec.Names = { "a::b::Foo" };
   Spec.OldHeader = "foo.h";
   Spec.OldCC = "foo.cc";
   Spec.NewHeader = "new_foo.h";
@@ -228,7 +228,7 @@
 
 TEST(ClangMove, MoveHeaderOnly) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "a::b::Foo";
+  Spec.Names = { "a::b::Foo" };
   Spec.OldHeader = "foo.h";
   Spec.NewHeader = "new_foo.h";
   auto Results = runClangMoveOnCode(Spec);
@@ -239,7 +239,7 @@
 
 TEST(ClangMove, MoveCCOnly) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "a::b::Foo";
+  Spec.Names = { "a::b::Foo" };
   Spec.OldCC = "foo.cc";
   Spec.NewCC = "new_foo.cc";
   std::string ExpectedHeader = "#include \"foo.h\"\n\n";
@@ -251,7 +251,7 @@
 
 TEST(ClangMove, MoveNonExistClass) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "NonExistFoo";
+  Spec.Names = { "NonExistFoo" };
   Spec.OldHeader = "foo.h";
   Spec.OldCC = "foo.cc";
   Spec.NewHeader = "new_foo.h";
Index: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
===
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
@@ -38,10 +38,10 @@
 
 cl::OptionCategory ClangMoveCategory("clang-move options");
 
-cl::opt
-Names("names", cl::desc("A comma-separated list of the names of classes "
-"being moved, e.g. \"Foo\", \"a::Foo, b::Foo\"."),
-  cl::cat(ClangMoveCategory));
+cl::list Names("names", cl::CommaSeparated, cl::OneOrMore,
+cl::desc("The list of the names of classes being "
+ "moved, e.g. \"Foo,a::Foo,b::Foo\"."),
+cl::cat(ClangMoveCategory));
 
 cl::opt
 OldHeader("old_header",
@@ -90,7 +90,7 @@
   tooling::RefactoringTool Tool(OptionsParser.getCompilations(),
 OptionsParser.getSourcePathList());
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = Names;
+  Spec.Names = { Names.begin(), Names.end() };
   Spec.OldHeader = OldHeader;
   Spec.NewHeader = NewHeader;
   Spec.OldCC = OldCC;
Index: clang-tools-extra/trunk/clang-move/ClangMove.cpp
===
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp
@@ -311,10 +311,8 @@
 }
 
 void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
-  SmallVector ClassNames;
-  llvm::StringRef(Spec.Names).split(ClassNames, ',');
   Optional InMovedClassNames;
-  for (StringRef ClassName : ClassNames) {
+  for (StringRef ClassName : Spec.Names) {
 llvm::StringRef GlobalClassName = ClassName.trim().ltrim(':');
 const auto HasName = hasName(("::" + GlobalClassName).str());
 InMovedClassNames =
Index: clang-tools-extra/trunk/clang-move/ClangMove.h
===
--- clang-tools-extra/trunk/clang-move/ClangMove.h
+++ clang-tools-extra/trunk/clang-move/ClangMove.h
@@ -37,9 +37,8 @@
   };
 
   struct MoveDefinitionSpec {
-// A comma-separated list of fully qualified names, e.g. "Foo",
-// "a::Foo, b::Foo".
-std::string Names;
+// The list of fully qualified names, e.g. Foo, a::Foo, b::Foo.
+SmallVector Names;
 // The file path of old header, can be relative path and absolute path.
 std::string OldHeader;
 // The file path of old cc, can be relative path and absolute path.


Index: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
===
--- clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
+++ clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
@@ -213,7 +213,7 @@
 
 TEST(ClangMove, MoveHeaderAndCC) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "a::b::Foo";
+  Spec.Names = { "a::b::Foo" };
   

[clang-tools-extra] r284291 - [clang-move] Use cl::list for the list of names

2016-10-14 Thread Alexander Shaposhnikov via cfe-commits
Author: alexshap
Date: Fri Oct 14 18:16:25 2016
New Revision: 284291

URL: http://llvm.org/viewvc/llvm-project?rev=284291=rev
Log:
[clang-move] Use cl::list for the list of names

This diff replaces manual parsing of the comma-separated list of names with 
cl::list and cl::CommaSeparated.
Test plan: make -j8 check-clang-tools

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

Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp
clang-tools-extra/trunk/clang-move/ClangMove.h
clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=284291=284290=284291=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Fri Oct 14 18:16:25 2016
@@ -311,10 +311,8 @@ ClangMoveTool::ClangMoveTool(
 }
 
 void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
-  SmallVector ClassNames;
-  llvm::StringRef(Spec.Names).split(ClassNames, ',');
   Optional InMovedClassNames;
-  for (StringRef ClassName : ClassNames) {
+  for (StringRef ClassName : Spec.Names) {
 llvm::StringRef GlobalClassName = ClassName.trim().ltrim(':');
 const auto HasName = hasName(("::" + GlobalClassName).str());
 InMovedClassNames =

Modified: clang-tools-extra/trunk/clang-move/ClangMove.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.h?rev=284291=284290=284291=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.h (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.h Fri Oct 14 18:16:25 2016
@@ -37,9 +37,8 @@ public:
   };
 
   struct MoveDefinitionSpec {
-// A comma-separated list of fully qualified names, e.g. "Foo",
-// "a::Foo, b::Foo".
-std::string Names;
+// The list of fully qualified names, e.g. Foo, a::Foo, b::Foo.
+SmallVector Names;
 // The file path of old header, can be relative path and absolute path.
 std::string OldHeader;
 // The file path of old cc, can be relative path and absolute path.

Modified: clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp?rev=284291=284290=284291=diff
==
--- clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp (original)
+++ clang-tools-extra/trunk/clang-move/tool/ClangMoveMain.cpp Fri Oct 14 
18:16:25 2016
@@ -38,10 +38,10 @@ std::error_code CreateNewFile(const llvm
 
 cl::OptionCategory ClangMoveCategory("clang-move options");
 
-cl::opt
-Names("names", cl::desc("A comma-separated list of the names of classes "
-"being moved, e.g. \"Foo\", \"a::Foo, b::Foo\"."),
-  cl::cat(ClangMoveCategory));
+cl::list Names("names", cl::CommaSeparated, cl::OneOrMore,
+cl::desc("The list of the names of classes being "
+ "moved, e.g. \"Foo,a::Foo,b::Foo\"."),
+cl::cat(ClangMoveCategory));
 
 cl::opt
 OldHeader("old_header",
@@ -90,7 +90,7 @@ int main(int argc, const char **argv) {
   tooling::RefactoringTool Tool(OptionsParser.getCompilations(),
 OptionsParser.getSourcePathList());
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = Names;
+  Spec.Names = { Names.begin(), Names.end() };
   Spec.OldHeader = OldHeader;
   Spec.NewHeader = NewHeader;
   Spec.OldCC = OldCC;

Modified: clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp?rev=284291=284290=284291=diff
==
--- clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp Fri Oct 14 
18:16:25 2016
@@ -213,7 +213,7 @@ runClangMoveOnCode(const move::ClangMove
 
 TEST(ClangMove, MoveHeaderAndCC) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "a::b::Foo";
+  Spec.Names = { "a::b::Foo" };
   Spec.OldHeader = "foo.h";
   Spec.OldCC = "foo.cc";
   Spec.NewHeader = "new_foo.h";
@@ -228,7 +228,7 @@ TEST(ClangMove, MoveHeaderAndCC) {
 
 TEST(ClangMove, MoveHeaderOnly) {
   move::ClangMoveTool::MoveDefinitionSpec Spec;
-  Spec.Names = "a::b::Foo";
+  Spec.Names = { "a::b::Foo" };
   Spec.OldHeader = "foo.h";
   Spec.NewHeader = "new_foo.h";
   auto Results = runClangMoveOnCode(Spec);
@@ 

Re: [libcxx] r284210 - XFAIL aligned allocation test failures with UBSAN

2016-10-14 Thread Eric Fiselier via cfe-commits
Thanks Richard. I've fixed the tests in r284289.

On Fri, Oct 14, 2016 at 4:40 PM, Richard Smith 
wrote:

> On Fri, Oct 14, 2016 at 3:34 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Oh, I have another idea: could it be that you're also turning some
>> optimization on when UBSan is enabled? Note that the operator new/operator
>> delete pair is elidable in each of these tests, and Clang will remove the
>> calls when compiling with optimizations enabled.
>>
>> That's it. The UBSAN tests build w/ -O2.
>>
>
> OK. You should be able to get the tests to pass by escaping the allocation
> somehow. Try changing the type of the x variable to 'B *volatile'.
>
>
>> /Eric
>>
>> On Fri, Oct 14, 2016 at 4:18 PM, Richard Smith 
>> wrote:
>>
>>> Oh, I have another idea: could it be that you're also turning some
>>> optimization on when UBSan is enabled? Note that the operator new/operator
>>> delete pair is elidable in each of these tests, and Clang will remove the
>>> calls when compiling with optimizations enabled.
>>>
>>> On Fri, Oct 14, 2016 at 2:38 PM, Eric Fiselier via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 UBSAN may not be replacing the function, but it is doing something
 weird at the codegen level. I looked into this a while ago but never sorted
 it out.

 Either way I'll clarify the comments and add the missing reset() calls.
 Unfortunately the tests still fail in the same way.

 On Fri, Oct 14, 2016 at 11:49 AM, Richard Smith 
 wrote:

> On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Fri Oct 14 02:49:15 2016
>> New Revision: 284210
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=284210=rev
>> Log:
>> XFAIL  aligned allocation test failures with UBSAN
>>
>> Modified:
>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>> elete/new.delete.single/delete_align_val_t_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>>
>> Modified: libcxx/trunk/test/std/language
>> .support/support.dynamic/new.delete/new.delete.array/delete_
>> align_val_t_replace.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>> nguage.support/support.dynamic/new.delete/new.delete.array/d
>> elete_align_val_t_replace.pass.cpp?rev=284210=284209=2
>> 84210=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d
>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp Fri Oct
>> 14 02:49:15 2016
>> @@ -17,6 +17,9 @@
>>  // None of the current GCC compilers support this.
>>  // XFAIL: gcc-4, gcc-5, gcc-6
>>
>> +// UBSAN replaces certain new/delete functions which makes this test
>> fail
>>
>
> I don't think that's the problem; the UBSan runtime doesn't replace
> any functions. Instead...
>
>
>> +// XFAIL: ubsan
>> +
>>  #include 
>>  #include 
>>  #include 
>> @@ -58,24 +61,24 @@ struct alignas(std::max_align_t) B {};
>>  int main()
>>  {
>>
>
> I think you're missing a call to reset() here. It looks like the
> sanitizer runtimes happen to call 'operator new' before entering main.
>
>
>>  {
>> -B *x = new B;
>> +B *x = new B[2];
>>  assert(0 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(0 == aligned_delete_called);
>>
>> -delete x;
>> +delete [] x;
>>  assert(1 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(0 == aligned_delete_called);
>>  }
>>  reset();
>>  {
>> -A *x = new A;
>> +A *x = new A[2];
>>  assert(0 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(0 == aligned_delete_called);
>>
>> -delete x;
>> +delete [] x;
>>  assert(0 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(1 == 

[libcxx] r284289 - Prevent new/delete replacement tests from being optimized away.

2016-10-14 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 14 17:47:08 2016
New Revision: 284289

URL: http://llvm.org/viewvc/llvm-project?rev=284289=rev
Log:
Prevent new/delete replacement tests from being optimized away.

Modified:

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp?rev=284289=284288=284289=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
 Fri Oct 14 17:47:08 2016
@@ -15,10 +15,7 @@
 // XFAIL: clang-3, apple-clang
 
 // None of the current GCC compilers support this.
-// XFAIL: gcc-4, gcc-5, gcc-6
-
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
+// XFAIL: gcc
 
 #include 
 #include 
@@ -58,28 +55,31 @@ void operator delete [] (void* p, std::a
 struct alignas(OverAligned) A {};
 struct alignas(std::max_align_t) B {};
 
+B* volatile b; // Escape the memory
+A* volatile a;
+
 int main()
 {
 reset();
 {
-B *x = new B[2];
+b = new B[2];
 assert(0 == unsized_delete_called);
 assert(0 == unsized_delete_nothrow_called);
 assert(0 == aligned_delete_called);
 
-delete [] x;
+delete [] b;
 assert(1 == unsized_delete_called);
 assert(0 == unsized_delete_nothrow_called);
 assert(0 == aligned_delete_called);
 }
 reset();
 {
-A *x = new A[2];
+a = new A[2];
 assert(0 == unsized_delete_called);
 assert(0 == unsized_delete_nothrow_called);
 assert(0 == aligned_delete_called);
 
-delete [] x;
+delete [] a;
 assert(0 == unsized_delete_called);
 assert(0 == unsized_delete_nothrow_called);
 assert(1 == aligned_delete_called);

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp?rev=284289=284288=284289=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
 Fri Oct 14 17:47:08 2016
@@ -11,10 +11,6 @@
 
 // UNSUPPORTED: sanitizer-new-delete
 
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
-
-
 #include 
 #include 
 #include 
@@ -45,9 +41,11 @@ struct A
 ~A() {--A_constructed;}
 };
 
+A* volatile ap;
+
 int main()
 {
-A* ap = new (std::nothrow) A[3];
+ap = new (std::nothrow) A[3];
 assert(ap);
 assert(A_constructed == 3);
 assert(new_called);

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp?rev=284289=284288=284289=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
 Fri Oct 14 17:47:08 2016
@@ -11,9 +11,6 @@
 
 // UNSUPPORTED: sanitizer-new-delete
 
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
-
 
 #include 
 #include 
@@ -45,9 

LLVM buildmaster will be updated and restarted tonight

2016-10-14 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 5 PM Pacific time
today.

Thanks

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


r284288 - Sema: honour dllexport in itanium more faithfully

2016-10-14 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Oct 14 17:25:46 2016
New Revision: 284288

URL: http://llvm.org/viewvc/llvm-project?rev=284288=rev
Log:
Sema: honour dllexport in itanium more faithfully

Although the itanium environment uses the itanium layout for C++, treat the
dllexport semantics more similarly to the MSVC specification.  This preserves
the existing behaviour for the use of the itanium ABI on non-windows-itanium
environments.  Export the inline definitions too.

Added:
cfe/trunk/test/CodeGenCXX/windows-itanium-dllexport.cpp
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=284288=284287=284288=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Oct 14 17:25:46 2016
@@ -5546,7 +5546,8 @@ void Sema::checkClassLevelDLLAttribute(C
 
   if (MD->isInlined()) {
 // MinGW does not import or export inline methods.
-if (!Context.getTargetInfo().getCXXABI().isMicrosoft())
+if (!Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+!Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())
   continue;
 
 // MSVC versions before 2015 don't export the move assignment operators

Added: cfe/trunk/test/CodeGenCXX/windows-itanium-dllexport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/windows-itanium-dllexport.cpp?rev=284288=auto
==
--- cfe/trunk/test/CodeGenCXX/windows-itanium-dllexport.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/windows-itanium-dllexport.cpp Fri Oct 14 17:25:46 
2016
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fdeclspec %s -o - 
| FileCheck %s
+
+struct __declspec(dllexport) s {
+  void f() {}
+};
+
+// CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_
+// CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv
+


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


Re: [libcxx] r284210 - XFAIL aligned allocation test failures with UBSAN

2016-10-14 Thread Eric Fiselier via cfe-commits
Oh, I have another idea: could it be that you're also turning some
optimization on when UBSan is enabled? Note that the operator new/operator
delete pair is elidable in each of these tests, and Clang will remove the
calls when compiling with optimizations enabled.

That's it. The UBSAN tests build w/ -O2.

/Eric

On Fri, Oct 14, 2016 at 4:18 PM, Richard Smith 
wrote:

> Oh, I have another idea: could it be that you're also turning some
> optimization on when UBSan is enabled? Note that the operator new/operator
> delete pair is elidable in each of these tests, and Clang will remove the
> calls when compiling with optimizations enabled.
>
> On Fri, Oct 14, 2016 at 2:38 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> UBSAN may not be replacing the function, but it is doing something weird
>> at the codegen level. I looked into this a while ago but never sorted it
>> out.
>>
>> Either way I'll clarify the comments and add the missing reset() calls.
>> Unfortunately the tests still fail in the same way.
>>
>> On Fri, Oct 14, 2016 at 11:49 AM, Richard Smith 
>> wrote:
>>
>>> On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: ericwf
 Date: Fri Oct 14 02:49:15 2016
 New Revision: 284210

 URL: http://llvm.org/viewvc/llvm-project?rev=284210=rev
 Log:
 XFAIL  aligned allocation test failures with UBSAN

 Modified:
 libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/delete_align_val_t_replace.pass.cpp
 libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
 libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.single/delete_align_val_t_replace.pass.cpp
 libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp

 Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/delete_align_val_t_replace.pass.cpp
 URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
 nguage.support/support.dynamic/new.delete/new.delete.array/d
 elete_align_val_t_replace.pass.cpp?rev=284210=284209=2
 84210=diff
 
 ==
 --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/delete_align_val_t_replace.pass.cpp (original)
 +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/delete_align_val_t_replace.pass.cpp Fri Oct 14
 02:49:15 2016
 @@ -17,6 +17,9 @@
  // None of the current GCC compilers support this.
  // XFAIL: gcc-4, gcc-5, gcc-6

 +// UBSAN replaces certain new/delete functions which makes this test
 fail

>>>
>>> I don't think that's the problem; the UBSan runtime doesn't replace any
>>> functions. Instead...
>>>
>>>
 +// XFAIL: ubsan
 +
  #include 
  #include 
  #include 
 @@ -58,24 +61,24 @@ struct alignas(std::max_align_t) B {};
  int main()
  {

>>>
>>> I think you're missing a call to reset() here. It looks like the
>>> sanitizer runtimes happen to call 'operator new' before entering main.
>>>
>>>
  {
 -B *x = new B;
 +B *x = new B[2];
  assert(0 == unsized_delete_called);
  assert(0 == unsized_delete_nothrow_called);
  assert(0 == aligned_delete_called);

 -delete x;
 +delete [] x;
  assert(1 == unsized_delete_called);
  assert(0 == unsized_delete_nothrow_called);
  assert(0 == aligned_delete_called);
  }
  reset();
  {
 -A *x = new A;
 +A *x = new A[2];
  assert(0 == unsized_delete_called);
  assert(0 == unsized_delete_nothrow_called);
  assert(0 == aligned_delete_called);

 -delete x;
 +delete [] x;
  assert(0 == unsized_delete_called);
  assert(0 == unsized_delete_nothrow_called);
  assert(1 == aligned_delete_called);

 Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
 URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
 nguage.support/support.dynamic/new.delete/new.delete.array/n
 ew_align_val_t_nothrow_replace.pass.cpp?rev=284210=284209
 =284210=diff
 
 ==
 --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
 elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
 (original)
 

Re: [libcxx] r284210 - XFAIL aligned allocation test failures with UBSAN

2016-10-14 Thread Richard Smith via cfe-commits
Oh, I have another idea: could it be that you're also turning some
optimization on when UBSan is enabled? Note that the operator new/operator
delete pair is elidable in each of these tests, and Clang will remove the
calls when compiling with optimizations enabled.

On Fri, Oct 14, 2016 at 2:38 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> UBSAN may not be replacing the function, but it is doing something weird
> at the codegen level. I looked into this a while ago but never sorted it
> out.
>
> Either way I'll clarify the comments and add the missing reset() calls.
> Unfortunately the tests still fail in the same way.
>
> On Fri, Oct 14, 2016 at 11:49 AM, Richard Smith 
> wrote:
>
>> On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: ericwf
>>> Date: Fri Oct 14 02:49:15 2016
>>> New Revision: 284210
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=284210=rev
>>> Log:
>>> XFAIL  aligned allocation test failures with UBSAN
>>>
>>> Modified:
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.single/delete_align_val_t_replace.pass.cpp
>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>>>
>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>>> nguage.support/support.dynamic/new.delete/new.delete.array/d
>>> elete_align_val_t_replace.pass.cpp?rev=284210=284209=
>>> 284210=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp (original)
>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp Fri Oct 14
>>> 02:49:15 2016
>>> @@ -17,6 +17,9 @@
>>>  // None of the current GCC compilers support this.
>>>  // XFAIL: gcc-4, gcc-5, gcc-6
>>>
>>> +// UBSAN replaces certain new/delete functions which makes this test
>>> fail
>>>
>>
>> I don't think that's the problem; the UBSan runtime doesn't replace any
>> functions. Instead...
>>
>>
>>> +// XFAIL: ubsan
>>> +
>>>  #include 
>>>  #include 
>>>  #include 
>>> @@ -58,24 +61,24 @@ struct alignas(std::max_align_t) B {};
>>>  int main()
>>>  {
>>>
>>
>> I think you're missing a call to reset() here. It looks like the
>> sanitizer runtimes happen to call 'operator new' before entering main.
>>
>>
>>>  {
>>> -B *x = new B;
>>> +B *x = new B[2];
>>>  assert(0 == unsized_delete_called);
>>>  assert(0 == unsized_delete_nothrow_called);
>>>  assert(0 == aligned_delete_called);
>>>
>>> -delete x;
>>> +delete [] x;
>>>  assert(1 == unsized_delete_called);
>>>  assert(0 == unsized_delete_nothrow_called);
>>>  assert(0 == aligned_delete_called);
>>>  }
>>>  reset();
>>>  {
>>> -A *x = new A;
>>> +A *x = new A[2];
>>>  assert(0 == unsized_delete_called);
>>>  assert(0 == unsized_delete_nothrow_called);
>>>  assert(0 == aligned_delete_called);
>>>
>>> -delete x;
>>> +delete [] x;
>>>  assert(0 == unsized_delete_called);
>>>  assert(0 == unsized_delete_nothrow_called);
>>>  assert(1 == aligned_delete_called);
>>>
>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>>> nguage.support/support.dynamic/new.delete/new.delete.array/n
>>> ew_align_val_t_nothrow_replace.pass.cpp?rev=284210=284209
>>> =284210=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>>> (original)
>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp Fri Oct
>>> 14 02:49:15 2016
>>> @@ -13,9 +13,6 @@
>>>
>>>  // UNSUPPORTED: sanitizer-new-delete
>>>
>>> -// TODO Investigate why UBSAN prevents nothrow new from calling our
>>> replacement.
>>> -// XFAIL: ubsan
>>> -
>>>  #include 
>>>  #include 
>>>  #include 
>>>
>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
>>> 

Re: [libcxx] r249738 - Split out of .

2016-10-14 Thread Richard Smith via cfe-commits
On Fri, Oct 14, 2016 at 11:44 AM, Bruno Cardoso Lopes <
bruno.card...@gmail.com> wrote:

> Hi Richard,
>
> I have a patch on top of your suggested patch from a year ago, that
> break the cyclic dependency we're seeing, with this (and a few changes
> to the SDK) we can bootstrap clang with submodule local visibility on
> darwin. I've attached the patch with a reduced, standalone testcase
> that doesn't depend on the SDK. The issues that are not covered by
> your patch, that I cover in mine, are related to built-in and textual
> headers: they can be found in paths where they don't map to any
> modules, triggering other cycles. I fix that by looking further to
> find a matching module for the header in question, instead the first
> found header in header search.
>

It looks like the 0002 patch is working around a bug in the 0001 patch:
with 0001 applied, a module with [no_undeclared_includes] can still include
a textual header from another module on which it doesn't declare a
dependency (in the testcase, the libc module is incorrectly permitted to
include the textual header  from libc++). Rather than preferring
non-modular headers over modular headers as the 0002 patch does, I wonder
if the issue could instead be resolved by fixing that apparent bug.

I gave that a go; the result is attached. I also had to change the way we
handle builtin headers -- instead of implicitly including (for instance)
the builtin  as a modular header in any module that provides its
own , I now only include it as a textual header (this also lets
us use the same approach for this case whether or not we're using local
submodule visibility). That exposed a couple of testcases that were
(unreasonably, in my opinion) failing to include_next the real builtin
header from their wrapper header.

The attached patch causes your testcase to pass; I'd be interested to know
if it works in practice on Darwin.

Thanks!


> Can you take a look?
>
> Thanks,
>
>
> On Thu, Jul 28, 2016 at 3:55 PM, Adrian Prantl via cfe-commits
>  wrote:
> > +Bruno
> >
> > On Jul 27, 2016, at 11:58 PM, Nico Weber  wrote:
> >
> > I played with modules a bit today, and as far as I can tell this is still
> > broken. If this proves difficult to fix, should this change be reverted
> for
> > now? It breaks using modules on Darwin.
> >
> > On Sun, Mar 13, 2016 at 12:53 AM, Adrian Prantl via cfe-commits
> >  wrote:
> >>
> >> > On Mar 11, 2016, at 4:11 PM, Duncan P. N. Exon Smith
> >> >  wrote:
> >> >
> >> > Did anyone file a PR for this?
> >> >
> >>
> >> I filed PR 26928 - Prune the include path for modules
> >> https://llvm.org/bugs/show_bug.cgi?id=26928
> >> as a starting point.
> >>
> >> -- adrian
> >>
> >> ___
> >> 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
> >
>
>
>
> --
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc
>
Index: include/clang/Basic/Module.h
===
--- include/clang/Basic/Module.h(revision 284181)
+++ include/clang/Basic/Module.h(working copy)
@@ -201,6 +201,10 @@
   /// built.
   unsigned ConfigMacrosExhaustive : 1;
 
+  /// \brief Whether files in this module can only include files from used
+  /// modules.
+  unsigned NoUndeclaredIncludes : 1;
+
   /// \brief Describes the visibility of the various names within a
   /// particular module.
   enum NameVisibilityKind {
Index: include/clang/Lex/HeaderSearch.h
===
--- include/clang/Lex/HeaderSearch.h(revision 284181)
+++ include/clang/Lex/HeaderSearch.h(working copy)
@@ -523,8 +523,10 @@
   /// \brief Retrieve the module that corresponds to the given file, if any.
   ///
   /// \param File The header that we wish to map to a module.
-  ModuleMap::KnownHeader findModuleForHeader(const FileEntry *File) const;
-  
+  /// \param AllowTextual Whether we want to find textual headers too.
+  ModuleMap::KnownHeader findModuleForHeader(const FileEntry *File,
+ bool AllowTextual = false) const;
+
   /// \brief Read the contents of the given module map file.
   ///
   /// \param File The module map file.
Index: include/clang/Lex/ModuleMap.h
===
--- include/clang/Lex/ModuleMap.h   (revision 284181)
+++ include/clang/Lex/ModuleMap.h   (working copy)
@@ -171,7 +171,8 @@
 
   /// \brief The set of attributes that can be attached to a module.
   struct Attributes {
-Attributes() : IsSystem(), IsExternC(), IsExhaustive() {}
+Attributes()
+: 

r284285 - Add more swift calling convention tests

2016-10-14 Thread Arnold Schwaighofer via cfe-commits
Author: arnolds
Date: Fri Oct 14 16:55:56 2016
New Revision: 284285

URL: http://llvm.org/viewvc/llvm-project?rev=284285=rev
Log:
Add more swift calling convention tests

Modified:
cfe/trunk/test/CodeGen/64bit-swiftcall.c
cfe/trunk/test/CodeGen/arm-swiftcall.c

Modified: cfe/trunk/test/CodeGen/64bit-swiftcall.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/64bit-swiftcall.c?rev=284285=284284=284285=diff
==
--- cfe/trunk/test/CodeGen/64bit-swiftcall.c (original)
+++ cfe/trunk/test/CodeGen/64bit-swiftcall.c Fri Oct 14 16:55:56 2016
@@ -71,6 +71,9 @@ typedef int int3 __attribute__((ext_vect
 typedef int int4 __attribute__((ext_vector_type(4)));
 typedef int int5 __attribute__((ext_vector_type(5)));
 typedef int int8 __attribute__((ext_vector_type(8)));
+typedef char char16 __attribute__((ext_vector_type(16)));
+typedef short short8 __attribute__((ext_vector_type(8)));
+typedef long long long2 __attribute__((ext_vector_type(2)));
 
 #define TEST(TYPE)   \
   SWIFTCALL TYPE return_##TYPE(void) {   \
@@ -510,8 +513,38 @@ typedef struct {
   double d1;
 } struct_d2;
 TEST(struct_d2)
+
 // CHECK-LABEL: define swiftcc { double, double } @return_struct_d2()
 // CHECK-LABEL: define swiftcc void @take_struct_d2(double, double)
+typedef struct {
+  double d0;
+  double d1;
+  double d2;
+} struct_d3;
+TEST(struct_d3)
+// CHECK-LABEL: define swiftcc { double, double, double } @return_struct_d3()
+// CHECK-LABEL: define swiftcc void @take_struct_d3(double, double, double)
+
+typedef struct {
+  double d0;
+  double d1;
+  double d2;
+  double d3;
+} struct_d4;
+TEST(struct_d4)
+// CHECK-LABEL: define swiftcc { double, double, double, double } 
@return_struct_d4()
+// CHECK-LABEL: define swiftcc void @take_struct_d4(double, double, double, 
double)
+
+typedef struct {
+  double d0;
+  double d1;
+  double d2;
+  double d3;
+  double d4;
+} struct_d5;
+TEST(struct_d5)
+// CHECK: define swiftcc void @return_struct_d5([[STRUCT5:%.*]]* noalias sret
+// CHECK: define swiftcc void @take_struct_d5([[STRUCT5]]
 
 typedef struct {
   char c0;
@@ -700,6 +733,263 @@ TEST(struct_l5)
 // CHECK: define swiftcc void @return_struct_l5([[STRUCT5:%.*]]* noalias sret
 // CHECK: define swiftcc void @take_struct_l5([[STRUCT5]]*
 
+typedef struct {
+  char16 c0;
+} struct_vc1;
+TEST(struct_vc1)
+// CHECK-LABEL: define swiftcc <16 x i8> @return_struct_vc1()
+// CHECK-LABEL: define swiftcc void @take_struct_vc1(<16 x i8>)
+
+typedef struct {
+  char16 c0;
+  char16 c1;
+} struct_vc2;
+TEST(struct_vc2)
+// CHECK-LABEL: define swiftcc { <16 x i8>, <16 x i8> } @return_struct_vc2()
+// CHECK-LABEL: define swiftcc void @take_struct_vc2(<16 x i8>, <16 x i8>)
+
+typedef struct {
+  char16 c0;
+  char16 c1;
+  char16 c2;
+} struct_vc3;
+TEST(struct_vc3)
+// CHECK-LABEL: define swiftcc { <16 x i8>, <16 x i8>, <16 x i8> } 
@return_struct_vc3()
+// CHECK-LABEL: define swiftcc void @take_struct_vc3(<16 x i8>, <16 x i8>, <16 
x i8>)
+
+typedef struct {
+  char16 c0;
+  char16 c1;
+  char16 c2;
+  char16 c3;
+} struct_vc4;
+TEST(struct_vc4)
+// CHECK-LABEL: define swiftcc { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } 
@return_struct_vc4()
+// CHECK-LABEL: define swiftcc void @take_struct_vc4(<16 x i8>, <16 x i8>, <16 
x i8>, <16 x i8>)
+
+typedef struct {
+  char16 c0;
+  char16 c1;
+  char16 c2;
+  char16 c3;
+  char16 c4;
+} struct_vc5;
+TEST(struct_vc5)
+// CHECK: define swiftcc void @return_struct_vc5([[STRUCT:%.*]]* noalias sret
+// CHECK: define swiftcc void @take_struct_vc5([[STRUCT]]
+
+typedef struct {
+  short8 c0;
+} struct_vs1;
+TEST(struct_vs1)
+// CHECK-LABEL: define swiftcc <8 x i16> @return_struct_vs1()
+// CHECK-LABEL: define swiftcc void @take_struct_vs1(<8 x i16>)
+
+typedef struct {
+  short8 c0;
+  short8 c1;
+} struct_vs2;
+TEST(struct_vs2)
+// CHECK-LABEL: define swiftcc { <8 x i16>, <8 x i16> } @return_struct_vs2()
+// CHECK-LABEL: define swiftcc void @take_struct_vs2(<8 x i16>, <8 x i16>)
+
+typedef struct {
+  short8 c0;
+  short8 c1;
+  short8 c2;
+} struct_vs3;
+TEST(struct_vs3)
+// CHECK-LABEL: define swiftcc { <8 x i16>, <8 x i16>, <8 x i16> } 
@return_struct_vs3()
+// CHECK-LABEL: define swiftcc void @take_struct_vs3(<8 x i16>, <8 x i16>, <8 
x i16>)
+
+typedef struct {
+  short8 c0;
+  short8 c1;
+  short8 c2;
+  short8 c3;
+} struct_vs4;
+TEST(struct_vs4)
+// CHECK-LABEL: define swiftcc { <8 x i16>, <8 x i16>, <8 x i16>, <8 x i16> } 
@return_struct_vs4()
+// CHECK-LABEL: define swiftcc void @take_struct_vs4(<8 x i16>, <8 x i16>, <8 
x i16>, <8 x i16>)
+
+typedef struct {
+  short8 c0;
+  short8 c1;
+  short8 c2;
+  short8 c3;
+  short8 c4;
+} struct_vs5;
+TEST(struct_vs5)
+// CHECK: define swiftcc void @return_struct_vs5([[STRUCT:%.*]]* noalias sret
+// CHECK: define swiftcc void @take_struct_vs5([[STRUCT]]
+
+typedef struct {
+  int4 c0;
+} struct_vi1;
+TEST(struct_vi1)
+// CHECK-LABEL: define swiftcc 

[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.

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

I reverted this in r284081, and relanded with fixes described here as r284284.




Comment at: lib/Sema/SemaDecl.cpp:9712
+
+  // Demote the newly parsed definition to a fake declaration.
+  if (!VDecl->isThisDeclarationADemotedDefinition())

We also need to do this work when MergeVarDecls encounters the same condition.



Comment at: lib/Serialization/ASTReaderDecl.cpp:3087
+  CurD->isThisDeclarationADefinition()) {
+VD->demoteThisDefinitionToDeclaration();
+break;

When we do this, we need to tell the ASTContext we merged the definitions, so 
that the old definition will be made visible whenever the new one is.


https://reviews.llvm.org/D24508



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


r284284 - Reinstate r284008 reverted in r284081, with two fixes:

2016-10-14 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Oct 14 16:41:24 2016
New Revision: 284284

URL: http://llvm.org/viewvc/llvm-project?rev=284284=rev
Log:
Reinstate r284008 reverted in r284081, with two fixes:

1) Merge and demote variable definitions when we find a redefinition in
MergeVarDecls, not only when we find one in AddInitializerToDecl (we only reach
the second case if it's the addition of the initializer itself that converts an
existing declaration into a definition). 

2) When rebuilding a redeclaration chain for a variable, if we merge two
definitions together, mark the definitions as merged so the retained definition
is made visible whenever the demoted definition would have been.

Original commit message (from r283882):

[modules] PR28752: Do not instantiate variable declarations which are not 
visible.

Original patch by Vassil Vassilev! Changes listed above are mine.

Added:
cfe/trunk/test/Modules/Inputs/PR28752/
  - copied from r284080, cfe/trunk/test/Modules/Inputs/PR28752/
cfe/trunk/test/Modules/pr28752.cpp
  - copied, changed from r284080, cfe/trunk/test/Modules/pr28752.cpp
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284284=284283=284284=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Oct 14 16:41:24 2016
@@ -865,6 +865,11 @@ protected:
 
 unsigned : NumVarDeclBits;
 
+// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
+/// \brief Whether this variable is a definition which was demoted due to
+/// module merge.
+unsigned IsThisDeclarationADemotedDefinition : 1;
+
 /// \brief Whether this variable is the exception variable in a C++ catch
 /// or an Objective-C @catch statement.
 unsigned ExceptionVar : 1;
@@ -1198,12 +1203,28 @@ public:
   InitializationStyle getInitStyle() const {
 return static_cast(VarDeclBits.InitStyle);
   }
-
   /// \brief Whether the initializer is a direct-initializer (list or call).
   bool isDirectInit() const {
 return getInitStyle() != CInit;
   }
 
+  /// \brief If this definition should pretend to be a declaration.
+  bool isThisDeclarationADemotedDefinition() const {
+return isa(this) ? false :
+  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+  }
+
+  /// \brief This is a definition which should be demoted to a declaration.
+  ///
+  /// In some cases (mostly module merging) we can end up with two visible
+  /// definitions one of which needs to be demoted to a declaration to keep
+  /// the AST invariants.
+  void demoteThisDefinitionToDeclaration() {
+assert (isThisDeclarationADefinition() && "Not a definition!");
+assert (!isa(this) && "Cannot demote ParmVarDecls!");
+NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
+  }
+
   /// \brief Determine whether this variable is the exception variable in a
   /// C++ catch statememt or an Objective-C \@catch statement.
   bool isExceptionVariable() const {
@@ -1302,6 +1323,10 @@ public:
 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
   }
 
+  /// \brief Retrieve the variable declaration from which this variable could
+  /// be instantiated, if it is an instantiation (rather than a non-template).
+  VarDecl *getTemplateInstantiationPattern() const;
+
   /// \brief If this variable is an instantiated static data member of a
   /// class template specialization, returns the templated static data member
   /// from which it was instantiated.

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284284=284283=284284=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct 14 16:41:24 2016
@@ -2286,6 +2286,7 @@ public:
   void MergeVarDecl(VarDecl *New, LookupResult );
   void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
   void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
+  bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
   bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S);
 
   // AssignmentAction - This is used by all the assignment diagnostic functions

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 

[PATCH] D25519: [CodeCompletion] Refactor: Extract two Objective-C block formatting related functions from FormatFunctionParameter

2016-10-14 Thread Manman Ren via cfe-commits
manmanren accepted this revision.
manmanren added a comment.
This revision is now accepted and ready to land.

LGTM.

Manman


Repository:
  rL LLVM

https://reviews.llvm.org/D25519



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


[PATCH] D23657: Remove some false positives when taking the address of packed members

2016-10-14 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

It seems like on-stack arrays still don't work?

  #include 
  
  struct test {
uint32_t x;
  } __attribute__((__packed__));
  
  int main(void) {
struct test __attribute__((__aligned__(4))) a[4];
uint32_t *p32;
p32 = [0].x;
  }


https://reviews.llvm.org/D23657



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


[libcxx] r284282 - Clarify XFAIL comments

2016-10-14 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 14 16:30:35 2016
New Revision: 284282

URL: http://llvm.org/viewvc/llvm-project?rev=284282=rev
Log:
Clarify XFAIL comments

Modified:

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp

libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp?rev=284282=284281=284282=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
 Fri Oct 14 16:30:35 2016
@@ -17,7 +17,7 @@
 // None of the current GCC compilers support this.
 // XFAIL: gcc-4, gcc-5, gcc-6
 
-// UBSAN replaces certain new/delete functions which makes this test fail
+// TODO Investigate why UBSAN prevents new from calling our replacement.
 // XFAIL: ubsan
 
 #include 
@@ -60,6 +60,7 @@ struct alignas(std::max_align_t) B {};
 
 int main()
 {
+reset();
 {
 B *x = new B[2];
 assert(0 == unsized_delete_called);

Modified: 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp?rev=284282=284281=284282=diff
==
--- 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
 Fri Oct 14 16:30:35 2016
@@ -17,7 +17,7 @@
 // None of the current GCC compilers support this.
 // XFAIL: gcc-4, gcc-5, gcc-6
 
-// UBSAN replaces certain new/delete functions which makes this test fail
+// TODO Investigate why UBSAN prevents new from calling our replacement.
 // XFAIL: ubsan
 
 #include 
@@ -60,6 +60,7 @@ struct alignas(std::max_align_t) B {};
 
 int main()
 {
+reset();
 {
 B *x = new B;
 assert(0 == unsized_delete_called);


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


Re: [libcxx] r284210 - XFAIL aligned allocation test failures with UBSAN

2016-10-14 Thread Eric Fiselier via cfe-commits
UBSAN may not be replacing the function, but it is doing something weird at
the codegen level. I looked into this a while ago but never sorted it out.

Either way I'll clarify the comments and add the missing reset() calls.
Unfortunately the tests still fail in the same way.

On Fri, Oct 14, 2016 at 11:49 AM, Richard Smith 
wrote:

> On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Fri Oct 14 02:49:15 2016
>> New Revision: 284210
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=284210=rev
>> Log:
>> XFAIL  aligned allocation test failures with UBSAN
>>
>> Modified:
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/delete_align_val_t_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/delete_align_val_t_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>>
>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/delete_align_val_t_replace.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>> nguage.support/support.dynamic/new.delete/new.delete.array/
>> delete_align_val_t_replace.pass.cpp?rev=284210=284209&
>> r2=284210=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/delete_align_val_t_replace.pass.cpp (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/delete_align_val_t_replace.pass.cpp Fri Oct 14
>> 02:49:15 2016
>> @@ -17,6 +17,9 @@
>>  // None of the current GCC compilers support this.
>>  // XFAIL: gcc-4, gcc-5, gcc-6
>>
>> +// UBSAN replaces certain new/delete functions which makes this test fail
>>
>
> I don't think that's the problem; the UBSan runtime doesn't replace any
> functions. Instead...
>
>
>> +// XFAIL: ubsan
>> +
>>  #include 
>>  #include 
>>  #include 
>> @@ -58,24 +61,24 @@ struct alignas(std::max_align_t) B {};
>>  int main()
>>  {
>>
>
> I think you're missing a call to reset() here. It looks like the sanitizer
> runtimes happen to call 'operator new' before entering main.
>
>
>>  {
>> -B *x = new B;
>> +B *x = new B[2];
>>  assert(0 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(0 == aligned_delete_called);
>>
>> -delete x;
>> +delete [] x;
>>  assert(1 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(0 == aligned_delete_called);
>>  }
>>  reset();
>>  {
>> -A *x = new A;
>> +A *x = new A[2];
>>  assert(0 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(0 == aligned_delete_called);
>>
>> -delete x;
>> +delete [] x;
>>  assert(0 == unsized_delete_called);
>>  assert(0 == unsized_delete_nothrow_called);
>>  assert(1 == aligned_delete_called);
>>
>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>> nguage.support/support.dynamic/new.delete/new.delete.array/
>> new_align_val_t_nothrow_replace.pass.cpp?rev=284210=
>> 284209=284210=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>> (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp Fri Oct
>> 14 02:49:15 2016
>> @@ -13,9 +13,6 @@
>>
>>  // UNSUPPORTED: sanitizer-new-delete
>>
>> -// TODO Investigate why UBSAN prevents nothrow new from calling our
>> replacement.
>> -// XFAIL: ubsan
>> -
>>  #include 
>>  #include 
>>  #include 
>>
>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/delete_align_val_t_replace.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>> nguage.support/support.dynamic/new.delete/new.delete.single/
>> delete_align_val_t_replace.pass.cpp?rev=284210=284209&
>> r2=284210=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/delete_align_val_t_replace.pass.cpp (original)
>> +++ 

[PATCH] D25480: __builtin_fpclassify missing one int parameter

2016-10-14 Thread David Sheinkman via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284277: __builtin_fpclassify missing one int parameter 
(authored by davidsh).

Changed prior to commit:
  https://reviews.llvm.org/D25480?vs=74377=74740#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25480

Files:
  cfe/trunk/include/clang/Basic/Builtins.def
  cfe/trunk/test/Sema/builtin-unary-fp.c


Index: cfe/trunk/include/clang/Basic/Builtins.def
===
--- cfe/trunk/include/clang/Basic/Builtins.def
+++ cfe/trunk/include/clang/Basic/Builtins.def
@@ -367,7 +367,7 @@
 BUILTIN(__builtin_isunordered   , "i.", "Fnc")
 
 // Unary FP classification
-BUILTIN(__builtin_fpclassify, "i.", "Fnc")
+BUILTIN(__builtin_fpclassify, "ii.", "Fnc")
 BUILTIN(__builtin_isfinite,   "i.", "Fnc")
 BUILTIN(__builtin_isinf,  "i.", "Fnc")
 BUILTIN(__builtin_isinf_sign, "i.", "Fnc")
Index: cfe/trunk/test/Sema/builtin-unary-fp.c
===
--- cfe/trunk/test/Sema/builtin-unary-fp.c
+++ cfe/trunk/test/Sema/builtin-unary-fp.c
@@ -11,6 +11,7 @@
   check(__builtin_isnan(1,2)); // expected-error{{too many arguments}}
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1.0));
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1)); // expected-error{{requires 
argument of floating point type}}
+  check(__builtin_fpclassify(0, 1, 2, 3, 4.5, 5.0)); // 
expected-warning{{implicit conversion from 'double' to 'int' changes value from 
4.5 to 4}}
   check(__builtin_fpclassify(0, 0, 0, 0, 1)); // expected-error{{too few 
arguments}}
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1, 0)); // expected-error{{too 
many arguments}}
 }


Index: cfe/trunk/include/clang/Basic/Builtins.def
===
--- cfe/trunk/include/clang/Basic/Builtins.def
+++ cfe/trunk/include/clang/Basic/Builtins.def
@@ -367,7 +367,7 @@
 BUILTIN(__builtin_isunordered   , "i.", "Fnc")
 
 // Unary FP classification
-BUILTIN(__builtin_fpclassify, "i.", "Fnc")
+BUILTIN(__builtin_fpclassify, "ii.", "Fnc")
 BUILTIN(__builtin_isfinite,   "i.", "Fnc")
 BUILTIN(__builtin_isinf,  "i.", "Fnc")
 BUILTIN(__builtin_isinf_sign, "i.", "Fnc")
Index: cfe/trunk/test/Sema/builtin-unary-fp.c
===
--- cfe/trunk/test/Sema/builtin-unary-fp.c
+++ cfe/trunk/test/Sema/builtin-unary-fp.c
@@ -11,6 +11,7 @@
   check(__builtin_isnan(1,2)); // expected-error{{too many arguments}}
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1.0));
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1)); // expected-error{{requires argument of floating point type}}
+  check(__builtin_fpclassify(0, 1, 2, 3, 4.5, 5.0)); // expected-warning{{implicit conversion from 'double' to 'int' changes value from 4.5 to 4}}
   check(__builtin_fpclassify(0, 0, 0, 0, 1)); // expected-error{{too few arguments}}
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1, 0)); // expected-error{{too many arguments}}
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284277 - __builtin_fpclassify missing one int parameter

2016-10-14 Thread David Sheinkman via cfe-commits
Author: davidsh
Date: Fri Oct 14 15:43:37 2016
New Revision: 284277

URL: http://llvm.org/viewvc/llvm-project?rev=284277=rev
Log:
__builtin_fpclassify missing one int parameter

Patch by Tania Albarghouthi.

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


Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/test/Sema/builtin-unary-fp.c

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=284277=284276=284277=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Fri Oct 14 15:43:37 2016
@@ -367,7 +367,7 @@ BUILTIN(__builtin_islessgreater , "i.",
 BUILTIN(__builtin_isunordered   , "i.", "Fnc")
 
 // Unary FP classification
-BUILTIN(__builtin_fpclassify, "i.", "Fnc")
+BUILTIN(__builtin_fpclassify, "ii.", "Fnc")
 BUILTIN(__builtin_isfinite,   "i.", "Fnc")
 BUILTIN(__builtin_isinf,  "i.", "Fnc")
 BUILTIN(__builtin_isinf_sign, "i.", "Fnc")

Modified: cfe/trunk/test/Sema/builtin-unary-fp.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtin-unary-fp.c?rev=284277=284276=284277=diff
==
--- cfe/trunk/test/Sema/builtin-unary-fp.c (original)
+++ cfe/trunk/test/Sema/builtin-unary-fp.c Fri Oct 14 15:43:37 2016
@@ -11,6 +11,7 @@ void a() {
   check(__builtin_isnan(1,2)); // expected-error{{too many arguments}}
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1.0));
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1)); // expected-error{{requires 
argument of floating point type}}
+  check(__builtin_fpclassify(0, 1, 2, 3, 4.5, 5.0)); // 
expected-warning{{implicit conversion from 'double' to 'int' changes value from 
4.5 to 4}}
   check(__builtin_fpclassify(0, 0, 0, 0, 1)); // expected-error{{too few 
arguments}}
   check(__builtin_fpclassify(0, 0, 0, 0, 0, 1, 0)); // expected-error{{too 
many arguments}}
 }


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


Re: [libcxx] r284214 - XFAIL aligned allocation tests for older Clang versions

2016-10-14 Thread Eric Fiselier via cfe-commits
Hi Nico,

Could you give me more information about the compiler your using?

/Eric

On Fri, Oct 14, 2016 at 1:21 PM, Nico Weber  wrote:

> This is breaking tests for me:
>
> Unexpected Passing Tests (4):
> libc++ :: std/language.support/support.dynamic/new.delete/new.delete.
> array/new_align_val_t.pass.cpp
> libc++ :: std/language.support/support.dynamic/new.delete/new.delete.
> array/new_align_val_t_nothrow.pass.cpp
> libc++ :: std/language.support/support.dynamic/new.delete/new.delete.
> single/new_align_val_t.pass.cpp
> libc++ :: std/language.support/support.dynamic/new.delete/new.delete.
> single/new_align_val_t_nothrow.pass.cpp
>
> Am I holding something wrong, or are these XFAILs wrong?
>
> On Fri, Oct 14, 2016 at 4:47 AM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Fri Oct 14 03:47:09 2016
>> New Revision: 284214
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=284214=rev
>> Log:
>> XFAIL aligned allocation tests for older Clang versions
>>
>> Modified:
>> libcxx/trunk/test/libcxx/test/config.py
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>> libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t_replace.pass.cpp
>>
>> Modified: libcxx/trunk/test/libcxx/test/config.py
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>> /test/config.py?rev=284214=284213=284214=diff
>> 
>> ==
>> --- libcxx/trunk/test/libcxx/test/config.py (original)
>> +++ libcxx/trunk/test/libcxx/test/config.py Fri Oct 14 03:47:09 2016
>> @@ -315,6 +315,10 @@ class Configuration(object):
>>
>>  if self.cxx.hasCompileFlag('-faligned-allocation'):
>>  self.config.available_features.add('-faligned-allocation')
>> +else:
>> +# FIXME remove this once more than just clang-4.0 support
>> +# C++17 aligned allocation.
>> +self.config.available_features.add('no-aligned-allocation')
>>
>>  if self.get_lit_bool('has_libatomic', False):
>>  self.config.available_features.add('libatomic')
>>
>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>> nguage.support/support.dynamic/new.delete/new.delete.array/
>> new_align_val_t.pass.cpp?rev=284214=284213=284214=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t.pass.cpp (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t.pass.cpp Fri Oct 14 03:47:09 2016
>> @@ -9,11 +9,13 @@
>>
>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>>
>> -// test operator new
>> -
>>  // asan and msan will not call the new handler.
>>  // UNSUPPORTED: sanitizer-new-delete
>>
>> +// XFAIL: no-aligned-allocation
>> +
>> +// test operator new
>> +
>>  #include 
>>  #include 
>>  #include 
>>
>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
>> nguage.support/support.dynamic/new.delete/new.delete.array/
>> new_align_val_t_nothrow.pass.cpp?rev=284214=284213=284214=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow.pass.cpp (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow.pass.cpp Fri Oct 14
>> 03:47:09 2016
>> @@ -9,11 +9,13 @@
>>
>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>>
>> -// test operator new (nothrow)
>> -
>>  // asan and msan will not call the new handler.
>>  // UNSUPPORTED: sanitizer-new-delete
>>
>> +// XFAIL: 

[PATCH] D25284: AvailabilityAttrs: Delay partial availability diagnostics

2016-10-14 Thread Erik Pilkington via cfe-commits
erik.pilkington updated this revision to Diff 74738.
erik.pilkington added a comment.

This new patch renames `DelayedDiagnostic::DeprecationData` to 
`DelayedDiagnostic::AvailabilityData`, because now that it can hold information 
about deprecated, unavailable, and partial diagnostics.
Thanks,
Erik


https://reviews.llvm.org/D25284

Files:
  include/clang/Sema/DelayedDiagnostic.h
  lib/Sema/DelayedDiagnostic.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaObjC/unguarded-availability.m

Index: test/SemaObjC/unguarded-availability.m
===
--- test/SemaObjC/unguarded-availability.m
+++ test/SemaObjC/unguarded-availability.m
@@ -63,7 +63,7 @@
 #ifdef OBJCPP
 // expected-note@+2 {{marked partial here}}
 #endif
-typedef int int_10_12 AVAILABLE_10_12; // expected-note 3 {{'int_10_12' has been explicitly marked partial here}}
+typedef int int_10_12 AVAILABLE_10_12; // expected-note 2 {{'int_10_12' has been explicitly marked partial here}}
 
 void use_typedef() {
   int_10_11 x; // expected-warning{{'int_10_11' is only available on macOS 10.11 or newer}} expected-note{{enclose 'int_10_11' in an @available check to silence this warning}}
@@ -127,8 +127,7 @@
 
 void test_params(int_10_12 x); // expected-warning {{'int_10_12' is partial: introduced in macOS 10.12}} expected-note{{redeclare}}
 
-// FIXME: This should be fine!
-void test_params2(int_10_12 x) AVAILABLE_10_12; // expected-warning {{'int_10_12' is partial: introduced in macOS 10.12}} expected-note{{redeclare}}
+void test_params2(int_10_12 x) AVAILABLE_10_12; // no warn
 
 #ifdef OBJCPP
 
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -6474,9 +6474,6 @@
 break;
 
   case AR_NotYetIntroduced:
-assert(!S.getCurFunctionOrMethodDecl() &&
-   "Function-level partial availablity should not be diagnosed here!");
-
 diag = diag::warn_partial_availability;
 diag_message = diag::warn_partial_message;
 diag_fwdclass_message = diag::warn_partial_fwdclass_message;
@@ -6549,15 +6546,14 @@
 
 static void handleDelayedAvailabilityCheck(Sema , DelayedDiagnostic ,
Decl *Ctx) {
-  assert(DD.Kind == DelayedDiagnostic::Deprecation ||
- DD.Kind == DelayedDiagnostic::Unavailable);
-  AvailabilityResult AR = DD.Kind == DelayedDiagnostic::Deprecation
-  ? AR_Deprecated
-  : AR_Unavailable;
+  assert(DD.Kind == DelayedDiagnostic::Availability &&
+ "Expected an availability diagnostic here");
+
   DD.Triggered = true;
   DoEmitAvailabilityWarning(
-  S, AR, Ctx, DD.getDeprecationDecl(), DD.getDeprecationMessage(), DD.Loc,
-  DD.getUnknownObjCClass(), DD.getObjCProperty(), false);
+  S, DD.getAvailabilityResult(), Ctx, DD.getAvailabilityDecl(),
+  DD.getAvailabilityMessage(), DD.Loc, DD.getUnknownObjCClass(),
+  DD.getObjCProperty(), false);
 }
 
 void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {
@@ -6587,8 +6583,7 @@
 continue;
 
   switch (diag.Kind) {
-  case DelayedDiagnostic::Deprecation:
-  case DelayedDiagnostic::Unavailable:
+  case DelayedDiagnostic::Availability:
 // Don't bother giving deprecation/unavailable diagnostics if
 // the decl is invalid.
 if (!decl->isInvalidDecl())
@@ -6623,8 +6618,7 @@
const ObjCPropertyDecl  *ObjCProperty,
bool ObjCPropertyAccess) {
   // Delay if we're currently parsing a declaration.
-  if (DelayedDiagnostics.shouldDelayDiagnostics() &&
-  AR != AR_NotYetIntroduced) {
+  if (DelayedDiagnostics.shouldDelayDiagnostics()) {
 DelayedDiagnostics.add(DelayedDiagnostic::makeAvailability(
 AR, Loc, D, UnknownObjCClass, ObjCProperty, Message,
 ObjCPropertyAccess));
Index: lib/Sema/DelayedDiagnostic.cpp
===
--- lib/Sema/DelayedDiagnostic.cpp
+++ lib/Sema/DelayedDiagnostic.cpp
@@ -20,50 +20,41 @@
 using namespace sema;
 
 DelayedDiagnostic
-DelayedDiagnostic::makeAvailability(AvailabilityResult AD,
+DelayedDiagnostic::makeAvailability(AvailabilityResult AR,
 SourceLocation Loc,
 const NamedDecl *D,
 const ObjCInterfaceDecl *UnknownObjCClass,
 const ObjCPropertyDecl  *ObjCProperty,
 StringRef Msg,
 bool ObjCPropertyAccess) {
   DelayedDiagnostic DD;
-  switch (AD) {
-  case AR_Deprecated:
-DD.Kind = Deprecation;
-break;
-  case AR_Unavailable:
-DD.Kind = Unavailable;
-break;
-  default:
-llvm_unreachable("partial diags should not be delayed");
-  }
+  DD.Kind = 

[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-14 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

The `..:target:hexagon:include:` is debug code printing all the path 
components, separated by :.


https://reviews.llvm.org/D25597



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


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-14 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

Right on entry to the asserting function:

  (gdb) where
  #0  0x752b9870 in (anonymous 
namespace)::RedirectingFileSystem::lookupPath(llvm::sys::path::const_iterator, 
llvm::sys::path::const_iterator, (anonymous namespace)::Entry*) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #1  0x752b9b8c in (anonymous 
namespace)::RedirectingFileSystem::lookupPath(llvm::sys::path::const_iterator, 
llvm::sys::path::const_iterator, (anonymous namespace)::Entry*) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #2  0x752b929f in (anonymous 
namespace)::RedirectingFileSystem::lookupPath(llvm::Twine const&) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #3  0x752b836c in (anonymous 
namespace)::RedirectingFileSystem::status(llvm::Twine const&) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #4  0x752b2171 in clang::vfs::OverlayFileSystem::status(llvm::Twine 
const&) () from /w/bld/up/bin/../lib/libclang.so.40
  #5  0x75292691 in clang::FileSystemStatCache::get(llvm::StringRef, 
clang::FileData&, bool, std::__1::unique_ptr*, clang::FileSystemStatCache*, 
clang::vfs::FileSystem&)
  () from /w/bld/up/bin/../lib/libclang.so.40
  #6  0x7528f523 in clang::FileManager::getStatValue(llvm::StringRef, 
clang::FileData&, bool, std::__1::unique_ptr*) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #7  0x7528f326 in clang::FileManager::getDirectory(llvm::StringRef, 
bool) () from /w/bld/up/bin/../lib/libclang.so.40
  #8  0x75323e23 in (anonymous 
namespace)::InitHeaderSearch::AddUnmappedPath(llvm::Twine const&, 
clang::frontend::IncludeDirGroup, bool) ()
 from /w/bld/up/bin/../lib/libclang.so.40
  #9  0x75323133 in 
clang::ApplyHeaderSearchOptions(clang::HeaderSearch&, 
clang::HeaderSearchOptions const&, clang::LangOptions const&, llvm::Triple 
const&) () from /w/bld/up/bin/../lib/libclang.so.40
  #10 0x752dc120 in 
clang::CompilerInstance::createPreprocessor(clang::TranslationUnitKind) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #11 0x7531d0a7 in 
clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, 
clang::FrontendInputFile const&) ()
 from /w/bld/up/bin/../lib/libclang.so.40
  #12 0x752ccc90 in 
clang::ASTUnit::LoadFromCompilerInvocationAction(clang::CompilerInvocation*, 
std::__1::shared_ptr, 
llvm::IntrusiveRefCntPtr, clang::FrontendAction*, 
clang::ASTUnit*, bool, llvm::StringRef, bool, bool, unsigned int, bool, bool, 
bool, std::__1::unique_ptr*)
  () from /w/bld/up/bin/../lib/libclang.so.40
  #13 0x7507e1b6 in clang_indexSourceFileFullArgv::$_0::operator()() 
const () from /w/bld/up/bin/../lib/libclang.so.40
  #14 0x75c22271 in 
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) () from 
/w/bld/up/bin/../lib/libclang.so.40
  #15 0x75c223b4 in RunSafelyOnThread_Dispatch(void*) ()
 from /w/bld/up/bin/../lib/libclang.so.40
  #16 0x75c6d3fa in ExecuteOnThread_Dispatch(void*) ()
 from /w/bld/up/bin/../lib/libclang.so.40
  #17 0x7797d182 in start_thread (arg=0x73234700)
  at pthread_create.c:312
  #18 0x73b3047d in clone ()
  at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
  
  (gdb) cont
  Continuing.
  ..:target:hexagon:include:
  c-index-test: 
/w/src/llvm.org/tools/clang/lib/Basic/VirtualFileSystem.cpp:1485: 
ErrorOr<(anonymous namespace)::Entry *> (anonymous 
namespace)::RedirectingFileSystem::lookupPath(sys::path::const_iterator, 
sys::path::const_iterator, (anonymous namespace)::Entry *): Assertion 
`!isTraversalComponent(*Start) && !isTraversalComponent(From->getName()) && 
"Paths should not contain traversal components"' failed.
  
  Program received signal SIGABRT, Aborted.
  0x73a6ccc9 in __GI_raise (sig=sig@entry=6)
  at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
  56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.


https://reviews.llvm.org/D25597



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


[PATCH] D19854: Define Contiki OS toolchain

2016-10-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284278: Define Contiki OS toolchain (authored by dlkreitz).

Changed prior to commit:
  https://reviews.llvm.org/D19854?vs=70076=74741#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D19854

Files:
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/test/Driver/fsanitize.c


Index: cfe/trunk/test/Driver/fsanitize.c
===
--- cfe/trunk/test/Driver/fsanitize.c
+++ cfe/trunk/test/Driver/fsanitize.c
@@ -397,6 +397,7 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 
| FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
 // SP: "-fsanitize=safe-stack"
Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -1249,6 +1249,14 @@
   Tool *buildLinker() const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF {
+public:
+  Contiki(const Driver , const llvm::Triple ,
+  const llvm::opt::ArgList );
+
+  SanitizerMask getSupportedSanitizers() const override;
+};
+
 } // end namespace toolchains
 } // end namespace driver
 } // end namespace clang
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -5305,3 +5305,14 @@
   Res |= SanitizerKind::Vptr;
   return Res;
 }
+
+Contiki::Contiki(const Driver , const llvm::Triple , const ArgList 
)
+: Generic_ELF(D, Triple, Args) {}
+
+SanitizerMask Contiki::getSupportedSanitizers() const {
+  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  if (IsX86)
+Res |= SanitizerKind::SafeStack;
+  return Res;
+}
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -3120,6 +3120,9 @@
 case llvm::Triple::PS4:
   TC = new toolchains::PS4CPU(*this, Target, Args);
   break;
+case llvm::Triple::Contiki:
+  TC = new toolchains::Contiki(*this, Target, Args);
+  break;
 default:
   // Of these targets, Hexagon is the only one that might have
   // an OS of Linux, in which case it got handled above already.


Index: cfe/trunk/test/Driver/fsanitize.c
===
--- cfe/trunk/test/Driver/fsanitize.c
+++ cfe/trunk/test/Driver/fsanitize.c
@@ -397,6 +397,7 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
 // SP: "-fsanitize=safe-stack"
Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -1249,6 +1249,14 @@
   Tool *buildLinker() const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF {
+public:
+  Contiki(const Driver , const llvm::Triple ,
+  const llvm::opt::ArgList );
+
+  SanitizerMask getSupportedSanitizers() const override;
+};
+
 } // end namespace toolchains
 } // end namespace driver
 } // end namespace clang
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -5305,3 +5305,14 @@
   Res |= SanitizerKind::Vptr;
   return Res;
 }
+
+Contiki::Contiki(const Driver , const llvm::Triple , const ArgList )
+: Generic_ELF(D, Triple, Args) {}
+
+SanitizerMask Contiki::getSupportedSanitizers() const {
+  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  if (IsX86)
+Res |= SanitizerKind::SafeStack;
+  return Res;
+}
Index: cfe/trunk/lib/Driver/Driver.cpp

r284278 - Define Contiki OS toolchain

2016-10-14 Thread David L Kreitzer via cfe-commits
Author: dlkreitz
Date: Fri Oct 14 15:44:33 2016
New Revision: 284278

URL: http://llvm.org/viewvc/llvm-project?rev=284278=rev
Log:
Define Contiki OS toolchain

Patch by Michael LeMay

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

Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=284278=284277=284278=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 14 15:44:33 2016
@@ -3120,6 +3120,9 @@ const ToolChain ::getToolChain(co
 case llvm::Triple::PS4:
   TC = new toolchains::PS4CPU(*this, Target, Args);
   break;
+case llvm::Triple::Contiki:
+  TC = new toolchains::Contiki(*this, Target, Args);
+  break;
 default:
   // Of these targets, Hexagon is the only one that might have
   // an OS of Linux, in which case it got handled above already.

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284278=284277=284278=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct 14 15:44:33 2016
@@ -5305,3 +5305,14 @@ SanitizerMask PS4CPU::getSupportedSaniti
   Res |= SanitizerKind::Vptr;
   return Res;
 }
+
+Contiki::Contiki(const Driver , const llvm::Triple , const ArgList 
)
+: Generic_ELF(D, Triple, Args) {}
+
+SanitizerMask Contiki::getSupportedSanitizers() const {
+  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  if (IsX86)
+Res |= SanitizerKind::SafeStack;
+  return Res;
+}

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=284278=284277=284278=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Oct 14 15:44:33 2016
@@ -1249,6 +1249,14 @@ protected:
   Tool *buildLinker() const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF {
+public:
+  Contiki(const Driver , const llvm::Triple ,
+  const llvm::opt::ArgList );
+
+  SanitizerMask getSupportedSanitizers() const override;
+};
+
 } // end namespace toolchains
 } // end namespace driver
 } // end namespace clang

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=284278=284277=284278=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Fri Oct 14 15:44:33 2016
@@ -397,6 +397,7 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 
| FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
 // SP: "-fsanitize=safe-stack"


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


[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

2016-10-14 Thread John McCall via cfe-commits
rjmccall added a comment.

Sorry, no, just the one that takes an llvm::Value* instead of an Expr*.


https://reviews.llvm.org/D25547



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


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-14 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Krzysztof, do you have a backtrace that you can paste here or point me to the 
buidbot stderr log? There's no point in looking for relative paths inside the 
VFS, it would be nice if we fix the root cause here.


https://reviews.llvm.org/D25597



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


Re: [clang-tools-extra] r284233 - [clang-move] Add header guard for the new header.

2016-10-14 Thread Tim Northover via cfe-commits
Hi Haojian,

On 14 October 2016 at 06:01, Haojian Wu via cfe-commits
 wrote:
> +  std::string GuardName(FileName);
> +  if (IsHeader) {
> +std::replace(GuardName.begin(), GuardName.end(), '/', '_');
> +std::replace(GuardName.begin(), GuardName.end(), '.', '_');
> +std::replace(GuardName.begin(), GuardName.end(), '-', '_');

I think this is causing problems with one of our bots that has an '@'
in a path it uses. In general it seems like a whitelist based on what
a C token is would be better than a blacklist of characters.

Could you take a look?

Cheers.

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


Re: [PATCH] D24997: [ClangTidy] Add UsingInserter and NamespaceAliaser

2016-10-14 Thread Julian Bangert via cfe-commits
I figured out make clang-tidy. Compiles now (the typedef was the wrong way
around, and i never noticed because make with the default target continued
to work).


Updated the diff.

On Fri, Oct 14, 2016 at 12:49 PM Julian Bangert  wrote:

> Apologies for the breakage. I investigated and it turns out my open-source
> checkout does not build clang-tidy. I have checked out llvm into ~/llvm,
> clang into ~/llvm/tools/clang and clang-extra-tools into
> ~/llvm/tools/clang/tools/extra.
> In ~/llvm-build I run cmake ../llvm && make -j 32 and it doesn't compile
> clang tidy. I also tried  cmake -DCLANG_ENABLE_STATIC_ANALYZER=true
> ../llvm/ but that doesn't make a difference. Any ideas?
>
>
> On Wed, Oct 12, 2016 at 1:34 AM Haojian Wu  wrote:
>
> hokein added a comment.
>
> @jbangert, your patch broke the buildbot, and I reverted it in r283985.
> You need to add the new source files to the CMakefile. (I saw other
> compilation errors after I updated the cmake files, Could you take a look
> on it? )
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D24997
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24997: [ClangTidy] Add UsingInserter and NamespaceAliaser

2016-10-14 Thread Julian Bangert via cfe-commits
jbangert removed rL LLVM as the repository for this revision.
jbangert updated this revision to Diff 74737.
Herald added subscribers: mgorny, beanz.

https://reviews.llvm.org/D24997

Files:
  clang-tidy/utils/ASTUtils.cpp
  clang-tidy/utils/ASTUtils.h
  clang-tidy/utils/CMakeLists.txt
  clang-tidy/utils/NamespaceAliaser.cpp
  clang-tidy/utils/NamespaceAliaser.h
  clang-tidy/utils/UsingInserter.cpp
  clang-tidy/utils/UsingInserter.h
  unittests/clang-tidy/CMakeLists.txt
  unittests/clang-tidy/NamespaceAliaserTest.cpp
  unittests/clang-tidy/UsingInserterTest.cpp

Index: unittests/clang-tidy/UsingInserterTest.cpp
===
--- /dev/null
+++ unittests/clang-tidy/UsingInserterTest.cpp
@@ -0,0 +1,115 @@
+//=== UsingInserterTest.cpp - clang-tidy ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../clang-tidy/utils/UsingInserter.h"
+
+#include "ClangTidyTest.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace tidy {
+namespace utils {
+
+// Replace all function calls with calls to foo::func. Inserts using
+// declarations as necessary. This checker is for testing only. It
+// can only run on one test case (e.g. wih one SourceManager).
+class InsertUsingCheck : public clang::tidy::ClangTidyCheck {
+public:
+  using clang::tidy::ClangTidyCheck::ClangTidyCheck;
+  void registerMatchers(clang::ast_matchers::MatchFinder *Finder) override {
+Finder->addMatcher(clang::ast_matchers::callExpr().bind("foo"), this);
+  }
+  void
+  check(const clang::ast_matchers::MatchFinder::MatchResult ) override {
+if (!Inserter)
+  Inserter.reset(new UsingInserter(*Result.SourceManager,
+   Result.Context->getLangOpts()));
+
+const clang::CallExpr *Call =
+Result.Nodes.getNodeAs("foo");
+assert(Call != nullptr && "Did not find node \"foo\"");
+auto Hint =
+Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func");
+
+if (Hint.hasValue())
+  diag(Call->getLocStart(), "Fix for testing") << Hint.getValue();
+
+diag(Call->getLocStart(), "insert call")
+<< clang::FixItHint::CreateReplacement(
+   Call->getCallee()->getSourceRange(),
+   Inserter->getShortName(*Result.Context, *Call, "::foo::func"));
+  }
+
+private:
+  std::unique_ptr Inserter;
+};
+
+template 
+std::string runChecker(StringRef Code, int ExpectedWarningCount) {
+  std::map AdditionalFileContents = {{"foo.h",
+"namespace foo {\n"
+"namespace bar {\n"
+"}\n"
+"void func() { }\n"
+"}"}};
+  std::vector errors;
+
+  std::string result =
+  test::runCheckOnCode(Code, , "foo.cc", None,
+  ClangTidyOptions(), AdditionalFileContents);
+
+  EXPECT_EQ(ExpectedWarningCount, errors.size());
+  return result;
+}
+
+TEST(UsingInserterTest, ReusesExisting) {
+  EXPECT_EQ("#include \"foo.h\"\n"
+"namespace {"
+"using ::foo::func;\n"
+"void f() { func(); }"
+"}",
+runChecker("#include \"foo.h\"\n"
+ "namespace {"
+ "using ::foo::func;\n"
+ "void f() { f(); }"
+ "}",
+ 1));
+}
+
+TEST(UsingInserterTest, ReusesExistingGlobal) {
+  EXPECT_EQ("#include \"foo.h\"\n"
+"using ::foo::func;\n"
+"namespace {"
+"void f() { func(); }"
+"}",
+runChecker("#include \"foo.h\"\n"
+ "using ::foo::func;\n"
+ "namespace {"
+ "void f() { f(); }"
+ "}",
+ 1));
+}
+
+TEST(UsingInserterTest, AvoidsConflict) {
+  EXPECT_EQ("#include \"foo.h\"\n"
+"namespace {"
+"void f() { int func; ::foo::func(); }"
+"}",
+runChecker("#include \"foo.h\"\n"
+ "namespace {"
+ "void f() { int func; f(); }"
+ "}",
+ 1));

[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-14 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

dbgs showed that the path components were `.. target hexagon include`.
The paths are constructed in lib/Driver/ToolChains.cpp, many are based on 
"getHexagonTargetDir".


https://reviews.llvm.org/D25597



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


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-14 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

One possible reason: remove_dots is called upon a path with a leading "..", 
which then gets appended in front of another path to form the absolute path. 
I'm taking a look right now to try to figure out if there's any code path that 
might lead to this.


https://reviews.llvm.org/D25597



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


r284272 - Implement no_sanitize_address for global vars

2016-10-14 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Fri Oct 14 14:55:09 2016
New Revision: 284272

URL: http://llvm.org/viewvc/llvm-project?rev=284272=rev
Log:
Implement no_sanitize_address for global vars

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/CodeGen/SanitizerMetadata.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/CodeGen/asan-globals.cpp
cfe/trunk/test/SemaCXX/attr-no-sanitize-address.cpp
cfe/trunk/test/SemaCXX/attr-no-sanitize.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=284272=284271=284272=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Oct 14 14:55:09 2016
@@ -1705,7 +1705,8 @@ def X86ForceAlignArgPointer : Inheritabl
 def NoSanitize : InheritableAttr {
   let Spellings = [GNU<"no_sanitize">, CXX11<"clang", "no_sanitize">];
   let Args = [VariadicStringArgument<"Sanitizers">];
-  let Subjects = SubjectList<[Function, ObjCMethod], ErrorDiag>;
+  let Subjects = SubjectList<[Function, ObjCMethod, GlobalVar], ErrorDiag,
+"ExpectedFunctionMethodOrGlobalVar">;
   let Documentation = [NoSanitizeDocs];
   let AdditionalMembers = [{
 SanitizerMask getMask() const {
@@ -1727,7 +1728,8 @@ def NoSanitizeSpecific : InheritableAttr
GCC<"no_sanitize_address">,
GCC<"no_sanitize_thread">,
GNU<"no_sanitize_memory">];
-  let Subjects = SubjectList<[Function], ErrorDiag>;
+  let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
+"ExpectedFunctionGlobalVarMethodOrProperty">;
   let Documentation = [NoSanitizeAddressDocs, NoSanitizeThreadDocs,
NoSanitizeMemoryDocs];
   let ASTNode = 0;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=284272=284271=284272=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct 14 14:55:09 
2016
@@ -2577,6 +2577,7 @@ def warn_attribute_wrong_decl_type : War
   "|functions, methods and blocks"
   "|functions, methods, and classes"
   "|functions, methods, and parameters"
+  "|functions, methods, and global variables"
   "|classes"
   "|enums"
   "|variables"

Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=284272=284271=284272=diff
==
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Fri Oct 14 14:55:09 2016
@@ -891,6 +891,7 @@ enum AttributeDeclKind {
   ExpectedFunctionMethodOrBlock,
   ExpectedFunctionMethodOrClass,
   ExpectedFunctionMethodOrParameter,
+  ExpectedFunctionMethodOrGlobalVar,
   ExpectedClass,
   ExpectedEnum,
   ExpectedVariable,

Modified: cfe/trunk/lib/CodeGen/SanitizerMetadata.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/SanitizerMetadata.cpp?rev=284272=284271=284272=diff
==
--- cfe/trunk/lib/CodeGen/SanitizerMetadata.cpp (original)
+++ cfe/trunk/lib/CodeGen/SanitizerMetadata.cpp Fri Oct 14 14:55:09 2016
@@ -63,7 +63,13 @@ void SanitizerMetadata::reportGlobalToAS
   std::string QualName;
   llvm::raw_string_ostream OS(QualName);
   D.printQualifiedName(OS);
-  reportGlobalToASan(GV, D.getLocation(), OS.str(), D.getType(), IsDynInit);
+
+  bool IsBlacklisted = false;
+  for (auto Attr : D.specific_attrs())
+if (Attr->getMask() & SanitizerKind::Address)
+  IsBlacklisted = true;
+  reportGlobalToASan(GV, D.getLocation(), OS.str(), D.getType(), IsDynInit,
+ IsBlacklisted);
 }
 
 void SanitizerMetadata::disableSanitizerForGlobal(llvm::GlobalVariable *GV) {

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=284272=284271=284272=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Oct 14 14:55:09 2016
@@ -5313,9 +5313,15 @@ static void handleDeprecatedAttr(Sema 
 !(Attr.hasScope() && Attr.getScopeName()->isStr("gnu")))
   S.Diag(Attr.getLoc(), diag::ext_cxx14_attr) << Attr.getName();
 
-  D->addAttr(::new (S.Context) DeprecatedAttr(Attr.getRange(), S.Context, Str,
-   Replacement,
-   

[PATCH] D25579: [codeview] emit debug info for indirect virtual base classes

2016-10-14 Thread Bob Haarman via cfe-commits
inglorion updated this revision to Diff 74734.
inglorion added a comment.

- Removed unused header.


https://reviews.llvm.org/D25579

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-ms-vbase.cpp

Index: test/CodeGenCXX/debug-info-ms-vbase.cpp
===
--- test/CodeGenCXX/debug-info-ms-vbase.cpp
+++ test/CodeGenCXX/debug-info-ms-vbase.cpp
@@ -24,6 +24,18 @@
 
 // CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]])
 
+// CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase"
+// CHECK-SAME: elements: ![[elements:[0-9]+]]
+
+// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]]
+// CHECK-NOT: DIFlagIndirect
+// CHECK-SAME: )
+
+// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]]
+// CHECK-SAME: flags:
+// CHECK-SAME: DIFlagVirtual
+// CHECK-SAME: DIFlagIndirect
+
 // CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr",
 // CHECK-SAME: elements: ![[elements:[0-9]+]]
 
@@ -52,3 +64,6 @@
 
 HasPrimaryBase has_primary_base;
 
+struct HasIndirectVirtualBase : public HasPrimaryBase {};
+
+HasIndirectVirtualBase has_indirect_virtual_base;
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -15,12 +15,14 @@
 #define LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H
 
 #include "CGBuilder.h"
+#include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/IR/DIBuilder.h"
 #include "llvm/IR/DebugInfo.h"
@@ -32,7 +34,6 @@
 }
 
 namespace clang {
-class CXXMethodDecl;
 class ClassTemplateSpecializationDecl;
 class GlobalDecl;
 class ModuleMap;
@@ -218,6 +219,15 @@
SmallVectorImpl ,
llvm::DIType *RecordTy);
 
+  /// Helper function for CollectCXXBases.
+  /// Adds debug info entries for types in Bases that are not in SeenTypes.
+  void CollectCXXBasesAux(const CXXRecordDecl *RD, llvm::DIFile *Unit,
+  SmallVectorImpl ,
+  llvm::DIType *RecordTy,
+  const CXXRecordDecl::base_class_const_range ,
+  llvm::DenseSet ,
+  llvm::DINode::DIFlags StartingFlags);
+
   /// A helper function to collect template parameters.
   llvm::DINodeArray CollectTemplateParams(const TemplateParameterList *TPList,
   ArrayRef TAList,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -13,9 +13,9 @@
 
 #include "CGDebugInfo.h"
 #include "CGBlocks.h"
-#include "CGRecordLayout.h"
 #include "CGCXXABI.h"
 #include "CGObjCRuntime.h"
+#include "CGRecordLayout.h"
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "clang/AST/ASTContext.h"
@@ -31,6 +31,7 @@
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/ModuleMap.h"
 #include "clang/Lex/PreprocessorOptions.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/IR/Constants.h"
@@ -1366,13 +1367,35 @@
 void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile *Unit,
   SmallVectorImpl ,
   llvm::DIType *RecordTy) {
-  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
-  for (const auto  : RD->bases()) {
-llvm::DINode::DIFlags BFlags = llvm::DINode::FlagZero;
-uint64_t BaseOffset;
+  llvm::DenseSet SeenTypes;
+  CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->bases(), SeenTypes,
+ llvm::DINode::FlagZero);
+
+  // If we are generating CodeView debug info, we also need to emit records for
+  // indirect virtual base classes.
+  if (CGM.getCodeGenOpts().EmitCodeView) {
+CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->vbases(), SeenTypes,
+   llvm::DINode::FlagIndirect | llvm::DINode::FlagVirtual);
+  }
+}
 
+void CGDebugInfo::CollectCXXBasesAux(
+const CXXRecordDecl *RD, llvm::DIFile *Unit,
+SmallVectorImpl , llvm::DIType *RecordTy,
+const CXXRecordDecl::base_class_const_range ,
+llvm::DenseSet ,
+llvm::DINode::DIFlags StartingFlags) {
+  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
+  for (const auto 

r284271 - [linux] When pre-reserving stack pages to work around broken address space

2016-10-14 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Oct 14 14:51:36 2016
New Revision: 284271

URL: http://llvm.org/viewvc/llvm-project?rev=284271=rev
Log:
[linux] When pre-reserving stack pages to work around broken address space
layout for PIE binaries, ask the OS how much stack space is already in use to
avoid stack overflow if we are run with more than 512K of combined command line
arguments + environment variables.

Modified:
cfe/trunk/tools/driver/cc1_main.cpp

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=284271=284270=284271=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Fri Oct 14 14:51:36 2016
@@ -80,20 +80,48 @@ void initializePollyPasses(llvm::PassReg
 static const int kSufficientStack = 8 << 20;
 
 #if defined(__linux__) && defined(__PIE__)
+static size_t getCurrentStackAllocation() {
+  // If we can't compute the current stack usage, allow for 512K of command
+  // line arguments and environment.
+  size_t Usage = 512 * 1024;
+  if (FILE *StatFile = fopen("/proc/self/stat", "r")) {
+// We assume that the stack extends from its current address to the end of
+// the environment space. In reality, there is another string literal (the
+// program name) after the environment, but this is close enough (we only
+// need to be within 100K or so).
+unsigned long StackPtr, EnvEnd;
+if (fscanf(StatFile,
+   "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*lu %*lu %*lu %*lu %*lu "
+   "%*lu %*ld %*ld %*ld %*ld %*ld %*ld %*llu %*lu %*ld %*lu %*lu "
+   "%*lu %*lu %lu %*lu %*lu %*lu %*lu %*lu %*llu %*lu %*lu %*d %*d 
"
+   "%*u %*u %*llu %*lu %*ld %*lu %*lu %*lu %*lu %*lu %*lu %lu %*d",
+   , ) == 2) {
+  Usage = StackPtr < EnvEnd ? EnvEnd - StackPtr : StackPtr - EnvEnd;
+}
+fclose(StatFile);
+  }
+  return Usage;
+}
+
+#include 
+
 LLVM_ATTRIBUTE_NOINLINE
-static void ensureStackAddressSpace() {
+static void ensureStackAddressSpace(int ExtraChunks = 0) {
   // Linux kernels prior to 4.1 will sometimes locate the heap of a PIE binary
   // relatively close to the stack (they are only guaranteed to be 128MiB
   // apart). This results in crashes if we happen to heap-allocate more than
   // 128MiB before we reach our stack high-water mark.
   //
   // To avoid these crashes, ensure that we have sufficient virtual memory
-  // pages allocated before we start running by touching an early page. (We
-  // allow 512KiB for kernel/libc-provided data such as command-line arguments
-  // and environment variables, and for main and cc1_main)
-  volatile char ReservedStack[kSufficientStack - 512 * 1024];
-  volatile int N = 0;
-  (void)+ReservedStack[N];
+  // pages allocated before we start running.
+  size_t Curr = getCurrentStackAllocation();
+  const int kTargetStack = kSufficientStack - 256 * 1024;
+  if (Curr < kTargetStack) {
+volatile char *volatile Alloc =
+static_cast(alloca(kTargetStack - Curr));
+Alloc[0] = 0;
+Alloc[kTargetStack - Curr - 1] = 0;
+  }
 }
 #else
 static void ensureStackAddressSpace() {}


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


[PATCH] D25579: [codeview] emit debug info for indirect virtual base classes

2016-10-14 Thread Bob Haarman via cfe-commits
inglorion updated this revision to Diff 74733.
inglorion added a comment.

@rnk's comments (thanks!)

- Converted SeenTypes to a DenseSet.
- Switched to getCodeGenOpts().EmitCodeView to check if we should emit the 
extra records.
- Switched to using SeenTypes.count(...) != 0 to check if we've seen a type.


https://reviews.llvm.org/D25579

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-ms-vbase.cpp

Index: test/CodeGenCXX/debug-info-ms-vbase.cpp
===
--- test/CodeGenCXX/debug-info-ms-vbase.cpp
+++ test/CodeGenCXX/debug-info-ms-vbase.cpp
@@ -24,6 +24,18 @@
 
 // CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]])
 
+// CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase"
+// CHECK-SAME: elements: ![[elements:[0-9]+]]
+
+// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]]
+// CHECK-NOT: DIFlagIndirect
+// CHECK-SAME: )
+
+// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]]
+// CHECK-SAME: flags:
+// CHECK-SAME: DIFlagVirtual
+// CHECK-SAME: DIFlagIndirect
+
 // CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr",
 // CHECK-SAME: elements: ![[elements:[0-9]+]]
 
@@ -52,3 +64,6 @@
 
 HasPrimaryBase has_primary_base;
 
+struct HasIndirectVirtualBase : public HasPrimaryBase {};
+
+HasIndirectVirtualBase has_indirect_virtual_base;
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -15,12 +15,14 @@
 #define LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H
 
 #include "CGBuilder.h"
+#include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExternalASTSource.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Frontend/CodeGenOptions.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/IR/DIBuilder.h"
 #include "llvm/IR/DebugInfo.h"
@@ -32,7 +34,6 @@
 }
 
 namespace clang {
-class CXXMethodDecl;
 class ClassTemplateSpecializationDecl;
 class GlobalDecl;
 class ModuleMap;
@@ -218,6 +219,15 @@
SmallVectorImpl ,
llvm::DIType *RecordTy);
 
+  /// Helper function for CollectCXXBases.
+  /// Adds debug info entries for types in Bases that are not in SeenTypes.
+  void CollectCXXBasesAux(const CXXRecordDecl *RD, llvm::DIFile *Unit,
+  SmallVectorImpl ,
+  llvm::DIType *RecordTy,
+  const CXXRecordDecl::base_class_const_range ,
+  llvm::DenseSet ,
+  llvm::DINode::DIFlags StartingFlags);
+
   /// A helper function to collect template parameters.
   llvm::DINodeArray CollectTemplateParams(const TemplateParameterList *TPList,
   ArrayRef TAList,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -13,9 +13,9 @@
 
 #include "CGDebugInfo.h"
 #include "CGBlocks.h"
-#include "CGRecordLayout.h"
 #include "CGCXXABI.h"
 #include "CGObjCRuntime.h"
+#include "CGRecordLayout.h"
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "clang/AST/ASTContext.h"
@@ -31,7 +31,9 @@
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/ModuleMap.h"
 #include "clang/Lex/PreprocessorOptions.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
@@ -1366,13 +1368,35 @@
 void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile *Unit,
   SmallVectorImpl ,
   llvm::DIType *RecordTy) {
-  const ASTRecordLayout  = CGM.getContext().getASTRecordLayout(RD);
-  for (const auto  : RD->bases()) {
-llvm::DINode::DIFlags BFlags = llvm::DINode::FlagZero;
-uint64_t BaseOffset;
+  llvm::DenseSet SeenTypes;
+  CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->bases(), SeenTypes,
+ llvm::DINode::FlagZero);
+
+  // If we are generating CodeView debug info, we also need to emit records for
+  // indirect virtual base classes.
+  if (CGM.getCodeGenOpts().EmitCodeView) {
+CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->vbases(), SeenTypes,
+   llvm::DINode::FlagIndirect | llvm::DINode::FlagVirtual);
+  }
+}
 
+void CGDebugInfo::CollectCXXBasesAux(
+const CXXRecordDecl 

Re: [PATCH] D24997: [ClangTidy] Add UsingInserter and NamespaceAliaser

2016-10-14 Thread Julian Bangert via cfe-commits
Apologies for the breakage. I investigated and it turns out my open-source
checkout does not build clang-tidy. I have checked out llvm into ~/llvm,
clang into ~/llvm/tools/clang and clang-extra-tools into
~/llvm/tools/clang/tools/extra.
In ~/llvm-build I run cmake ../llvm && make -j 32 and it doesn't compile
clang tidy. I also tried  cmake -DCLANG_ENABLE_STATIC_ANALYZER=true
../llvm/ but that doesn't make a difference. Any ideas?


On Wed, Oct 12, 2016 at 1:34 AM Haojian Wu  wrote:

> hokein added a comment.
>
> @jbangert, your patch broke the buildbot, and I reverted it in r283985.
> You need to add the new source files to the CMakefile. (I saw other
> compilation errors after I updated the cmake files, Could you take a look
> on it? )
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D24997
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25475: [analyzer] Add a new SVal to support pointer-to-member operations.

2016-10-14 Thread Kirill Romanenkov via cfe-commits
kromanenkov added inline comments.



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:2314
 {
+  // Return to fulfil assert condition
+  if (location.getAs())

NoQ wrote:
> Hmm. Why would anybody try to load anything from a plain pointer-to-member, 
> rather than from a pointer-to-member-applied-to-an-object (which would no 
> longer be represented by a `PointerToMember` value)? I suspect there's 
> something wrong above the stack (or one of the sub-expression `SVal`s is 
> incorrect), because otherwise i think that making `PointerToMember` a NonLoc 
> is correct - we cannot store things in it or load things from it.
Brief analysis shows that we call evalLoad of pointer-to-member SVal after 
ExprEngine::VisitCast call when cast kind is CK_LValueToRValue. Skipping this 
check leads to assertion fail in pointer-to-member.cpp test. I will investigate 
the other ways to supress this assertion.



Comment at: test/Analysis/pointer-to-member.cpp:79
   // FIXME: Should emit a null dereference.
   return obj.*member; // no-warning
 }

NoQ wrote:
> In fact, maybe dereferencing a null pointer-to-member should produce an 
> `UndefinedVal`, which could be later caught by 
> `core.uninitialized.UndefReturn`. I wonder why doesn't this happen.
In fact, I plan to caught dereferencing of null pointer-to-members by the 
checker which I intend to commit after this patch :) So, do you think that the 
check for dereferencing a null pointer-to-member should be a part of an 
analyzer core?


https://reviews.llvm.org/D25475



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


[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

2016-10-14 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

There are two overloaded functions of CodeGenFunction::EmitScalarInit. Are you 
suggesting we fold both of them into EmitStoreThroughLValue and remove them?


https://reviews.llvm.org/D25547



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


Re: [libcxx] r284214 - XFAIL aligned allocation tests for older Clang versions

2016-10-14 Thread Nico Weber via cfe-commits
This is breaking tests for me:

Unexpected Passing Tests (4):
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp

Am I holding something wrong, or are these XFAILs wrong?

On Fri, Oct 14, 2016 at 4:47 AM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Oct 14 03:47:09 2016
> New Revision: 284214
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284214=rev
> Log:
> XFAIL aligned allocation tests for older Clang versions
>
> Modified:
> libcxx/trunk/test/libcxx/test/config.py
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_
> replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/new_align_val_t_
> nothrow_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
>
> Modified: libcxx/trunk/test/libcxx/test/config.py
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/
> libcxx/test/config.py?rev=284214=284213=284214=diff
> 
> ==
> --- libcxx/trunk/test/libcxx/test/config.py (original)
> +++ libcxx/trunk/test/libcxx/test/config.py Fri Oct 14 03:47:09 2016
> @@ -315,6 +315,10 @@ class Configuration(object):
>
>  if self.cxx.hasCompileFlag('-faligned-allocation'):
>  self.config.available_features.add('-faligned-allocation')
> +else:
> +# FIXME remove this once more than just clang-4.0 support
> +# C++17 aligned allocation.
> +self.config.available_features.add('no-aligned-allocation')
>
>  if self.get_lit_bool('has_libatomic', False):
>  self.config.available_features.add('libatomic')
>
> Modified: libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> language.support/support.dynamic/new.delete/new.delete.
> array/new_align_val_t.pass.cpp?rev=284214=284213=284214=diff
> 
> ==
> --- libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp (original)
> +++ libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp Fri Oct 14
> 03:47:09 2016
> @@ -9,11 +9,13 @@
>
>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>
> -// test operator new
> -
>  // asan and msan will not call the new handler.
>  // UNSUPPORTED: sanitizer-new-delete
>
> +// XFAIL: no-aligned-allocation
> +
> +// test operator new
> +
>  #include 
>  #include 
>  #include 
>
> Modified: libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> language.support/support.dynamic/new.delete/new.delete.
> array/new_align_val_t_nothrow.pass.cpp?rev=284214=284213&
> r2=284214=diff
> 
> ==
> --- libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
> (original)
> +++ libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp Fri
> Oct 14 03:47:09 2016
> @@ -9,11 +9,13 @@
>
>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>
> -// test operator new (nothrow)
> -
>  // asan and msan will not call the new handler.
>  // UNSUPPORTED: sanitizer-new-delete
>
> +// XFAIL: no-aligned-allocation
> +
> +// test operator new (nothrow)
> +
>  #include 
>  #include 
>  #include 
>
> Modified: libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_
> replace.pass.cpp
> URL: 

r284265 - [Sema] Refactor context checking for availability diagnostics

2016-10-14 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Fri Oct 14 14:08:01 2016
New Revision: 284265

URL: http://llvm.org/viewvc/llvm-project?rev=284265=rev
Log:
[Sema] Refactor context checking for availability diagnostics

This commit combines a couple of redundant functions that do availability
attribute context checking into a more correct/simpler one.

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

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaObjC/class-unavail-warning.m

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284265=284264=284265=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Oct 14 14:08:01 2016
@@ -9889,23 +9889,16 @@ public:
 return OriginalLexicalContext ? OriginalLexicalContext : CurContext;
   }
 
-  AvailabilityResult getCurContextAvailability() const;
-
-  /// \brief Get the verison that this context implies.
-  /// For instance, a method in an interface that is annotated with an
-  /// availability attribuite effectively has the availability of the 
interface.
-  VersionTuple getVersionForDecl(const Decl *Ctx) const;
-
   /// \brief The diagnostic we should emit for \c D, or \c AR_Available.
   ///
   /// \param D The declaration to check. Note that this may be altered to point
   /// to another declaration that \c D gets it's availability from. i.e., we
   /// walk the list of typedefs to find an availability attribute.
   ///
-  /// \param ContextVersion The version to compare availability against.
-  AvailabilityResult
-  ShouldDiagnoseAvailabilityOfDecl(NamedDecl *, VersionTuple ContextVersion,
-   std::string *Message);
+  /// \param Message If non-null, this will be populated with the message from
+  /// the availability attribute that is selected.
+  AvailabilityResult ShouldDiagnoseAvailabilityOfDecl(NamedDecl *,
+  std::string *Message);
 
   const DeclContext *getCurObjCLexicalContext() const {
 const DeclContext *DC = getCurLexicalContext();

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=284265=284264=284265=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Oct 14 14:08:01 2016
@@ -15615,29 +15615,3 @@ void Sema::ActOnPragmaWeakAlias(Identifi
 Decl *Sema::getObjCDeclContext() const {
   return (dyn_cast_or_null(CurContext));
 }
-
-AvailabilityResult Sema::getCurContextAvailability() const {
-  const Decl *D = cast_or_null(getCurObjCLexicalContext());
-  if (!D)
-return AR_Available;
-
-  // If we are within an Objective-C method, we should consult
-  // both the availability of the method as well as the
-  // enclosing class.  If the class is (say) deprecated,
-  // the entire method is considered deprecated from the
-  // purpose of checking if the current context is deprecated.
-  if (const ObjCMethodDecl *MD = dyn_cast(D)) {
-AvailabilityResult R = MD->getAvailability();
-if (R != AR_Available)
-  return R;
-D = MD->getClassInterface();
-  }
-  // If we are within an Objective-c @implementation, it
-  // gets the same availability context as the @interface.
-  else if (const ObjCImplementationDecl *ID =
-dyn_cast(D)) {
-D = ID->getClassInterface();
-  }
-  // Recover from user error.
-  return D ? D->getAvailability() : AR_Available;
-}

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=284265=284264=284265=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Oct 14 14:08:01 2016
@@ -6317,30 +6317,6 @@ static void handleDelayedForbiddenType(S
   diag.Triggered = true;
 }
 
-static bool isDeclDeprecated(Decl *D) {
-  do {
-if (D->isDeprecated())
-  return true;
-// A category implicitly has the availability of the interface.
-if (const ObjCCategoryDecl *CatD = dyn_cast(D))
-  if (const ObjCInterfaceDecl *Interface = CatD->getClassInterface())
-return Interface->isDeprecated();
-  } while ((D = cast_or_null(D->getDeclContext(;
-  return false;
-}
-
-static bool isDeclUnavailable(Decl *D) {
-  do {
-if (D->isUnavailable())
-  return true;
-// A category implicitly has the availability of the interface.
-if (const ObjCCategoryDecl *CatD = dyn_cast(D))
-  if (const ObjCInterfaceDecl *Interface = CatD->getClassInterface())
-return Interface->isUnavailable();
-  } while ((D = 

[PATCH] D25283: AvailabilityAttrs: Refactor context checking when diagnosing an availability violation

2016-10-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284265: [Sema] Refactor context checking for availability 
diagnostics (authored by epilk).

Changed prior to commit:
  https://reviews.llvm.org/D25283?vs=74547=74729#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25283

Files:
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/test/SemaObjC/class-unavail-warning.m

Index: cfe/trunk/include/clang/Sema/Sema.h
===
--- cfe/trunk/include/clang/Sema/Sema.h
+++ cfe/trunk/include/clang/Sema/Sema.h
@@ -9889,23 +9889,16 @@
 return OriginalLexicalContext ? OriginalLexicalContext : CurContext;
   }
 
-  AvailabilityResult getCurContextAvailability() const;
-
-  /// \brief Get the verison that this context implies.
-  /// For instance, a method in an interface that is annotated with an
-  /// availability attribuite effectively has the availability of the interface.
-  VersionTuple getVersionForDecl(const Decl *Ctx) const;
-
   /// \brief The diagnostic we should emit for \c D, or \c AR_Available.
   ///
   /// \param D The declaration to check. Note that this may be altered to point
   /// to another declaration that \c D gets it's availability from. i.e., we
   /// walk the list of typedefs to find an availability attribute.
   ///
-  /// \param ContextVersion The version to compare availability against.
-  AvailabilityResult
-  ShouldDiagnoseAvailabilityOfDecl(NamedDecl *, VersionTuple ContextVersion,
-   std::string *Message);
+  /// \param Message If non-null, this will be populated with the message from
+  /// the availability attribute that is selected.
+  AvailabilityResult ShouldDiagnoseAvailabilityOfDecl(NamedDecl *,
+  std::string *Message);
 
   const DeclContext *getCurObjCLexicalContext() const {
 const DeclContext *DC = getCurLexicalContext();
Index: cfe/trunk/test/SemaObjC/class-unavail-warning.m
===
--- cfe/trunk/test/SemaObjC/class-unavail-warning.m
+++ cfe/trunk/test/SemaObjC/class-unavail-warning.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1  -fsyntax-only  -triple x86_64-apple-darwin10 -verify %s
+// RUN: %clang_cc1  -fsyntax-only -fblocks -triple x86_64-apple-darwin10 -verify %s
 // rdar://9092208
 
 __attribute__((unavailable("not available")))
@@ -98,3 +98,19 @@
 @end
 @interface UnavailSub(cat) // no error
 @end
+
+int unavail_global UNAVAILABLE;
+
+UNAVAILABLE __attribute__((objc_root_class))
+@interface TestAttrContext
+-meth;
+@end
+
+@implementation TestAttrContext
+-meth {
+  unavail_global = 2; // no warn
+  (void) ^{
+unavail_global = 4; // no warn
+  };
+}
+@end
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -15615,29 +15615,3 @@
 Decl *Sema::getObjCDeclContext() const {
   return (dyn_cast_or_null(CurContext));
 }
-
-AvailabilityResult Sema::getCurContextAvailability() const {
-  const Decl *D = cast_or_null(getCurObjCLexicalContext());
-  if (!D)
-return AR_Available;
-
-  // If we are within an Objective-C method, we should consult
-  // both the availability of the method as well as the
-  // enclosing class.  If the class is (say) deprecated,
-  // the entire method is considered deprecated from the
-  // purpose of checking if the current context is deprecated.
-  if (const ObjCMethodDecl *MD = dyn_cast(D)) {
-AvailabilityResult R = MD->getAvailability();
-if (R != AR_Available)
-  return R;
-D = MD->getClassInterface();
-  }
-  // If we are within an Objective-c @implementation, it
-  // gets the same availability context as the @interface.
-  else if (const ObjCImplementationDecl *ID =
-dyn_cast(D)) {
-D = ID->getClassInterface();
-  }
-  // Recover from user error.
-  return D ? D->getAvailability() : AR_Available;
-}
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -6317,30 +6317,6 @@
   diag.Triggered = true;
 }
 
-static bool isDeclDeprecated(Decl *D) {
-  do {
-if (D->isDeprecated())
-  return true;
-// A category implicitly has the availability of the interface.
-if (const ObjCCategoryDecl *CatD = dyn_cast(D))
-  if (const ObjCInterfaceDecl *Interface = CatD->getClassInterface())
-return Interface->isDeprecated();
-  } while ((D = cast_or_null(D->getDeclContext(;
-  return false;
-}
-
-static bool isDeclUnavailable(Decl *D) {
-  do {
-if (D->isUnavailable())
-  return true;
-// A category implicitly has the availability of the interface.
-if (const 

Re: r276159 - [modules] Don't emit initializers for VarDecls within a module eagerly whenever

2016-10-14 Thread Manman via cfe-commits
Hi Richard,

Another follow-up commit r284263.

When we import the top-level module with “@import X;”, all the initializers in 
the submodule should be emitted.

Let me know if you see any problem,
Manman

> On Oct 13, 2016, at 4:03 PM, Richard Smith  wrote:
> 
> On Thu, Oct 13, 2016 at 11:52 AM, Manman via cfe-commits 
> > wrote:
> Hi Richard,
> 
> I committed a follow-up patch in r284142 to fix issues with C/ObjC.
> 
> Let me know if you see any problem.
> 
> Looks good, thank you!
>  
> Manman
> 
> > On Jul 20, 2016, at 12:10 PM, Richard Smith via cfe-commits 
> > > wrote:
> >
> > Author: rsmith
> > Date: Wed Jul 20 14:10:16 2016
> > New Revision: 276159
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=276159=rev 
> > 
> > Log:
> > [modules] Don't emit initializers for VarDecls within a module eagerly 
> > whenever
> > we first touch any part of that module. Instead, defer them until the first
> > time that module is (transitively) imported. The initializer step for a 
> > module
> > then recursively initializes modules that its own headers imported.
> >
> > For example, this avoids running the  global initializer in 
> > programs
> > that don't actually use iostreams, but do use other parts of the standard
> > library.
> >
> > Added:
> >cfe/trunk/test/Modules/Inputs/unused-global-init/
> >  - copied from r275623, 
> > cfe/trunk/test/Modules/Inputs/unused-global-init/
> >cfe/trunk/test/Modules/unused-global-init.cpp
> >  - copied, changed from r275623, 
> > cfe/trunk/test/Modules/unused-global-init.cpp
> > Modified:
> >cfe/trunk/include/clang/AST/ASTContext.h
> >cfe/trunk/include/clang/Sema/Sema.h
> >cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> >cfe/trunk/lib/AST/ASTContext.cpp
> >cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> >cfe/trunk/lib/Sema/SemaDecl.cpp
> >cfe/trunk/lib/Sema/SemaLookup.cpp
> >cfe/trunk/lib/Serialization/ASTReader.cpp
> >cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> >cfe/trunk/lib/Serialization/ASTWriter.cpp
> >cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> >cfe/trunk/test/Modules/Inputs/unused-global-init/used.h
> >cfe/trunk/test/Modules/odr.cpp
> >cfe/trunk/test/Modules/templates.mm 
> >
> > Modified: cfe/trunk/include/clang/AST/ASTContext.h
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=276159=276158=276159=diff
> >  
> > 
> > ==
> > --- cfe/trunk/include/clang/AST/ASTContext.h (original)
> > +++ cfe/trunk/include/clang/AST/ASTContext.h Wed Jul 20 14:10:16 2016
> > @@ -312,6 +312,18 @@ class ASTContext : public RefCountedBase
> >   /// definitions of that entity.
> >   llvm::DenseMap> MergedDefModules;
> >
> > +  /// \brief Initializers for a module, in order. Each Decl will be either
> > +  /// something that has a semantic effect on startup (such as a variable 
> > with
> > +  /// a non-constant initializer), or an ImportDecl (which recursively 
> > triggers
> > +  /// initialization of another module).
> > +  struct PerModuleInitializers {
> > +llvm::SmallVector Initializers;
> > +llvm::SmallVector LazyInitializers;
> > +
> > +void resolve(ASTContext );
> > +  };
> > +  llvm::DenseMap ModuleInitializers;
> > +
> > public:
> >   /// \brief A type synonym for the TemplateOrInstantiation mapping.
> >   typedef llvm::PointerUnion
> > @@ -883,6 +895,17 @@ public:
> > return MergedIt->second;
> >   }
> >
> > +  /// Add a declaration to the list of declarations that are initialized
> > +  /// for a module. This will typically be a global variable (with internal
> > +  /// linkage) that runs module initializers, such as the iostream 
> > initializer,
> > +  /// or an ImportDecl nominating another module that has initializers.
> > +  void addModuleInitializer(Module *M, Decl *Init);
> > +
> > +  void addLazyModuleInitializers(Module *M, ArrayRef IDs);
> > +
> > +  /// Get the initializations to perform when importing a module, if any.
> > +  ArrayRef getModuleInitializers(Module *M);
> > +
> >   TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
> >
> >   ExternCContextDecl *getExternCContextDecl() const;
> >
> > Modified: cfe/trunk/include/clang/Sema/Sema.h
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=276159=276158=276159=diff
> >  
> > 
> > 

r284263 - Module: emit initializers in submodules when importing the parent module.

2016-10-14 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Oct 14 13:55:44 2016
New Revision: 284263

URL: http://llvm.org/viewvc/llvm-project?rev=284263=rev
Log:
Module: emit initializers in submodules when importing the parent module.

When importing the parent module, module initializers in submodules should
be emitted.

rdar://28740482

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/test/Modules/Inputs/objc-initializer/module.modulemap
cfe/trunk/test/Modules/objc-initializer.m

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=284263=284262=284263=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Oct 14 13:55:44 2016
@@ -3951,9 +3951,33 @@ void CodeGenModule::EmitTopLevelDecl(Dec
 DI->EmitImportDecl(*Import);
 }
 
-// Emit the module initializers.
-for (auto *D : Context.getModuleInitializers(Import->getImportedModule()))
-  EmitTopLevelDecl(D);
+// Find all of the submodules and emit the module initializers.
+llvm::SmallPtrSet Visited;
+SmallVector Stack;
+Visited.insert(Import->getImportedModule());
+Stack.push_back(Import->getImportedModule());
+
+while (!Stack.empty()) {
+  clang::Module *Mod = Stack.pop_back_val();
+  if (!EmittedModuleInitializers.insert(Mod).second)
+continue;
+
+  for (auto *D : Context.getModuleInitializers(Mod))
+EmitTopLevelDecl(D);
+
+  // Visit the submodules of this module.
+  for (clang::Module::submodule_iterator Sub = Mod->submodule_begin(),
+ SubEnd = Mod->submodule_end();
+   Sub != SubEnd; ++Sub) {
+// Skip explicit children; they need to be explicitly imported to emit
+// the initializers.
+if ((*Sub)->IsExplicit)
+  continue;
+
+if (Visited.insert(*Sub).second)
+  Stack.push_back(*Sub);
+  }
+}
 break;
   }
 

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=284263=284262=284263=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Oct 14 13:55:44 2016
@@ -420,6 +420,10 @@ private:
   /// \brief The complete set of modules that has been imported.
   llvm::SetVector ImportedModules;
 
+  /// \brief The set of modules for which the module initializers
+  /// have been emitted.
+  llvm::SmallPtrSet EmittedModuleInitializers;
+
   /// \brief A vector of metadata strings.
   SmallVector LinkerOptionsMetadata;
 

Modified: cfe/trunk/test/Modules/Inputs/objc-initializer/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/objc-initializer/module.modulemap?rev=284263=284262=284263=diff
==
--- cfe/trunk/test/Modules/Inputs/objc-initializer/module.modulemap (original)
+++ cfe/trunk/test/Modules/Inputs/objc-initializer/module.modulemap Fri Oct 14 
13:55:44 2016
@@ -1,4 +1,7 @@
 module X {
-  header "X.h"
+  module T {
+header "X.h"
+export *
+  }
   export *
 }

Modified: cfe/trunk/test/Modules/objc-initializer.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/objc-initializer.m?rev=284263=284262=284263=diff
==
--- cfe/trunk/test/Modules/objc-initializer.m (original)
+++ cfe/trunk/test/Modules/objc-initializer.m Fri Oct 14 13:55:44 2016
@@ -1,8 +1,14 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I 
%S/Inputs/objc-initializer %s -emit-llvm -o - -fobjc-arc | FileCheck %s
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I 
%S/Inputs/objc-initializer %s -emit-llvm -o - -fobjc-arc -DIMPORT_TOP | 
FileCheck %s
 // CHECK: kSimDeviceIOGetInterface = internal constant {{.*}} bitcast
 
+#ifdef IMPORT_TOP
+@import X;
+#else
 #import 
+#endif
+
 void test2(const NSString*);
 void test() {
   test2(kSimDeviceIOGetInterface);


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


Re: [libcxx] r249738 - Split out of .

2016-10-14 Thread Bruno Cardoso Lopes via cfe-commits
Hi Richard,

I have a patch on top of your suggested patch from a year ago, that
break the cyclic dependency we're seeing, with this (and a few changes
to the SDK) we can bootstrap clang with submodule local visibility on
darwin. I've attached the patch with a reduced, standalone testcase
that doesn't depend on the SDK. The issues that are not covered by
your patch, that I cover in mine, are related to built-in and textual
headers: they can be found in paths where they don't map to any
modules, triggering other cycles. I fix that by looking further to
find a matching module for the header in question, instead the first
found header in header search.

Can you take a look?

Thanks,


On Thu, Jul 28, 2016 at 3:55 PM, Adrian Prantl via cfe-commits
 wrote:
> +Bruno
>
> On Jul 27, 2016, at 11:58 PM, Nico Weber  wrote:
>
> I played with modules a bit today, and as far as I can tell this is still
> broken. If this proves difficult to fix, should this change be reverted for
> now? It breaks using modules on Darwin.
>
> On Sun, Mar 13, 2016 at 12:53 AM, Adrian Prantl via cfe-commits
>  wrote:
>>
>> > On Mar 11, 2016, at 4:11 PM, Duncan P. N. Exon Smith
>> >  wrote:
>> >
>> > Did anyone file a PR for this?
>> >
>>
>> I filed PR 26928 - Prune the include path for modules
>> https://llvm.org/bugs/show_bug.cgi?id=26928
>> as a starting point.
>>
>> -- adrian
>>
>> ___
>> 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
>



-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc


0001-Add-NoUndeclaredIncludes-attribute-and-logic.patch
Description: Binary data


0002-Changes-on-top-of-Richard-s-patch.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284259 - Revert r284256 due to test failure

2016-10-14 Thread Ed Maste via cfe-commits
Author: emaste
Date: Fri Oct 14 13:20:12 2016
New Revision: 284259

URL: http://llvm.org/viewvc/llvm-project?rev=284259=rev
Log:
Revert r284256 due to test failure

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/openbsd.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=284259=284258=284259=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 14 13:20:12 2016
@@ -8519,10 +8519,6 @@ void openbsd::Linker::ConstructJob(Compi
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
-  else if (Args.hasArg(options::OPT_static) &&
-   !Args.hasArg(options::OPT_nopie))
-CmdArgs.push_back(
-Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
   else
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));

Modified: cfe/trunk/test/Driver/openbsd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=284259=284258=284259=diff
==
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Fri Oct 14 13:20:12 2016
@@ -67,26 +67,3 @@
 // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
 // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
 // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
-
-// Check linking against correct startup code when (not) using PIE
-// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
-// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s 
-### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
-// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 
2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
-// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie 
%s -### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
-// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -nopie %s -### 
2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
-// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -nopie %s 
-### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
-// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -static -nopie %s 
-### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
-// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -static 
-nopie %s -### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
-// CHECK-PIE: "/usr/lib/crt0.o"
-// CHECK-PIE-NOT: "-nopie"
-// CHECK-STATIC-PIE: "/usr/lib/rcrt0.o"
-// CHECK-STATIC-PIE-NOT: "-nopie"
-// CHECK-NOPIE: "-nopie" {{.*}}"/usr/lib/crt0.o"


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


[PATCH] D22130: Link static PIE programs against rcrt0.o on OpenBSD

2016-10-14 Thread Ed Maste via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284256: Link static PIE programs against rcrt0.o on OpenBSD 
(authored by emaste).

Changed prior to commit:
  https://reviews.llvm.org/D22130?vs=68046=74718#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22130

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/openbsd.c


Index: cfe/trunk/test/Driver/openbsd.c
===
--- cfe/trunk/test/Driver/openbsd.c
+++ cfe/trunk/test/Driver/openbsd.c
@@ -67,3 +67,26 @@
 // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
 // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
 // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
+
+// Check linking against correct startup code when (not) using PIE
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie 
%s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -nopie %s -### 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -nopie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -static -nopie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -static 
-nopie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// CHECK-PIE: "/usr/lib/crt0.o"
+// CHECK-PIE-NOT: "-nopie"
+// CHECK-STATIC-PIE: "/usr/lib/rcrt0.o"
+// CHECK-STATIC-PIE-NOT: "-nopie"
+// CHECK-NOPIE: "-nopie" {{.*}}"/usr/lib/crt0.o"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -8519,6 +8519,10 @@
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+  else if (Args.hasArg(options::OPT_static) &&
+   !Args.hasArg(options::OPT_nopie))
+CmdArgs.push_back(
+Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
   else
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));


Index: cfe/trunk/test/Driver/openbsd.c
===
--- cfe/trunk/test/Driver/openbsd.c
+++ cfe/trunk/test/Driver/openbsd.c
@@ -67,3 +67,26 @@
 // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
 // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
 // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
+
+// Check linking against correct startup code when (not) using PIE
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -nopie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -nopie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -static -nopie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -static -nopie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// CHECK-PIE: "/usr/lib/crt0.o"
+// CHECK-PIE-NOT: "-nopie"
+// CHECK-STATIC-PIE: "/usr/lib/rcrt0.o"
+// CHECK-STATIC-PIE-NOT: "-nopie"
+// CHECK-NOPIE: "-nopie" {{.*}}"/usr/lib/crt0.o"
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -8519,6 +8519,10 @@
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+  else if (Args.hasArg(options::OPT_static) &&
+   

r284256 - Link static PIE programs against rcrt0.o on OpenBSD

2016-10-14 Thread Ed Maste via cfe-commits
Author: emaste
Date: Fri Oct 14 12:59:53 2016
New Revision: 284256

URL: http://llvm.org/viewvc/llvm-project?rev=284256=rev
Log:
Link static PIE programs against rcrt0.o on OpenBSD

Patch by Stefan Kempf.

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

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/openbsd.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=284256=284255=284256=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 14 12:59:53 2016
@@ -8519,6 +8519,10 @@ void openbsd::Linker::ConstructJob(Compi
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+  else if (Args.hasArg(options::OPT_static) &&
+   !Args.hasArg(options::OPT_nopie))
+CmdArgs.push_back(
+Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
   else
 CmdArgs.push_back(
 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));

Modified: cfe/trunk/test/Driver/openbsd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=284256=284255=284256=diff
==
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Fri Oct 14 12:59:53 2016
@@ -67,3 +67,26 @@
 // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
 // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
 // CHECK-MIPS64EL-PIC: as{{.*}}" "-mabi" "64" "-EL" "-KPIC"
+
+// Check linking against correct startup code when (not) using PIE
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static -fno-pie 
%s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -nopie %s -### 
2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -nopie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -static -nopie %s 
-### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// RUN: %clang -no-canonical-prefix -target i868-pc-openbsd -fno-pie -static 
-nopie %s -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
+// CHECK-PIE: "/usr/lib/crt0.o"
+// CHECK-PIE-NOT: "-nopie"
+// CHECK-STATIC-PIE: "/usr/lib/rcrt0.o"
+// CHECK-STATIC-PIE-NOT: "-nopie"
+// CHECK-NOPIE: "-nopie" {{.*}}"/usr/lib/crt0.o"


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


Re: [libcxx] r284210 - XFAIL aligned allocation test failures with UBSAN

2016-10-14 Thread Richard Smith via cfe-commits
On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Oct 14 02:49:15 2016
> New Revision: 284210
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284210=rev
> Log:
> XFAIL  aligned allocation test failures with UBSAN
>
> Modified:
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_
> replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/new_align_val_t_
> nothrow_replace.pass.cpp
>
> Modified: libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> language.support/support.dynamic/new.delete/new.delete.
> array/delete_align_val_t_replace.pass.cpp?rev=284210&
> r1=284209=284210=diff
> 
> ==
> --- libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
> (original)
> +++ libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
> Fri Oct 14 02:49:15 2016
> @@ -17,6 +17,9 @@
>  // None of the current GCC compilers support this.
>  // XFAIL: gcc-4, gcc-5, gcc-6
>
> +// UBSAN replaces certain new/delete functions which makes this test fail
>

I don't think that's the problem; the UBSan runtime doesn't replace any
functions. Instead...


> +// XFAIL: ubsan
> +
>  #include 
>  #include 
>  #include 
> @@ -58,24 +61,24 @@ struct alignas(std::max_align_t) B {};
>  int main()
>  {
>

I think you're missing a call to reset() here. It looks like the sanitizer
runtimes happen to call 'operator new' before entering main.


>  {
> -B *x = new B;
> +B *x = new B[2];
>  assert(0 == unsized_delete_called);
>  assert(0 == unsized_delete_nothrow_called);
>  assert(0 == aligned_delete_called);
>
> -delete x;
> +delete [] x;
>  assert(1 == unsized_delete_called);
>  assert(0 == unsized_delete_nothrow_called);
>  assert(0 == aligned_delete_called);
>  }
>  reset();
>  {
> -A *x = new A;
> +A *x = new A[2];
>  assert(0 == unsized_delete_called);
>  assert(0 == unsized_delete_nothrow_called);
>  assert(0 == aligned_delete_called);
>
> -delete x;
> +delete [] x;
>  assert(0 == unsized_delete_called);
>  assert(0 == unsized_delete_nothrow_called);
>  assert(1 == aligned_delete_called);
>
> Modified: libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_
> replace.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> language.support/support.dynamic/new.delete/new.delete.
> array/new_align_val_t_nothrow_replace.pass.cpp?rev=284210&
> r1=284209=284210=diff
> 
> ==
> --- libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
> (original)
> +++ libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
> Fri Oct 14 02:49:15 2016
> @@ -13,9 +13,6 @@
>
>  // UNSUPPORTED: sanitizer-new-delete
>
> -// TODO Investigate why UBSAN prevents nothrow new from calling our
> replacement.
> -// XFAIL: ubsan
> -
>  #include 
>  #include 
>  #include 
>
> Modified: libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> language.support/support.dynamic/new.delete/new.delete.
> single/delete_align_val_t_replace.pass.cpp?rev=284210&
> r1=284209=284210=diff
> 
> ==
> --- libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
> (original)
> +++ libcxx/trunk/test/std/language.support/support.
> dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
> Fri Oct 14 02:49:15 2016
> @@ -17,6 +17,9 @@
>  // None of the current GCC compilers support this.
>  // XFAIL: gcc-4, gcc-5, gcc-6
>
> +// UBSAN replaces certain new/delete functions which makes this test fail
> +// XFAIL: ubsan
> +
>  #include 
>  #include 
>  #include 
>
> Modified: libcxx/trunk/test/std/language.support/support.
> 

[PATCH] D25593: [libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib

2016-10-14 Thread Dimitry Andric via cfe-commits
dim accepted this revision.
dim added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25593



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


r284253 - Implement __stosb intrinsic as a volatile memset

2016-10-14 Thread Albert Gutowski via cfe-commits
Author: agutowski
Date: Fri Oct 14 12:33:05 2016
New Revision: 284253

URL: http://llvm.org/viewvc/llvm-project?rev=284253=rev
Log:
Implement __stosb intrinsic as a volatile memset

Summary: We need `__stosb` to be an intrinsic, because SecureZeroMemory 
function uses it without including intrin.h. Implementing it as a volatile 
memset is not consistent with MSDN specification, but it gives us 
target-independent IR while keeping the most important properties of `__stosb`.

Reviewers: rnk, hans, thakis, majnemer

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=284253=284252=284253=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Fri Oct 14 12:33:05 2016
@@ -2041,6 +2041,8 @@ TARGET_HEADER_BUILTIN(__emulu, "ULLiUiUi
 
 TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(__stosb, "vUc*Ucz", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
+
 #undef BUILTIN
 #undef TARGET_BUILTIN
 #undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=284253=284252=284253=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Oct 14 12:33:05 2016
@@ -7770,6 +7770,11 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 Value *F = CGM.getIntrinsic(Intrinsic::addressofreturnaddress);
 return Builder.CreateCall(F);
   }
+  case X86::BI__stosb: {
+// We treat __stosb as a volatile memset - it may not generate "rep stosb"
+// instruction, but it will create a memset that won't be optimized away.
+return Builder.CreateMemSet(Ops[0], Ops[1], Ops[2], 1, true);
+  }
   }
 }
 

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=284253=284252=284253=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Fri Oct 14 12:33:05 2016
@@ -1024,11 +1024,6 @@ __movsw(unsigned short *__dst, unsigned
 : "%edi", "%esi", "%ecx");
 }
 static __inline__ void __DEFAULT_FN_ATTRS
-__stosb(unsigned char *__dst, unsigned char __x, size_t __n) {
-  __asm__("rep stosb" : : "D"(__dst), "a"(__x), "c"(__n)
-: "%edi", "%ecx");
-}
-static __inline__ void __DEFAULT_FN_ATTRS
 __stosd(unsigned long *__dst, unsigned long __x, size_t __n) {
   __asm__("rep stosl" : : "D"(__dst), "a"(__x), "c"(__n)
 : "%edi", "%ecx");

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=284253=284252=284253=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Fri Oct 14 12:33:05 2016
@@ -14,6 +14,22 @@ typedef __SIZE_TYPE__ size_t;
 
 #include 
 
+#if defined(__i386__) || defined(__x86_64__)
+void test__stosb(unsigned char *Dest, unsigned char Data, size_t Count) {
+  return __stosb(Dest, Data, Count);
+}
+
+// CHECK-I386: define{{.*}}void @test__stosb
+// CHECK-I386:   tail call void @llvm.memset.p0i8.i32(i8* %Dest, i8 %Data, i32 
%Count, i32 1, i1 true)
+// CHECK-I386:   ret void
+// CHECK-I386: }
+
+// CHECK-X64: define{{.*}}void @test__stosb
+// CHECK-X64:   tail call void @llvm.memset.p0i8.i64(i8* %Dest, i8 %Data, i64 
%Count, i32 1, i1 true)
+// CHECK-X64:   ret void
+// CHECK-X64: }
+#endif
+
 void *test_ReturnAddress() {
   return _ReturnAddress();
 }

Modified: cfe/trunk/test/Headers/ms-intrin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=284253=284252=284253=diff
==
--- cfe/trunk/test/Headers/ms-intrin.cpp (original)
+++ cfe/trunk/test/Headers/ms-intrin.cpp Fri Oct 14 12:33:05 2016
@@ -38,7 +38,6 @@ void f() {
   __movsd(0, 0, 0);
   __movsw(0, 0, 0);
 
-  __stosb(0, 0, 0);
   __stosd(0, 0, 0);
   __stosw(0, 0, 0);
 


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


[PATCH] D25334: Implement __stosb intrinsic as a volatile memset

2016-10-14 Thread David Majnemer via cfe-commits
majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D25334



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


[PATCH] D25606: alpha.core.UnreachableCode - don't warn about unreachable code inside macro

2016-10-14 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

We should pattern match for this specific macro pattern (ex: do{...}while(0) ) 
instead of suppressing all warnings coming from macros. Maybe we could use the 
same heuristic as -Wunreachable-code-return compiler warning?


Repository:
  rL LLVM

https://reviews.llvm.org/D25606



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


[PATCH] Warning for main returning a bool.

2016-10-14 Thread Joshua Hurwitz via cfe-commits
See attached.

Returning a bool from main is a special case of return type mismatch. The
common convention when returning a bool is that 'true' (== 1) indicates
success and 'false' (== 0) failure. But since main expects a return value
of 0 on success, returning a bool is usually unintended.
From 4b88e06e060fc70d6f82d17d92155377f939a96a Mon Sep 17 00:00:00 2001
From: Joshua Hurwitz 
Date: Fri, 14 Oct 2016 13:04:26 -0400
Subject: [PATCH] Warning for main returning a bool.

Returning a bool from main is a special case of return type mismatch.
The common convention when returning a bool is that 'true' (== 1)
indicates success and 'false' (== 0) failure. But since main expects a
return value of 0 on success, returning a bool is usually unintended.
---
 include/clang/Basic/DiagnosticSemaKinds.td |  2 ++
 lib/Sema/SemaStmt.cpp  |  5 +
 test/Sema/warn-main-returns-bool.cpp   | 17 +
 3 files changed, 24 insertions(+)
 create mode 100644 test/Sema/warn-main-returns-bool.cpp

diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 872311f..9b9115d 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -634,6 +634,8 @@ def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
 def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
 "parameter of 'main' (%select{argument count|argument array|environment|"
 "platform-specific data}0) must be of type %1">;
+def warn_main_returns_bool : Warning<"type of expression returned from 'main' "
+"(%0) should be 'int'">, InGroup;
 def err_main_global_variable :
 Error<"main cannot be declared as global variable">;
 def warn_main_redefined : Warning<"variable named 'main' with external linkage "
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index eba192d..dca81a2 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -3193,6 +3193,11 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
 if (FD->isNoReturn())
   Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr)
 << FD->getDeclName();
+if (FD->isMain() && RetValExp)
+  if (Context.hasSameUnqualifiedType(RetValExp->getType(), Context.BoolTy))
+Diag(ReturnLoc, diag::warn_main_returns_bool)
+  << RetValExp->getType().getUnqualifiedType()
+  << RetValExp->getSourceRange();
   } else if (ObjCMethodDecl *MD = getCurMethodDecl()) {
 FnRetType = MD->getReturnType();
 isObjCMethod = true;
diff --git a/test/Sema/warn-main-returns-bool.cpp b/test/Sema/warn-main-returns-bool.cpp
new file mode 100644
index 000..8763335
--- /dev/null
+++ b/test/Sema/warn-main-returns-bool.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wmain -verify %s
+
+// expected-note@+1 {{previous definition is here}}
+int main() {
+  return 0;
+}  // no-warning
+
+// expected-error@+1 {{redefinition of 'main'}}
+int main() {
+  unsigned int u = 0;
+  return u;
+}  // no-warning
+
+int main() {
+  const bool b = true;
+  return b;  // expected-warning {{type of expression returned from 'main' ('bool') should be 'int'}}
+}
-- 
2.8.0.rc3.226.g39d4020

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


[PATCH] D25621: DebugInfo: use DIAlignment type.

2016-10-14 Thread Adrian Prantl via cfe-commits
aprantl added inline comments.



Comment at: include/clang/AST/ASTContext.h:83
 uint64_t Width;
-unsigned Align;
+llvm::DIAlignment Align;
 bool AlignIsRequired : 1;

I'm not sure we want to use a debug info type inside the AST. I think we only 
want to use them in CGDebugInfo.cpp.


https://reviews.llvm.org/D25621



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-14 Thread Aditya Kumar via cfe-commits
hiraditya created this revision.
hiraditya added reviewers: mclow.lists, EricWF.
hiraditya added subscribers: laxmansole, sebpop, cfe-commits.

Author: laxmansole

  

Original Differential Revision: https://reviews.llvm.org/D22834

  

Posting the patch again as the bug https://llvm.org/bugs/show_bug.cgi?id=30341 
is fixed.

  

Currently basic_string's destructor is not getting inlined. So adding 'inline' 
attribute to ~basic_string().
Worked in collaboration with Aditya Kumar.

  

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280944 
91177308-0d34-0410-b5e6-96231b3b80d8


https://reviews.llvm.org/D25624

Files:
  include/string


Index: include/string
===
--- include/string
+++ include/string
@@ -1834,6 +1834,7 @@
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 template 
+inline _LIBCPP_INLINE_VISIBILITY
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2


Index: include/string
===
--- include/string
+++ include/string
@@ -1834,6 +1834,7 @@
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 template 
+inline _LIBCPP_INLINE_VISIBILITY
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-10-14 Thread Anton Yartsev via cfe-commits
ayartsev closed this revision.
ayartsev added a comment.

Closed by r283499.


https://reviews.llvm.org/D22494



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


[PATCH] D25305: [OpenCL] Setting constant address space for array initializers

2016-10-14 Thread Yaxun Liu via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


https://reviews.llvm.org/D25305



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


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

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

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

> > You could also try to add a canary with clang analyzer eval after the if 
> > statement to force the test to fail if we do add this symbolic reasoning.
>
> sounds good. sorry but I don't see how to do it.


The trick is to not first store the UnknownVal into a local (the analyzer will 
automatically create a symbol for that when read).

Instead you can do something like:

  if (table[i] != 0) { }
  clang_analyzer_eval((table[i] != 0)) // expected-warning {{UNKNOWN}}

This way if the analyzer ever starts generating symbols for a read from 
table[i] then the case split will change the eval to emit TRUE on one path and 
FALSE on the other.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



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


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

2016-10-14 Thread Ehsan Akhgari via cfe-commits
ehsan resigned from this revision.
ehsan removed a reviewer: ehsan.
ehsan added a comment.

I also don't know enough about the build system to review this, sorry!


Repository:
  rL LLVM

https://reviews.llvm.org/D1



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


[PATCH] D25305: [OpenCL] Setting constant address space for array initializers

2016-10-14 Thread Alexey Sotkin via cfe-commits
AlexeySotkin added a comment.

Now there should be both :)


https://reviews.llvm.org/D25305



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


[PATCH] D25305: [OpenCL] Setting constant address space for array initializers

2016-10-14 Thread Alexey Sotkin via cfe-commits
AlexeySotkin updated this revision to Diff 74693.
AlexeySotkin added a comment.

Squashing commits


https://reviews.llvm.org/D25305

Files:
  lib/CodeGen/CGDecl.cpp
  test/CodeGenOpenCL/private-array-initialization.cl


Index: test/CodeGenOpenCL/private-array-initialization.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/private-array-initialization.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | 
FileCheck %s
+
+// CHECK: @test.arr = private addrspace(2) constant [3 x i32] [i32 1, i32 2, 
i32 3], align 4
+
+void test() {
+  __private int arr[] = {1, 2, 3};
+// CHECK:  %[[arr_i8_ptr:[0-9]+]] = bitcast [3 x i32]* %arr to i8*
+// CHECK:  call void @llvm.memcpy.p0i8.p2i8.i32(i8* %[[arr_i8_ptr]], i8 
addrspace(2)* bitcast ([3 x i32] addrspace(2)* @test.arr to i8 addrspace(2)*), 
i32 12, i32 4, i1 false)
+}
\ No newline at end of file
Index: lib/CodeGen/CGDecl.cpp
===
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -1266,12 +1266,20 @@
 // Otherwise, create a temporary global with the initializer then
 // memcpy from the global to the alloca.
 std::string Name = getStaticDeclName(CGM, D);
+unsigned AS = 0;
+llvm::GlobalValue::UnnamedAddr UA = llvm::GlobalValue::UnnamedAddr::Global;
+if (getLangOpts().OpenCL) {
+  UA = llvm::GlobalValue::UnnamedAddr::None;
+  AS = CGM.getContext().getTargetAddressSpace(LangAS::opencl_constant);
+  BP = llvm::PointerType::getInt8PtrTy(getLLVMContext(), AS);
+}
 llvm::GlobalVariable *GV =
   new llvm::GlobalVariable(CGM.getModule(), constant->getType(), true,
llvm::GlobalValue::PrivateLinkage,
-   constant, Name);
+   constant, Name, nullptr,
+   llvm::GlobalValue::NotThreadLocal, AS);
 GV->setAlignment(Loc.getAlignment().getQuantity());
-GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
+GV->setUnnamedAddr(UA);
 
 Address SrcPtr = Address(GV, Loc.getAlignment());
 if (SrcPtr.getType() != BP)


Index: test/CodeGenOpenCL/private-array-initialization.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/private-array-initialization.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s
+
+// CHECK: @test.arr = private addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
+
+void test() {
+  __private int arr[] = {1, 2, 3};
+// CHECK:  %[[arr_i8_ptr:[0-9]+]] = bitcast [3 x i32]* %arr to i8*
+// CHECK:  call void @llvm.memcpy.p0i8.p2i8.i32(i8* %[[arr_i8_ptr]], i8 addrspace(2)* bitcast ([3 x i32] addrspace(2)* @test.arr to i8 addrspace(2)*), i32 12, i32 4, i1 false)
+}
\ No newline at end of file
Index: lib/CodeGen/CGDecl.cpp
===
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -1266,12 +1266,20 @@
 // Otherwise, create a temporary global with the initializer then
 // memcpy from the global to the alloca.
 std::string Name = getStaticDeclName(CGM, D);
+unsigned AS = 0;
+llvm::GlobalValue::UnnamedAddr UA = llvm::GlobalValue::UnnamedAddr::Global;
+if (getLangOpts().OpenCL) {
+  UA = llvm::GlobalValue::UnnamedAddr::None;
+  AS = CGM.getContext().getTargetAddressSpace(LangAS::opencl_constant);
+  BP = llvm::PointerType::getInt8PtrTy(getLLVMContext(), AS);
+}
 llvm::GlobalVariable *GV =
   new llvm::GlobalVariable(CGM.getModule(), constant->getType(), true,
llvm::GlobalValue::PrivateLinkage,
-   constant, Name);
+   constant, Name, nullptr,
+   llvm::GlobalValue::NotThreadLocal, AS);
 GV->setAlignment(Loc.getAlignment().getQuantity());
-GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
+GV->setUnnamedAddr(UA);
 
 Address SrcPtr = Address(GV, Loc.getAlignment());
 if (SrcPtr.getType() != BP)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25305: [OpenCL] Setting constant address space for array initializers

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

The test looks OK. However, the patch only contains the test now.


https://reviews.llvm.org/D25305



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


[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced

2016-10-14 Thread Victor Leschuk via cfe-commits
vleschuk updated this revision to Diff 74686.
vleschuk added a comment.

Use DIAlignment type instead of uint64_t for alignment in DebugInfo.


https://reviews.llvm.org/D24426

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGen/debug-info-packed-struct.c
  test/CodeGen/debug-info-vector.c
  test/CodeGenCXX/debug-info-calling-conventions.cpp
  test/CodeGenCXX/debug-info-enum-class.cpp
  test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  test/CodeGenCXX/debug-info-ms-bitfields.cpp
  test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp
  test/CodeGenCXX/debug-info-rvalue-ref.cpp
  test/CodeGenCXX/debug-info-template-quals.cpp
  test/CodeGenCXX/debug-info-template.cpp
  test/CodeGenCXX/debug-info-union.cpp
  test/CodeGenCXX/debug-info-uuid.cpp
  test/CodeGenCXX/debug-info-vla.cpp
  test/CodeGenCXX/debug-info-zero-length-arrays.cpp
  test/CodeGenCXX/debug-info.cpp
  test/CodeGenCXX/debug-lambda-this.cpp
  test/CodeGenObjC/block-byref-debuginfo.m
  test/CodeGenObjC/debug-info-block-type.m
  test/CodeGenObjC/debug-info-ivars-extension.m
  test/CodeGenObjC/debug-info-ivars-private.m
  test/CodeGenObjC/debug-info-ivars.m
  test/CodeGenObjCXX/debug-info-cyclic.mm

Index: test/CodeGenObjCXX/debug-info-cyclic.mm
===
--- test/CodeGenObjCXX/debug-info-cyclic.mm
+++ test/CodeGenObjCXX/debug-info-cyclic.mm
@@ -3,7 +3,7 @@
 struct B {
 // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B"
 // CHECK-SAME: line: [[@LINE-2]],
-// CHECK-SAME: size: 8, align: 8,
+// CHECK-SAME: size: 8,
 // CHECK-NOT:  offset:
 // CHECK-NOT:  DIFlagFwdDecl
 // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]]
Index: test/CodeGenObjC/debug-info-ivars.m
===
--- test/CodeGenObjC/debug-info-ivars.m
+++ test/CodeGenObjC/debug-info-ivars.m
@@ -21,24 +21,24 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i"
 // CHECK-SAME:   line: 10
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32,
+// CHECK-SAME:   size: 32,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: ![[INT]] = !DIBasicType(name: "int"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1"
 // CHECK-SAME:   line: 11
 // CHECK-SAME:   baseType: ![[UNSIGNED:[0-9]+]]
-// CHECK-SAME:   size: 9, align: 32,
+// CHECK-SAME:   size: 9,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2"
 // CHECK-SAME:   line: 12
 // CHECK-SAME:   baseType: ![[UNSIGNED]]
-// CHECK-SAME:   size: 9, align: 32, offset: 1,
+// CHECK-SAME:   size: 9, offset: 1,
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3"
 // CHECK-SAME:   line: 14
 // CHECK-SAME:   baseType: ![[UNSIGNED]]
-// CHECK-SAME:   size: 9, align: 32, offset: 3,
+// CHECK-SAME:   size: 9, offset: 3,
 // CHECK-SAME:   flags: DIFlagProtected
Index: test/CodeGenObjC/debug-info-ivars-private.m
===
--- test/CodeGenObjC/debug-info-ivars-private.m
+++ test/CodeGenObjC/debug-info-ivars-private.m
@@ -35,13 +35,13 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo"
 // CHECK-SAME:   line: 14
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32,
+// CHECK-SAME:   size: 32,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagProtected
 // CHECK: ![[INT]] = !DIBasicType(name: "int"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar"
 // CHECK-SAME:   line: 27
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32,
+// CHECK-SAME:   size: 32,
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagPrivate
Index: test/CodeGenObjC/debug-info-ivars-extension.m
===
--- test/CodeGenObjC/debug-info-ivars-extension.m
+++ test/CodeGenObjC/debug-info-ivars-extension.m
@@ -30,7 +30,7 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a"
 // CHECK-SAME:   line: 7
 // CHECK-SAME:   baseType: ![[INT:[0-9]+]]
-// CHECK-SAME:   size: 32, align: 32
+// CHECK-SAME:   size: 32
 // CHECK-NOT:offset:
 // CHECK-SAME:   flags: DIFlagPublic
 // CHECK: ![[INT]] = !DIBasicType(name: "int"
@@ -42,6 +42,6 @@
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b"
 // 

[PATCH] D25600: [ASTMatcher] Add isStaticDataMember matcher for varDecl.

2016-10-14 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/ASTMatchers/ASTMatchers.h:3005
+/// \endcode
+AST_MATCHER(VarDecl, isStaticDataMember) {
+  return Node.isStaticDataMember();

hokein wrote:
> aaron.ballman wrote:
> > How does this differ from the existing matcher `hasStaticStorageDuration()` 
> > over a `fieldDecl()`?
> `fieldDecl` document says that fieldDecl is "an instance of this class is 
> created by Sema::ActOnField to
> represent a member of a struct/union/class.". So for static class members, 
> they should not belong to `fieldDecl` as they are not bound to class 
> instances.
>  
> Technically, we can't apply `hasStaticStorageDuration()` and 
> `isStaticStorageClass` over a `fieldDecl`.
>  
That's a really good point, but the question still remains: since we have 
`hasStaticStorageDuration()` already, can we find a way to use that same 
matcher rather than introduce a new matcher under a new name that does the same 
thing?

This time I tested a matcher, and found that you get the correct behavior from 
`varDecl(hasStaticStorageDuration(), hasParent(recordDecl()))`.

I think this is especially important to try to do because we have 
`hasStaticStorageDuration()` and `isStaticStorageClass()`, so adding 
`isStaticDataMember()` adds a third option to possibly confuse users.


https://reviews.llvm.org/D25600



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


[PATCH] D25621: DebugInfo: use DIAlignment type.

2016-10-14 Thread Victor Leschuk via cfe-commits
vleschuk created this revision.
vleschuk added reviewers: aprantl, mehdi_amini, dblaikie, echristo.
vleschuk added a subscriber: cfe-commits.

Use DIAlignment type introduced in https://reviews.llvm.org/D25620


https://reviews.llvm.org/D25621

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/DeclBase.h
  lib/AST/DeclBase.cpp
  lib/CodeGen/CGDebugInfo.cpp

Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -596,7 +596,7 @@
   }
   // Bit size, align and offset of the type.
   uint64_t Size = CGM.getContext().getTypeSize(BT);
-  uint64_t Align = CGM.getContext().getTypeAlign(BT);
+  llvm::DIAlignment Align = CGM.getContext().getTypeAlign(BT);
   return DBuilder.createBasicType(BTName, Size, Align, Encoding);
 }
 
@@ -607,7 +607,7 @@
 Encoding = llvm::dwarf::DW_ATE_lo_user;
 
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
-  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+  llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty);
   return DBuilder.createBasicType("complex", Size, Align, Encoding);
 }
 
@@ -721,7 +721,7 @@
   StringRef RDName = getClassName(RD);
 
   uint64_t Size = 0;
-  uint64_t Align = 0;
+  llvm::DIAlignment Align = 0;
 
   const RecordDecl *D = RD->getDefinition();
   if (D && D->isCompleteDefinition()) {
@@ -749,7 +749,7 @@
   // because that does not return the correct value for references.
   unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
   uint64_t Size = CGM.getTarget().getPointerWidth(AS);
-  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+  llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty);
 
   if (Tag == llvm::dwarf::DW_TAG_reference_type ||
   Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
@@ -1181,7 +1181,7 @@
 QualType PointeeTy = ThisPtrTy->getPointeeType();
 unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy);
 uint64_t Size = CGM.getTarget().getPointerWidth(AS);
-uint64_t Align = CGM.getContext().getTypeAlign(ThisPtrTy);
+llvm::DIAlignment Align = CGM.getContext().getTypeAlign(ThisPtrTy);
 llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit);
 llvm::DIType *ThisPtrType =
 DBuilder.createPointerType(PointeeType, Size, Align);
@@ -1968,12 +1968,12 @@
 
   // Bit size, align and offset of the type.
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
-  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+  llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty);
 
   llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
   if (ID->getImplementation())
 Flags |= llvm::DINode::FlagObjcClassComplete;
-
+ 
   llvm::DIScope *Mod = getParentModuleOrNull(ID);
   llvm::DICompositeType *RealDecl = DBuilder.createStructType(
   Mod ? Mod : Unit, ID->getName(), DefUnit, Line, Size, Align, Flags,
@@ -2134,14 +2134,14 @@
   llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript);
 
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
-  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+  llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty);
 
   return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) {
   uint64_t Size;
-  uint64_t Align;
+  llvm::DIAlignment Align;
 
   // FIXME: make getTypeAlign() aware of VLAs and incomplete array types
   if (const auto *VAT = dyn_cast(Ty)) {
@@ -2264,7 +2264,7 @@
   const EnumDecl *ED = Ty->getDecl();
 
   uint64_t Size = 0;
-  uint64_t Align = 0;
+  llvm::DIAlignment Align = 0;
   if (!ED->getTypeForDecl()->isIncompleteType()) {
 Size = CGM.getContext().getTypeSize(ED->getTypeForDecl());
 Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl());
@@ -2307,7 +2307,7 @@
 llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
   const EnumDecl *ED = Ty->getDecl();
   uint64_t Size = 0;
-  uint64_t Align = 0;
+  llvm::DIAlignment Align = 0;
   if (!ED->getTypeForDecl()->isIncompleteType()) {
 Size = CGM.getContext().getTypeSize(ED->getTypeForDecl());
 Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl());
@@ -2607,7 +2607,7 @@
 return getOrCreateRecordFwdDecl(Ty, RDContext);
 
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
-  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+  llvm::DIAlignment Align = CGM.getContext().getTypeAlign(Ty);
 
   SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU);
 
Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -327,11 +327,11 @@
   return getASTContext().getASTMutationListener();
 }
 
-unsigned Decl::getMaxAlignment() const {
+llvm::DIAlignment Decl::getMaxAlignment() const {
   if (!hasAttrs())
 return 0;
 
-  unsigned Align = 0;
+  llvm::DIAlignment Align = 0;
   const 

Re: r284174 - Disable swiftcall test on windows: More brutal way to appease windows bots

2016-10-14 Thread Arnold Schwaighofer via cfe-commits
https://llvm.org/bugs/show_bug.cgi?id=30699


> On Oct 14, 2016, at 7:11 AM, Robinson, Paul  wrote:
> 
> Is there a bug to track this problem so it doesn't get lost?
> --paulr
>  
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
> Reid Kleckner via cfe-commits
> Sent: Thursday, October 13, 2016 4:02 PM
> To: Arnold Schwaighofer
> Cc: cfe-commits
> Subject: Re: r284174 - Disable swiftcall test on windows: More brutal way to 
> appease windows bots
>  
> These kinds of crashes typically happen when you have something like a 
> use-after-destroy of a temporary, like a misuse of Twine or 
> std::initializer_list.
>  
> On Thu, Oct 13, 2016 at 3:47 PM, Arnold Schwaighofer via cfe-commits 
>  wrote:
> Author: arnolds
> Date: Thu Oct 13 17:47:03 2016
> New Revision: 284174
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=284174=rev
> Log:
> Disable swiftcall test on windows: More brutal way to appease windows bots
> 
> The backtrace on the bot does not give me any indication what is wrong.
> The test case interestingly passes in stage2 of the build.
> I don't have a way of debugging this.
> 
> Disable the test on windows and hope if there is truly a bug in the code that
> was causing we will eventually run into this on other platforms.
> 
> Modified:
> cfe/trunk/test/CodeGen/64bit-swiftcall.c
> 
> Modified: cfe/trunk/test/CodeGen/64bit-swiftcall.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/64bit-swiftcall.c?rev=284174=284173=284174=diff
> ==
> --- cfe/trunk/test/CodeGen/64bit-swiftcall.c (original)
> +++ cfe/trunk/test/CodeGen/64bit-swiftcall.c Thu Oct 13 17:47:03 2016
> @@ -3,6 +3,9 @@
> 
>  // REQUIRES: aarch64-registered-target,x86-registered-target
> 
> +// The union_het_vecint test case crashes on windows bot but only in stage1 
> and not in stage2.
> +// UNSUPPORTED: system-windows
> +
>  #define SWIFTCALL __attribute__((swiftcall))
>  #define OUT __attribute__((swift_indirect_result))
>  #define ERROR __attribute__((swift_error_result))
> 
> 
> ___
> 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] D25600: [ASTMatcher] Add isStaticDataMember matcher for varDecl.

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



Comment at: include/clang/ASTMatchers/ASTMatchers.h:3005
+/// \endcode
+AST_MATCHER(VarDecl, isStaticDataMember) {
+  return Node.isStaticDataMember();

aaron.ballman wrote:
> How does this differ from the existing matcher `hasStaticStorageDuration()` 
> over a `fieldDecl()`?
`fieldDecl` document says that fieldDecl is "an instance of this class is 
created by Sema::ActOnField to
represent a member of a struct/union/class.". So for static class members, they 
should not belong to `fieldDecl` as they are not bound to class instances.
 
Technically, we can't apply `hasStaticStorageDuration()` and 
`isStaticStorageClass` over a `fieldDecl`.
 


https://reviews.llvm.org/D25600



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


[PATCH] D25283: AvailabilityAttrs: Refactor context checking when diagnosing an availability violation

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

LGTM


https://reviews.llvm.org/D25283



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


RE: r284174 - Disable swiftcall test on windows: More brutal way to appease windows bots

2016-10-14 Thread Robinson, Paul via cfe-commits
Is there a bug to track this problem so it doesn't get lost?
--paulr

From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Reid 
Kleckner via cfe-commits
Sent: Thursday, October 13, 2016 4:02 PM
To: Arnold Schwaighofer
Cc: cfe-commits
Subject: Re: r284174 - Disable swiftcall test on windows: More brutal way to 
appease windows bots

These kinds of crashes typically happen when you have something like a 
use-after-destroy of a temporary, like a misuse of Twine or 
std::initializer_list.

On Thu, Oct 13, 2016 at 3:47 PM, Arnold Schwaighofer via cfe-commits 
> wrote:
Author: arnolds
Date: Thu Oct 13 17:47:03 2016
New Revision: 284174

URL: http://llvm.org/viewvc/llvm-project?rev=284174=rev
Log:
Disable swiftcall test on windows: More brutal way to appease windows bots

The backtrace on the bot does not give me any indication what is wrong.
The test case interestingly passes in stage2 of the build.
I don't have a way of debugging this.

Disable the test on windows and hope if there is truly a bug in the code that
was causing we will eventually run into this on other platforms.

Modified:
cfe/trunk/test/CodeGen/64bit-swiftcall.c

Modified: cfe/trunk/test/CodeGen/64bit-swiftcall.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/64bit-swiftcall.c?rev=284174=284173=284174=diff
==
--- cfe/trunk/test/CodeGen/64bit-swiftcall.c (original)
+++ cfe/trunk/test/CodeGen/64bit-swiftcall.c Thu Oct 13 17:47:03 2016
@@ -3,6 +3,9 @@

 // REQUIRES: aarch64-registered-target,x86-registered-target

+// The union_het_vecint test case crashes on windows bot but only in stage1 
and not in stage2.
+// UNSUPPORTED: system-windows
+
 #define SWIFTCALL __attribute__((swiftcall))
 #define OUT __attribute__((swift_indirect_result))
 #define ERROR __attribute__((swift_error_result))


___
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] D25572: [Coverage] Support for C++17 if initializers

2016-10-14 Thread Igor Kudrin via cfe-commits
ikudrin accepted this revision.
ikudrin added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25572



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


[PATCH] D25539: [Coverage] Support for C++17 switch initializers

2016-10-14 Thread Igor Kudrin via cfe-commits
ikudrin accepted this revision.
ikudrin added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25539



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


[libcxx] r284237 - [libcxx] Improve the gcc workaround for the missing __has_include macro.

2016-10-14 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Fri Oct 14 08:56:58 2016
New Revision: 284237

URL: http://llvm.org/viewvc/llvm-project?rev=284237=rev
Log:
[libcxx] Improve the gcc workaround for the missing __has_include macro.

NFC.

Modified:
libcxx/trunk/include/__threading_support

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=284237=284236=284237=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Fri Oct 14 08:56:58 2016
@@ -19,20 +19,18 @@
 
 #ifndef _LIBCPP_HAS_NO_THREADS
 
-// These checks are carefully arranged so as not to trigger a gcc pre-processor
-// defect which causes it to fail to parse the __has_include check below, the
-// redundancy is intentional.
-#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-#if !defined(__clang__) && (_GNUC_VER < 500)
-#include <__external_threading>
-#define _LIBCPP_HAS_EXTERNAL_THREADING_HEADER
-#elif !defined(__has_include) || __has_include(<__external_threading>)
-#include <__external_threading>
-#define _LIBCPP_HAS_EXTERNAL_THREADING_HEADER
-#endif
+#ifndef __libcpp_has_include
+  #ifndef __has_include
+#define __libcpp_has_include(x) 0
+  #else
+#define __libcpp_has_include(x) __has_include(x)
+  #endif
 #endif
 
-#if !defined(_LIBCPP_HAS_EXTERNAL_THREADING_HEADER)
+#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \
+__libcpp_has_include(<__external_threading>)
+#include <__external_threading>
+#else
 #include 
 #include 
 
@@ -241,7 +239,7 @@ void __libcpp_tls_set(__libcpp_tls_key _
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !_LIBCPP_HAS_EXTERNAL_THREADING_HEADER
+#endif // !_LIBCPP_HAS_THREAD_API_EXTERNAL || 
!__libcpp_has_include(<__external_threading>)
 
 #endif // _LIBCPP_HAS_NO_THREADS
 


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


[PATCH] D25593: [libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib

2016-10-14 Thread Ed Maste via cfe-commits
emaste added inline comments.



Comment at: lib/abi/CHANGELOG.TXT:22
+  Although this change removes symbols, it should still be non-ABI breaking
+  since all of the definitions removed are inline functions.
+

Should we also include in this comment the further justification from your 
Phabricator description above (about having own definitions)?


https://reviews.llvm.org/D25593



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


[PATCH] D22955: [MSVC] Improved late parsing of template functions.

2016-10-14 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Sema/SemaLookup.cpp:1044-1070
+static bool isBaseClass(const CXXRecordDecl *Record, CXXRecordDecl *Base) {
+  SmallVector Queue;
+
+  while (true) {
+for (const auto  : Record->bases()) {
+  const RecordType *Ty = I.getType()->getAs();
+  if (!Ty)

majnemer wrote:
> This looks a lot like forallBases, any chance it could be reused?
Yes, they are very similar, but forallBases() is a bit different. It checks 
that the provided callback returns true for all bases. In this case I need a 
single match, while other bases may not match. That's why I can't reuse 
forallBases().


https://reviews.llvm.org/D22955



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


[PATCH] D25613: [clang-move] Don't overuse Replacements::add.

2016-10-14 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rL284236: [clang-move] Don't overuse Replacements::add. 
(authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D25613?vs=74677=74679#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25613

Files:
  clang-tools-extra/trunk/clang-move/ClangMove.cpp

Index: clang-tools-extra/trunk/clang-move/ClangMove.cpp
===
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp
@@ -193,27 +193,6 @@
   return SourceText.str();
 }
 
-clang::tooling::Replacement
-getReplacementInChangedCode(const clang::tooling::Replacements ,
-const clang::tooling::Replacement ) {
-  unsigned Start = Replacements.getShiftedCodePosition(Replacement.getOffset());
-  unsigned End = Replacements.getShiftedCodePosition(Replacement.getOffset() +
- Replacement.getLength());
-  return clang::tooling::Replacement(Replacement.getFilePath(), Start,
- End - Start,
- Replacement.getReplacementText());
-}
-
-void addOrMergeReplacement(const clang::tooling::Replacement ,
-   clang::tooling::Replacements *Replacements) {
-  auto Err = Replacements->add(Replacement);
-  if (Err) {
-llvm::consumeError(std::move(Err));
-auto Replace = getReplacementInChangedCode(*Replacements, Replacement);
-*Replacements = Replacements->merge(clang::tooling::Replacements(Replace));
-  }
-}
-
 bool isInHeaderFile(const clang::SourceManager , const clang::Decl *D,
 llvm::StringRef OriginalRunningDirectory,
 llvm::StringRef OldHeader) {
@@ -251,32 +230,24 @@
const std::vector ,
llvm::StringRef FileName,
bool IsHeader = false) {
-  clang::tooling::Replacements InsertedReplacements;
+  std::string NewCode;
   std::string GuardName(FileName);
   if (IsHeader) {
 std::replace(GuardName.begin(), GuardName.end(), '/', '_');
 std::replace(GuardName.begin(), GuardName.end(), '.', '_');
 std::replace(GuardName.begin(), GuardName.end(), '-', '_');
 
 GuardName = StringRef(GuardName).upper();
-std::string HeaderGuard = "#ifndef " + GuardName + "\n";
-HeaderGuard += "#define " + GuardName + "\n";
-clang::tooling::Replacement HeaderGuardInclude(FileName, 0, 0,
-   HeaderGuard);
-addOrMergeReplacement(HeaderGuardInclude, );
+NewCode += "#ifndef " + GuardName + "\n";
+NewCode += "#define " + GuardName + "\n";
   }
 
   // Add #Includes.
-  std::string AllIncludesString;
-  // FIXME: Add header guard.
   for (const auto  : Includes)
-AllIncludesString += Include;
+NewCode += Include;
 
-  if (!AllIncludesString.empty()) {
-clang::tooling::Replacement InsertInclude(FileName, 0, 0,
-  AllIncludesString + "\n");
-addOrMergeReplacement(InsertInclude, );
-  }
+  if (!Includes.empty())
+NewCode += "\n";
 
   // Add moved class definition and its related declarations. All declarations
   // in same namespace are grouped together.
@@ -299,36 +270,23 @@
 for (auto It = CurrentNamespaces.rbegin(); RemainingSize > 0;
  --RemainingSize, ++It) {
   assert(It < CurrentNamespaces.rend());
-  auto code = "} // namespace " + *It + "\n";
-  clang::tooling::Replacement InsertedReplacement(FileName, 0, 0, code);
-  addOrMergeReplacement(InsertedReplacement, );
+  NewCode += "} // namespace " + *It + "\n";
 }
 while (DeclIt != DeclNamespaces.end()) {
-  clang::tooling::Replacement InsertedReplacement(
-  FileName, 0, 0, "namespace " + *DeclIt + " {\n");
-  addOrMergeReplacement(InsertedReplacement, );
+  NewCode += "namespace " + *DeclIt + " {\n";
   ++DeclIt;
 }
-
-clang::tooling::Replacement InsertedReplacement(
-FileName, 0, 0, getDeclarationSourceText(MovedDecl.Decl, MovedDecl.SM));
-addOrMergeReplacement(InsertedReplacement, );
-
+NewCode += getDeclarationSourceText(MovedDecl.Decl, MovedDecl.SM);
 CurrentNamespaces = std::move(NextNamespaces);
   }
   std::reverse(CurrentNamespaces.begin(), CurrentNamespaces.end());
-  for (const auto  : CurrentNamespaces) {
-clang::tooling::Replacement InsertedReplacement(
-FileName, 0, 0, "} // namespace " + NS + "\n");
-addOrMergeReplacement(InsertedReplacement, );
-  }
+  for (const auto  : CurrentNamespaces)
+NewCode += "} // namespace " + NS + "\n";
 
-  if (IsHeader) {
-clang::tooling::Replacement HeaderGuardEnd(FileName, 0, 0,
-   "#endif // " + GuardName + "\n");
-

[clang-tools-extra] r284236 - [clang-move] Don't overuse Replacements::add.

2016-10-14 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri Oct 14 08:43:49 2016
New Revision: 284236

URL: http://llvm.org/viewvc/llvm-project?rev=284236=rev
Log:
[clang-move] Don't overuse Replacements::add.

Reviewers: ioeric

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=284236=284235=284236=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Fri Oct 14 08:43:49 2016
@@ -193,27 +193,6 @@ std::string getDeclarationSourceText(con
   return SourceText.str();
 }
 
-clang::tooling::Replacement
-getReplacementInChangedCode(const clang::tooling::Replacements ,
-const clang::tooling::Replacement ) {
-  unsigned Start = 
Replacements.getShiftedCodePosition(Replacement.getOffset());
-  unsigned End = Replacements.getShiftedCodePosition(Replacement.getOffset() +
- Replacement.getLength());
-  return clang::tooling::Replacement(Replacement.getFilePath(), Start,
- End - Start,
- Replacement.getReplacementText());
-}
-
-void addOrMergeReplacement(const clang::tooling::Replacement ,
-   clang::tooling::Replacements *Replacements) {
-  auto Err = Replacements->add(Replacement);
-  if (Err) {
-llvm::consumeError(std::move(Err));
-auto Replace = getReplacementInChangedCode(*Replacements, Replacement);
-*Replacements = Replacements->merge(clang::tooling::Replacements(Replace));
-  }
-}
-
 bool isInHeaderFile(const clang::SourceManager , const clang::Decl *D,
 llvm::StringRef OriginalRunningDirectory,
 llvm::StringRef OldHeader) {
@@ -251,7 +230,7 @@ createInsertedReplacements(const std::ve
const std::vector ,
llvm::StringRef FileName,
bool IsHeader = false) {
-  clang::tooling::Replacements InsertedReplacements;
+  std::string NewCode;
   std::string GuardName(FileName);
   if (IsHeader) {
 std::replace(GuardName.begin(), GuardName.end(), '/', '_');
@@ -259,24 +238,16 @@ createInsertedReplacements(const std::ve
 std::replace(GuardName.begin(), GuardName.end(), '-', '_');
 
 GuardName = StringRef(GuardName).upper();
-std::string HeaderGuard = "#ifndef " + GuardName + "\n";
-HeaderGuard += "#define " + GuardName + "\n";
-clang::tooling::Replacement HeaderGuardInclude(FileName, 0, 0,
-   HeaderGuard);
-addOrMergeReplacement(HeaderGuardInclude, );
+NewCode += "#ifndef " + GuardName + "\n";
+NewCode += "#define " + GuardName + "\n";
   }
 
   // Add #Includes.
-  std::string AllIncludesString;
-  // FIXME: Add header guard.
   for (const auto  : Includes)
-AllIncludesString += Include;
+NewCode += Include;
 
-  if (!AllIncludesString.empty()) {
-clang::tooling::Replacement InsertInclude(FileName, 0, 0,
-  AllIncludesString + "\n");
-addOrMergeReplacement(InsertInclude, );
-  }
+  if (!Includes.empty())
+NewCode += "\n";
 
   // Add moved class definition and its related declarations. All declarations
   // in same namespace are grouped together.
@@ -299,36 +270,23 @@ createInsertedReplacements(const std::ve
 for (auto It = CurrentNamespaces.rbegin(); RemainingSize > 0;
  --RemainingSize, ++It) {
   assert(It < CurrentNamespaces.rend());
-  auto code = "} // namespace " + *It + "\n";
-  clang::tooling::Replacement InsertedReplacement(FileName, 0, 0, code);
-  addOrMergeReplacement(InsertedReplacement, );
+  NewCode += "} // namespace " + *It + "\n";
 }
 while (DeclIt != DeclNamespaces.end()) {
-  clang::tooling::Replacement InsertedReplacement(
-  FileName, 0, 0, "namespace " + *DeclIt + " {\n");
-  addOrMergeReplacement(InsertedReplacement, );
+  NewCode += "namespace " + *DeclIt + " {\n";
   ++DeclIt;
 }
-
-clang::tooling::Replacement InsertedReplacement(
-FileName, 0, 0, getDeclarationSourceText(MovedDecl.Decl, 
MovedDecl.SM));
-addOrMergeReplacement(InsertedReplacement, );
-
+NewCode += getDeclarationSourceText(MovedDecl.Decl, MovedDecl.SM);
 CurrentNamespaces = std::move(NextNamespaces);
   }
   std::reverse(CurrentNamespaces.begin(), CurrentNamespaces.end());
-  for (const auto  : CurrentNamespaces) {
-clang::tooling::Replacement InsertedReplacement(
-FileName, 0, 0, "} // namespace " + NS + "\n");
-addOrMergeReplacement(InsertedReplacement, );
-  }
+  for (const auto  : CurrentNamespaces)
+NewCode 

  1   2   >