Re: [PATCH][Solaris] Default to -fno-cxa-finalize

2015-09-04 Thread Xan López via cfe-commits
On Fri, Aug 28, 2015 at 07:52:17PM +0200, Xan López via cfe-commits wrote:
> There is no __cxa_finalize symbol available on recent Solaris OS
> versions, so we need this flag to make non trivial C++ programs run.
> 
> Also stop looking for cxa_finalize.o, since it won't be there.
> 
> (This patch sits on top of a couple of unreviewed patches that make clang 
> actually work on Solaris, see:
> 
> http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292800.html
> http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150817/293971.html
> 
> It should be trivial to rebase against master if it is reviewed first though)
> 
> Xan

Ping?


> From 014ddb164689a3452b76f85079f213d607d07840 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Xan=20L=C3=B3pez?= 
> Date: Fri, 14 Aug 2015 11:36:56 +0200
> Subject: [PATCH 2/4] [Solaris] Default to -fno-cxa-finalize
> 
> There is no __cxa_finalize symbol available on recent Solaris OS
> versions, so we need this flag to make non trivial C++ programs run.
> 
> Also stop looking for cxa_finalize.o, since it won't be there.
> ---
>  lib/Driver/Tools.cpp | 9 +++--
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
> index b204961..cf01d7b 100644
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -4506,8 +4506,9 @@ void Clang::ConstructJob(Compilation &C, const 
> JobAction &JA,
>if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,
>  options::OPT_fno_use_cxa_atexit,
>  !IsWindowsCygnus && !IsWindowsGNU &&
> -getToolChain().getArch() != llvm::Triple::hexagon &&
> -getToolChain().getArch() != llvm::Triple::xcore) ||
> +getToolChain().getTriple().getOS() != 
> llvm::Triple::Solaris &&
> +getToolChain().getArch() != llvm::Triple::hexagon &&
> +getToolChain().getArch() != llvm::Triple::xcore) ||
>KernelOrKext)
>  CmdArgs.push_back("-fno-use-cxa-atexit");
>  
> @@ -6882,10 +6883,6 @@ void solaris::Linker::ConstructJob(Compilation &C, 
> const JobAction &JA,
>  Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o")));
>  CmdArgs.push_back(
>  Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
> -
> -if (getToolChain().getDriver().CCCIsCXX())
> -  CmdArgs.push_back(
> -  Args.MakeArgString(getToolChain().GetFilePath("cxa_finalize.o")));
>}
>  
>const ToolChain::path_list &Paths = getToolChain().getFilePaths();
> -- 
> 2.4.3
> 

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

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


Re: [PATCH][Solaris] Add -lc also when linking shared libraries

2015-09-04 Thread Xan López via cfe-commits
On Fri, Aug 28, 2015 at 07:53:40PM +0200, Xan López via cfe-commits wrote:
> This is actually needed, otherwise libc won't be added at all. For
> instance when building libclang.so all the libc symbols won't be
> found, with ld warning about libc being an "implicit dependency".
> 
> ((This patch sits on top of a couple of unreviewed patches that make clang 
> actually work on Solaris, see:
> 
> http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292800.html
> http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150817/293971.html
> 
> It should be trivial to rebase against master if it is reviewed first though)
> 
> Xan

Ping?

> From 8e81d6b095542c0ff1e28cf1f09d675f8afe1a25 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Xan=20L=C3=B3pez?= 
> Date: Mon, 17 Aug 2015 16:04:26 +0200
> Subject: [PATCH 4/4] [Solaris] Add -lc also when linking shared libraries
> 
> This is actually needed, otherwise libc won't be added at all. For
> instance when building libclang.so all the libc symbols won't be
> found, with ld warning about libc being an "implicit dependency".
> ---
>  lib/Driver/Tools.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
> index cf01d7b..2034c0f 100644
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -6899,9 +6899,9 @@ void solaris::Linker::ConstructJob(Compilation &C, 
> const JobAction &JA,
>  if (getToolChain().getDriver().CCCIsCXX())
>getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
>  CmdArgs.push_back("-lgcc_s");
> +CmdArgs.push_back("-lc");
>  if (!Args.hasArg(options::OPT_shared)) {
>CmdArgs.push_back("-lgcc");
> -  CmdArgs.push_back("-lc");
>CmdArgs.push_back("-lm");
>  }
>}
> -- 
> 2.4.3
> 

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

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


Re: [PATCH] D11797: [LIbClang] Report the named type for ElaboratedType

2015-09-04 Thread Sergey Kalinichev via cfe-commits
skalinichev updated this revision to Diff 34019.
skalinichev added a comment.

Rebased.

Yes, now it's ready.


http://reviews.llvm.org/D11797

Files:
  test/Index/print-type.c
  test/Index/print-type.cpp
  tools/libclang/CXType.cpp

Index: tools/libclang/CXType.cpp
===
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -121,6 +121,11 @@
 if (const DecayedType *DT = T->getAs()) {
   return MakeCXType(DT->getOriginalType(), TU);
 }
+
+/* Handle elaborated types as the original type */
+if (const auto *ET = T->getAs()) {
+  return MakeCXType(ET->getNamedType(), TU);
+}
   }
   if (TK == CXType_Invalid)
 TK = GetTypeKind(T);
@@ -388,7 +393,6 @@
 
   Decl *D = nullptr;
 
-try_again:
   switch (TP->getTypeClass()) {
   case Type::Typedef:
 D = cast(TP)->getDecl();
@@ -417,10 +421,6 @@
 
   // FIXME: Template type parameters!  
 
-  case Type::Elaborated:
-TP = cast(TP)->getNamedType().getTypePtrOrNull();
-goto try_again;
-
   default:
 break;
   }
Index: test/Index/print-type.cpp
===
--- test/Index/print-type.cpp
+++ test/Index/print-type.cpp
@@ -48,7 +48,7 @@
 };
 int Blob::*member_pointer;
 
-
+namespace NS { struct Type{}; } NS::Type elaboratedNamespaceType();
 
 auto autoI = 0;
 auto autoTbar = tbar(0);
@@ -69,7 +69,7 @@
 // CHECK: Namespace=inner:14:11 (Definition) [type=] [typekind=Invalid] 
[isPOD=0]
 // CHECK: StructDecl=Bar:16:8 (Definition) [type=outer::inner::Bar] 
[typekind=Record] [isPOD=0] [nbFields=3]
 // CHECK: CXXConstructor=Bar:17:3 (Definition) [type=void (outer::Foo 
*){{.*}}] [typekind=FunctionProto] [canonicaltype=void (outer::Foo 
*){{.*}}] [canonicaltypekind=FunctionProto] [resulttype=void] 
[resulttypekind=Void] [args= [outer::Foo *] [Pointer]] [isPOD=0]
-// CHECK: ParmDecl=foo:17:25 (Definition) [type=outer::Foo *] 
[typekind=Pointer] [canonicaltype=outer::Foo *] 
[canonicaltypekind=Pointer] [isPOD=1] [pointeetype=outer::Foo] 
[pointeekind=Unexposed]
+// CHECK: ParmDecl=foo:17:25 (Definition) [type=outer::Foo *] 
[typekind=Pointer] [canonicaltype=outer::Foo *] 
[canonicaltypekind=Pointer] [isPOD=1] [pointeetype=Foo] 
[pointeekind=Unexposed]
 // CHECK: NamespaceRef=outer:1:11 [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: TemplateRef=Foo:4:8 [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0]
@@ -127,6 +127,9 @@
 // CHECK: StructDecl=Blob:45:8 (Definition) [type=Blob] [typekind=Record] 
[isPOD=1] [nbFields=2]
 // CHECK: FieldDecl=i:46:7 (Definition) [type=int] [typekind=Int] [isPOD=1]
 // CHECK: VarDecl=member_pointer:49:12 (Definition) [type=int Blob::*] 
[typekind=MemberPointer] [isPOD=1]
+// CHECK: FunctionDecl=elaboratedNamespaceType:51:42 [type=NS::Type ()] 
[typekind=FunctionProto] [canonicaltype=NS::Type ()] 
[canonicaltypekind=FunctionProto] [resulttype=NS::Type] [resulttypekind=Record] 
[isPOD=0]
+// CHECK: NamespaceRef=NS:51:11 [type=] [typekind=Invalid] [isPOD=0]
+// CHECK: TypeRef=struct NS::Type:51:23 [type=NS::Type] [typekind=Record] 
[isPOD=1]
 // CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
 // CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
Index: test/Index/print-type.c
===
--- test/Index/print-type.c
+++ test/Index/print-type.c
@@ -12,6 +12,9 @@
 
 int f2(int incompletearray[]);
 
+enum Enum{i}; enum Enum elaboratedEnumType();
+struct Struct{}; struct Struct elaboratedStructType();
+
 // RUN: c-index-test -test-print-type %s | FileCheck %s
 // CHECK: FunctionDecl=f:3:6 (Definition) [type=int *(int *, char *, FooType, 
int *, void (*)(int))] [typekind=FunctionProto] [canonicaltype=int *(int *, 
char *, int, int *, void (*)(int))] [canonicaltypekind=FunctionProto] 
[resulttype=int *] [resulttypekind=Pointer] [args= [int *] [Pointer] [char *] 
[Pointer] [FooType] [Typedef] [int [5]] [ConstantArray] [void (*)(int)] 
[Pointer]] [isPOD=0]
 // CHECK: ParmDecl=p:3:13 (Definition) [type=int *] [typekind=Pointer] 
[isPOD=1] [pointeetype=int] [pointeekind=Int]
@@ -45,3 +48,8 @@
 // CHECK: VarDecl=x:10:38 [type=__attribute__((__vector_size__(4 * 
sizeof(int int] [typekind=Vector] [isPOD=1]
 // CHECK: TypedefDecl=int4_t:11:46 (Definition) [type=int4_t] 
[typekind=Typedef] [canonicaltype=__attribute__((__vector_size__(4 * 
sizeof(int int] [canonicaltypekind=Vector] [isPOD=1]
 // CHECK: ParmDecl=incompletearray:13:12 (Definition) [type=int []] 
[typekind=IncompleteArray] [isPOD=1]
+// CHECK: FunctionDecl=elaboratedEnumType:15:25 [type=enum Enum ()] 
[typekind=FunctionNoProto] [canonicaltype=enum Enum ()] 
[canonicaltypekind=FunctionNoProto] [resulttype

r246844 - Fix the perentheses location when the constructor is called on a class that has a destructor

2015-09-04 Thread Olivier Goffart via cfe-commits
Author: ogoffart
Date: Fri Sep  4 05:17:10 2015
New Revision: 246844

URL: http://llvm.org/viewvc/llvm-project?rev=246844&view=rev
Log:
Fix the perentheses location when the constructor is called on a class that has 
a destructor

Modified:
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/test/SemaCXX/sourceranges.cpp

Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=246844&r1=246843&r2=246844&view=diff
==
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Fri Sep  4 05:17:10 2015
@@ -2483,8 +2483,11 @@ ExprResult Sema::BuildCXXFunctionalCastE
   Op.CheckCXXCStyleCast(/*FunctionalStyle=*/true, /*ListInit=*/false);
   if (Op.SrcExpr.isInvalid())
 return ExprError();
-  
-  if (CXXConstructExpr *ConstructExpr = 
dyn_cast(Op.SrcExpr.get()))
+
+  auto *SubExpr = Op.SrcExpr.get();
+  if (auto *BindExpr = dyn_cast(SubExpr))
+SubExpr = BindExpr->getSubExpr();
+  if (auto *ConstructExpr = dyn_cast(SubExpr))
 ConstructExpr->setParenOrBraceRange(SourceRange(LPLoc, RPLoc));
 
   return Op.complete(CXXFunctionalCastExpr::Create(Context, Op.ResultType,

Modified: cfe/trunk/test/SemaCXX/sourceranges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/sourceranges.cpp?rev=246844&r1=246843&r2=246844&view=diff
==
--- cfe/trunk/test/SemaCXX/sourceranges.cpp (original)
+++ cfe/trunk/test/SemaCXX/sourceranges.cpp Fri Sep  4 05:17:10 2015
@@ -7,7 +7,7 @@ class P {
 };
 
 namespace foo {
-class A { public: A() {} };
+class A { public: A(int = 0) {} };
 enum B {};
 typedef int C;
 }
@@ -37,3 +37,16 @@ void destruct(foo::A *a1, foo::A *a2, P<
   // CHECK: MemberExpr {{0x[0-9a-fA-F]+}}  '' ->~P
   p1->~P();
 }
+
+struct D {
+  D(int);
+  ~D();
+};
+
+void construct() {
+  using namespace foo;
+  A a = A(12);
+  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'class foo::A' 
'void (int)'
+  D d = D(12);
+  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'struct D' 
'void (int)'
+}


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


Re: [PATCH] D12492: [Clang-Format] Add AlwaysBreakBeforeElse and AlwaysBreakBeforeCatch Style to avoid cuddled else/catch

2015-09-04 Thread Paul Hoad via cfe-commits
MyDeveloperDay retitled this revision from "[Clang-Format] Add 
AlwaysBreakBeforeElse Style to avoid cuddled else" to "[Clang-Format] Add 
AlwaysBreakBeforeElse and AlwaysBreakBeforeCatch Style to avoid cuddled 
else/catch".
MyDeveloperDay updated the summary for this revision.
MyDeveloperDay updated this revision to Diff 34023.
MyDeveloperDay added a comment.

As this patch has not been reviewed yet, and in using the tool in my own 
environment I noticed the same is true for catch statments, I want to see 
try {
}
catch (exception &e) {
}

not

try {
} catch (exception &e) {
}


http://reviews.llvm.org/D12492

Files:
  docs/ClangFormatStyleOptions.rst
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -9131,6 +9131,47 @@
WebKitBraceStyle);
 }
 
+TEST_F(FormatTest, AlwaysBreakBeforeElse) {
+  FormatStyle BeforeElse = getLLVMStyle();
+  BeforeElse.AlwaysBreakBeforeElse = true;
+  verifyFormat("void foo() {\n"
+   "  if (a) {\n"
+   "a();\n"
+   "  }\n"
+   "  else {\n"
+   "b();\n"
+   "  }\n"
+   "}\n",
+   BeforeElse);
+
+  verifyFormat("void foo() {\n"
+   "  if (a) {\n"
+   "a();\n"
+   "  }\n"
+   "  else if (b) {\n"
+   "b();\n"
+   "  }\n"
+   "  else {\n"
+   "b();\n"
+   "  }\n"
+   "}\n",
+   BeforeElse);
+}
+
+TEST_F(FormatTest, AlwaysBreakBeforeCatch) {
+  FormatStyle BeforeCatch = getLLVMStyle();
+  BeforeCatch.AlwaysBreakBeforeCatch = true;
+  verifyFormat("void foo() {\n"
+   "  try {\n"
+   "a();\n"
+   "  }\n"
+   "  catch (exception &) {\n"
+   "b();\n"
+   "  }\n"
+   "}\n",
+   BeforeCatch);
+}
+
 TEST_F(FormatTest, CatchExceptionReferenceBinding) {
   verifyFormat("void f() {\n"
"  try {\n"
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1272,8 +1272,11 @@
 --Line->Level;
   }
   if (FormatTok->Tok.is(tok::kw_else)) {
-if (Style.BreakBeforeBraces == FormatStyle::BS_Stroustrup)
+if (Style.BreakBeforeBraces == FormatStyle::BS_Stroustrup ||
+Style.AlwaysBreakBeforeElse) {
   addUnwrappedLine();
+}
+
 nextToken();
 if (FormatTok->Tok.is(tok::l_brace)) {
   CompoundStatementIndenter Indenter(this, Style, Line->Level);
@@ -1316,7 +1319,8 @@
 parseBlock(/*MustBeDeclaration=*/false);
 if (Style.BreakBeforeBraces == FormatStyle::BS_Allman ||
 Style.BreakBeforeBraces == FormatStyle::BS_GNU ||
-Style.BreakBeforeBraces == FormatStyle::BS_Stroustrup) {
+Style.BreakBeforeBraces == FormatStyle::BS_Stroustrup ||
+Style.AlwaysBreakBeforeCatch) {
   addUnwrappedLine();
 } else {
   NeedsUnwrappedLine = true;
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -217,6 +217,8 @@
Style.AlwaysBreakAfterDefinitionReturnType);
 IO.mapOptional("AlwaysBreakBeforeMultilineStrings",
Style.AlwaysBreakBeforeMultilineStrings);
+IO.mapOptional("AlwaysBreakBeforeElse", Style.AlwaysBreakBeforeElse);
+IO.mapOptional("AlwaysBreakBeforeCatch", Style.AlwaysBreakBeforeCatch);
 IO.mapOptional("AlwaysBreakTemplateDeclarations",
Style.AlwaysBreakTemplateDeclarations);
 IO.mapOptional("BinPackArguments", Style.BinPackArguments);
@@ -357,6 +359,8 @@
   LLVMStyle.AllowShortLoopsOnASingleLine = false;
   LLVMStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None;
   LLVMStyle.AlwaysBreakBeforeMultilineStrings = false;
+  LLVMStyle.AlwaysBreakBeforeElse = false;
+  LLVMStyle.AlwaysBreakBeforeCatch = false;
   LLVMStyle.AlwaysBreakTemplateDeclarations = false;
   LLVMStyle.BinPackParameters = true;
   LLVMStyle.BinPackArguments = true;
@@ -420,6 +424,8 @@
   GoogleStyle.AllowShortIfStatementsOnASingleLine = true;
   GoogleStyle.AllowShortLoopsOnASingleLine = true;
   GoogleStyle.AlwaysBreakBeforeMultilineStrings = true;
+  GoogleStyle.AlwaysBreakBeforeElse = false;
+  GoogleStyle.AlwaysBreakBeforeCatch = false;
   GoogleStyle.AlwaysBreakTemplateDeclarations = true;
   GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
   GoogleStyle.DerivePointerAlignment = true;
Index: include/clang/Format/Format.h
===

r246846 - [OPENMP] Fix for http://llvm.org/PR24674: assertion failed and and abort trap

2015-09-04 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Sep  4 06:26:21 2015
New Revision: 246846

URL: http://llvm.org/viewvc/llvm-project?rev=246846&view=rev
Log:
[OPENMP] Fix for http://llvm.org/PR24674: assertion failed and and abort trap
Fix processing of shared variables with reference types in OpenMP constructs. 
Previously, if the variable was not marked in one of the private clauses, the 
reference to this variable was emitted incorrectly and caused an assertion 
later.

Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/OpenMP/critical_codegen.cpp
cfe/trunk/test/OpenMP/for_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/for_lastprivate_codegen.cpp
cfe/trunk/test/OpenMP/for_linear_codegen.cpp
cfe/trunk/test/OpenMP/for_private_codegen.cpp
cfe/trunk/test/OpenMP/for_reduction_codegen.cpp
cfe/trunk/test/OpenMP/simd_codegen.cpp
cfe/trunk/test/OpenMP/single_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=246846&r1=246845&r2=246846&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Sep  4 06:26:21 2015
@@ -1942,11 +1942,17 @@ LValue CodeGenFunction::EmitDeclRefLValu
   if (auto *FD = LambdaCaptureFields.lookup(VD))
 return EmitCapturedFieldLValue(*this, FD, CXXABIThisValue);
   else if (CapturedStmtInfo) {
-if (auto *V = LocalDeclMap.lookup(VD))
+if (auto *V = LocalDeclMap.lookup(VD)) {
+  if (VD->getType()->isReferenceType()) {
+llvm::LoadInst *LI = Builder.CreateLoad(V);
+LI->setAlignment(Alignment.getQuantity());
+V = LI;
+return MakeNaturalAlignAddrLValue(V, T);
+  }
   return MakeAddrLValue(V, T, Alignment);
-else
-  return EmitCapturedFieldLValue(*this, CapturedStmtInfo->lookup(VD),
- CapturedStmtInfo->getContextValue());
+}
+return EmitCapturedFieldLValue(*this, CapturedStmtInfo->lookup(VD),
+   CapturedStmtInfo->getContextValue());
   }
   assert(isa(CurCodeDecl));
   return MakeAddrLValue(GetAddrOfBlockDecl(VD, VD->hasAttr()),

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=246846&r1=246845&r2=246846&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Fri Sep  4 06:26:21 2015
@@ -383,6 +383,12 @@ void CodeGenFunction::EmitOMPLastprivate
   auto *OriginalAddr = GetAddrOfLocalVar(DestVD);
   // Get the address of the private variable.
   auto *PrivateAddr = GetAddrOfLocalVar(PrivateVD);
+  if (PrivateVD->getType()->isReferenceType())
+PrivateAddr =
+EmitLoadOfLValue(MakeNaturalAlignAddrLValue(
+ PrivateAddr, PrivateVD->getType()),
+ (*IRef)->getExprLoc())
+.getScalarVal();
   EmitOMPCopy(*this, Type, OriginalAddr, PrivateAddr, DestVD, SrcVD,
   AssignOp);
 }

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=246846&r1=246845&r2=246846&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Sep  4 06:26:21 2015
@@ -584,7 +584,15 @@ public:
   if (SavedLocals.count(LocalVD) > 0) return false;
   SavedLocals[LocalVD] = CGF.LocalDeclMap.lookup(LocalVD);
   CGF.LocalDeclMap.erase(LocalVD);
-  SavedPrivates[LocalVD] = PrivateGen();
+  auto *V = PrivateGen();
+  QualType VarTy = LocalVD->getType();
+  if (VarTy->isReferenceType()) {
+auto *TempAlloca = CGF.CreateMemTemp(VarTy);
+LValue RefLVal = CGF.MakeNaturalAlignAddrLValue(TempAlloca, VarTy);
+CGF.EmitStoreOfScalar(V, RefLVal);
+V = TempAlloca;
+  }
+  SavedPrivates[LocalVD] = V;
   CGF.LocalDeclMap[LocalVD] = SavedLocals[LocalVD];
   return true;
 }

Modified: cfe/trunk/test/OpenMP/critical_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/critical_codegen.cpp?rev=246846&r1=246845&r2=246846&view=diff
==
--- cfe/trunk/test/OpenMP/critical_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/critical_codegen.cpp Fri Sep  4 06:26:21 2015
@@ -37,6 +37,23 @@ int main() {
   return a;
 }
 
+struct S {
+  int a;
+};
+// CHECK-LABEL: critical

r246849 - clang/test/SemaCXX/sourceranges.cpp: Appease win32. Class method is thiscall for targeting i686-(msvc|mingw32).

2015-09-04 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Sep  4 06:40:31 2015
New Revision: 246849

URL: http://llvm.org/viewvc/llvm-project?rev=246849&view=rev
Log:
clang/test/SemaCXX/sourceranges.cpp: Appease win32. Class method is thiscall 
for targeting i686-(msvc|mingw32).

Modified:
cfe/trunk/test/SemaCXX/sourceranges.cpp

Modified: cfe/trunk/test/SemaCXX/sourceranges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/sourceranges.cpp?rev=246849&r1=246848&r2=246849&view=diff
==
--- cfe/trunk/test/SemaCXX/sourceranges.cpp (original)
+++ cfe/trunk/test/SemaCXX/sourceranges.cpp Fri Sep  4 06:40:31 2015
@@ -46,7 +46,7 @@ struct D {
 void construct() {
   using namespace foo;
   A a = A(12);
-  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'class foo::A' 
'void (int)'
+  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'class foo::A' 
'void (int){{ __attribute__\(\(thiscall\)\)?}}'
   D d = D(12);
-  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'struct D' 
'void (int)'
+  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'struct D' 
'void (int){{ __attribute__\(\(thiscall\)\)?}}'
 }


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


r246850 - clang/test/SemaCXX/sourceranges.cpp: Fix silly expressions. Sorry for the breakage.

2015-09-04 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Sep  4 06:49:36 2015
New Revision: 246850

URL: http://llvm.org/viewvc/llvm-project?rev=246850&view=rev
Log:
clang/test/SemaCXX/sourceranges.cpp: Fix silly expressions. Sorry for the 
breakage.

Modified:
cfe/trunk/test/SemaCXX/sourceranges.cpp

Modified: cfe/trunk/test/SemaCXX/sourceranges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/sourceranges.cpp?rev=246850&r1=246849&r2=246850&view=diff
==
--- cfe/trunk/test/SemaCXX/sourceranges.cpp (original)
+++ cfe/trunk/test/SemaCXX/sourceranges.cpp Fri Sep  4 06:49:36 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+// RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s
 
 template
 class P {
@@ -46,7 +46,7 @@ struct D {
 void construct() {
   using namespace foo;
   A a = A(12);
-  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'class foo::A' 
'void (int){{ __attribute__\(\(thiscall\)\)?}}'
+  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'class foo::A' 
'void (int){{( __attribute__\(\(thiscall\)\))?}}'
   D d = D(12);
-  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'struct D' 
'void (int){{ __attribute__\(\(thiscall\)\)?}}'
+  // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}}  'struct D' 
'void (int){{( __attribute__\(\(thiscall\)\))?}}'
 }


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


Re: [PATCH] D12326: [Modules] Emit warning if module cannot instantiate static class member.

2015-09-04 Thread Serge Pavlov via cfe-commits
Any feedback?

Thanks,
--Serge

2015-08-26 0:26 GMT+06:00 Serge Pavlov :

> sepavloff created this revision.
> sepavloff added a subscriber: cfe-commits.
>
> Instantiation of static class members can be not obvious in some cases.
> Using
> modules can cause problems even more difficult to diagnose. PR24425
> describes
> one of such cases. As a way to assist a user, compiler could issue
> warnings if
> code that is potentially erroneous. This patch implements a warning if a
> static
> class member is used in a module, but cannot be instantiated there.
>
> http://reviews.llvm.org/D12326
>
> Files:
>   include/clang/Basic/DiagnosticGroups.td
>   include/clang/Basic/DiagnosticSemaKinds.td
>   lib/Sema/SemaDecl.cpp
>   test/Modules/Inputs/module-inst.cpp
>   test/Modules/Inputs/module-inst/a.h
>   test/Modules/Inputs/module-inst/module.modulemap
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia via cfe-commits
angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: alexfh, cfe-commits.

The InitListExpr subtree is visited twice, this caused the check to do multiple 
replacements. Added a set to avoid it.

http://reviews.llvm.org/D12631

Files:
  clang-tidy/modernize/LoopConvertUtils.cpp
  clang-tidy/modernize/LoopConvertUtils.h
  test/clang-tidy/modernize-loop-convert-extra.cpp

Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -884,3 +884,32 @@
 }
 
 } // namespace Lambdas
+
+namespace InitLists {
+
+struct D { int i; };
+struct E { D d; };
+int g(int b);
+
+void f() {
+  const unsigned N = 3;
+  int Array[N];
+
+  // Subtrees of InitListExpr are visited twice. Test that we do not do repeated
+  // replacements.
+  for (unsigned i = 0; i < N; ++i) {
+int a{ Array[i] };
+int b{ g(Array[i]) };
+int c{ g( { Array[i] } ) };
+D d{ { g( { Array[i] } ) } };
+E e{ { { g( { Array[i] } ) } } };
+  }
+  // CHECK-MESSAGES: :[[@LINE-7]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: int a{ elem };
+  // CHECK-FIXES-NEXT: int b{ g(elem) };
+  // CHECK-FIXES-NEXT: int c{ g( { elem } ) };
+  // CHECK-FIXES-NEXT: D d{ { g( { elem } ) } };
+  // CHECK-FIXES-NEXT: E e{ { { g( { elem } ) } } };
+}
+
+} // namespace InitLists
Index: clang-tidy/modernize/LoopConvertUtils.h
===
--- clang-tidy/modernize/LoopConvertUtils.h
+++ clang-tidy/modernize/LoopConvertUtils.h
@@ -205,6 +205,18 @@
   : Expression(E), IsArrow(false), Range(Expression->getSourceRange()) {}
   Usage(const Expr *E, bool IsArrow, SourceRange Range)
   : Expression(E), IsArrow(IsArrow), Range(std::move(Range)) {}
+
+  // Comparators for llvm::SmallSet.
+  bool operator<(const Usage &Other) const {
+return std::make_tuple(Expression, IsArrow, Range.getBegin(),
+   Range.getEnd()) <
+   std::make_tuple(Other.Expression, Other.IsArrow,
+   Other.Range.getBegin(), Other.Range.getEnd());
+  }
+  bool operator==(const Usage &Other) const {
+return Expression == Other.Expression && IsArrow == Other.IsArrow &&
+   Range == Other.Range;
+  }
 };
 
 /// \brief A class to encapsulate lowering of the tool's confidence level.
@@ -277,6 +289,9 @@
   /// \brief Accessor for Usages.
   const UsageResult &getUsages() const { return Usages; }
 
+  /// \brief Returns true and adds the Usage if it was not added before.
+  bool addUsage(const Usage &U);
+
   /// \brief Get the container indexed by IndexVar, if any.
   const Expr *getContainerIndexed() const { return ContainerExpr; }
 
@@ -336,6 +351,7 @@
   /// A container which holds all usages of IndexVar as the index of
   /// ArraySubscriptExpressions.
   UsageResult Usages;
+  llvm::SmallSet UsageSet;
   bool OnlyUsedAsIndex;
   /// The DeclStmt for an alias to the container element.
   const DeclStmt *AliasDecl;
Index: clang-tidy/modernize/LoopConvertUtils.cpp
===
--- clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tidy/modernize/LoopConvertUtils.cpp
@@ -460,6 +460,14 @@
   DependentExprs.push_back(std::make_pair(Node, ID));
 }
 
+bool ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  if (UsageSet.insert(U).second) {
+Usages.push_back(U);
+return true;
+  }
+  return false;
+}
+
 /// \brief If the unary operator is a dereference of IndexVar, include it
 /// as a valid usage and prune the traversal.
 ///
@@ -475,7 +483,7 @@
   // If we dereference an iterator that's actually a pointer, count the
   // occurrence.
   if (isDereferenceOfUop(Uop, IndexVar)) {
-Usages.push_back(Usage(Uop));
+addUsage(Usage(Uop));
 return true;
   }
 
@@ -549,8 +557,8 @@
 // If something complicated is happening (i.e. the next token isn't an
 // arrow), give up on making this work.
 if (!ArrowLoc.isInvalid()) {
-  Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
- SourceRange(Base->getExprLoc(), ArrowLoc)));
+  addUsage(Usage(ResultExpr, /*IsArrow=*/true,
+ SourceRange(Base->getExprLoc(), ArrowLoc)));
   return true;
 }
   }
@@ -579,7 +587,7 @@
 if (isIndexInSubscriptExpr(Context, MemberCall->getArg(0), IndexVar,
Member->getBase(), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(MemberCall));
+  addUsage(Usage(MemberCall));
   return true;
 }
   }
@@ -614,7 +622,7 @@
   switch (OpCall->getOperator()) {
   case OO_Star:
 if (isDereferenceOfOpCall(OpCall, IndexVar)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;

Re: [PATCH] D11361: [OpenMP] Target directive host codegen

2015-09-04 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

Needs two small changes to work with current trunk



Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2135-2136
@@ +2134,4 @@
+  const Expr *IfCond = nullptr;
+  if (auto C = S.getSingleClause(OMPC_if)) {
+IfCond = cast(C)->getCondition();
+  }

This now has to be `S.getSingleClause()` and we can therefore omit 
the cast...


Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2141-2142
@@ +2140,4 @@
+  const Expr *Device = nullptr;
+  if (auto C = S.getSingleClause(OMPC_device)) {
+Device = cast(C)->getDevice();
+  }

Likewise `S.getSingleClause()` without the need for an extra 
cast


http://reviews.llvm.org/D11361



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


Re: [PATCH] D9888: [OPENMP] Driver support for OpenMP offloading

2015-09-04 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

I think this has to be updated for the current trunk...


http://reviews.llvm.org/D9888



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


r246853 - [OPENMP] Fix false diagnostic on instantiation-dependent exprs for atomic constructs.

2015-09-04 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Sep  4 07:55:50 2015
New Revision: 246853

URL: http://llvm.org/viewvc/llvm-project?rev=246853&view=rev
Log:
[OPENMP] Fix false diagnostic on instantiation-dependent exprs for atomic 
constructs.
Some of instantiation-dependent expressions could cause false diagnostic to be 
emitted about unsupported atomic constructs. Relaxed rules for detection of 
incorrect expressions.

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/atomic_codegen.cpp
cfe/trunk/test/OpenMP/atomic_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=246853&r1=246852&r2=246853&view=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Sep  4 07:55:50 2015
@@ -4294,7 +4294,7 @@ bool OpenMPAtomicUpdateChecker::checkSta
   NoteLoc = AtomicUnaryOp->getOperatorLoc();
   NoteRange = SourceRange(NoteLoc, NoteLoc);
 }
-  } else {
+  } else if (!AtomicBody->isInstantiationDependent()) {
 ErrorFound = NotABinaryOrUnaryExpression;
 NoteLoc = ErrorLoc = AtomicBody->getExprLoc();
 NoteRange = ErrorRange = AtomicBody->getSourceRange();
@@ -4440,7 +4440,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirect
   NoteLoc = NotScalarExpr->getExprLoc();
   NoteRange = NotScalarExpr->getSourceRange();
 }
-  } else {
+  } else if (!AtomicBody->isInstantiationDependent()) {
 ErrorFound = NotAnAssignmentOp;
 ErrorLoc = AtomicBody->getExprLoc();
 ErrorRange = AtomicBody->getSourceRange();
@@ -4501,7 +4501,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirect
   NoteLoc = NotScalarExpr->getExprLoc();
   NoteRange = NotScalarExpr->getSourceRange();
 }
-  } else {
+  } else if (!AtomicBody->isInstantiationDependent()) {
 ErrorFound = NotAnAssignmentOp;
 ErrorLoc = AtomicBody->getExprLoc();
 ErrorRange = AtomicBody->getSourceRange();
@@ -4579,7 +4579,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirect
 UE = Checker.getUpdateExpr();
 IsXLHSInRHSPart = Checker.isXLHSInRHSPart();
 IsPostfixUpdate = Checker.isPostfixUpdate();
-  } else {
+  } else if (!AtomicBody->isInstantiationDependent()) {
 ErrorLoc = AtomicBody->getExprLoc();
 ErrorRange = AtomicBody->getSourceRange();
 NoteLoc = AtomicBinOp ? AtomicBinOp->getOperatorLoc()
@@ -4686,46 +4686,54 @@ StmtResult Sema::ActOnOpenMPAtomicDirect
   }
   if (!IsUpdateExprFound) {
 //  { v = x; x = expr; }
-auto *FirstBinOp = dyn_cast(First);
-if (!FirstBinOp || FirstBinOp->getOpcode() != BO_Assign) {
-  ErrorFound = NotAnAssignmentOp;
-  NoteLoc = ErrorLoc = FirstBinOp ? FirstBinOp->getOperatorLoc()
-  : First->getLocStart();
-  NoteRange = ErrorRange = FirstBinOp
-   ? FirstBinOp->getSourceRange()
-   : SourceRange(ErrorLoc, ErrorLoc);
-} else {
-  auto *SecondBinOp = dyn_cast(Second);
-  if (!SecondBinOp || SecondBinOp->getOpcode() != BO_Assign) {
+auto *FirstExpr = dyn_cast(First);
+auto *SecondExpr = dyn_cast(Second);
+if (!FirstExpr || !SecondExpr ||
+!(FirstExpr->isInstantiationDependent() ||
+  SecondExpr->isInstantiationDependent())) {
+  auto *FirstBinOp = dyn_cast(First);
+  if (!FirstBinOp || FirstBinOp->getOpcode() != BO_Assign) {
 ErrorFound = NotAnAssignmentOp;
-NoteLoc = ErrorLoc = SecondBinOp ? 
SecondBinOp->getOperatorLoc()
- : Second->getLocStart();
-NoteRange = ErrorRange = SecondBinOp
- ? SecondBinOp->getSourceRange()
+NoteLoc = ErrorLoc = FirstBinOp ? FirstBinOp->getOperatorLoc()
+: First->getLocStart();
+NoteRange = ErrorRange = FirstBinOp
+ ? FirstBinOp->getSourceRange()
  : SourceRange(ErrorLoc, ErrorLoc);
   } else {
-auto *PossibleXRHSInFirst =
-FirstBinOp->getRHS()->IgnoreParenImpCasts();
-auto *PossibleXLHSInSecond =
-SecondBinOp->getLHS()->IgnoreParenImpCasts();
-llvm::FoldingSetNodeID X1Id, X2Id;
-PossibleXRHSInFirst->Profile(X1Id, Context, 
/*Canonical=*/true);
-PossibleXLHSInSecond->Profile(X2Id, Context,
-  /*Canonical=*/true);
-

Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:465
@@ +464,3 @@
+  if (UsageSet.insert(U).second) {
+Usages.push_back(U);
+return true;

Do you need both `Usages` and `UsageSet`?


Comment at: clang-tidy/modernize/LoopConvertUtils.h:211
@@ +210,3 @@
+  bool operator<(const Usage &Other) const {
+return std::make_tuple(Expression, IsArrow, Range.getBegin(),
+   Range.getEnd()) <

Please use `std::tie` instead of `std::make_tuple` to avoid copies.


Comment at: clang-tidy/modernize/LoopConvertUtils.h:217
@@ +216,3 @@
+  bool operator==(const Usage &Other) const {
+return Expression == Other.Expression && IsArrow == Other.IsArrow &&
+   Range == Other.Range;

Looks like you can use `std::tie` here as well.


http://reviews.llvm.org/D12631



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


Re: [PATCH] D12619: [Static Analyzer] Minor cleanups for the nullability checker.

2015-09-04 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a subscriber: danielmarjamaki.
danielmarjamaki added a comment.

Overall.. LGTM



Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:78
@@ -78,2 +77,3 @@
+  llvm_unreachable("Unexpected enumeration.");
   return "";
 }

After llvm_unreachable there is often not a return.


http://reviews.llvm.org/D12619



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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia via cfe-commits
angelgarcia added a comment.

Anyway, I just found that this needs a few more changes (it still does 
duplicated replacementes inside some macros, and I have to find out why), so 
don't bother with this for now.



Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:465
@@ +464,3 @@
+  if (UsageSet.insert(U).second) {
+Usages.push_back(U);
+return true;

alexfh wrote:
> Do you need both `Usages` and `UsageSet`?
Yes, because SmallSet doesn't provide a way to iterate over its members.


Comment at: clang-tidy/modernize/LoopConvertUtils.h:211
@@ +210,3 @@
+  bool operator<(const Usage &Other) const {
+return std::make_tuple(Expression, IsArrow, Range.getBegin(),
+   Range.getEnd()) <

alexfh wrote:
> Please use `std::tie` instead of `std::make_tuple` to avoid copies.
I used std::tie here at first, but it didn't work because it tries to bind a 
RValue to a non-const ref. 


http://reviews.llvm.org/D12631



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


[PATCH] D12633: Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets

2015-09-04 Thread Alexandros Lamprineas via cfe-commits
labrinea created this revision.
labrinea added reviewers: rengolin, richard.barton.arm.
labrinea added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

Added the remaining macros and corresponding regression tests.

http://reviews.llvm.org/D12633

Files:
  lib/Basic/Targets.cpp
  test/Preprocessor/aarch64-target-features.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -32,6 +32,7 @@
 // CHECK-V8-BAREHF: __ARM_FEATURE_DIRECTED_ROUNDING 1
 // CHECK-V8-BAREHF: __ARM_FEATURE_NUMERIC_MAXMIN 1
 // CHECK-V8-BAREHF: __ARM_NEON__ 1
+// CHECK-V8-BAREHF: __ARM_PCS_VFP 1
 // CHECK-V8-BAREHF: __VFP_FP__ 1
 
 // RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s
@@ -85,8 +86,20 @@
 // THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
 
 // RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-DEFS %s
+// CHECK-DEFS:#define __ARM_FP_FENV_ROUNDING 1
+// CHECK-DEFS:#define __ARM_PCS 1
 // CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
 // CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
+// CHECK-DEFS:#define __STDC_IEC_559__ 1
+
+// RUN: %clang -target arm-none-linux-gnu -std=c99 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-C99 %s
+// CHECK-C99: __SUPPORT_SNAN__ 1
+
+// RUN: %clang -target arm-none-linux-gnu -std=c11 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-C11 %s
+// CHECK-C11-NOT: __SUPPORT_SNAN__ 1
+
+// RUN: %clang -target arm-none-linux-gnu -ffast-math -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FASTMATH %s
+// CHECK-FASTMATH: __ARM_FP_FAST 1
 
 // RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTWCHAR %s
 // CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -34,12 +34,23 @@
 // CHECK: __ARM_NEON 1
 // CHECK: __ARM_NEON_FP 0xE
 // CHECK: __ARM_PCS_AAPCS64 1
+// CHECK-NOT: __ARM_PCS 1
+// CHECK-NOT: __ARM_PCS_VFP 1
 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
+// CHECK: __STDC_IEC_559__ 1
 
 // RUN: %clang -target aarch64_be-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-BIGENDIAN
 // CHECK-BIGENDIAN: __ARM_BIG_ENDIAN 1
 
+// RUN: %clang -target aarch64-none-linux-gnu -std=c99 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-C99 %s
+// RUN: %clang -target arm64-none-linux-gnu -std=c99 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-C99 %s
+// CHECK-C99: __SUPPORT_SNAN__ 1
+
+// RUN: %clang -target aarch64-none-linux-gnu -std=c11 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-C11 %s
+// RUN: %clang -target arm64-none-linux-gnu -std=c11 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-C11 %s
+// CHECK-C11-NOT: __SUPPORT_SNAN__ 1
+
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+crypto -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-a+crypto -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
 // CHECK-CRYPTO: __ARM_FEATURE_CRYPTO 1
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4776,6 +4776,18 @@
 // ACLE 6.4.6 Q (saturation) flag
 if (hasDSP || hasSAT)
   Builder.defineMacro("__ARM_FEATURE_QBIT", "1");
+
+// ACLE 6.6 Floating-point model
+if (Opts.FastMath || Opts.FiniteMathOnly)
+  Builder.defineMacro("__ARM_FP_FAST", "1");
+
+if (Opts.C99 && !Opts.Freestanding) {
+  Builder.defineMacro("__ARM_FP_FENV_ROUNDING", "1");
+  Builder.defineMacro("__STDC_IEC_559__", "1");
+}
+
+if (!Opts.C11)
+  Builder.defineMacro("__SUPPORT_SNAN__", "1");
   }
 
   void getTargetBuiltins(const Builtin::Info *&Records,
@@ -5229,7 +5241,7 @@
 Builder.defineMacro("__ARM_ARCH_PROFILE", "'A'");
 
 Builder.defineMacro("__ARM_64BIT_STATE", "1");
-Builder.defineMacro("__ARM_PCS_AAPCS64");
+Builder.defineMacro("__ARM_PCS_AAPCS64", "1");
 Builder.defineMacro("__ARM_ARCH_ISA_A64", "1");
 
 Builder.defineMacro("__ARM_FEATURE_CLZ", "1");
@@ -5250,11 +5262,17 @@
 Builder.defineMacro("__ARM_FP16_FORMAT_IEEE", "1");
 Builder.defineMacro("__ARM_FP16_ARGS", "1");
 
+// ACLE 6.6 Floating-point model
 if (Opts.FastMath || Opts.FiniteMathOnly)
-  Builder.defineMacro("__ARM_FP_FAST");
+  Builder.defineMacro("__ARM_FP_FAST", "1");
+
+if (Opts.C99 && !Opts.Freestanding) {
+  Builder.defineMacro("__ARM_FP_FENV_ROUNDING", "1");
+  Builder.defineMacro("__STDC_IEC_559__",

[clang-tools-extra] r246854 - [clang-tidy] Fix add_new_check.py.

2015-09-04 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Sep  4 09:56:57 2015
New Revision: 246854

URL: http://llvm.org/viewvc/llvm-project?rev=246854&view=rev
Log:
[clang-tidy] Fix add_new_check.py.

This fixes the case where the check should be added at the end of
the list of checks in CMakeLists.txt of the corresponding module.
Before it was added after LINK_LIBS line.

http://reviews.llvm.org/D12629

Patch by Marek Kurdej!

Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py

Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=246854&r1=246853&r2=246854&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Fri Sep  4 09:56:57 2015
@@ -34,9 +34,10 @@ def adapt_cmake(module_path, check_name_
 cpp_found = False
 file_added = False
 for line in lines:
-  if not file_added and (line.endswith('.cpp') or cpp_found):
+  cpp_line = line.endswith('.cpp')
+  if (not file_added) and (cpp_line or cpp_found):
 cpp_found = True
-if line.strip() > cpp_file:
+if (line.strip() > cpp_file) or (not cpp_line):
   f.write('  ' + cpp_file + '\n')
   file_added = True
   f.write(line + '\n')


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


[clang-tools-extra] r246856 - [clang-tidy] Fix llvm-include-order check on Windows.

2015-09-04 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Sep  4 10:46:51 2015
New Revision: 246856

URL: http://llvm.org/viewvc/llvm-project?rev=246856&view=rev
Log:
[clang-tidy] Fix llvm-include-order check on Windows.

IncludeDirectives struct used a StringRef that pointed to a stack variable
(SmallString<128> FilenameBuffer from PPDirectives.cpp:1513).

http://reviews.llvm.org/D12632

Patch by Marek Kurdej!

Modified:
clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp

Modified: clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp?rev=246856&r1=246855&r2=246856&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp Fri Sep  4 
10:46:51 2015
@@ -33,7 +33,7 @@ private:
   struct IncludeDirective {
 SourceLocation Loc;///< '#' location in the include directive
 CharSourceRange Range; ///< SourceRange for the file name
-StringRef Filename;///< Filename as a string
+std::string Filename;  ///< Filename as a string
 bool IsAngled; ///< true if this was an include with angle brackets
 bool IsMainModule; ///< true if this was the first include in a file
   };

Modified: clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp?rev=246856&r1=246855&r2=246856&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/llvm-include-order.cpp Fri Sep  4 
10:46:51 2015
@@ -1,7 +1,6 @@
 // RUN: %python %S/check_clang_tidy.py %s llvm-include-order %t -- -isystem 
%S/Inputs/Headers
 
 // FIXME: Investigating.
-// XFAIL: win32
 
 // CHECK-MESSAGES: [[@LINE+2]]:1: warning: #includes are not sorted properly
 #include "j.h"


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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 34035.
angelgarcia added a comment.

I think this solves the duplication problem. And I think is clearer and cheaper 
than what I was trying to do before.


http://reviews.llvm.org/D12631

Files:
  clang-tidy/modernize/LoopConvertUtils.cpp
  clang-tidy/modernize/LoopConvertUtils.h
  test/clang-tidy/modernize-loop-convert-extra.cpp

Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -884,3 +884,32 @@
 }
 
 } // namespace Lambdas
+
+namespace InitLists {
+
+struct D { int i; };
+struct E { D d; };
+int g(int b);
+
+void f() {
+  const unsigned N = 3;
+  int Array[N];
+
+  // Subtrees of InitListExpr are visited twice. Test that we do not do repeated
+  // replacements.
+  for (unsigned i = 0; i < N; ++i) {
+int a{ Array[i] };
+int b{ g(Array[i]) };
+int c{ g( { Array[i] } ) };
+D d{ { g( { Array[i] } ) } };
+E e{ { { g( { Array[i] } ) } } };
+  }
+  // CHECK-MESSAGES: :[[@LINE-7]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: int a{ elem };
+  // CHECK-FIXES-NEXT: int b{ g(elem) };
+  // CHECK-FIXES-NEXT: int c{ g( { elem } ) };
+  // CHECK-FIXES-NEXT: D d{ { g( { elem } ) } };
+  // CHECK-FIXES-NEXT: E e{ { { g( { elem } ) } } };
+}
+
+} // namespace InitLists
Index: clang-tidy/modernize/LoopConvertUtils.h
===
--- clang-tidy/modernize/LoopConvertUtils.h
+++ clang-tidy/modernize/LoopConvertUtils.h
@@ -277,6 +277,9 @@
   /// \brief Accessor for Usages.
   const UsageResult &getUsages() const { return Usages; }
 
+  /// \brief Returns true and adds the Usage if it was not added before.
+  bool addUsage(const Usage &U);
+
   /// \brief Get the container indexed by IndexVar, if any.
   const Expr *getContainerIndexed() const { return ContainerExpr; }
 
@@ -336,6 +339,7 @@
   /// A container which holds all usages of IndexVar as the index of
   /// ArraySubscriptExpressions.
   UsageResult Usages;
+  llvm::SmallSet UsageSet;
   bool OnlyUsedAsIndex;
   /// The DeclStmt for an alias to the container element.
   const DeclStmt *AliasDecl;
Index: clang-tidy/modernize/LoopConvertUtils.cpp
===
--- clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tidy/modernize/LoopConvertUtils.cpp
@@ -460,6 +460,18 @@
   DependentExprs.push_back(std::make_pair(Node, ID));
 }
 
+bool ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  while (Begin.isMacroID())
+Begin = Context->getSourceManager().getExpansionLoc(Begin);
+
+  if (UsageSet.insert(Begin).second) {
+Usages.push_back(U);
+return true;
+  }
+  return false;
+}
+
 /// \brief If the unary operator is a dereference of IndexVar, include it
 /// as a valid usage and prune the traversal.
 ///
@@ -475,7 +487,7 @@
   // If we dereference an iterator that's actually a pointer, count the
   // occurrence.
   if (isDereferenceOfUop(Uop, IndexVar)) {
-Usages.push_back(Usage(Uop));
+addUsage(Usage(Uop));
 return true;
   }
 
@@ -549,8 +561,8 @@
 // If something complicated is happening (i.e. the next token isn't an
 // arrow), give up on making this work.
 if (!ArrowLoc.isInvalid()) {
-  Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
- SourceRange(Base->getExprLoc(), ArrowLoc)));
+  addUsage(Usage(ResultExpr, /*IsArrow=*/true,
+ SourceRange(Base->getExprLoc(), ArrowLoc)));
   return true;
 }
   }
@@ -579,7 +591,7 @@
 if (isIndexInSubscriptExpr(Context, MemberCall->getArg(0), IndexVar,
Member->getBase(), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(MemberCall));
+  addUsage(Usage(MemberCall));
   return true;
 }
   }
@@ -614,7 +626,7 @@
   switch (OpCall->getOperator()) {
   case OO_Star:
 if (isDereferenceOfOpCall(OpCall, IndexVar)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -625,7 +637,7 @@
 if (isIndexInSubscriptExpr(Context, OpCall->getArg(1), IndexVar,
OpCall->getArg(0), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -674,7 +686,7 @@
   if (!ContainerExpr)
 ContainerExpr = Arr;
 
-  Usages.push_back(Usage(E));
+  addUsage(Usage(E));
   return true;
 }
 
@@ -746,12 +758,12 @@
 bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
const LambdaCapture *C) {
   if (C->capturesVariable()) {
-const VarDecl* VDecl = C->get

r246857 - Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.

2015-09-04 Thread Ed Schouten via cfe-commits
Author: ed
Date: Fri Sep  4 11:07:39 2015
New Revision: 246857

URL: http://llvm.org/viewvc/llvm-project?rev=246857&view=rev
Log:
Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.

If we build with -Werror=implicit-function-declaration, only implicit
function declarations of non-library functions throw compiler errors.
For library functions, we only produce a warning. There is no way to
promote both of these cases to an error without promoting other
warnings.

It makes little sense to introduce an additional compiler flag just to
control this specific warning. In my opinion it should just be part of
the same group.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Driver/implicit-function-as-error.c
cfe/trunk/test/Misc/warning-flags.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=246857&r1=246856&r2=246857&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Sep  4 11:07:39 
2015
@@ -416,7 +416,8 @@ def note_unreachable_silence : Note<
 
 /// Built-in functions.
 def ext_implicit_lib_function_decl : ExtWarn<
-  "implicitly declaring library function '%0' with type %1">;
+  "implicitly declaring library function '%0' with type %1">,
+  InGroup;
 def note_include_header_or_declare : Note<
   "include the header <%0> or explicitly provide a declaration for '%1'">;
 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;

Modified: cfe/trunk/test/Driver/implicit-function-as-error.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/implicit-function-as-error.c?rev=246857&r1=246856&r2=246857&view=diff
==
--- cfe/trunk/test/Driver/implicit-function-as-error.c (original)
+++ cfe/trunk/test/Driver/implicit-function-as-error.c Fri Sep  4 11:07:39 2015
@@ -5,5 +5,6 @@
 // to an error.
 
 void radar_10894044() {
+  printf("Hi\n"); // expected-error {{implicitly declaring library function 
'printf' with type 'int (const char *, ...)'}} expected-note {{include the 
header  or explicitly provide a declaration for 'printf'}}
   radar_10894044_not_declared(); // expected-error {{implicit declaration of 
function 'radar_10894044_not_declared' is invalid in C99}}
 }

Modified: cfe/trunk/test/Misc/warning-flags.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=246857&r1=246856&r2=246857&view=diff
==
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Fri Sep  4 11:07:39 2015
@@ -18,12 +18,11 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (93):
+CHECK: Warnings without flags (92):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
-CHECK-NEXT:   ext_implicit_lib_function_decl
 CHECK-NEXT:   ext_initializer_string_for_char_array_too_long
 CHECK-NEXT:   ext_missing_declspec
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name


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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:465
@@ +464,3 @@
+  SourceLocation Begin = U.Range.getBegin();
+  while (Begin.isMacroID())
+Begin = Context->getSourceManager().getExpansionLoc(Begin);

There should be no need for a while() getExpansionLoc should always go to the 
most expanded location location.


Comment at: clang-tidy/modernize/LoopConvertUtils.h:280-281
@@ -279,1 +279,4 @@
 
+  /// \brief Returns true and adds the Usage if it was not added before.
+  bool addUsage(const Usage &U);
+

The result seems to be never used?


Comment at: clang-tidy/modernize/LoopConvertUtils.h:342
@@ -338,2 +341,3 @@
   UsageResult Usages;
+  llvm::SmallSet UsageSet;
   bool OnlyUsedAsIndex;

I don't think putting Set into the name helps. UsageLocations perhaps?


http://reviews.llvm.org/D12631



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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 34039.
angelgarcia marked 2 inline comments as done.
angelgarcia added a comment.

Ok! I wasn't sure, and a while would be correct in both cases :)


http://reviews.llvm.org/D12631

Files:
  clang-tidy/modernize/LoopConvertUtils.cpp
  clang-tidy/modernize/LoopConvertUtils.h
  test/clang-tidy/modernize-loop-convert-extra.cpp

Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -884,3 +884,32 @@
 }
 
 } // namespace Lambdas
+
+namespace InitLists {
+
+struct D { int i; };
+struct E { D d; };
+int g(int b);
+
+void f() {
+  const unsigned N = 3;
+  int Array[N];
+
+  // Subtrees of InitListExpr are visited twice. Test that we do not do repeated
+  // replacements.
+  for (unsigned i = 0; i < N; ++i) {
+int a{ Array[i] };
+int b{ g(Array[i]) };
+int c{ g( { Array[i] } ) };
+D d{ { g( { Array[i] } ) } };
+E e{ { { g( { Array[i] } ) } } };
+  }
+  // CHECK-MESSAGES: :[[@LINE-7]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: int a{ elem };
+  // CHECK-FIXES-NEXT: int b{ g(elem) };
+  // CHECK-FIXES-NEXT: int c{ g( { elem } ) };
+  // CHECK-FIXES-NEXT: D d{ { g( { elem } ) } };
+  // CHECK-FIXES-NEXT: E e{ { { g( { elem } ) } } };
+}
+
+} // namespace InitLists
Index: clang-tidy/modernize/LoopConvertUtils.h
===
--- clang-tidy/modernize/LoopConvertUtils.h
+++ clang-tidy/modernize/LoopConvertUtils.h
@@ -277,6 +277,9 @@
   /// \brief Accessor for Usages.
   const UsageResult &getUsages() const { return Usages; }
 
+  /// \brief Returns true and adds the Usage if it was not added before.
+  void addUsage(const Usage &U);
+
   /// \brief Get the container indexed by IndexVar, if any.
   const Expr *getContainerIndexed() const { return ContainerExpr; }
 
@@ -336,6 +339,7 @@
   /// A container which holds all usages of IndexVar as the index of
   /// ArraySubscriptExpressions.
   UsageResult Usages;
+  llvm::SmallSet UsageLocations;
   bool OnlyUsedAsIndex;
   /// The DeclStmt for an alias to the container element.
   const DeclStmt *AliasDecl;
Index: clang-tidy/modernize/LoopConvertUtils.cpp
===
--- clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tidy/modernize/LoopConvertUtils.cpp
@@ -460,6 +460,15 @@
   DependentExprs.push_back(std::make_pair(Node, ID));
 }
 
+void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  if (Begin.isMacroID())
+Begin = Context->getSourceManager().getExpansionLoc(Begin);
+
+  if (UsageLocations.insert(Begin).second)
+Usages.push_back(U);
+}
+
 /// \brief If the unary operator is a dereference of IndexVar, include it
 /// as a valid usage and prune the traversal.
 ///
@@ -475,7 +484,7 @@
   // If we dereference an iterator that's actually a pointer, count the
   // occurrence.
   if (isDereferenceOfUop(Uop, IndexVar)) {
-Usages.push_back(Usage(Uop));
+addUsage(Usage(Uop));
 return true;
   }
 
@@ -549,8 +558,8 @@
 // If something complicated is happening (i.e. the next token isn't an
 // arrow), give up on making this work.
 if (!ArrowLoc.isInvalid()) {
-  Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
- SourceRange(Base->getExprLoc(), ArrowLoc)));
+  addUsage(Usage(ResultExpr, /*IsArrow=*/true,
+ SourceRange(Base->getExprLoc(), ArrowLoc)));
   return true;
 }
   }
@@ -579,7 +588,7 @@
 if (isIndexInSubscriptExpr(Context, MemberCall->getArg(0), IndexVar,
Member->getBase(), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(MemberCall));
+  addUsage(Usage(MemberCall));
   return true;
 }
   }
@@ -614,7 +623,7 @@
   switch (OpCall->getOperator()) {
   case OO_Star:
 if (isDereferenceOfOpCall(OpCall, IndexVar)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -625,7 +634,7 @@
 if (isIndexInSubscriptExpr(Context, OpCall->getArg(1), IndexVar,
OpCall->getArg(0), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -674,7 +683,7 @@
   if (!ContainerExpr)
 ContainerExpr = Arr;
 
-  Usages.push_back(Usage(E));
+  addUsage(Usage(E));
   return true;
 }
 
@@ -746,12 +755,12 @@
 bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
const LambdaCapture *C) {
   if (C->capturesVariable()) {
-const VarDecl* VDecl = C->getCapturedVar();
+const VarDecl *VDecl

Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:463-470
@@ -462,1 +462,10 @@
 
+void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  if (Begin.isMacroID())
+Begin = Context->getSourceManager().getExpansionLoc(Begin);
+
+  if (UsageLocations.insert(Begin).second)
+Usages.push_back(U);
+}
+

Now that I take a step back - shouldn't we go to the *spelling* location to 
deduplicate? The spelling location is the location that will be edited, after 
all.


http://reviews.llvm.org/D12631



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


recordDecl() AST matcher

2015-09-04 Thread Aaron Ballman via cfe-commits
It turns out that the recordDecl() AST matcher doesn't match
RecordDecl objects; instead, it matches CXXRecordDecl objects. This
is... unfortunate... as it makes writing AST matchers more complicated
because of having to translate between recordDecl()/CXXRecordDecl. It
also makes it impossible to match a struct or union declaration in C
or ObjC. However, given how prevalent recordDecl()'s use is in the
wild (I'm guessing), changing it at this point would be a Bad Thing.

For people trying to write AST matchers for languages like C or ObjC,
I would like to propose adding:

structDecl()
unionDecl()
tagDecl()

These will match nicely with the existing enumDecl() AST matcher.

Additionally, I would like to add cxxRecordDecl() to match
CXXRecordDecl objects. While it duplicates the functionality exposed
by recordDecl(), it more clearly matches the intention of which AST
node it corresponds to.

Finally, I would like to undocument recordDecl() and change our
existing documentation and AST matcher uses to use
cxxRecordDecl/structDecl() instead. Maybe someday we can deprecate
recordDecl() more officially.

I'm open to other ideas if there are better ways to move forward. If
you think changing the meaning of recordDecl() is acceptable, I can
also go that route (though I would still propose adding unionDecl()
and cxxRecordDecl() in that case).

Thanks!

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


r246860 - Fixing a bug where hasType(decl()) would fail to match on C code involving structs or unions.

2015-09-04 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Fri Sep  4 13:34:48 2015
New Revision: 246860

URL: http://llvm.org/viewvc/llvm-project?rev=246860&view=rev
Log:
Fixing a bug where hasType(decl()) would fail to match on C code involving 
structs or unions.

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

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=246860&r1=246859&r2=246860&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Fri Sep  4 
13:34:48 2015
@@ -668,16 +668,14 @@ private:
 return matchesDecl(Node.getDecl(), Finder, Builder);
   }
 
-  /// \brief Extracts the CXXRecordDecl or EnumDecl of a QualType and returns
-  /// whether the inner matcher matches on it.
+  /// \brief Extracts the TagDecl of a QualType and returns whether the inner
+  /// matcher matches on it.
   bool matchesSpecialized(const QualType &Node, ASTMatchFinder *Finder,
   BoundNodesTreeBuilder *Builder) const {
 /// FIXME: Add other ways to convert...
 if (Node.isNull())
   return false;
-if (const EnumType *AsEnum = dyn_cast(Node.getTypePtr()))
-  return matchesDecl(AsEnum->getDecl(), Finder, Builder);
-return matchesDecl(Node->getAsCXXRecordDecl(), Finder, Builder);
+return matchesDecl(Node->getAsTagDecl(), Finder, Builder);
   }
 
   /// \brief Gets the TemplateDecl from a TemplateSpecializationType

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=246860&r1=246859&r2=246860&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Fri Sep  4 13:34:48 2015
@@ -919,6 +919,9 @@ TEST(TypeMatcher, MatchesClassType) {
 
   EXPECT_TRUE(
   matches("class A { public: A *a; class B {}; };", TypeAHasClassB));
+
+  EXPECT_TRUE(matchesC("struct S {}; void f(void) { struct S s; }",
+   varDecl(hasType(namedDecl(hasName("S"));
 }
 
 TEST(Matcher, BindMatchedNodes) {

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=246860&r1=246859&r2=246860&view=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Fri Sep  4 13:34:48 2015
@@ -120,6 +120,12 @@ testing::AssertionResult matchesObjC(con
 }
 
 template 
+testing::AssertionResult matchesC(const std::string &Code, const T &AMatcher) {
+  return matchesConditionally(Code, AMatcher, true, "", FileContentMappings(),
+  "input.c");
+}
+
+template 
 testing::AssertionResult notMatchesObjC(const std::string &Code,
  const T &AMatcher) {
   return matchesConditionally(


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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 34054.
angelgarcia added a comment.

Yes, with SpellingLoc works as well, and it should be better.


http://reviews.llvm.org/D12631

Files:
  clang-tidy/modernize/LoopConvertUtils.cpp
  clang-tidy/modernize/LoopConvertUtils.h
  test/clang-tidy/modernize-loop-convert-extra.cpp

Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -884,3 +884,32 @@
 }
 
 } // namespace Lambdas
+
+namespace InitLists {
+
+struct D { int i; };
+struct E { D d; };
+int g(int b);
+
+void f() {
+  const unsigned N = 3;
+  int Array[N];
+
+  // Subtrees of InitListExpr are visited twice. Test that we do not do repeated
+  // replacements.
+  for (unsigned i = 0; i < N; ++i) {
+int a{ Array[i] };
+int b{ g(Array[i]) };
+int c{ g( { Array[i] } ) };
+D d{ { g( { Array[i] } ) } };
+E e{ { { g( { Array[i] } ) } } };
+  }
+  // CHECK-MESSAGES: :[[@LINE-7]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: int a{ elem };
+  // CHECK-FIXES-NEXT: int b{ g(elem) };
+  // CHECK-FIXES-NEXT: int c{ g( { elem } ) };
+  // CHECK-FIXES-NEXT: D d{ { g( { elem } ) } };
+  // CHECK-FIXES-NEXT: E e{ { { g( { elem } ) } } };
+}
+
+} // namespace InitLists
Index: clang-tidy/modernize/LoopConvertUtils.h
===
--- clang-tidy/modernize/LoopConvertUtils.h
+++ clang-tidy/modernize/LoopConvertUtils.h
@@ -277,6 +277,9 @@
   /// \brief Accessor for Usages.
   const UsageResult &getUsages() const { return Usages; }
 
+  /// \brief Returns true and adds the Usage if it was not added before.
+  void addUsage(const Usage &U);
+
   /// \brief Get the container indexed by IndexVar, if any.
   const Expr *getContainerIndexed() const { return ContainerExpr; }
 
@@ -336,6 +339,7 @@
   /// A container which holds all usages of IndexVar as the index of
   /// ArraySubscriptExpressions.
   UsageResult Usages;
+  llvm::SmallSet UsageLocations;
   bool OnlyUsedAsIndex;
   /// The DeclStmt for an alias to the container element.
   const DeclStmt *AliasDecl;
Index: clang-tidy/modernize/LoopConvertUtils.cpp
===
--- clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tidy/modernize/LoopConvertUtils.cpp
@@ -460,6 +460,15 @@
   DependentExprs.push_back(std::make_pair(Node, ID));
 }
 
+void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  if (Begin.isMacroID())
+Begin = Context->getSourceManager().getSpellingLoc(Begin);
+
+  if (UsageLocations.insert(Begin).second)
+Usages.push_back(U);
+}
+
 /// \brief If the unary operator is a dereference of IndexVar, include it
 /// as a valid usage and prune the traversal.
 ///
@@ -475,7 +484,7 @@
   // If we dereference an iterator that's actually a pointer, count the
   // occurrence.
   if (isDereferenceOfUop(Uop, IndexVar)) {
-Usages.push_back(Usage(Uop));
+addUsage(Usage(Uop));
 return true;
   }
 
@@ -549,8 +558,8 @@
 // If something complicated is happening (i.e. the next token isn't an
 // arrow), give up on making this work.
 if (!ArrowLoc.isInvalid()) {
-  Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
- SourceRange(Base->getExprLoc(), ArrowLoc)));
+  addUsage(Usage(ResultExpr, /*IsArrow=*/true,
+ SourceRange(Base->getExprLoc(), ArrowLoc)));
   return true;
 }
   }
@@ -579,7 +588,7 @@
 if (isIndexInSubscriptExpr(Context, MemberCall->getArg(0), IndexVar,
Member->getBase(), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(MemberCall));
+  addUsage(Usage(MemberCall));
   return true;
 }
   }
@@ -614,7 +623,7 @@
   switch (OpCall->getOperator()) {
   case OO_Star:
 if (isDereferenceOfOpCall(OpCall, IndexVar)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -625,7 +634,7 @@
 if (isIndexInSubscriptExpr(Context, OpCall->getArg(1), IndexVar,
OpCall->getArg(0), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -674,7 +683,7 @@
   if (!ContainerExpr)
 ContainerExpr = Arr;
 
-  Usages.push_back(Usage(E));
+  addUsage(Usage(E));
   return true;
 }
 
@@ -746,12 +755,12 @@
 bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
const LambdaCapture *C) {
   if (C->capturesVariable()) {
-const VarDecl* VDecl = C->getCapturedVar();
+const VarDecl *VDecl = C->getCapturedVar();
 if (areSameVariable(I

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-09-04 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

This essentially looks fine. Let me know if you want me to take another look 
once you've fixed the `ignorePointerCastsAndParens` bug with derived-to-base 
conversions, otherwise go ahead.



Comment at: lib/AST/ExprConstant.cpp:499
@@ -496,1 +498,3 @@
+  /// MemberExpr with a base that can't be evaluated.
+  EM_ConstantExpressionOffsetFold,
 } EvalMode;

Maybe rename to `OffsetFold` or `DesignatorFold`?


Comment at: lib/AST/ExprConstant.cpp:6263-6264
@@ +6262,4 @@
+  auto *SubExpr = Cast->getSubExpr();
+  if (!SubExpr->getType()->hasPointerRepresentation() || !SubExpr->isRValue())
+return NoParens;
+  return ignorePointerCastsAndParens(SubExpr);

I don't think this is quite right: you should only skip past casts that don't 
change the pointer value. In particular, this check will step past 
derived-to-base pointer conversions, which may require an adjustment to the 
pointer.


http://reviews.llvm.org/D12169



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


Re: [PATCH] D12624: Top-level anonymous namespaces are missing import DW_TAG_imported_module and nested anonymous namespaces are not

2015-09-04 Thread Richard Smith via cfe-commits
rsmith added a comment.

I think this is fundamentally the right approach. Anonymous namespaces do 
inject a using directive, and we should not forget to pass it to the AST 
consumer.



Comment at: lib/CodeGen/CGDebugInfo.cpp:3263-3264
@@ +3262,4 @@
+  const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
+  if (!NSDecl->isAnonymousNamespace() || 
+  CGM.getTarget().getTriple().isPS4CPU()) { 
+DBuilder.createImportedModule(

I think we should do this unconditionally, to better match the source language 
semantics, but I'm curious what David, Eric, and other folks on the DWARF side 
think.


Comment at: lib/Parse/ParseDeclCXX.cpp:204
@@ +203,3 @@
+  
+ // Return NamespaceDecl + ImportDecl here.
+  return Actions.ConvertDeclToDeclGroup(NamespcDecl, 

This comment doesn't add anything and doesn't use the right name for either 
variable. Just remove it?


Comment at: lib/Parse/ParseDeclCXX.cpp:235
@@ -230,2 +234,3 @@
   ParseScope NamespaceScope(this, Scope::DeclScope);
+  UsingDirectiveDecl *ImplicitUsingDirectiveDecl = NULL;
   Decl *NamespcDecl =

Use `nullptr`, not `NULL`.


Comment at: lib/Parse/ParseDeclCXX.cpp:241
@@ -236,2 +240,3 @@
+   attrs.getList(), 
ImplicitUsingDirectiveDecl);
 
   ParseInnerNamespace(IdentLoc, Ident, NamespaceLoc, ++index, InlineLoc,

Add an assert here:

  assert(!ImplicitUsingDirectiveDecl && "nested namespace definition cannot 
define anonymous namespace");


Comment at: lib/Sema/SemaDeclCXX.cpp:7189
@@ -7189,1 +7188,3 @@
+   AttributeList *AttrList,
+   UsingDirectiveDecl *& UD) {
   SourceLocation StartLoc = InlineLoc.isValid() ? InlineLoc : NamespaceLoc;

No space after `&`.


http://reviews.llvm.org/D12624



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


Re: [PATCH] D12453: [CUDA] Allow function overloads based on host/device attributes.

2015-09-04 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 34059.
tra marked 2 inline comments as done.
tra added a comment.

Added more test cases to cover constructor/destructor/new/delete.
Refactored code to remove unwanted CUDA functions from Lookup match results.
Disabled HD overloading of H or H destructors to guarantee single destructor 
for codegen. (I'm still investigating whether it makes sense to enforce the 
same restriction on all functions as pcc@ suggested in design doc).


http://reviews.llvm.org/D12453

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Sema/Sema.h
  lib/AST/ItaniumMangle.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaCUDA.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGenCUDA/function-overload.cu
  test/SemaCUDA/function-overload.cu

Index: test/SemaCUDA/function-overload.cu
===
--- /dev/null
+++ test/SemaCUDA/function-overload.cu
@@ -0,0 +1,241 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// Make sure we handle target overloads correctly.
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu \
+// RUN:-fsyntax-only -fcuda-target-overloads -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda \
+// RUN:-fsyntax-only -fcuda-target-overloads -fcuda-is-device -verify %s
+
+// Check target overloads handling with disabled call target checks.
+// RUN: %clang_cc1 -DNOCHECKS -triple x86_64-unknown-linux-gnu -fsyntax-only \
+// RUN:-fcuda-disable-target-call-checks -fcuda-target-overloads -verify %s
+// RUN: %clang_cc1 -DNOCHECKS -triple nvptx64-nvidia-cuda -fsyntax-only \
+// RUN:-fcuda-disable-target-call-checks -fcuda-target-overloads \
+// RUN:-fcuda-is-device -verify %s
+
+#include "Inputs/cuda.h"
+
+typedef int (*fp_t)(void);
+typedef void (*gp_t)(void);
+
+__device__ int dhhd(void) { return 2; }
+__host__ int dhhd(void) { return 1; } // expected-note {{previous definition is here}}
+int dhhd(void) { return 1; } // expected-error {{redefinition of 'dhhd'}}
+__host__ __device__ int dhhd(void) { return 3; }
+
+__host__ int hhd(void) { return 4; }
+__host__ __device__ int dhd(void) { return 5; }
+
+__device__ int dhd(void) { return 6; }
+__host__ __device__ int hhd(void) { return 7; }
+
+__device__ int d(void) { return 8; }
+__host__ int h(void) { return 9; }
+__global__ void g(void) {}
+
+extern "C" __device__ int chd(void) {return 10;}
+extern "C" __host__ int chd(void) {return 11;} // expected-note {{previous definition is here}}
+extern "C" int chd(void) {return 11;} // expected-error {{redefinition of 'chd'}}
+extern "C" __host__ __device__ int chd(void) {return 12;} // expected-note {{previous definition is here}}
+extern "C" __host__ __device__ int chd(void) {return 13;} // expected-error {{redefinition of 'chd'}}
+
+__host__ void hostf(void) {
+  fp_t dhddp = dhhd;
+  fp_t hhdp = hhd;
+  fp_t dhdp = dhd;
+  gp_t gp = g;
+  fp_t dp = d;
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{reference to __device__ function 'd' in __host__ function}}
+  // expected-note@33 {{'d' declared here}}
+#endif
+  fp_t hp = h;
+
+  dhhd();
+  hhd();
+  dhd();
+  chd();
+  d();
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{no matching function for call to 'd'}}
+  // expected-note@33 {{candidate function not viable: call to __device__ function from __host__ function}}
+#endif
+  h();
+
+  g(); // expected-error {{call to global function g not configured}}
+  g<<<0,0>>>();
+}
+
+__device__ void devicef(void) {
+  fp_t dhddp = dhhd;
+  fp_t hhdp = hhd;
+  fp_t dhdp = dhd;
+  gp_t gp = g; // expected-error {{reference to __global__ function 'g' in __device__ function}}
+   // expected-note@35 {{'g' declared here}}
+  fp_t dp = d;
+  fp_t hp = h;
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{reference to __host__ function 'h' in __device__ function}}
+  // expected-note@34 {{'h' declared here}}
+#endif
+
+  dhhd();
+  hhd();
+  dhd();
+  chd();
+  d();
+  h();
+  g();
+#if !defined(NOCHECKS)
+  // expected-error@-3 {{no matching function for call to 'h'}}
+  // expected-note@34 {{candidate function not viable: call to __host__ function from __device__ function}}
+#endif
+  // expected-error@-5 {{no matching function for call to 'g'}}
+  // expected-note@35 {{candidate function not viable: call to __global__ function from __device__ function}}
+  g<<<0,0>>>();
+  // expected-error@-1 {{reference to __global__ function 'g' in __device__ function}}
+  // expected-note@35 {{'g' declared here}}
+}
+
+__global__ void globalf(void) {
+  fp_t dhddp = dhhd;
+  fp_t hhdp = hhd;
+  fp_t dhdp = dhd;
+  gp_t gp = g; // expected-error {{reference to __global__ function 'g' in __global__ function}}
+   // expected-note@35 {{'g' declared here}}
+  fp_t dp = d;
+  fp_t hp = h;
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{reference to __host__ function 'h' in __global__ fu

Re: [PATCH] D12435: [Concepts] Add diagnostic; invalid specifier on function or variable concept declaration

2015-09-04 Thread Nathan Wilson via cfe-commits
nwilson added a comment.

Ping


http://reviews.llvm.org/D12435



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


Re: [PATCH] D12326: [Modules] Emit warning if module cannot instantiate static class member.

2015-09-04 Thread Sean Silva via cfe-commits
silvas added a subscriber: silvas.
silvas added a comment.

How expensive is this check?


http://reviews.llvm.org/D12326



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


r246864 - Don't allow dllexport/import on static local variables

2015-09-04 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Fri Sep  4 14:59:39 2015
New Revision: 246864

URL: http://llvm.org/viewvc/llvm-project?rev=246864&view=rev
Log:
Don't allow dllexport/import on static local variables

They might technically have external linkage, but it still doesn't make sense
for the user to try and export such variables. This matches MSVC's and MinGW's
behaviour.

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/dllexport.c
cfe/trunk/test/Sema/dllimport.c
cfe/trunk/test/SemaCXX/dllexport.cpp
cfe/trunk/test/SemaCXX/dllimport.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=246864&r1=246863&r2=246864&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Sep  4 14:59:39 2015
@@ -5355,9 +5355,11 @@ static void checkAttributesAfterMerging(
 }
   }
 
-  // dll attributes require external linkage.
   if (const InheritableAttr *Attr = getDLLAttr(&ND)) {
-if (!ND.isExternallyVisible()) {
+// dll attributes require external linkage. Static locals may have external
+// linkage but still cannot be explicitly imported or exported.
+auto *VD = dyn_cast(&ND);
+if (!ND.isExternallyVisible() || (VD && VD->isStaticLocal())) {
   S.Diag(ND.getLocation(), diag::err_attribute_dll_not_extern)
 << &ND << Attr;
   ND.setInvalidDecl();

Modified: cfe/trunk/test/Sema/dllexport.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/dllexport.c?rev=246864&r1=246863&r2=246864&view=diff
==
--- cfe/trunk/test/Sema/dllexport.c (original)
+++ cfe/trunk/test/Sema/dllexport.c Fri Sep  4 14:59:39 2015
@@ -109,6 +109,11 @@ __declspec(dllexport) void redecl6(); //
 // External linkage is required.
 __declspec(dllexport) static int staticFunc(); // expected-error{{'staticFunc' 
must have external linkage when declared 'dllexport'}}
 
+// Static locals don't count as having external linkage.
+void staticLocalFunc() {
+  __declspec(dllexport) static int staticLocal; // 
expected-error{{'staticLocal' must have external linkage when declared 
'dllexport'}}
+}
+
 
 
 
//===--===//

Modified: cfe/trunk/test/Sema/dllimport.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/dllimport.c?rev=246864&r1=246863&r2=246864&view=diff
==
--- cfe/trunk/test/Sema/dllimport.c (original)
+++ cfe/trunk/test/Sema/dllimport.c Fri Sep  4 14:59:39 2015
@@ -168,3 +168,8 @@ __declspec(dllimport) inline void redecl
 
 // External linkage is required.
 __declspec(dllimport) static int staticFunc(); // expected-error{{'staticFunc' 
must have external linkage when declared 'dllimport'}}
+
+// Static locals don't count as having external linkage.
+void staticLocalFunc() {
+  __declspec(dllimport) static int staticLocal; // 
expected-error{{'staticLocal' must have external linkage when declared 
'dllimport'}}
+}

Modified: cfe/trunk/test/SemaCXX/dllexport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/dllexport.cpp?rev=246864&r1=246863&r2=246864&view=diff
==
--- cfe/trunk/test/SemaCXX/dllexport.cpp (original)
+++ cfe/trunk/test/SemaCXX/dllexport.cpp Fri Sep  4 14:59:39 2015
@@ -71,14 +71,9 @@ __declspec(dllexport) auto ExternalAutoT
 
 // Thread local variables are invalid.
 __declspec(dllexport) __thread int ThreadLocalGlobal; // 
expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 
'dllexport'}}
-inline void InlineWithThreadLocal() {
-  static __declspec(dllexport) __thread int ThreadLocalGlobal; // 
expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 
'dllexport'}}
-}
-
-// But if they're in a dllexport function, it's ok, because they will never 
get imported.
+// But a static local TLS var in an export function is OK.
 inline void __declspec(dllexport) ExportedInlineWithThreadLocal() {
-  static __declspec(dllexport) __thread int OK1; // no-error
-  static __thread int OK2; // no-error
+  static __thread int OK; // no-error
 }
 
 // Export in local scope.

Modified: cfe/trunk/test/SemaCXX/dllimport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/dllimport.cpp?rev=246864&r1=246863&r2=246864&view=diff
==
--- cfe/trunk/test/SemaCXX/dllimport.cpp (original)
+++ cfe/trunk/test/SemaCXX/dllimport.cpp Fri Sep  4 14:59:39 2015
@@ -93,16 +93,10 @@ __declspec(dllimport) auto InternalAutoT
 
 // Thread local variables are invalid.
 __declspec(dllimport) __thread int ThreadLocalGlobal; // 
expected-error{{'ThreadLocalGlobal' cannot be thread local when declared

[PATCH] D12644: Using -isysroot on Apple platform

2015-09-04 Thread Steven Wu via cfe-commits
steven_wu created this revision.
steven_wu added a reviewer: EricWF.
steven_wu added a subscriber: cfe-commits.

--sysroot might cause inconsistency between the header gets used and the
library gets linked on Apple platform. Use -isysroot instead.

http://reviews.llvm.org/D12644

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -209,7 +209,11 @@
 # Target flags 
 add_flags_if(LIBCXX_BUILD_32_BITS -m32)
 add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+if (APPLE)
+  add_flags_if(LIBCXX_SYSROOT "-isysroot ${LIBCXX_SYSROOT}")
+else
+  add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+endif()
 add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -209,7 +209,11 @@
 # Target flags 
 add_flags_if(LIBCXX_BUILD_32_BITS -m32)
 add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+if (APPLE)
+  add_flags_if(LIBCXX_SYSROOT "-isysroot ${LIBCXX_SYSROOT}")
+else
+  add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+endif()
 add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12326: [Modules] Emit warning if module cannot instantiate static class member.

2015-09-04 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

I don't really see this as being specific to modules, nor to static data 
members. The natural generalization of this is:

- at the end of a translation unit (including at the end of a module), warn on 
any implicit instantiations that are needed but could not be performed because 
the definition is not available

For valid code, this means we'd warn on templates/temploids which have their 
definition and all relevant explicit instantiations tucked away in some source 
file (but for which no explicit instantiation declarations are provided in the 
relevant header file) -- uncommon, but an idiom used by some. There is at least 
a syntactic solution we can suggest for people who see the warning: add the 
missing explicit instantiation declarations to the header file.



Comment at: lib/Sema/SemaDecl.cpp:1-14445
@@ -14403,2 +14443,4 @@
   checkModuleImportContext(*this, Mod, DirectiveLoc, CurContext);
+  InstantiationScanner Scanner(*this);
+  Scanner.TraverseDecl(getASTContext().getTranslationUnitDecl());
 

This is not the right way to implement the check. `RecursiveASTVisitor`s are 
generally very expensive, and are poison to modules builds (because they will 
import all of the contents of all module files).

The right way to handle this is to produce the warning from within 
`PerformPendingInstantiations` when it's called at the end of the translation 
unit / module, in the cases where we want to perform an implicit instantiation, 
the template is not defined, and there is no preceding explicit instantiation 
declaration.

  warning: instantiation of 'Foo::s_bar' required here, but 'Foo::s_bar' 
is not defined
  note: add an explicit instantiation declaration to suppress this warning if 
'Foo::s_bar' is explicitly instantiated in another translation unit

Extra credit: include a fixit hint in the note to add 'extern template char 
Foo::s_bar;' somewhere sensible.


http://reviews.llvm.org/D12326



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


[PATCH][www] Mention that libcxx is necessary on OS X

2015-09-04 Thread Yuri Gribov via cfe-commits
Hi all,

According to https://llvm.org/bugs/show_bug.cgi?id=17821 , when Clang gets
built on OS X we need to build it with libcxx and libcxxabi (otherwise
tests will fail to link with "can't find iostream". This patch adds a note
to getting started page. Ok to apply?

Best regards,
Yury Gribov


libcxx-osx-1.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12412: [CodeGen] Point empty %invoke.cont block to successor

2015-09-04 Thread Vedant Kumar via cfe-commits
vsk added a comment.

Ping


http://reviews.llvm.org/D12412



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


Re: [PATCH][www] Mention that libcxx is necessary on OS X

2015-09-04 Thread Jonathan Roelofs via cfe-commits



On 9/4/15 2:45 PM, Yuri Gribov via cfe-commits wrote:

Hi all,

According to https://llvm.org/bugs/show_bug.cgi?id=17821 , when Clang
gets built on OS X we need to build it with libcxx and libcxxabi
(otherwise tests will fail to link with "can't find iostream". This
patch adds a note to getting started page. Ok to apply?


Which tests fail to link for you?

Jon



Best regards,
Yury Gribov


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



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


Re: [PATCH] D12644: Using -isysroot on Apple platform

2015-09-04 Thread Eric Fiselier via cfe-commits
EricWF added a reviewer: danalbert.
EricWF added a subscriber: danalbert.
EricWF added a comment.

@danalbert actually uses this option. I would like him to confirm this change.


http://reviews.llvm.org/D12644



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


[PATCH] D12646: Add libc++ header path for DarwinClang builds

2015-09-04 Thread don hinton via cfe-commits
hintonda created this revision.
hintonda added a reviewer: rsmith.
hintonda added a subscriber: cfe-commits.

Current behavior doesn't add c++ header path if libc++ wasn't installed via 
macports in /usr.  This change will try to locate c++ headers from various 
locations, including in tree, via macports, sysroot, and default Xcode location 
-- which is how my configuration finds it.

This probably needs a bit of work, especially wrt other configurations, so 
feedback would be appreciated..

http://reviews.llvm.org/D12646

Files:
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h

Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -475,6 +475,9 @@
 
   void AddLinkARCArgs(const llvm::opt::ArgList &Args,
   llvm::opt::ArgStringList &CmdArgs) const override;
+
+  void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const 
override;
   /// }
 
 private:
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -264,6 +264,43 @@
   CmdArgs.push_back(Args.MakeArgString(P));
 }
 
+void DarwinClang::AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList 
&DriverArgs,
+   llvm::opt::ArgStringList 
&CC1Args) const {
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+  DriverArgs.hasArg(options::OPT_nostdincxx))
+return;
+
+  DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ);
+
+  // Check if libc++ has been enabled and provide its include paths if so.
+  if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
+const std::string LibCXXIncludePathCandidates[] = {
+// The primary location is within the Clang installation.
+// FIXME: We shouldn't hard code 'v1' here to make Clang future proof 
to
+// newer ABI versions.
+getDriver().Dir + "/../include/c++/v1",
+
+// Try sysroot, e.g., DEFAULT_SYSROOT, if set
+getDriver().SysRoot + "/usr/include/c++/v1",
+
+// libc++ was installed via macports
+"/usr/include/c++/v1",
+
+// libc++ was installed as part of Xcode
+
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
+};
+for (const auto &IncludePath : LibCXXIncludePathCandidates) {
+  if (!llvm::sys::fs::exists(IncludePath))
+continue;
+  // Add the first candidate that exists.
+  addSystemInclude(DriverArgs, CC1Args, IncludePath);
+  break;
+}
+return;
+  }
+}
+
+
 void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
   StringRef DarwinLibName, bool AlwaysLink,
   bool IsEmbedded, bool AddRPath) const {


Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -475,6 +475,9 @@
 
   void AddLinkARCArgs(const llvm::opt::ArgList &Args,
   llvm::opt::ArgStringList &CmdArgs) const override;
+
+  void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const override;
   /// }
 
 private:
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -264,6 +264,43 @@
   CmdArgs.push_back(Args.MakeArgString(P));
 }
 
+void DarwinClang::AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+   llvm::opt::ArgStringList &CC1Args) const {
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+  DriverArgs.hasArg(options::OPT_nostdincxx))
+return;
+
+  DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ);
+
+  // Check if libc++ has been enabled and provide its include paths if so.
+  if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
+const std::string LibCXXIncludePathCandidates[] = {
+// The primary location is within the Clang installation.
+// FIXME: We shouldn't hard code 'v1' here to make Clang future proof to
+// newer ABI versions.
+getDriver().Dir + "/../include/c++/v1",
+
+// Try sysroot, e.g., DEFAULT_SYSROOT, if set
+getDriver().SysRoot + "/usr/include/c++/v1",
+
+// libc++ was installed via macports
+"/usr/include/c++/v1",
+
+// libc++ was installed as part of Xcode
+"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
+};
+for (const auto &IncludePath : LibCXXIncludePathCandidates) {
+  if (!llvm::sys::fs::exists(IncludePath))
+continue;
+  // Add the first

Re: [PATCH] D12644: Using -isysroot on Apple platform

2015-09-04 Thread Steven Wu via cfe-commits
steven_wu updated this revision to Diff 34073.
steven_wu added a comment.

Sorry, made a typo on the previous patch.

A little background information. When the greendragon jenkins make an
system upgrade in the future, it will need this flag as well to build and
test libcxx through cmake/ninja.


http://reviews.llvm.org/D12644

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -209,7 +209,11 @@
 # Target flags 
 add_flags_if(LIBCXX_BUILD_32_BITS -m32)
 add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+if (APPLE)
+  add_flags_if(LIBCXX_SYSROOT "-isysroot ${LIBCXX_SYSROOT}")
+else()
+  add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+endif()
 add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -209,7 +209,11 @@
 # Target flags 
 add_flags_if(LIBCXX_BUILD_32_BITS -m32)
 add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
-add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+if (APPLE)
+  add_flags_if(LIBCXX_SYSROOT "-isysroot ${LIBCXX_SYSROOT}")
+else()
+  add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
+endif()
 add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
 
 # Warning flags ===
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH][www] Mention that libcxx is necessary on OS X

2015-09-04 Thread Yuri Gribov via cfe-commits
On Fri, Sep 4, 2015 at 11:49 PM, Jonathan Roelofs  wrote:

> On 9/4/15 2:45 PM, Yuri Gribov via cfe-commits wrote:
>
>> Hi all,
>>
>> According to https://llvm.org/bugs/show_bug.cgi?id=17821 , when Clang
>> gets built on OS X we need to build it with libcxx and libcxxabi
>> (otherwise tests will fail to link with "can't find iostream". This
>> patch adds a note to getting started page. Ok to apply?
>>
>
> Which tests fail to link for you?
>

Sorry, I'm not at my desk right now. Basically make check-all failed in 5
seconds and after some googling I found the above bug with Bob Wilson's
advice to link libcxx which fixed the issue.

Do you mean that libcxx shouldn't be needed on Mac?

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


Re: [PATCH][www] Mention that libcxx is necessary on OS X

2015-09-04 Thread Jonathan Roelofs via cfe-commits



On 9/4/15 2:55 PM, Yuri Gribov wrote:

On Fri, Sep 4, 2015 at 11:49 PM, Jonathan Roelofs
mailto:jonat...@codesourcery.com>> wrote:

On 9/4/15 2:45 PM, Yuri Gribov via cfe-commits wrote:

Hi all,

According to https://llvm.org/bugs/show_bug.cgi?id=17821 , when
Clang
gets built on OS X we need to build it with libcxx and libcxxabi
(otherwise tests will fail to link with "can't find iostream". This
patch adds a note to getting started page. Ok to apply?


Which tests fail to link for you?


Sorry, I'm not at my desk right now. Basically make check-all failed in
5 seconds and after some googling I found the above bug with Bob
Wilson's advice to link libcxx which fixed the issue.

Do you mean that libcxx shouldn't be needed on Mac?


What I mean is that we should either fix the tests, or describe 
precisely the scenario in which libcxx+libcxxabi is needed because 
it's not always needed. I suspect it's just needed when testing the 
sanitizers (but I might be wrong).



Jon



  -Y


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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a reviewer: alexfh.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with a comment.



Comment at: clang-tidy/modernize/LoopConvertUtils.h:211
@@ -210,3 +210,3 @@
 /// \brief A class to encapsulate lowering of the tool's confidence level.
 class Confidence {
 public:

You're right. I missed that getBegin()/getEnd() return values, not const 
references. Anyway, it's irrelevant now.


Comment at: clang-tidy/modernize/LoopConvertUtils.h:280
@@ -279,1 +279,3 @@
 
+  /// \brief Returns true and adds the Usage if it was not added before.
+  void addUsage(const Usage &U);

The "Returns true" part is wrong now.


http://reviews.llvm.org/D12631



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


Re: [PATCH] D12631: Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 34076.
angelgarcia added a comment.

Wooops, solved.


http://reviews.llvm.org/D12631

Files:
  clang-tidy/modernize/LoopConvertUtils.cpp
  clang-tidy/modernize/LoopConvertUtils.h
  test/clang-tidy/modernize-loop-convert-extra.cpp

Index: test/clang-tidy/modernize-loop-convert-extra.cpp
===
--- test/clang-tidy/modernize-loop-convert-extra.cpp
+++ test/clang-tidy/modernize-loop-convert-extra.cpp
@@ -884,3 +884,32 @@
 }
 
 } // namespace Lambdas
+
+namespace InitLists {
+
+struct D { int i; };
+struct E { D d; };
+int g(int b);
+
+void f() {
+  const unsigned N = 3;
+  int Array[N];
+
+  // Subtrees of InitListExpr are visited twice. Test that we do not do repeated
+  // replacements.
+  for (unsigned i = 0; i < N; ++i) {
+int a{ Array[i] };
+int b{ g(Array[i]) };
+int c{ g( { Array[i] } ) };
+D d{ { g( { Array[i] } ) } };
+E e{ { { g( { Array[i] } ) } } };
+  }
+  // CHECK-MESSAGES: :[[@LINE-7]]:3: warning: use range-based for loop instead
+  // CHECK-FIXES: int a{ elem };
+  // CHECK-FIXES-NEXT: int b{ g(elem) };
+  // CHECK-FIXES-NEXT: int c{ g( { elem } ) };
+  // CHECK-FIXES-NEXT: D d{ { g( { elem } ) } };
+  // CHECK-FIXES-NEXT: E e{ { { g( { elem } ) } } };
+}
+
+} // namespace InitLists
Index: clang-tidy/modernize/LoopConvertUtils.h
===
--- clang-tidy/modernize/LoopConvertUtils.h
+++ clang-tidy/modernize/LoopConvertUtils.h
@@ -277,6 +277,9 @@
   /// \brief Accessor for Usages.
   const UsageResult &getUsages() const { return Usages; }
 
+  /// \brief Adds the Usage if it was not added before.
+  void addUsage(const Usage &U);
+
   /// \brief Get the container indexed by IndexVar, if any.
   const Expr *getContainerIndexed() const { return ContainerExpr; }
 
@@ -336,6 +339,7 @@
   /// A container which holds all usages of IndexVar as the index of
   /// ArraySubscriptExpressions.
   UsageResult Usages;
+  llvm::SmallSet UsageLocations;
   bool OnlyUsedAsIndex;
   /// The DeclStmt for an alias to the container element.
   const DeclStmt *AliasDecl;
Index: clang-tidy/modernize/LoopConvertUtils.cpp
===
--- clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tidy/modernize/LoopConvertUtils.cpp
@@ -460,6 +460,15 @@
   DependentExprs.push_back(std::make_pair(Node, ID));
 }
 
+void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  if (Begin.isMacroID())
+Begin = Context->getSourceManager().getSpellingLoc(Begin);
+
+  if (UsageLocations.insert(Begin).second)
+Usages.push_back(U);
+}
+
 /// \brief If the unary operator is a dereference of IndexVar, include it
 /// as a valid usage and prune the traversal.
 ///
@@ -475,7 +484,7 @@
   // If we dereference an iterator that's actually a pointer, count the
   // occurrence.
   if (isDereferenceOfUop(Uop, IndexVar)) {
-Usages.push_back(Usage(Uop));
+addUsage(Usage(Uop));
 return true;
   }
 
@@ -549,8 +558,8 @@
 // If something complicated is happening (i.e. the next token isn't an
 // arrow), give up on making this work.
 if (!ArrowLoc.isInvalid()) {
-  Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
- SourceRange(Base->getExprLoc(), ArrowLoc)));
+  addUsage(Usage(ResultExpr, /*IsArrow=*/true,
+ SourceRange(Base->getExprLoc(), ArrowLoc)));
   return true;
 }
   }
@@ -579,7 +588,7 @@
 if (isIndexInSubscriptExpr(Context, MemberCall->getArg(0), IndexVar,
Member->getBase(), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(MemberCall));
+  addUsage(Usage(MemberCall));
   return true;
 }
   }
@@ -614,7 +623,7 @@
   switch (OpCall->getOperator()) {
   case OO_Star:
 if (isDereferenceOfOpCall(OpCall, IndexVar)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -625,7 +634,7 @@
 if (isIndexInSubscriptExpr(Context, OpCall->getArg(1), IndexVar,
OpCall->getArg(0), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -674,7 +683,7 @@
   if (!ContainerExpr)
 ContainerExpr = Arr;
 
-  Usages.push_back(Usage(E));
+  addUsage(Usage(E));
   return true;
 }
 
@@ -746,12 +755,12 @@
 bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
const LambdaCapture *C) {
   if (C->capturesVariable()) {
-const VarDecl* VDecl = C->getCapturedVar();
+const VarDecl *VDecl = C->getCapturedVar();
 if (areSameVariable(IndexVar, cast(VDecl))) {
   // FIXME: if the index is captu

Re: [PATCH] D12412: [CodeGen] Point empty %invoke.cont block to successor

2015-09-04 Thread Reid Kleckner via cfe-commits
rnk added a subscriber: rnk.
rnk added a comment.

I think a better fix would be to insert a non-terminator placeholder that 
doesn't confuse EmitBlock.


http://reviews.llvm.org/D12412



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


Re: [PATCH] D11380: Implement LFTS searchers. Boyer_Moore and Boyer_Moore_Horspool

2015-09-04 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM modulo handling C++03. Currently  compiles w/ 
clang in C++03. Please either ensure your portions of the searchers also 
compile in C++03 and change the tests or #ifdef them out before committing.


http://reviews.llvm.org/D11380



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


Re: [PATCH] D12512: [libcxxabi] Manually align pointers in __cxa_allocate_exception - Fixes PR24604

2015-09-04 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In http://reviews.llvm.org/D12512#237175, @joerg wrote:

> Please don't commit this as is. Many platforms have posix_memalign or 
> equivalent, which makes this both simpler and potentially without wasting 
> memory. Compare e.g. http://reviews.llvm.org/D12001.


Will do. Any advice on detecting posix_memalign? I don't see anything in the 
patch you pointed me to.

PS. Thanks for actually rejecting the patch. It makes the phab workflow easier 
to use.


http://reviews.llvm.org/D12512



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


r246877 - Increase accuracy of __builtin_object_size.

2015-09-04 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Fri Sep  4 16:28:13 2015
New Revision: 246877

URL: http://llvm.org/viewvc/llvm-project?rev=246877&view=rev
Log:
Increase accuracy of __builtin_object_size.

Improvements:

- For all types, we would give up in a case such as:
__builtin_object_size((char*)&foo, N);
  even if we could provide an answer to
__builtin_object_size(&foo, N);
  We now provide the same answer for both of the above examples in all
  cases.

- For type=1|3, we now support subobjects with unknown bases, as long
  as the designator is valid.

Thanks to Richard Smith for the review + design planning.

Review: http://reviews.llvm.org/D12169


Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/CodeGen/object-size.c

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=246877&r1=246876&r2=246877&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Sep  4 16:28:13 2015
@@ -492,7 +492,11 @@ namespace {
   /// optimizer if we don't constant fold them here, but in an unevaluated
   /// context we try to fold them immediately since the optimizer never
   /// gets a chance to look at it.
-  EM_PotentialConstantExpressionUnevaluated
+  EM_PotentialConstantExpressionUnevaluated,
+
+  /// Evaluate as a constant expression. Continue evaluating if we find a
+  /// MemberExpr with a base that can't be evaluated.
+  EM_DesignatorFold,
 } EvalMode;
 
 /// Are we checking whether the expression is a potential constant
@@ -595,6 +599,7 @@ namespace {
   case EM_PotentialConstantExpression:
   case EM_ConstantExpressionUnevaluated:
   case EM_PotentialConstantExpressionUnevaluated:
+  case EM_DesignatorFold:
 HasActiveDiagnostic = false;
 return OptionalDiagnostic();
   }
@@ -674,6 +679,7 @@ namespace {
   case EM_ConstantExpression:
   case EM_ConstantExpressionUnevaluated:
   case EM_ConstantFold:
+  case EM_DesignatorFold:
 return false;
   }
   llvm_unreachable("Missed EvalMode case");
@@ -702,10 +708,15 @@ namespace {
   case EM_ConstantExpressionUnevaluated:
   case EM_ConstantFold:
   case EM_IgnoreSideEffects:
+  case EM_DesignatorFold:
 return false;
   }
   llvm_unreachable("Missed EvalMode case");
 }
+
+bool allowInvalidBaseExpr() const {
+  return EvalMode == EM_DesignatorFold;
+}
   };
 
   /// Object used to treat all foldable expressions as constant expressions.
@@ -736,6 +747,21 @@ namespace {
 }
   };
 
+  /// RAII object used to treat the current evaluation as the correct pointer
+  /// offset fold for the current EvalMode
+  struct FoldOffsetRAII {
+EvalInfo &Info;
+EvalInfo::EvaluationMode OldMode;
+explicit FoldOffsetRAII(EvalInfo &Info, bool Subobject)
+: Info(Info), OldMode(Info.EvalMode) {
+  if (!Info.checkingPotentialConstantExpression())
+Info.EvalMode = Subobject ? EvalInfo::EM_DesignatorFold
+  : EvalInfo::EM_ConstantFold;
+}
+
+~FoldOffsetRAII() { Info.EvalMode = OldMode; }
+  };
+
   /// RAII object used to suppress diagnostics and side-effects from a
   /// speculative evaluation.
   class SpeculativeEvaluationRAII {
@@ -917,7 +943,8 @@ namespace {
   struct LValue {
 APValue::LValueBase Base;
 CharUnits Offset;
-unsigned CallIndex;
+bool InvalidBase : 1;
+unsigned CallIndex : 31;
 SubobjectDesignator Designator;
 
 const APValue::LValueBase getLValueBase() const { return Base; }
@@ -938,17 +965,23 @@ namespace {
   assert(V.isLValue());
   Base = V.getLValueBase();
   Offset = V.getLValueOffset();
+  InvalidBase = false;
   CallIndex = V.getLValueCallIndex();
   Designator = SubobjectDesignator(Ctx, V);
 }
 
-void set(APValue::LValueBase B, unsigned I = 0) {
+void set(APValue::LValueBase B, unsigned I = 0, bool BInvalid = false) {
   Base = B;
   Offset = CharUnits::Zero();
+  InvalidBase = BInvalid;
   CallIndex = I;
   Designator = SubobjectDesignator(getType(B));
 }
 
+void setInvalid(APValue::LValueBase B, unsigned I = 0) {
+  set(B, I, true);
+}
+
 // Check that this LValue is not based on a null pointer. If it is, produce
 // a diagnostic and mark the designator as invalid.
 bool checkNullPointer(EvalInfo &Info, const Expr *E,
@@ -4368,20 +4401,23 @@ public:
   bool VisitMemberExpr(const MemberExpr *E) {
 // Handle non-static data members.
 QualType BaseTy;
+bool EvalOK;
 if (E->isArrow()) {
-  if (!EvaluatePointer(E->getBase(), Result, this->Info))
-return false;
+  EvalOK = EvaluatePointer(E->getBase(), Result, this->Info);
   BaseTy = 
E->getBase()->getType()->castAs()->get

Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-09-04 Thread George Burgess IV via cfe-commits
george.burgess.iv closed this revision.
george.burgess.iv marked 2 inline comments as done.
george.burgess.iv added a comment.

r246877. Thanks for the review!

(Also: Forgot to submit comments with the most recent revision, so you're 
getting them all now. Sorry. :) )



Comment at: lib/AST/ExprConstant.cpp:498-502
@@ -499,6 +497,7 @@
 /// expression?
 bool checkingPotentialConstantExpression() const {
   return EvalMode == EM_PotentialConstantExpression ||
- EvalMode == EM_PotentialConstantExpressionUnevaluated;
+ EvalMode == EM_PotentialConstantExpressionUnevaluated ||
+ EvalMode == EM_OffsetFold;
 }
 

rsmith wrote:
> I think you should only have one mode here, and it should not be a "checking 
> potential constant expression" mode. (Then, if evaluation of a 
> `__builtin_object_size` call fails from a "checking potential constant 
> expression" mode, we should treat it as a potential success -- that is, 
> return false with no diagnostic.)
> 
> It looks like the only place this would go wrong is the assertion in 
> `CheckLValueConstantExpression`, but you can update that assertion to also 
> allow this one case.
Migrated to EM_ConstantFold (if Type=0|2) or EM_ConstantExpressionConstantFold 
(if Type=1|3)


Comment at: lib/AST/ExprConstant.cpp:866
@@ +865,3 @@
+Entries.back().ArrayIndex += N;
+if (!Info.allowOutOfBoundsIndices() &&
+Entries.back().ArrayIndex > MostDerivedArraySize) {

rsmith wrote:
> I'm not convinced this is a good idea. There are two cases:
> 
> 1) We're looking for the complete object (type is 0 or 2). We don't need this 
> change: the right thing to do is discard the subobject designator and just 
> track the offset, which is what we'd do anyway and all we need.
> 
> 2) We're looking for the specified subobject (type is 1 or 3). This change 
> seems wrong: we no longer know which the specified subobject is, because the 
> code computed an offset that left the subobject we thought we were in.
SGTM. Backed it out.


Comment at: lib/AST/ExprConstant.cpp:4626-4632
@@ -4625,9 +4752,7 @@
 bool LValueExprEvaluator::VisitMemberExpr(const MemberExpr *E) {
-  // Handle static data members.
   if (const VarDecl *VD = dyn_cast(E->getMemberDecl())) {
 VisitIgnoredValue(E->getBase());
 return VisitVarDecl(E, VD);
   }
 
-  // Handle static member functions.
   if (const CXXMethodDecl *MD = dyn_cast(E->getMemberDecl())) {

rsmith wrote:
> Why do you hate comments? :)
They were far too concise and up-to-date for my taste.


Comment at: lib/AST/ExprConstant.cpp:4879-4913
@@ -4753,31 +4878,37 @@
 
   bool Success(const APValue &V, const Expr *E) {
 Result.setFrom(Info.Ctx, V);
 return true;
   }
+
+  bool InvalidBase(const APValue &V, const Expr *E) {
+Result.setInvalid(E);
+return true;
+  }
+
   bool ZeroInitialization(const Expr *E) {
 return Success((Expr*)nullptr);
   }
 
   bool VisitBinaryOperator(const BinaryOperator *E);
   bool VisitCastExpr(const CastExpr* E);
   bool VisitUnaryAddrOf(const UnaryOperator *E);
   bool VisitObjCStringLiteral(const ObjCStringLiteral *E)
   { return Success(E); }
   bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E)
-  { return Success(E); }
+  { return Success(E); }
   bool VisitAddrLabelExpr(const AddrLabelExpr *E)
   { return Success(E); }
   bool VisitCallExpr(const CallExpr *E);
   bool VisitBlockExpr(const BlockExpr *E) {
 if (!E->getBlockDecl()->hasCaptures())
   return Success(E);
 return Error(E);
   }
   bool VisitCXXThisExpr(const CXXThisExpr *E) {
 // Can't look at 'this' when checking a potential constant expression.
 if (Info.checkingPotentialConstantExpression())
   return false;
 if (!Info.CurrentCall->This) {
   if (Info.getLangOpts().CPlusPlus11)
 Info.Diag(E, diag::note_constexpr_this) << E->isImplicit();

> Why? This seems like a pretty canonical example of "we do not know which 
> subobject is being referenced any more", and thus we should give up for types 
> 1 and 3 here.

SGTM.

> That certainly seems like a bug...

Discussed in person. Was a misunderstanding on my part.


Comment at: lib/AST/ExprConstant.cpp:6299
@@ -6167,3 +6298,3 @@
 /// as used by __builtin_object_size.
-static QualType getObjectType(APValue::LValueBase B) {
+static QualType GetObjectType(APValue::LValueBase B) {
   if (const ValueDecl *D = B.dyn_cast()) {

rsmith wrote:
> Lowercase first letter for function names is preferred in new code.
Thanks for the heads-up :)


Comment at: lib/AST/ExprConstant.cpp:6331-6336
@@ -6200,8 +6330,8 @@
 
   // MostDerivedType is null if we're dealing with a literal such as nullptr or
   // (char*)0x10. Lower it to LLVM in either case so it can figure out what
   // to do with it.
   // FIXME(gbiv): Try to

[clang-tools-extra] r246879 - Avoid repeated replacements on loop-convert check.

2015-09-04 Thread Angel Garcia Gomez via cfe-commits
Author: angelgarcia
Date: Fri Sep  4 16:37:05 2015
New Revision: 246879

URL: http://llvm.org/viewvc/llvm-project?rev=246879&view=rev
Log:
Avoid repeated replacements on loop-convert check.

Summary: The InitListExpr subtree is visited twice, this caused the check to do 
multiple replacements. Added a set to avoid it.

Reviewers: klimek, alexfh

Subscribers: cfe-commits, alexfh

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

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.h
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp?rev=246879&r1=246878&r2=246879&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp Fri Sep  
4 16:37:05 2015
@@ -460,6 +460,15 @@ void ForLoopIndexUseVisitor::addComponen
   DependentExprs.push_back(std::make_pair(Node, ID));
 }
 
+void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  if (Begin.isMacroID())
+Begin = Context->getSourceManager().getSpellingLoc(Begin);
+
+  if (UsageLocations.insert(Begin).second)
+Usages.push_back(U);
+}
+
 /// \brief If the unary operator is a dereference of IndexVar, include it
 /// as a valid usage and prune the traversal.
 ///
@@ -475,7 +484,7 @@ bool ForLoopIndexUseVisitor::TraverseUna
   // If we dereference an iterator that's actually a pointer, count the
   // occurrence.
   if (isDereferenceOfUop(Uop, IndexVar)) {
-Usages.push_back(Usage(Uop));
+addUsage(Usage(Uop));
 return true;
   }
 
@@ -549,8 +558,8 @@ bool ForLoopIndexUseVisitor::TraverseMem
 // If something complicated is happening (i.e. the next token isn't an
 // arrow), give up on making this work.
 if (!ArrowLoc.isInvalid()) {
-  Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
- SourceRange(Base->getExprLoc(), ArrowLoc)));
+  addUsage(Usage(ResultExpr, /*IsArrow=*/true,
+ SourceRange(Base->getExprLoc(), ArrowLoc)));
   return true;
 }
   }
@@ -579,7 +588,7 @@ bool ForLoopIndexUseVisitor::TraverseCXX
 if (isIndexInSubscriptExpr(Context, MemberCall->getArg(0), IndexVar,
Member->getBase(), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(MemberCall));
+  addUsage(Usage(MemberCall));
   return true;
 }
   }
@@ -614,7 +623,7 @@ bool ForLoopIndexUseVisitor::TraverseCXX
   switch (OpCall->getOperator()) {
   case OO_Star:
 if (isDereferenceOfOpCall(OpCall, IndexVar)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -625,7 +634,7 @@ bool ForLoopIndexUseVisitor::TraverseCXX
 if (isIndexInSubscriptExpr(Context, OpCall->getArg(1), IndexVar,
OpCall->getArg(0), ContainerExpr,
ContainerNeedsDereference)) {
-  Usages.push_back(Usage(OpCall));
+  addUsage(Usage(OpCall));
   return true;
 }
 break;
@@ -674,7 +683,7 @@ bool ForLoopIndexUseVisitor::TraverseArr
   if (!ContainerExpr)
 ContainerExpr = Arr;
 
-  Usages.push_back(Usage(E));
+  addUsage(Usage(E));
   return true;
 }
 
@@ -746,12 +755,12 @@ bool ForLoopIndexUseVisitor::VisitDeclRe
 bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
const LambdaCapture *C) {
   if (C->capturesVariable()) {
-const VarDecl* VDecl = C->getCapturedVar();
+const VarDecl *VDecl = C->getCapturedVar();
 if (areSameVariable(IndexVar, cast(VDecl))) {
   // FIXME: if the index is captured, it will count as an usage and the
   // alias (if any) won't work, because it is only used in case of having
   // exactly one usage.
-  Usages.push_back(Usage(nullptr, false, C->getLocation()));
+  addUsage(Usage(nullptr, false, C->getLocation()));
 }
   }
   return VisitorBase::TraverseLambdaCapture(LE, C);

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.h?rev=246879&r1=246878&r2=246879&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.h Fri Sep  4 
16:37:05 2015
@@ -277,6 +277,9 @@ public:
   /// \brief Accessor for Usages.
   const UsageResult &getUsages() const {

r246880 - Don't use unreachable as a placeholder, it confuses EmitBlock

2015-09-04 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Fri Sep  4 16:39:15 2015
New Revision: 246880

URL: http://llvm.org/viewvc/llvm-project?rev=246880&view=rev
Log:
Don't use unreachable as a placeholder, it confuses EmitBlock

This fixes an issue raised in D12412, where we generated invalid IR.

Thanks to Vedant Kumar for coming up with the initial work around.

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

Added:
cfe/trunk/test/CodeGenCXX/partial-init.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=246880&r1=246879&r2=246880&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Sep  4 16:39:15 2015
@@ -1253,7 +1253,9 @@ void AggExprEmitter::VisitInitListExpr(I
   assert(LV.isSimple());
   if (CGF.needsEHCleanup(dtorKind)) {
 if (!cleanupDominator)
-  cleanupDominator = CGF.Builder.CreateUnreachable(); // placeholder
+  cleanupDominator = CGF.Builder.CreateLoad(
+  CGF.Int8Ty,
+  llvm::Constant::getNullValue(CGF.Int8PtrTy)); // placeholder
 
 CGF.pushDestroy(EHCleanup, LV.getAddress(), field->getType(),
 CGF.getDestroyer(dtorKind), false);

Added: cfe/trunk/test/CodeGenCXX/partial-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/partial-init.cpp?rev=246880&view=auto
==
--- cfe/trunk/test/CodeGenCXX/partial-init.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/partial-init.cpp Fri Sep  4 16:39:15 2015
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -std=c++11 
-fcxx-exceptions -fexceptions -S -emit-llvm -o - %s | FileCheck %s
+
+namespace std {
+  struct string {
+const char *p;
+string(const char *s);
+~string();
+  };
+}
+
+struct Bar {
+  int a;
+};
+
+struct Foo {
+  std::string c;
+  Bar d[32];
+};
+
+static Foo table[] = {
+  { "blerg" },
+};
+
+// CHECK: define internal void @__cxx_global_var_init
+// CHECK: invoke void @_ZNSt6stringC1EPKc(
+// CHECK-NOT: unreachable
+// CHECK: br label


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


Re: [PATCH] D12508: [libcxx] Make it drastically simpler to link libc++.

2015-09-04 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: utils/gen_link_script/gen_link_script.py:1
@@ +1,2 @@
+#!/usr/bin/env python
+import os

jroelofs wrote:
> Do you foresee these linker scripts being significantly more complicated for 
> other platforms? ISTM that it would be much simpler to have CMake generate 
> these directly.
The linker scripts will get no more complicated. The will always just be 
`INPUT(libc++.so.x.x -l)`. However generating these in CMake is a pain. 
I've tried before and I promise the python approach is a lot cleaner. 

The main reason is that most CMake functions such as `FILE(...)` and 
`CONFIG_FILE(...)` are run at CMake configuration time and they don't allow 
generator expressions in them. I also don't know how to read the value of a 
symlink using CMake which is needed to generate the linker script.

If you really want me to rewrite this is CMake I will, but I promise that you 
probably don't.


http://reviews.llvm.org/D12508



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


Re: [PATCH] D12412: [CodeGen] Point empty %invoke.cont block to successor

2015-09-04 Thread Reid Kleckner via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL246880: Don't use unreachable as a placeholder, it confuses 
EmitBlock (authored by rnk).

Changed prior to commit:
  http://reviews.llvm.org/D12412?vs=33347&id=34080#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12412

Files:
  cfe/trunk/lib/CodeGen/CGExprAgg.cpp
  cfe/trunk/test/CodeGenCXX/partial-init.cpp

Index: cfe/trunk/test/CodeGenCXX/partial-init.cpp
===
--- cfe/trunk/test/CodeGenCXX/partial-init.cpp
+++ cfe/trunk/test/CodeGenCXX/partial-init.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -std=c++11 
-fcxx-exceptions -fexceptions -S -emit-llvm -o - %s | FileCheck %s
+
+namespace std {
+  struct string {
+const char *p;
+string(const char *s);
+~string();
+  };
+}
+
+struct Bar {
+  int a;
+};
+
+struct Foo {
+  std::string c;
+  Bar d[32];
+};
+
+static Foo table[] = {
+  { "blerg" },
+};
+
+// CHECK: define internal void @__cxx_global_var_init
+// CHECK: invoke void @_ZNSt6stringC1EPKc(
+// CHECK-NOT: unreachable
+// CHECK: br label
Index: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
===
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp
@@ -1253,7 +1253,9 @@
   assert(LV.isSimple());
   if (CGF.needsEHCleanup(dtorKind)) {
 if (!cleanupDominator)
-  cleanupDominator = CGF.Builder.CreateUnreachable(); // placeholder
+  cleanupDominator = CGF.Builder.CreateLoad(
+  CGF.Int8Ty,
+  llvm::Constant::getNullValue(CGF.Int8PtrTy)); // placeholder
 
 CGF.pushDestroy(EHCleanup, LV.getAddress(), field->getType(),
 CGF.getDestroyer(dtorKind), false);


Index: cfe/trunk/test/CodeGenCXX/partial-init.cpp
===
--- cfe/trunk/test/CodeGenCXX/partial-init.cpp
+++ cfe/trunk/test/CodeGenCXX/partial-init.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -std=c++11 -fcxx-exceptions -fexceptions -S -emit-llvm -o - %s | FileCheck %s
+
+namespace std {
+  struct string {
+const char *p;
+string(const char *s);
+~string();
+  };
+}
+
+struct Bar {
+  int a;
+};
+
+struct Foo {
+  std::string c;
+  Bar d[32];
+};
+
+static Foo table[] = {
+  { "blerg" },
+};
+
+// CHECK: define internal void @__cxx_global_var_init
+// CHECK: invoke void @_ZNSt6stringC1EPKc(
+// CHECK-NOT: unreachable
+// CHECK: br label
Index: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
===
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp
@@ -1253,7 +1253,9 @@
   assert(LV.isSimple());
   if (CGF.needsEHCleanup(dtorKind)) {
 if (!cleanupDominator)
-  cleanupDominator = CGF.Builder.CreateUnreachable(); // placeholder
+  cleanupDominator = CGF.Builder.CreateLoad(
+  CGF.Int8Ty,
+  llvm::Constant::getNullValue(CGF.Int8PtrTy)); // placeholder
 
 CGF.pushDestroy(EHCleanup, LV.getAddress(), field->getType(),
 CGF.getDestroyer(dtorKind), false);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12462: [PATCH] [clang-tidy] Add inconsistent declaration parameter name check

2015-09-04 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Sorry for the long delay.

This version looks significantly better. Thank you for the updates!



Comment at: 
clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp:1
@@ +1,2 @@
+//===--- InconsistentDeclarationParameterNameCheck.cpp -
+//clang-tidy---===//

Seems like clang-format (or something else) broke this comment.


Comment at: 
clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp:17
@@ +16,3 @@
+
+using namespace clang::ast_matchers;
+

nit: If you move this below `namespace clang {`, you can omit the `clang::` 
part.


Comment at: 
clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp:38
@@ +37,3 @@
+  DifferingParamInfo(int Number,
+ llvm::StringRef MainName,
+ llvm::StringRef OtherName,

I think, `llvm::` is not needed here, as `StringRef` should also be declared in 
namespace clang. 


Comment at: 
clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp:86
@@ +85,3 @@
+
+  // FIXME: provide a way to extract commented out parameter name from 
comment
+  if (!MainParamName.empty() &&

Please use proper Capitalization and punctuation. 
http://llvm.org/docs/CodingStandards.html#commenting

Same in other comments.


Comment at: 
clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp:180
@@ +179,3 @@
+for (const DifferingParamInfo &ParamInfo : 
InconsistentDeclaration.DifferingParams) {
+  auto ParamDiag = diag(ParamInfo.OtherNameRange.getBegin(),
+   "parameter %0 is named '%1' here, but '%2' in compared declaration",

That can quickly become extremely chatty. Maybe cramp two lists of names in a 
single message? Something along the lines of: "parameter names here: (a, b, c, 
d), in the other declaration: (q, u, x)"


Comment at: 
clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h:24
@@ +23,3 @@
+///
+/// Detailed documentation is provided in HTML files, see:
+/// 
http://clang.llvm.org/extra/clang-tidy/checks/readability-inconsistent-declaration-parameter-name.html

nit: I'd say "For detailed documentation see:"


http://reviews.llvm.org/D12462



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


Re: [PATCH] D12508: [libcxx] Make it drastically simpler to link libc++.

2015-09-04 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

I trust your judgement.


http://reviews.llvm.org/D12508



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


r246881 - Fix crash on invalid if we can't find a suitable PCH file in a specified

2015-09-04 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Sep  4 16:44:32 2015
New Revision: 246881

URL: http://llvm.org/viewvc/llvm-project?rev=246881&view=rev
Log:
Fix crash on invalid if we can't find a suitable PCH file in a specified
directory, and our frontend action cares whether the frontend setup actually
succeeded.

Modified:
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/test/PCH/pch-dir.c

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=246881&r1=246880&r2=246881&view=diff
==
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Fri Sep  4 16:44:32 2015
@@ -284,7 +284,7 @@ bool FrontendAction::BeginSourceFile(Com
 
   if (!Found) {
 CI.getDiagnostics().Report(diag::err_fe_no_pch_in_dir) << PCHInclude;
-return true;
+goto failure;
   }
 }
   }

Modified: cfe/trunk/test/PCH/pch-dir.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/pch-dir.c?rev=246881&r1=246880&r2=246881&view=diff
==
--- cfe/trunk/test/PCH/pch-dir.c (original)
+++ cfe/trunk/test/PCH/pch-dir.c Fri Sep  4 16:44:32 2015
@@ -1,4 +1,6 @@
+// RUN: rm -rf %t.h.gch
 // RUN: mkdir -p %t.h.gch
+//
 // RUN: %clang -x c-header %S/pch-dir.h -DFOO=foo -o %t.h.gch/c.gch 
 // RUN: %clang -x c-header %S/pch-dir.h -DFOO=bar -o %t.h.gch/cbar.gch 
 // RUN: %clang -x c++-header -std=c++98 %S/pch-dir.h -o %t.h.gch/cpp.gch 
@@ -10,7 +12,11 @@
 // RUN: FileCheck -check-prefix=CHECK-CPP %s < %t.cpplog
 
 // RUN: not %clang -x c++ -std=c++11 -include %t.h -fsyntax-only %s 2> 
%t.cpp11log
-// RUN: FileCheck -check-prefix=CHECK-CPP11 %s < %t.cpp11log
+// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.cpp11log
+
+// Don't crash if the precompiled header file is missing.
+// RUN: not %clang_cc1 -include-pch %t.h.gch -DFOO=baz -fsyntax-only %s 
-print-stats 2> %t.missinglog
+// RUN: FileCheck -check-prefix=CHECK-NO-SUITABLE %s < %t.missinglog
 
 // CHECK-CBAR: int bar
 int FOO;
@@ -25,4 +31,4 @@ int get() {
 #endif
 }
 
-// CHECK-CPP11: no suitable precompiled header file found in directory
+// CHECK-NO-SUITABLE: no suitable precompiled header file found in directory


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


r246882 - Don't crash on a self-alias declaration

2015-09-04 Thread Hal Finkel via cfe-commits
Author: hfinkel
Date: Fri Sep  4 16:49:21 2015
New Revision: 246882

URL: http://llvm.org/viewvc/llvm-project?rev=246882&view=rev
Log:
Don't crash on a self-alias declaration

We were crashing in CodeGen given input like this:

  int self_alias(void) __attribute__((weak, alias("self_alias")));

such a self-alias is invalid, but instead of diagnosing the situation, we'd
proceed to produce IR for both the function declaration and the alias. Because
we already had a function named 'self_alias', the alias could not be named the
same thing, and so LLVM would pick a different name ('self_alias1' for example)
for that value. When we later called CodeGenModule::checkAliases, we'd look up
the IR value corresponding to the alias name, find the function declaration
instead, and then assert in a cast to llvm::GlobalAlias. The easiest way to 
prevent
this is simply to avoid creating the wrongly-named alias value in the first
place and issue the diagnostic there (instead of in checkAliases). We detect a
related cycle case in CodeGenModule::EmitAliasDefinition already, so this just
adds a second such check.

Even though the other test cases for this 'alias definition is part of a cycle'
diagnostic are in test/Sema/attr-alias-elf.c, I've added a separate regression
test for this case. This is because I can't add this check to
test/Sema/attr-alias-elf.c without disturbing the other test cases in that
file. In order to avoid construction of the bad IR values, this diagnostic
is emitted from within CodeGenModule::EmitAliasDefinition (and the relevant
declaration is not added to the Aliases vector). The other cycle checks are
done within the CodeGenModule::checkAliases function based on the Aliases
vector, called from CodeGenModule::Release.  However, if there have been errors
earlier, HandleTranslationUnit does not call Release, and so checkAliases is
never called, and so none of the other diagnostics would be produced.

Fixes PR23509.

Added:
cfe/trunk/test/Sema/attr-self-alias.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=246882&r1=246881&r2=246882&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Sep  4 16:49:21 2015
@@ -2613,6 +2613,11 @@ void CodeGenModule::EmitAliasDefinition(
 
   StringRef MangledName = getMangledName(GD);
 
+  if (AA->getAliasee() == MangledName) {
+Diags.Report(AA->getLocation(), diag::err_cyclic_alias);
+return;
+  }
+
   // If there is a definition in the module, then it wins over the alias.
   // This is dubious, but allow it to be safe.  Just ignore the alias.
   llvm::GlobalValue *Entry = GetGlobalValue(MangledName);

Added: cfe/trunk/test/Sema/attr-self-alias.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-self-alias.c?rev=246882&view=auto
==
--- cfe/trunk/test/Sema/attr-self-alias.c (added)
+++ cfe/trunk/test/Sema/attr-self-alias.c Fri Sep  4 16:49:21 2015
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux  -fsyntax-only -verify 
-emit-llvm-only %s
+
+int self_alias(void) __attribute__((weak, alias("self_alias"))); // 
expected-error {{alias definition is part of a cycle}}
+


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


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-04 Thread Ismail Pazarbasi via cfe-commits
ismailp updated this revision to Diff 34082.
ismailp added a comment.

- Rolled back to the first version of patch, where only parameter `Out` is 
renamed to `OutStream`
- Use a different test that doesn't trigger the self-loop assertion.


http://reviews.llvm.org/D12119

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/free.c

Index: test/Analysis/free.c
===
--- test/Analysis/free.c
+++ test/Analysis/free.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -analyzer-viz-egraph-ubigraph 
-verify %s
 // RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -verify -analyzer-config 
unix.Malloc:Optimistic=true %s
 typedef __typeof(sizeof(int)) size_t;
 void free(void *);
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -778,8 +778,9 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"


Index: test/Analysis/free.c
===
--- test/Analysis/free.c
+++ test/Analysis/free.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -analyzer-viz-egraph-ubigraph -verify %s
 // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify -analyzer-config unix.Malloc:Optimistic=true %s
 typedef __typeof(sizeof(int)) size_t;
 void free(void *);
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -778,8 +778,9 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-04 Thread Ismail Pazarbasi via cfe-commits
ismailp added a comment.

Thank you for the feedback! I have added the test in a C file, so we can get 
the first part of the patch in -- between lines 778-780.

I think self-loop is a different problem, and that requires its own patch. I'll 
see what I can do about self-loop, if someone else isn't working on it.


http://reviews.llvm.org/D12119



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


Re: [PATCH][www] Mention that libcxx is necessary on OS X

2015-09-04 Thread Yuri Gribov via cfe-commits
Oh, nice so this was actually done by Kuba to fix sanitizer unittests:

  "echo '#include ' | ${COMPILER_RT_TEST_COMPILER} -E -x c++
- > /dev/null"
  "if [ $? != 0 ] "
  "  then echo"
  "  echo 'Your just-built clang cannot find C++ headers, which are
needed to build and run compiler-rt tests.'"
  "  echo 'You should copy or symlink your system C++ headers into
${LLVM_BINARY_DIR}/include/c++'"
  "  if [ -d $(dirname $(dirname $(xcrun -f clang)))/include/c++ ]"
  "then echo 'e.g. with:'"
  "echo '  cp -r' $(dirname $(dirname $(xcrun -f
clang)))/include/c++ '${LLVM_BINARY_DIR}/include/'"
  "  elif [ -d $(dirname $(dirname $(xcrun -f clang)))/lib/c++ ]"
  "then echo 'e.g. with:'"
  "echo '  cp -r' $(dirname $(dirname $(xcrun -f clang)))/lib/c++
'${LLVM_BINARY_DIR}/include/'"
  "  fi"
  "  echo 'This can also be fixed by checking out the libcxx project
from llvm.org and installing the headers'"
  "  echo 'into your build directory:'"
  "  echo '  cd ${LLVM_SOURCE_DIR}/projects && svn co
http://llvm.org/svn/llvm-project/libcxx/trunk libcxx'"
  "  echo '  cd ${LLVM_BINARY_DIR} && make -C
${LLVM_SOURCE_DIR}/projects/libcxx installheaders
HEADER_DIR=${LLVM_BINARY_DIR}/include'"
  "  echo"
  "  false"
  "fi"

What I mean is that we should either fix the tests, or describe precisely
> the scenario in which libcxx+libcxxabi is needed because it's not
> always needed. I suspect it's just needed when testing the sanitizers (but
> I might be wrong).
>

What if I s/mandatory on OS X, optional otherwise/required to run tests on
OS X/ ?

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


r246889 - Relax partial-init test case for ARM

2015-09-04 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Fri Sep  4 17:32:51 2015
New Revision: 246889

URL: http://llvm.org/viewvc/llvm-project?rev=246889&view=rev
Log:
Relax partial-init test case for ARM

Modified:
cfe/trunk/test/CodeGenCXX/partial-init.cpp

Modified: cfe/trunk/test/CodeGenCXX/partial-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/partial-init.cpp?rev=246889&r1=246888&r2=246889&view=diff
==
--- cfe/trunk/test/CodeGenCXX/partial-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/partial-init.cpp Fri Sep  4 17:32:51 2015
@@ -22,6 +22,6 @@ static Foo table[] = {
 };
 
 // CHECK: define internal void @__cxx_global_var_init
-// CHECK: invoke void @_ZNSt6stringC1EPKc(
+// CHECK: invoke {{.*}} @_ZNSt6stringC1EPKc(
 // CHECK-NOT: unreachable
 // CHECK: br label


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


r246890 - Fix a bug in __builtin_object_size cast removal

2015-09-04 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Fri Sep  4 17:36:18 2015
New Revision: 246890

URL: http://llvm.org/viewvc/llvm-project?rev=246890&view=rev
Log:
Fix a bug in __builtin_object_size cast removal

Apparently there are many cast kinds that may cause implicit pointer
arithmetic to happen. In light of this, the cast ignoring logic
introduced in r246877 has been changed to only ignore a small set of
cast kinds, and a test for this behavior has been added.

Thanks to Richard for catching this before it became a bug report. :)


Added:
cfe/trunk/test/CodeGen/object-size.cpp
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=246890&r1=246889&r2=246890&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Sep  4 17:36:18 2015
@@ -6249,8 +6249,8 @@ static QualType getObjectType(APValue::L
 }
 
 /// A more selective version of E->IgnoreParenCasts for
-/// TryEvaluateBuiltinObjectSize. This ignores casts/parens that serve only to
-/// change the type of E.
+/// TryEvaluateBuiltinObjectSize. This ignores some casts/parens that serve 
only
+/// to change the type of E.
 /// Ex. For E = `(short*)((char*)(&foo))`, returns `&foo`
 ///
 /// Always returns an RValue with a pointer representation.
@@ -6259,7 +6259,14 @@ static const Expr *ignorePointerCastsAnd
 
   auto *NoParens = E->IgnoreParens();
   auto *Cast = dyn_cast(NoParens);
-  if (Cast == nullptr || Cast->getCastKind() == CK_DerivedToBase)
+  if (Cast == nullptr)
+return NoParens;
+
+  // We only conservatively allow a few kinds of casts, because this code is
+  // inherently a simple solution that seeks to support the common case.
+  auto CastKind = Cast->getCastKind();
+  if (CastKind != CK_NoOp && CastKind != CK_BitCast &&
+  CastKind != CK_AddressSpaceConversion)
 return NoParens;
 
   auto *SubExpr = Cast->getSubExpr();

Added: cfe/trunk/test/CodeGen/object-size.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/object-size.cpp?rev=246890&view=auto
==
--- cfe/trunk/test/CodeGen/object-size.cpp (added)
+++ cfe/trunk/test/CodeGen/object-size.cpp Fri Sep  4 17:36:18 2015
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck 
%s
+
+// C++-specific tests for __builtin_object_size
+
+int gi;
+
+// CHECK-LABEL: define void @_Z5test1v()
+void test1() {
+  // Guaranteeing that our cast removal logic doesn't break more interesting
+  // cases.
+  struct A { int a; };
+  struct B { int b; };
+  struct C: public A, public B {};
+
+  C c;
+
+  // CHECK: store i32 8
+  gi = __builtin_object_size(&c, 0);
+  // CHECK: store i32 8
+  gi = __builtin_object_size((A*)&c, 0);
+  // CHECK: store i32 4
+  gi = __builtin_object_size((B*)&c, 0);
+
+  // CHECK: store i32 8
+  gi = __builtin_object_size((char*)&c, 0);
+  // CHECK: store i32 8
+  gi = __builtin_object_size((char*)(A*)&c, 0);
+  // CHECK: store i32 4
+  gi = __builtin_object_size((char*)(B*)&c, 0);
+}


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


[PATCH] D12652: [Static Analyzer] Lambda support.

2015-09-04 Thread Gábor Horváth via cfe-commits
xazax.hun created this revision.
xazax.hun added reviewers: dcoughlin, zaks.anna, jordan_rose, ted.
xazax.hun added a subscriber: cfe-commits.

This patch adds lambda support for the static analyzer.
All of my initial tests are passed.

Before this patch each time a LambdaExpr was encountered a sink node was 
generated. This also reduced the coverage of code that is actually not inside a 
lambda operator(). Also the lack of lambda support is a known cause of some 
false positives (for example in the dead store checker).

This is a work in progress version of this patch, I will move this feature 
behind a flag and run it on LLVM to make sure it is also tested with real world 
code.


http://reviews.llvm.org/D12652

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  lib/StaticAnalyzer/Core/MemRegion.cpp
  test/Analysis/dead-stores.cpp
  test/Analysis/lambdas.cpp
  test/Analysis/temporaries.cpp

Index: test/Analysis/temporaries.cpp
===
--- test/Analysis/temporaries.cpp
+++ test/Analysis/temporaries.cpp
@@ -299,13 +299,7 @@
   void testRecursiveFramesStart() { testRecursiveFrames(false); }
 
   void testLambdas() {
-// This is the test we would like to write:
-// []() { check(NoReturnDtor()); } != nullptr || check(Dtor());
-// But currently the analyzer stops when it encounters a lambda:
-[] {};
-// The CFG for this now looks correct, but we still do not reach the line
-// below.
-clang_analyzer_warnIfReached(); // FIXME: Should warn.
+[]() { check(NoReturnDtor()); } != nullptr || check(Dtor());
   }
 
   void testGnuExpressionStatements(int v) {
Index: test/Analysis/lambdas.cpp
===
--- test/Analysis/lambdas.cpp
+++ test/Analysis/lambdas.cpp
@@ -1,9 +1,142 @@
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze -analyzer-checker=debug.DumpCFG %s > %t 2>&1
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze -analyzer-checker=core,debug.ExprInspection -verify %s 
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze -analyzer-checker=core,debug.DumpCFG %s > %t 2>&1
 // RUN: FileCheck --input-file=%t %s
 
+void clang_analyzer_warnIfReached();
+void clang_analyzer_eval(int);
+
 struct X { X(const X&); };
 void f(X x) { (void) [x]{}; }
 
+
+// Lambda semantics tests.
+
+void basicCapture() {
+  int i = 5;
+  [i]() mutable {
+// clang_analyzer_eval does nothing in inlined functions.
+if (i != 5)
+  clang_analyzer_warnIfReached();
+++i;
+  }();
+  [&i] {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+  }();
+  [&i] {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+i++;
+  }();
+  clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
+}
+
+void deferredLambdaCall() {
+  int i = 5;
+  auto l1 = [i]() mutable {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+++i;
+  };
+  auto l2 = [&i] {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+  };
+  auto l3 = [&i] {
+if (i != 5)
+  clang_analyzer_warnIfReached();
+i++;
+  };
+  l1();
+  l2();
+  l3();
+  clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
+}
+
+void multipleCaptures() {
+  int i = 5, j = 5;
+  [i, &j]() mutable {
+if (i != 5 && j != 5)
+  clang_analyzer_warnIfReached();
+++i;
+++j;
+  }();
+  clang_analyzer_eval(i == 5); // expected-warning{{TRUE}}
+  clang_analyzer_eval(j == 6); // expected-warning{{TRUE}}
+  [=]() mutable {
+if (i != 5 && j != 6)
+  clang_analyzer_warnIfReached();
+++i;
+++j;
+  }();
+  clang_analyzer_eval(i == 5); // expected-warning{{TRUE}}
+  clang_analyzer_eval(j == 6); // expected-warning{{TRUE}}
+  [&]() mutable {
+if (i != 5 && j != 6)
+  clang_analyzer_warnIfReached();
+++i;
+++j;
+  }();
+  clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
+  clang_analyzer_eval(j == 7); // expected-warning{{TRUE}}
+}
+
+void testReturnValue() {
+  int i = 5;
+  auto l = [i] (int a) {
+return i + a;
+  };
+  int b = l(3);
+  clang_analyzer_eval(b == 8); // expected-warning{{TRUE}}
+}
+
+// Nested lambdas.
+
+void testNestedLambdas() {
+  int i = 5;
+  auto l = [i]() mutable {
+[&i]() {
+  ++i;
+}();
+if (i != 6)
+  clang_analyzer_warnIfReached();
+  };
+  l();
+  clang_analyzer_eval(i == 5); // expected-warning{{TRUE}}
+}
+
+// Captured this.
+
+class RandomClass {
+  int i;
+
+  void captureFields() {
+i = 5;
+[this]() {
+  // clang_analyzer_eval does nothing in inlined functions.
+  if (i != 5)
+clang_analyzer_warnIfReached();
+  ++i;
+}();
+clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
+  }
+};
+
+// Captured function pointers.
+
+void inc(int &x) {
+  ++x;
+}
+
+void testFunctionPointerCapture() {
+  void (*func)(int &) = inc;
+  int i = 5;
+  [&i, func] {
+func(i);
+  }();

Re: r245036 - Add structed way to express command line options in the compilation database.

2015-09-04 Thread Hans Wennborg via cfe-commits
On Fri, Aug 14, 2015 at 2:55 AM, Manuel Klimek via cfe-commits
 wrote:
> Author: klimek
> Date: Fri Aug 14 04:55:36 2015
> New Revision: 245036
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245036&view=rev
> Log:
> Add structed way to express command line options in the compilation database.
>
> Currently, arguments are passed via the string attribute 'command',
> assuming a shell-escaped / quoted command line to extract the original
> arguments. This works well enough on Unix systems, but turns out to be
> problematic for Windows tools to generate.
>
> This CL adds a new attribute 'arguments', an array of strings, which
> specifies the exact command line arguments. If 'arguments' is available
> in the compilation database, it is preferred to 'commands'.
>
> Currently there is no plan to retire 'commands': there are enough
> different use cases where users want to create their own mechanism for
> creating compilation databases, that it doesn't make sense to force them
> all to implement shell command line parsing.
>
> Patch by Daniel Dilts.

This seems to have caused a bad performance regression for a tool we
use in Chromium. On the file I tried, run-time went from 0.4 s to 3.0
s (7.5x slow-down), and peak memory usage from 42 MB to 366 MB (8.7x).

I suspect what's happened is that JSONCompilationDatabase::parse()
became significantly slower because it's now calling
unescapeCommandLine() and allocating a std::vector on each "command"
field during parsing, whereas previously the code wouldn't do that
until JSONCompilationDatabase::getCommands() was called on a specific
file or set of files.

One idea for fixing this would be to make the second part of
CompileCommandRef be a yaml::Node pointer, and look at the node type:
if it's a ScalarNode, it contains "commands" and needs to be
unescaped; if it's a SequenceNode, it's "arguments".
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r246893 - Test commit to see if libcxx.llvm.org/docs builds

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  4 17:57:00 2015
New Revision: 246893

URL: http://llvm.org/viewvc/llvm-project?rev=246893&view=rev
Log:
Test commit to see if libcxx.llvm.org/docs builds

Modified:
libcxx/trunk/TODO.TXT

Modified: libcxx/trunk/TODO.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/TODO.TXT?rev=246893&r1=246892&r2=246893&view=diff
==
--- libcxx/trunk/TODO.TXT (original)
+++ libcxx/trunk/TODO.TXT Fri Sep  4 17:57:00 2015
@@ -42,6 +42,7 @@ Test Suite Tasks
 * Move all libc++ specific tests from test/std into test/libcxx.
 * Improve how LIT handles compiler warnings.
 * Improve the quality and portability of the locale test data.
+* Convert failure tests to use Clang Verify.
 
 Misc Tasks
 ==
@@ -51,6 +52,5 @@ Misc Tasks
 * Look at basic_string's move assignment operator, re LWG 2063 and POCMA
 * libc++ is missing try_emplace
 * Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
-* Convert failure tests to use Clang Verify.
 * Document support (or lack of) for C++11 libraries in C++03.
 * Document supported compilers.


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


Re: [PATCH] D11397: [libcxx] Add first bits of

2015-09-04 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

@mclow.lists ping. Hopefully this should be a pretty simple review.


http://reviews.llvm.org/D11397



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


[libcxx] r246895 - Test commit for sphinx docs try2

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  4 18:19:11 2015
New Revision: 246895

URL: http://llvm.org/viewvc/llvm-project?rev=246895&view=rev
Log:
Test commit for sphinx docs try2

Modified:
libcxx/trunk/docs/index.rst

Modified: libcxx/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/index.rst?rev=246895&r1=246894&r2=246895&view=diff
==
--- libcxx/trunk/docs/index.rst (original)
+++ libcxx/trunk/docs/index.rst Fri Sep  4 18:19:11 2015
@@ -162,6 +162,7 @@ Please include [libcxx] in the subject.
 .. _phab doc: http://llvm.org/docs/Phabricator.html
 .. _cfe-dev: http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
 
+
 Links
 =
 


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


Re: [PATCH] D12453: [CUDA] Allow function overloads based on host/device attributes.

2015-09-04 Thread Richard Smith via cfe-commits
rsmith accepted this revision.


Comment at: lib/AST/ItaniumMangle.cpp:504
@@ +503,3 @@
+  if (FD->hasAttr() && FD->hasAttr())
+Out << "Ua6deviceUa4host";
+

If we have `enable_if` on a `__host__` `__device__` function, I think we should 
mangle as `Ua6deviceUa9enable_ifI...EUa4host`. (The relative order of 
`enable_if` attributes matters, but the order of them relative to `host` and 
`device` does not, so retaining alphabetical order seems best.)


Comment at: lib/Sema/SemaCUDA.cpp:216
@@ +215,3 @@
+Sema &S, const FunctionDecl *Caller, llvm::SmallVectorImpl &Matches,
+std::function FetchDecl) {
+  assert(S.getLangOpts().CUDATargetOverloads &&

We don't need the overhead of `std::function` here. Use this instead:

  template
  static void Erase...(
...,
FetchDeclFn FetchDecl) {


http://reviews.llvm.org/D12453



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


Re: [PATCH] D12616: Failing test highlighting no poisoning if dtor undeclared.

2015-09-04 Thread Naomi Musgrave via cfe-commits
nmusgrave updated this revision to Diff 34094.
nmusgrave marked an inline comment as done.
nmusgrave added a comment.

- Only check simplest object for existence of sanitizing callback.


http://reviews.llvm.org/D12616

Files:
  test/CodeGenCXX/sanitize-dtor-generated.cpp

Index: test/CodeGenCXX/sanitize-dtor-generated.cpp
===
--- /dev/null
+++ test/CodeGenCXX/sanitize-dtor-generated.cpp
@@ -0,0 +1,15 @@
+// Test -fsanitize-memory-use-after-dtor
+// RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor 
-disable-llvm-optzns -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor 
-disable-llvm-optzns -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | 
FileCheck %s
+
+// TODO Success pending on resolution of issue:
+//https://github.com/google/sanitizers/issues/596
+// XFAIL: *
+
+struct Trivial {
+  int a;
+  int b;
+};
+Trivial t;
+
+// CHECK: call void @__sanitizer_dtor_callback


Index: test/CodeGenCXX/sanitize-dtor-generated.cpp
===
--- /dev/null
+++ test/CodeGenCXX/sanitize-dtor-generated.cpp
@@ -0,0 +1,15 @@
+// Test -fsanitize-memory-use-after-dtor
+// RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-optzns -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-optzns -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
+
+// TODO Success pending on resolution of issue:
+//https://github.com/google/sanitizers/issues/596
+// XFAIL: *
+
+struct Trivial {
+  int a;
+  int b;
+};
+Trivial t;
+
+// CHECK: call void @__sanitizer_dtor_callback
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12616: Failing test highlighting no poisoning if dtor undeclared.

2015-09-04 Thread Evgeniy Stepanov via cfe-commits
eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

I'd call the test sanitize-dtor-trivial.cpp


http://reviews.llvm.org/D12616



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


Re: [PATCH] D12087: always_inline codegen rewrite

2015-09-04 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/CodeGen/CodeGenModule.h:505
@@ +504,3 @@
+
+  llvm::SetVector AlwaysInlineFunctions;
+

Did you try making this a vector? It'd be nice to avoid the set overhead here 
if we can.


Repository:
  rL LLVM

http://reviews.llvm.org/D12087



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


Re: [PATCH] D12087: always_inline codegen rewrite

2015-09-04 Thread Evgeniy Stepanov via cfe-commits
eugenis updated this revision to Diff 34095.

Repository:
  rL LLVM

http://reviews.llvm.org/D12087

Files:
  lib/CodeGen/CGCXX.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/ItaniumCXXABI.cpp
  test/CodeGen/always-inline.c
  test/CodeGen/always_inline-unused.c
  test/CodeGen/always_inline-wrappers.c
  test/CodeGen/always_inline.c
  test/CodeGen/function-attributes.c
  test/CodeGen/pr9614.c
  test/CodeGenCXX/alwaysinline.cpp
  test/Frontend/optimization-remark-line-directive.c
  test/Frontend/optimization-remark.c
  test/Modules/cxx-irgen.cpp

Index: test/Modules/cxx-irgen.cpp
===
--- test/Modules/cxx-irgen.cpp
+++ test/Modules/cxx-irgen.cpp
@@ -26,14 +26,14 @@
   };
 }
 
-// CHECK-DAG: define available_externally hidden {{.*}}{{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align
+// CHECK-DAG: define internal i32 @_ZN1SIiE1gEv.alwaysinline() #[[ALWAYS_INLINE:.*]] align
 int a = S::g();
 
 int b = h();
 
 // CHECK-DAG: define linkonce_odr {{.*}}{{signext i32|i32}} @_Z3minIiET_S0_S0_(i32
 int c = min(1, 2);
-// CHECK: define available_externally {{.*}}{{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align
+// CHECK-DAG: define internal {{.*}}{{signext i32|i32}} @_ZN1SIiE1fEv.alwaysinline() #[[ALWAYS_INLINE]] align
 
 namespace ImplicitSpecialMembers {
   // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1BC2ERKS0_(
Index: test/Frontend/optimization-remark.c
===
--- test/Frontend/optimization-remark.c
+++ test/Frontend/optimization-remark.c
@@ -32,6 +32,8 @@
 // CHECK-NOT: !llvm.dbg.cu = !{
 
 int foo(int x, int y) __attribute__((always_inline));
+// expected-remark@+2 {{foo.alwaysinline should always be inlined}}
+// expected-remark@+1 {{foo.alwaysinline inlined into foo}}
 int foo(int x, int y) { return x + y; }
 
 float foz(int x, int y) __attribute__((noinline));
@@ -45,7 +47,7 @@
 // expected-remark@+5 {{foz will not be inlined into bar}}
 // expected-remark@+4 {{foz should never be inlined}}
 // expected-remark@+3 {{foz will not be inlined into bar}}
-// expected-remark@+2 {{foo should always be inlined}}
-// expected-remark@+1 {{foo inlined into bar}}
+// expected-remark@+2 {{foo.alwaysinline should always be inlined}}
+// expected-remark@+1 {{foo.alwaysinline inlined into bar}}
   return foo(j, j - 2) * foz(j - 2, j);
 }
Index: test/Frontend/optimization-remark-line-directive.c
===
--- test/Frontend/optimization-remark-line-directive.c
+++ test/Frontend/optimization-remark-line-directive.c
@@ -5,8 +5,9 @@
 // RUN: %clang_cc1 %s -Rpass=inline -gline-tables-only -dwarf-column-info -emit-llvm-only -verify
 
 int foo(int x, int y) __attribute__((always_inline));
+// expected-remark@+1 {{foo.alwaysinline inlined into foo}}
 int foo(int x, int y) { return x + y; }
 
-// expected-remark@+2 {{foo inlined into bar}} expected-note@+2 {{could not determine the original source location for /bad/path/to/original.c:1230:25}}
+// expected-remark@+2 {{foo.alwaysinline inlined into bar}} expected-note@+2 {{could not determine the original source location for /bad/path/to/original.c:1230:25}}
 #line 1230 "/bad/path/to/original.c"
 int bar(int j) { return foo(j, j - 2); }
Index: test/CodeGenCXX/alwaysinline.cpp
===
--- /dev/null
+++ test/CodeGenCXX/alwaysinline.cpp
@@ -0,0 +1,68 @@
+// Test different kinds of alwaysinline *structor definitions.
+
+// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CALL
+
+// RUN: %clang_cc1 -mconstructor-aliases -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -mconstructor-aliases -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CALL
+
+struct A1 {
+  __attribute__((__always_inline__)) A1() {}
+  __attribute__((__always_inline__)) ~A1() {}
+};
+
+void g1() {
+  A1 a1;
+}
+
+struct A2 {
+  inline __attribute__((__always_inline__)) A2() {}
+  inline __attribute__((__always_inline__)) ~A2() {}
+};
+
+void g2() {
+  A2 a2;
+}
+
+struct A3 {
+  inline __attribute__((gnu_inline, __always_inline__)) A3() {}
+  inline __attribute__((gnu_inline, __always_inline__)) ~A3() {}
+};
+
+void g3() {
+  A3 a3;
+}
+
+// CHECK-DAG: define internal void @_ZN2A1C1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI:[01-9]+]]
+// CHECK-DAG: define internal void @_ZN2A1C2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
+// CHECK-DAG: define internal void @_ZN2A1D1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
+// CHECK-DAG: define internal void @_ZN2A1D2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[A

Re: [PATCH] D12087: always_inline codegen rewrite

2015-09-04 Thread Evgeniy Stepanov via cfe-commits
eugenis added inline comments.


Comment at: lib/CodeGen/CodeGenModule.h:505
@@ +504,3 @@
+
+  llvm::SmallVector AlwaysInlineFunctions;
+

Right. Sorry I missed the comment.
I've switched this to a vector.


Repository:
  rL LLVM

http://reviews.llvm.org/D12087



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


Re: [PATCH] D12435: [Concepts] Add diagnostic; invalid specifier on function or variable concept declaration

2015-09-04 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D12435



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


[libcxx] r246906 - Try building docs again.

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Sep  4 20:32:48 2015
New Revision: 246906

URL: http://llvm.org/viewvc/llvm-project?rev=246906&view=rev
Log:
Try building docs again.

Modified:
libcxx/trunk/docs/index.rst

Modified: libcxx/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/index.rst?rev=246906&r1=246905&r2=246906&view=diff
==
--- libcxx/trunk/docs/index.rst (original)
+++ libcxx/trunk/docs/index.rst Fri Sep  4 20:32:48 2015
@@ -162,7 +162,6 @@ Please include [libcxx] in the subject.
 .. _phab doc: http://llvm.org/docs/Phabricator.html
 .. _cfe-dev: http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
 
-
 Links
 =
 


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


Re: [PATCH] D12466: Fix empty -L Path on OSX hosts

2015-09-04 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

This looks fine, just make sure the indentation is right. Phab seems confused.


Repository:
  rL LLVM

http://reviews.llvm.org/D12466



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


Re: [PATCH] Expose diagnostic formatting to Python bindings

2015-09-04 Thread Omar Sandoval via cfe-commits
On Fri, Aug 07, 2015 at 11:35:26PM -0700, Omar Sandoval wrote:
> This makes it easier for tools using the Python libclang bindings to
> display diagnostics in a manner consistent with clang.

Ping, any comments on this?

Thanks.

> ---
>  bindings/python/clang/cindex.py | 33 +
>  1 file changed, 33 insertions(+)
> 
> diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
> index f5caca8572cb..f46084b140aa 100644
> --- a/bindings/python/clang/cindex.py
> +++ b/bindings/python/clang/cindex.py
> @@ -305,6 +305,14 @@ class Diagnostic(object):
>  Error   = 3
>  Fatal   = 4
>  
> +DisplaySourceLocation = 0x01
> +DisplayColumn = 0x02
> +DisplaySourceRanges   = 0x04
> +DisplayOption = 0x08
> +DisplayCategoryId = 0x10
> +DisplayCategoryName   = 0x20
> +_FormatOptionsMask = 0x3f
> +
>  def __init__(self, ptr):
>  self.ptr = ptr
>  
> @@ -382,10 +390,27 @@ class Diagnostic(object):
>  
>  return conf.lib.clang_getCString(disable)
>  
> +def format(self, options=None):
> +"""
> +Format this diagnostic for display. The options argument takes
> +Diagnostic.DisplayFoo flags, which can be combined using bitwise OR. 
> If
> +the options argument is not provided, the default display options 
> will
> +be used.
> +"""
> +if options is None:
> +options = conf.lib.clang_defaultDiagnosticDisplayOptions()
> +elif options & ~Diagnostic._FormatOptionsMask:
> +raise ValueError('Invalid format options')
> +formatted = conf.lib.clang_formatDiagnostic(self, options)
> +return conf.lib.clang_getCString(formatted)
> +
>  def __repr__(self):
>  return "" % (
>  self.severity, self.location, self.spelling)
>  
> +def __str__(self):
> +return self.format()
> +
>  def from_param(self):
>return self.ptr
>  
> @@ -2889,6 +2914,10 @@ functionList = [
> [Cursor],
> bool),
>  
> +  ("clang_defaultDiagnosticDisplayOptions",
> +   [],
> +   c_uint),
> +
>("clang_defaultSaveOptions",
> [TranslationUnit],
> c_uint),
> @@ -2930,6 +2959,10 @@ functionList = [
> [Type, Type],
> bool),
>  
> +  ("clang_formatDiagnostic",
> +   [Diagnostic, c_uint],
> +   _CXString),
> +
>("clang_getArgType",
> [Type, c_uint],
> Type,
> -- 
> 2.5.0
> 

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


[libcxx] r246909 - Add temporary Makefile.sphinx build file to get libcxx.llvm.org/docs going

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Sep  5 00:12:04 2015
New Revision: 246909

URL: http://llvm.org/viewvc/llvm-project?rev=246909&view=rev
Log:
Add temporary Makefile.sphinx build file to get libcxx.llvm.org/docs going

Added:
libcxx/trunk/docs/Makefile.sphinx

Added: libcxx/trunk/docs/Makefile.sphinx
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/Makefile.sphinx?rev=246909&view=auto
==
--- libcxx/trunk/docs/Makefile.sphinx (added)
+++ libcxx/trunk/docs/Makefile.sphinx Sat Sep  5 00:12:04 2015
@@ -0,0 +1,34 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS=
+SPHINXBUILD   = sphinx-build
+PAPER =
+BUILDDIR  = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp 
epub latex latexpdf text man changes linkcheck doctest gettext default
+
+default: html
+
+help:
+   @echo "Please use \`make ' where  is one of"
+   @echo "  html   to make standalone HTML files"
+
+clean:
+   -rm -rf $(BUILDDIR)/*
+
+html:
+   $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+   @echo
+   @# FIXME: Remove this `cp` once HTML->Sphinx transition is completed.
+   @# Kind of a hack, but HTML-formatted docs are on the way out anyway.
+   @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+


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


[libcxx] r246910 - Test commit for builder

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Sep  5 00:29:23 2015
New Revision: 246910

URL: http://llvm.org/viewvc/llvm-project?rev=246910&view=rev
Log:
Test commit for builder

Modified:
libcxx/trunk/docs/Makefile.sphinx
libcxx/trunk/docs/index.rst

Modified: libcxx/trunk/docs/Makefile.sphinx
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/Makefile.sphinx?rev=246910&r1=246909&r2=246910&view=diff
==
--- libcxx/trunk/docs/Makefile.sphinx (original)
+++ libcxx/trunk/docs/Makefile.sphinx Sat Sep  5 00:29:23 2015
@@ -1,5 +1,8 @@
 # Makefile for Sphinx documentation
 #
+# FIXME: This hack is only in place to allow the libcxx.llvm.org/docs builder
+# to work with libcxx. This should be removed when that builder supports
+# out-of-tree builds.
 
 # You can set these variables from the command line.
 SPHINXOPTS=

Modified: libcxx/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/index.rst?rev=246910&r1=246909&r2=246910&view=diff
==
--- libcxx/trunk/docs/index.rst (original)
+++ libcxx/trunk/docs/index.rst Sat Sep  5 00:29:23 2015
@@ -37,6 +37,7 @@ Getting Started with libc++
BuildingLibcxx
TestingLibcxx
 
+
 Current Status
 --
 


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


[libcxx] r246911 - Test temporary commit.

2015-09-04 Thread Tanya Lattner via cfe-commits
Author: tbrethou
Date: Sat Sep  5 00:34:27 2015
New Revision: 246911

URL: http://llvm.org/viewvc/llvm-project?rev=246911&view=rev
Log:
Test temporary commit. 

Modified:
libcxx/trunk/docs/README.txt

Modified: libcxx/trunk/docs/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/README.txt?rev=246911&r1=246910&r2=246911&view=diff
==
--- libcxx/trunk/docs/README.txt (original)
+++ libcxx/trunk/docs/README.txt Sat Sep  5 00:34:27 2015
@@ -1,6 +1,6 @@
 libc++ Documentation
 
-
+Test.
 The libc++ documentation is written using the Sphinx documentation generator. 
It is
 currently tested with Sphinx 1.1.3.
 


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


[libcxx] r246912 - Remove test commit.

2015-09-04 Thread Tanya Lattner via cfe-commits
Author: tbrethou
Date: Sat Sep  5 00:38:50 2015
New Revision: 246912

URL: http://llvm.org/viewvc/llvm-project?rev=246912&view=rev
Log:
Remove test commit.

Modified:
libcxx/trunk/docs/README.txt

Modified: libcxx/trunk/docs/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/README.txt?rev=246912&r1=246911&r2=246912&view=diff
==
--- libcxx/trunk/docs/README.txt (original)
+++ libcxx/trunk/docs/README.txt Sat Sep  5 00:38:50 2015
@@ -1,6 +1,6 @@
 libc++ Documentation
 
-Test.
+
 The libc++ documentation is written using the Sphinx documentation generator. 
It is
 currently tested with Sphinx 1.1.3.
 


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


Re: [PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy

2015-09-04 Thread Steven Wu via cfe-commits
steven_wu added a subscriber: steven_wu.
steven_wu added a comment.

This commit seems to cause miscompile in LNT testsuite with -O0 and -O3
http://lab.llvm.org:8080/green/job/perf_o0g_run/7070/warnings2Result/new/
http://lab.llvm.org:8080/green/job/perf_o3lto_run/15591/warnings2Result/new/

Looks like there is an undefined in LNT testsuite, here is the relevant code 
for consumer-lame:

  typedef struct
  
  { 
  
int used;   
  
int valid;  
  
char title[31]; 
  
char artist[31];
  
char album[31]; 
  
char year[5];   
  
char comment[31];   
  
char tagtext[128];  
  
char genre[1];  
  
unsigned char track;
  

  
  }   ID3TAGDATA; 
  void id3_inittag(ID3TAGDATA *tag) {   
  
...
strcpy( tag->genre, "ÿ"); /* unset genre */  
... 
  }

Here is the suggested change:

  diff --git a/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c 
b/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c
  index e24a966..23f2b86 100644
  --- a/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c
  +++ b/MultiSource/Benchmarks/MiBench/consumer-lame/id3tag.c
  @@ -34,7 +34,7 @@ void id3_inittag(ID3TAGDATA *tag) {
  strcpy( tag->album, "");
  strcpy( tag->year, "");
  strcpy( tag->comment, "");
  -   strcpy( tag->genre, "");/* unset genre */
  +   tag->genre[0] = ''; /* unset genre */
  tag->track = 0;
   
  tag->valid = 0; /* not ready for writing*/

However, I have trouble understand the code in consumer-typeset. It crashes in 
z07.c:138
By the looks of it, the code is trying to copy the include path (specified on 
command line), which is setup to be 
"$PATH_TO_TEST_SUITE/MultiSource/Benchmarks/MiBench/consumer-typeset/data/include"
 into unsigned char ostring[4]. From the look of the code, it is trying to 
utilize all the size in OBJECT to store the entire string. I don't know if that 
is fixable. Let me know if you have any better idea of how to fix that.


http://reviews.llvm.org/D12169



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


[libcxx] r246913 - Cleanup new documentation index and transfer more information from www/index.html

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Sep  5 01:50:03 2015
New Revision: 246913

URL: http://llvm.org/viewvc/llvm-project?rev=246913&view=rev
Log:
Cleanup new documentation index and transfer more information from 
www/index.html

Modified:
libcxx/trunk/docs/index.rst

Modified: libcxx/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/index.rst?rev=246913&r1=246912&r2=246913&view=diff
==
--- libcxx/trunk/docs/index.rst (original)
+++ libcxx/trunk/docs/index.rst Sat Sep  5 01:50:03 2015
@@ -46,35 +46,34 @@ library instead of contributing to an ex
 libstdcxx, GNU's libstdc++, STLport, etc).  There are many contributing
 reasons, but some of the major ones are:
 
-From years of experience (including having implemented the standard
-library before), we've learned many things about implementing
-the standard containers which require ABI breakage and fundamental changes
-to how they are implemented.  For example, it is generally accepted that
-building std::string using the "short string optimization" instead of
-using Copy On Write (COW) is a superior approach for multicore
-machines (particularly in C++11, which has rvalue references).  Breaking
-ABI compatibility with old versions of the library was
-determined to be critical to achieving the performance goals of
-libc++.
-
-Mainline libstdc++ has switched to GPL3, a license which the developers
-of libc++ cannot use.  libstdc++ 4.2 (the last GPL2 version) could be
-independently extended to support C++11, but this would be a fork of the
-codebase (which is often seen as worse for a project than starting a new
-independent one).  Another problem with libstdc++ is that it is tightly
-integrated with G++ development, tending to be tied fairly closely to the
-matching version of G++.
-
-STLport and the Apache libstdcxx library are two other popular
-candidates, but both lack C++11 support.  Our experience (and the
-experience of libstdc++ developers) is that adding support for C++11 (in
-particular rvalue references and move-only types) requires changes to
-almost every class and function, essentially amounting to a rewrite.
-Faced with a rewrite, we decided to start from scratch and evaluate every
-design decision from first principles based on experience.
-
-Further, both projects are apparently abandoned: STLport 5.2.1 was
-released in Oct'08, and STDCXX 4.2.1 in May'08.
+* From years of experience (including having implemented the standard
+  library before), we've learned many things about implementing
+  the standard containers which require ABI breakage and fundamental changes
+  to how they are implemented.  For example, it is generally accepted that
+  building std::string using the "short string optimization" instead of
+  using Copy On Write (COW) is a superior approach for multicore
+  machines (particularly in C++11, which has rvalue references).  Breaking
+  ABI compatibility with old versions of the library was
+  determined to be critical to achieving the performance goals of
+  libc++.
+
+* Mainline libstdc++ has switched to GPL3, a license which the developers
+  of libc++ cannot use.  libstdc++ 4.2 (the last GPL2 version) could be
+  independently extended to support C++11, but this would be a fork of the
+  codebase (which is often seen as worse for a project than starting a new
+  independent one).  Another problem with libstdc++ is that it is tightly
+  integrated with G++ development, tending to be tied fairly closely to the
+  matching version of G++.
+
+* STLport and the Apache libstdcxx library are two other popular
+  candidates, but both lack C++11 support.  Our experience (and the
+  experience of libstdc++ developers) is that adding support for C++11 (in
+  particular rvalue references and move-only types) requires changes to
+  almost every class and function, essentially amounting to a rewrite.
+  Faced with a rewrite, we decided to start from scratch and evaluate every
+  design decision from first principles based on experience.
+  Further, both projects are apparently abandoned: STLport 5.2.1 was
+  released in Oct'08, and STDCXX 4.2.1 in May'08.
 
 Platform and Compiler Support
 -
@@ -137,15 +136,22 @@ Design Documents
 
 .. _clow notes: 
https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
 
+Build Bots
+---
+
+* `LLVM Buildbot Builders `_
+* `Apple Jenkins Builders `_
+
 Getting Involved
 
 
-First please review our `Developer's Policy 
`__.
+First please review our `Developer's Policy 
`__
+and `Getting started with LLVM `__.
 
 **Bug Reports**
 
 If you think you've found a bug in libc++, please report it using
-the _`LLVM Bugzilla`. 

[libcxx] r246914 - Try and fix broken bugzilla link

2015-09-04 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sat Sep  5 01:57:29 2015
New Revision: 246914

URL: http://llvm.org/viewvc/llvm-project?rev=246914&view=rev
Log:
Try and fix broken bugzilla link

Modified:
libcxx/trunk/docs/index.rst

Modified: libcxx/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/index.rst?rev=246914&r1=246913&r2=246914&view=diff
==
--- libcxx/trunk/docs/index.rst (original)
+++ libcxx/trunk/docs/index.rst Sat Sep  5 01:57:29 2015
@@ -124,7 +124,7 @@ This list contains known issues with lib
 
 A full list of currently open libc++ bugs can be `found here `__.
 
-.. _libcxx bug list: 
https://llvm.org/bugs/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
+.. _`libcxx bug list`: 
https://llvm.org/bugs/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
 
 Design Documents
 


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