Re: [PATCH] D29303: In VirtualCallChecker, handle indirect calls

2017-02-25 Thread Anna Zaks via cfe-commits
Thank you!

On Friday, February 24, 2017, Hans Wennborg  wrote:

> Yes, this looks very straight-forward. Merged in r296154.
>
> On Fri, Feb 24, 2017 at 4:29 AM, Sam McCall via cfe-commits
> > wrote:
> > Thanks Anna, I'm new to the release process here.
> >
> > Hans: this is a simple fix for a null-dereference in the static analyzer.
> > Does it make sense to cherrypick?
> >
> > On Sat, Feb 18, 2017 at 2:46 AM, Anna Zaks via Phabricator
> > > wrote:
> >>
> >> zaks.anna added a comment.
> >>
> >> Has this been cherry-picked into the clang 4.0 release branch? If not,
> we
> >> should definitely do that!
> >>
> >>
> >> Repository:
> >>   rL LLVM
> >>
> >> https://reviews.llvm.org/D29303
> >>
> >>
> >>
> >
> >
> > ___
> > 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


r296282 - [index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish function-local symbols

2017-02-25 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Sat Feb 25 23:37:56 2017
New Revision: 296282

URL: http://llvm.org/viewvc/llvm-project?rev=296282=rev
Log:
[index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish 
function-local symbols

Parameters have a 'child' relation to their function/method.
Also add an option '-include-locals' to 'c-index-test core' to enable indexing 
of function-local symbols.

Original patch from Nathan Hawes with some changes by me.
https://reviews.llvm.org/D30304

Modified:
cfe/trunk/include/clang/Index/IndexSymbol.h
cfe/trunk/lib/Index/IndexBody.cpp
cfe/trunk/lib/Index/IndexSymbol.cpp
cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
cfe/trunk/lib/Index/IndexingContext.cpp
cfe/trunk/lib/Index/IndexingContext.h
cfe/trunk/test/Index/Core/index-source.m
cfe/trunk/tools/c-index-test/core_main.cpp
cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp

Modified: cfe/trunk/include/clang/Index/IndexSymbol.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/IndexSymbol.h?rev=296282=296281=296282=diff
==
--- cfe/trunk/include/clang/Index/IndexSymbol.h (original)
+++ cfe/trunk/include/clang/Index/IndexSymbol.h Sat Feb 25 23:37:56 2017
@@ -51,6 +51,8 @@ enum class SymbolKind : uint8_t {
   Constructor,
   Destructor,
   ConversionFunction,
+
+  Parameter,
 };
 
 enum class SymbolLanguage {
@@ -77,8 +79,9 @@ enum class SymbolProperty : uint8_t {
   IBAnnotated   = 1 << 4,
   IBOutletCollection= 1 << 5,
   GKInspectable = 1 << 6,
+  Local = 1 << 7,
 };
-static const unsigned SymbolPropertyBitNum = 7;
+static const unsigned SymbolPropertyBitNum = 8;
 typedef unsigned SymbolPropertySet;
 
 /// Set of roles that are attributed to symbol occurrences.
@@ -125,6 +128,8 @@ struct SymbolInfo {
 
 SymbolInfo getSymbolInfo(const Decl *D);
 
+bool isFunctionLocalSymbol(const Decl *D);
+
 void applyForEachSymbolRole(SymbolRoleSet Roles,
 llvm::function_ref Fn);
 void printSymbolRoles(SymbolRoleSet Roles, raw_ostream );

Modified: cfe/trunk/lib/Index/IndexBody.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexBody.cpp?rev=296282=296281=296282=diff
==
--- cfe/trunk/lib/Index/IndexBody.cpp (original)
+++ cfe/trunk/lib/Index/IndexBody.cpp Sat Feb 25 23:37:56 2017
@@ -269,7 +269,7 @@ public:
   const Decl *D = *I;
   if (!D)
 continue;
-  if (!IndexCtx.isFunctionLocalDecl(D))
+  if (!isFunctionLocalSymbol(D))
 IndexCtx.indexTopLevelDecl(D);
 }
 

Modified: cfe/trunk/lib/Index/IndexSymbol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexSymbol.cpp?rev=296282=296281=296282=diff
==
--- cfe/trunk/lib/Index/IndexSymbol.cpp (original)
+++ cfe/trunk/lib/Index/IndexSymbol.cpp Sat Feb 25 23:37:56 2017
@@ -49,6 +49,37 @@ static void checkForIBOutlets(const Decl
   }
 }
 
+bool index::isFunctionLocalSymbol(const Decl *D) {
+  assert(D);
+
+  if (isa(D))
+return true;
+
+  if (isa(D))
+return true;
+
+  if (isa(D))
+return true;
+
+  if (!D->getParentFunctionOrMethod())
+return false;
+
+  if (const NamedDecl *ND = dyn_cast(D)) {
+switch (ND->getFormalLinkage()) {
+  case NoLinkage:
+  case VisibleNoLinkage:
+  case InternalLinkage:
+return true;
+  case UniqueExternalLinkage:
+llvm_unreachable("Not a sema linkage");
+  case ExternalLinkage:
+return false;
+}
+  }
+
+  return true;
+}
+
 SymbolInfo index::getSymbolInfo(const Decl *D) {
   assert(D);
   SymbolInfo Info;
@@ -57,6 +88,10 @@ SymbolInfo index::getSymbolInfo(const De
   Info.Properties = SymbolPropertySet();
   Info.Lang = SymbolLanguage::C;
 
+  if (isFunctionLocalSymbol(D)) {
+Info.Properties |= (unsigned)SymbolProperty::Local;
+  }
+
   if (const TagDecl *TD = dyn_cast(D)) {
 switch (TD->getTagKind()) {
 case TTK_Struct:
@@ -94,10 +129,13 @@ SymbolInfo index::getSymbolInfo(const De
 
   } else if (auto *VD = dyn_cast(D)) {
 Info.Kind = SymbolKind::Variable;
-if (isa(D->getDeclContext())) {
+if (isa(D)) {
+  Info.Kind = SymbolKind::Parameter;
+} else if (isa(D->getDeclContext())) {
   Info.Kind = SymbolKind::StaticProperty;
   Info.Lang = SymbolLanguage::CXX;
 }
+
 if (isa(D)) {
   Info.Lang = SymbolLanguage::CXX;
   Info.Properties |= (unsigned)SymbolProperty::Generic;
@@ -378,6 +416,7 @@ StringRef index::getSymbolKindString(Sym
   case SymbolKind::Constructor: return "constructor";
   case SymbolKind::Destructor: return "destructor";
   case SymbolKind::ConversionFunction: return "coversion-func";
+  case SymbolKind::Parameter: return "param";
   }
   

[PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes

2017-02-25 Thread Ben Harper via Phabricator via cfe-commits
bmharper added a comment.

Hi @djasper,
This is the first patch I've contributed here, so I'm not familiar with the 
whole process. I assume this code is ready to land? When exactly does it get 
merged into master, and is there something else that I still need to do to make 
that happen?

Thanks,
Ben


https://reviews.llvm.org/D21279



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


r296276 - Update cxx_dr_status page.

2017-02-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sat Feb 25 17:54:18 2017
New Revision: 296276

URL: http://llvm.org/viewvc/llvm-project?rev=296276=rev
Log:
Update cxx_dr_status page.

Modified:
cfe/trunk/www/cxx_dr_status.html

Modified: cfe/trunk/www/cxx_dr_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_dr_status.html?rev=296276=296275=296276=diff
==
--- cfe/trunk/www/cxx_dr_status.html (original)
+++ cfe/trunk/www/cxx_dr_status.html Sat Feb 25 17:54:18 2017
@@ -9481,7 +9481,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1611;>1611
 C++14
 Deleted default constructor for abstract class
-Unknown
+Duplicate of 1658
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1612;>1612
@@ -9763,7 +9763,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1658;>1658
 C++14
 Deleted default constructor for abstract class via destructor
-Unknown
+SVN
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1659;>1659
@@ -12895,7 +12895,7 @@ and POD class
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2180;>2180
 DR
 Virtual bases in destructors and defaulted assignment operators
-Unknown
+Yes
   
   
 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2181;>2181


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


r296275 - C++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for special member functions.

2017-02-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sat Feb 25 17:53:05 2017
New Revision: 296275

URL: http://llvm.org/viewvc/llvm-project?rev=296275=rev
Log:
C++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for 
special member functions.

Essentially, as a base class constructor does not construct virtual bases, such
a constructor for an abstract class does not need the corresponding base class
construction to be valid, and likewise for destructors.

This creates an awkward situation: clang will sometimes generate references to
the complete object and deleting destructors for an abstract class (it puts
them in the construction vtable for a derived class). But we can't generate a
"correct" version of these because we can't generate references to base class
constructors any more (if they're template specializations, say, we might not
have instantiated them and can't assume any other TU will emit a copy).
Fortunately, we don't need to, since no correct program can ever invoke them,
so instead emit symbols that just trap.

We should stop emitting references to these symbols, but still need to emit
definitions for compatibility.

Added:
cfe/trunk/test/CXX/drs/dr21xx.cpp
cfe/trunk/test/CodeGenCXX/implicit-exception-spec.cpp
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/CXX/drs/dr16xx.cpp
cfe/trunk/test/CodeGenCXX/constructors.cpp
cfe/trunk/test/SemaCXX/implicit-exception-spec.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=296275=296274=296275=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Sat Feb 25 17:53:05 2017
@@ -441,9 +441,10 @@ class CXXRecordDecl : public RecordDecl
 /// either by the user or implicitly.
 unsigned DeclaredSpecialMembers : 6;
 
-/// \brief Whether an implicit copy constructor would have a 
const-qualified
-/// parameter.
-unsigned ImplicitCopyConstructorHasConstParam : 1;
+/// \brief Whether an implicit copy constructor could have a 
const-qualified
+/// parameter, for initializing virtual bases and for other subobjects.
+unsigned ImplicitCopyConstructorCanHaveConstParamForVBase : 1;
+unsigned ImplicitCopyConstructorCanHaveConstParamForNonVBase : 1;
 
 /// \brief Whether an implicit copy assignment operator would have a
 /// const-qualified parameter.
@@ -882,7 +883,9 @@ public:
   /// \brief Determine whether an implicit copy constructor for this type
   /// would have a parameter with a const-qualified reference type.
   bool implicitCopyConstructorHasConstParam() const {
-return data().ImplicitCopyConstructorHasConstParam;
+return data().ImplicitCopyConstructorCanHaveConstParamForNonVBase &&
+   (isAbstract() ||
+data().ImplicitCopyConstructorCanHaveConstParamForVBase);
   }
 
   /// \brief Determine whether this class has a copy constructor with

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=296275=296274=296275=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Sat Feb 25 17:53:05 2017
@@ -2363,8 +2363,10 @@ bool ASTNodeImporter::ImportDefinition(R
 ToData.UserProvidedDefaultConstructor
   = FromData.UserProvidedDefaultConstructor;
 ToData.DeclaredSpecialMembers = FromData.DeclaredSpecialMembers;
-ToData.ImplicitCopyConstructorHasConstParam
-  = FromData.ImplicitCopyConstructorHasConstParam;
+ToData.ImplicitCopyConstructorCanHaveConstParamForVBase
+  = FromData.ImplicitCopyConstructorCanHaveConstParamForVBase;
+ToData.ImplicitCopyConstructorCanHaveConstParamForNonVBase
+  = FromData.ImplicitCopyConstructorCanHaveConstParamForNonVBase;
 ToData.ImplicitCopyAssignmentHasConstParam
   = FromData.ImplicitCopyAssignmentHasConstParam;
 ToData.HasDeclaredCopyConstructorWithConstParam

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=296275=296274=296275=diff
==
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Sat Feb 25 17:53:05 2017
@@ -68,7 +68,8 @@ CXXRecordDecl::DefinitionData::Definitio
   HasConstexprDefaultConstructor(false),
   HasNonLiteralTypeFieldsOrBases(false), ComputedVisibleConversions(false),
   UserProvidedDefaultConstructor(false), DeclaredSpecialMembers(0),
-  

Re: r296193 - [Test] Make Lit tests C++11 compatible #10

2017-02-25 Thread Kim Gräsman via cfe-commits
Den 25 feb. 2017 7:23 em skrev "Charles Li via cfe-commits" <
cfe-commits@lists.llvm.org>:

Author: lcharles
Date: Fri Feb 24 17:23:53 2017
New Revision: 296193

URL: http://llvm.org/viewvc/llvm-project?rev=296193=rev
Log:
[Test] Make Lit tests C++11 compatible #10

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

Modified:
cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h
cfe/trunk/test/Modules/merge-using-decls.cpp
cfe/trunk/test/SemaCXX/PR9572.cpp
cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp
cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp

Modified: cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
Modules/Inputs/merge-using-decls/b.h?rev=296193=
296192=296193=diff

==
--- cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h (original)
+++ cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h Fri Feb 24 17:23:53
2017
@@ -29,11 +29,13 @@ template struct D : X, T {
   using typename X::t;
 };

+#if __cplusplus <= 199711L // C++11 does not allow access declerations


Typo: declerations, here and throughout.

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


r296267 - [test] Disable test/Index/pch-from-libclang.c for non-darwin systems.

2017-02-25 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Sat Feb 25 13:17:11 2017
New Revision: 296267

URL: http://llvm.org/viewvc/llvm-project?rev=296267=rev
Log:
[test] Disable test/Index/pch-from-libclang.c for non-darwin systems.

Modified:
cfe/trunk/test/Index/pch-from-libclang.c

Modified: cfe/trunk/test/Index/pch-from-libclang.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pch-from-libclang.c?rev=296267=296266=296267=diff
==
--- cfe/trunk/test/Index/pch-from-libclang.c (original)
+++ cfe/trunk/test/Index/pch-from-libclang.c Sat Feb 25 13:17:11 2017
@@ -1,4 +1,8 @@
 // Check that clang can use a PCH created from libclang.
+
+// FIXME: Non-darwin bots fail. Would need investigation using 
-module-file-info to see what is the difference in modules generated from 
libclang vs the compiler invocation, in those systems.
+// REQUIRES: system-darwin
+
 // RUN: c-index-test -write-pch %t.h.pch %s -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin
 // RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang 
-triple -Xclang x86_64-apple-darwin
 


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


r296265 - [test] Use cc1 -triple for test/Index/pch-from-libclang.c.

2017-02-25 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Sat Feb 25 12:55:32 2017
New Revision: 296265

URL: http://llvm.org/viewvc/llvm-project?rev=296265=rev
Log:
[test] Use cc1 -triple for test/Index/pch-from-libclang.c.

Note quite sure why driver -target has no effect.

Modified:
cfe/trunk/test/Index/pch-from-libclang.c

Modified: cfe/trunk/test/Index/pch-from-libclang.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pch-from-libclang.c?rev=296265=296264=296265=diff
==
--- cfe/trunk/test/Index/pch-from-libclang.c (original)
+++ cfe/trunk/test/Index/pch-from-libclang.c Sat Feb 25 12:55:32 2017
@@ -1,6 +1,6 @@
 // Check that clang can use a PCH created from libclang.
-// RUN: c-index-test -write-pch %t.h.pch %s -fmodules 
-fmodules-cache-path=%t.mcp -target x86_64-apple-darwin
-// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -target 
x86_64-apple-darwin
+// RUN: c-index-test -write-pch %t.h.pch %s -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin
+// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang 
-triple -Xclang x86_64-apple-darwin
 
 // expected-no-diagnostics
 


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


r296263 - [test] Add target to test/Index/pch-from-libclang.c.

2017-02-25 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Sat Feb 25 12:35:53 2017
New Revision: 296263

URL: http://llvm.org/viewvc/llvm-project?rev=296263=rev
Log:
[test] Add target to test/Index/pch-from-libclang.c.

Attempt to fix the failing bots.

Modified:
cfe/trunk/test/Index/pch-from-libclang.c

Modified: cfe/trunk/test/Index/pch-from-libclang.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pch-from-libclang.c?rev=296263=296262=296263=diff
==
--- cfe/trunk/test/Index/pch-from-libclang.c (original)
+++ cfe/trunk/test/Index/pch-from-libclang.c Sat Feb 25 12:35:53 2017
@@ -1,6 +1,6 @@
 // Check that clang can use a PCH created from libclang.
-// RUN: c-index-test -write-pch %t.h.pch %s -fmodules 
-fmodules-cache-path=%t.mcp
-// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record
+// RUN: c-index-test -write-pch %t.h.pch %s -fmodules 
-fmodules-cache-path=%t.mcp -target x86_64-apple-darwin
+// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -target 
x86_64-apple-darwin
 
 // expected-no-diagnostics
 


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


r296261 - [modules] For -module-file-info, print out the resource dir path, since it is included in the module hash.

2017-02-25 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Sat Feb 25 12:14:31 2017
New Revision: 296261

URL: http://llvm.org/viewvc/llvm-project?rev=296261=rev
Log:
[modules] For -module-file-info, print out the resource dir path, since it is 
included in the module hash.

Modified:
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/test/Modules/module_file_info.m

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=296261=296260=296261=diff
==
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Sat Feb 25 12:14:31 2017
@@ -567,6 +567,7 @@ namespace {
  bool Complain) override {
   Out.indent(2) << "Header search options:\n";
   Out.indent(4) << "System root [-isysroot=]: '" << HSOpts.Sysroot << 
"'\n";
+  Out.indent(4) << "Resource dir [ -resource-dir=]: '" << 
HSOpts.ResourceDir << "'\n";
   Out.indent(4) << "Module Cache: '" << SpecificModuleCachePath << "'\n";
   DUMP_BOOLEAN(HSOpts.UseBuiltinIncludes,
"Use builtin include directories [-nobuiltininc]");

Modified: cfe/trunk/test/Modules/module_file_info.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module_file_info.m?rev=296261=296260=296261=diff
==
--- cfe/trunk/test/Modules/module_file_info.m (original)
+++ cfe/trunk/test/Modules/module_file_info.m Sat Feb 25 12:14:31 2017
@@ -36,6 +36,7 @@
 
 // CHECK: Header search options:
 // CHECK:   System root [-isysroot=]: '/'
+// CHECK:   Resource dir [ -resource-dir=]: '{{.*}}clang{{.*}}'
 // CHECK:   Use builtin include directories [-nobuiltininc]: Yes
 // CHECK:   Use standard system include directories [-nostdinc]: No
 // CHECK:   Use standard C++ include directories [-nostdinc++]: Yes


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


r296262 - [driver] Pass a resource dir without the '/../' part.

2017-02-25 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Sat Feb 25 12:14:35 2017
New Revision: 296262

URL: http://llvm.org/viewvc/llvm-project?rev=296262=rev
Log:
[driver] Pass a resource dir without the '/../' part.

This get the resource dir string to match with the one from libclang (which is 
not adding '/../'),
and allows clang to accept a modules-enabled PCH that was created by libclang.

Added:
cfe/trunk/test/Index/pch-from-libclang.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=296262=296261=296262=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sat Feb 25 12:14:35 2017
@@ -79,7 +79,8 @@ Driver::Driver(StringRef ClangExecutable
 llvm::sys::path::append(P, ClangResourceDir);
   } else {
 StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
-llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
+P = llvm::sys::path::parent_path(Dir);
+llvm::sys::path::append(P, Twine("lib") + ClangLibdirSuffix, "clang",
 CLANG_VERSION_STRING);
   }
   ResourceDir = P.str();

Added: cfe/trunk/test/Index/pch-from-libclang.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/pch-from-libclang.c?rev=296262=auto
==
--- cfe/trunk/test/Index/pch-from-libclang.c (added)
+++ cfe/trunk/test/Index/pch-from-libclang.c Sat Feb 25 12:14:35 2017
@@ -0,0 +1,18 @@
+// Check that clang can use a PCH created from libclang.
+// RUN: c-index-test -write-pch %t.h.pch %s -fmodules 
-fmodules-cache-path=%t.mcp
+// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules 
-fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record
+
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+struct S { int x; };
+
+#else
+
+void test(struct S *s) {
+  s->x = 0;
+}
+
+#endif


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


r296193 - [Test] Make Lit tests C++11 compatible #10

2017-02-25 Thread Charles Li via cfe-commits
Author: lcharles
Date: Fri Feb 24 17:23:53 2017
New Revision: 296193

URL: http://llvm.org/viewvc/llvm-project?rev=296193=rev
Log:
[Test] Make Lit tests C++11 compatible #10

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

Modified:
cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h
cfe/trunk/test/Modules/merge-using-decls.cpp
cfe/trunk/test/SemaCXX/PR9572.cpp
cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp
cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp

Modified: cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h?rev=296193=296192=296193=diff
==
--- cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h (original)
+++ cfe/trunk/test/Modules/Inputs/merge-using-decls/b.h Fri Feb 24 17:23:53 2017
@@ -29,11 +29,13 @@ template struct D : X, T {
   using typename X::t;
 };
 
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
 template struct E : X, T {
   // Mismatch in using/access-declaration-ness.
   T::value;
   X::v;
 };
+#endif
 
 template struct F : X, T {
   // Mismatch in nested-name-specifier.
@@ -46,5 +48,9 @@ template struct F : X, T {
 // Force instantiation.
 typedef C::type I;
 typedef D::t I;
+
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
 typedef E::type I;
+#endif
+
 typedef F::type I;

Modified: cfe/trunk/test/Modules/merge-using-decls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/merge-using-decls.cpp?rev=296193=296192=296193=diff
==
--- cfe/trunk/test/Modules/merge-using-decls.cpp (original)
+++ cfe/trunk/test/Modules/merge-using-decls.cpp Fri Feb 24 17:23:53 2017
@@ -1,6 +1,10 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=1
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=1
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=1
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x 
c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2
 
 #if ORDER == 1
 #include "a.h"
@@ -24,7 +28,11 @@ template int Use() {
 }
 
 template int UseAll() {
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
   return Use() + Use() + Use() + Use(); // 
expected-note 0-2{{instantiation of}}
+#else
+  return Use() + Use() + Use(); // expected-note 
0-2{{instantiation of}}
+#endif
 }
 
 template int UseAll();
@@ -37,8 +45,10 @@ template int UseAll();
 // Here, we're instantiating the definition from 'A' and merging the definition
 // from 'B' into it.
 
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
 // expected-error@b.h:* {{'E::value' from module 'B' is not present in 
definition of 'E' in module 'A'}}
 // expected-error@b.h:* {{'E::v' from module 'B' is not present in definition 
of 'E' in module 'A'}}
+#endif
 
 // expected-error@b.h:* {{'F::type' from module 'B' is not present in 
definition of 'F' in module 'A'}}
 // expected-error@b.h:* {{'F::t' from module 'B' is not present in definition 
of 'F' in module 'A'}}
@@ -55,11 +65,14 @@ template int UseAll();
 // expected-error@b.h:* 2{{'typename' keyword used on a non-type}}
 // expected-error@b.h:* 2{{dependent using declaration resolved to type 
without 'typename'}}
 
+#if __cplusplus <= 199711L // C++11 does not allow access declerations
 // expected-error@a.h:* {{'E::type' from module 'A' is not present in 
definition of 'E' in module 'B'}}
 // expected-error@a.h:* {{'E::t' from module 'A' is not present in definition 
of 'E' in module 'B'}}
 // expected-error@a.h:* {{'E::value' from module 'A' is not present in 
definition of 'E' in module 'B'}}
 // expected-error@a.h:* {{'E::v' from module 'A' is not present in definition 
of 'E' in module 'B'}}
 // expected-note@b.h:* 2{{definition has no member}}
+#endif
+
 
 // expected-error@a.h:* {{'F::type' from module 'A' is not present in 
definition of 'F' in module 'B'}}
 // expected-error@a.h:* {{'F::t' from module 'A' is not present in definition 
of 'F' in module 'B'}}

Modified: cfe/trunk/test/SemaCXX/PR9572.cpp
URL: 

Re: [PATCH] Improved plugin/tool support by expanding an existing attribute

2017-02-25 Thread Marcwell Helpdesk via cfe-commits

As interesting the subject of pluggable attributes may be could we please drop 
that discussion and focus on the intention of and what the patch actually does? 
Two revisions of the patch have been supplied and both should reasonable not 
cause any controversy since they only enriches an already existing 
functionality.

You left out the statement annotation when asking to split the patch, if this 
is causing the controversy please explain why. It would be very interesting to 
know the original intention of the annotate attribute should it deviate in any 
way from being a general purpose information bearer. And as I have tried to 
explain several times, the statement annotations are as important/irrelevant as 
any other type of annotations and with the current support in LLVM/clang it 
won’t support forwarding to IR but it may be used in the AST. Furthermore, if 
you don’t like the what the documentation says about using the annotations for 
tools then drop the documentation or write it yourself, it must not be the 
show-stopper.

Cheers,
Chris

> On 21 feb 2017, at 15:11, Aaron Ballman  wrote:
> 
> On Tue, Feb 14, 2017 at 6:05 AM, Marcwell Helpdesk wrote:
>> The intention of the patch is to extend the functionality of annotations
>> while utilizing existing infrastructure in the AST and IR as much as
>> possible. Annotations are indeed a general purpose solution, sufficient for
>> many use cases, and a complement, not mutual exclusive to pluggable
>> attributes. And don’t forget the realm of AST tools. The compiler should not
>> perform any content checking of annotations but leave that to tool
>> implementations if it is used for other purposes than merely tags. For a
>> more complete support of annotations the AST and IR needs further work but
>> this patch is a step on the way.
>> 
>> Having pluggable attributes would be cool but it would face even greater
>> problems than you describe. Unless pluggable attributes involves writing
>> pluggable AST and IR modules the AST and IR must both support some form of
>> generic containers that could handle any type of attribute with any number
>> of parameters. In either case, it would most likely involve substantial
>> architectural changes to many parts.
> 
> Pluggable attributes do not require these component up front (though
> they could be explored for later iterations), but you are correct in
> that they involve more work than simply piggy-backing off the annotate
> attribute. However, that extra work comes with benefits that expanding
> the annotate attribute will never realize with the end results being
> roughly the same (the attribute metadata still gets passed down to the
> LLVM IR and represented in a manner that AST tools can handle).
> 
>> I have revised the patch by adding a second, optional parameter that makes
>> it possible to group annotations, reducing the risk for collisions and since
>> it is optional it won’t break any existing code. A non-zero group string is
>> prepended to the value string when forwarded to IR. The C++11 attribute has
>> been moved to the clang namespace as requested and unit tests and
>> documentation are updated to reflect the changes.
> 
> Can you please split this patch? The C++11 attribute name, associated
> tests, and documentation of what the attribute does currently are not
> controversial and those changes can go in pretty quickly if separated
> from the greater discussion about how to allow generic, custom
> attributes to be exposed.
> 
> ~Aaron
> 
>> 
>> Cheers,
>> Chris
>> 
>> Modified
>>  include/clang/Basic/Attr.td
>>  include/clang/Basic/AttrDocs.td
>>  lib/CodeGen/CodeGenFunction.cpp
>>  lib/CodeGen/CodeGenModule.cpp
>>  lib/CodeGen/CodeGenModule.h
>>  lib/Sema/SemaDeclAttr.cpp
>>  lib/Sema/SemaStmtAttr.cpp
>>  test/Parser/access-spec-attrs.cpp
>>  test/Sema/annotate.c
>> 
>> Added
>>  test/CodeGenCXX/annotations-field.cpp
>>  test/CodeGenCXX/annotations-global.cpp
>>  test/CodeGenCXX/annotations-loc.cpp
>>  test/CodeGenCXX/annotations-var.cpp
>>  test/SemaCXX/attr-annotate.cpp
>> 
>> 
>> 
>> On 9 feb 2017, at 15:07, Aaron Ballman  wrote:
>> 
>> On Sat, Feb 4, 2017 at 8:26 AM, Marcwell Helpdesk via cfe-commits
>>  wrote:
>> 
>> Many plugins/tools could benefit from having a generic way for communicating
>> control directives directly from the source code to itself (via the AST)
>> when acting, for example, as source code transformers, generators,
>> collectors and the like. Attributes are a suitable way of doing this but
>> most available attributes have predefined functionality and modifying the
>> compiler for every plugin/tool is obviously not an option. There is however
>> one undocumented but existing attribute that could be used for a generic
>> solution if it was slightly modified and expanded - the annotate attribute.
>> 
>> The current functionality of the annotate attribute encompass annotating
>> declarations with 

r296184 - [Test] Make Lit tests C++11 compatible #9

2017-02-25 Thread Charles Li via cfe-commits
Author: lcharles
Date: Fri Feb 24 16:22:05 2017
New Revision: 296184

URL: http://llvm.org/viewvc/llvm-project?rev=296184=rev
Log:
[Test] Make Lit tests C++11 compatible #9

[Test] Make Lit tests C++11 compatible #9

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

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp
cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp
cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
cfe/trunk/test/SemaCXX/no-wchar.cpp
cfe/trunk/test/SemaCXX/virtual-member-functions-key-function.cpp
cfe/trunk/test/SemaCXX/warn-bool-conversion.cpp
cfe/trunk/test/SemaCXX/zero-length-arrays.cpp
cfe/trunk/test/SemaTemplate/instantiate-c99.cpp
cfe/trunk/test/SemaTemplate/temp_explicit.cpp
cfe/trunk/test/SemaTemplate/value-dependent-null-pointer-constant.cpp

Modified: cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp?rev=296184=296183=296184=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-use-after-free.cpp Fri Feb 24 16:22:05 
2017
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple 
-emit-llvm-only %s
+// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple 
-emit-llvm-only -std=c++98 %s
+// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple 
-emit-llvm-only -std=c++11 %s
 // Check that we don't crash.
 // PR12305, PR12315
 
@@ -233,6 +235,7 @@ template < class > class scoped_ptr {
 namespace {
 class
 AAA {
+protected:
   virtual ~
   AAA () {
   }};

Modified: cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp?rev=296184=296183=296184=diff
==
--- cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dynamic-cast-hint.cpp Fri Feb 24 16:22:05 2017
@@ -1,7 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++98 -o - %s 
| FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -std=c++11 -o - %s 
| FileCheck %s
 
-class A { virtual ~A() {} };
-class B { virtual ~B() {} };
+class A { protected: virtual ~A() {} };
+class B { protected: virtual ~B() {} };
 
 class C : A { char x; };
 class D : public A { short y; };

Modified: cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp?rev=296184=296183=296184=diff
==
--- cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp (original)
+++ cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp Fri Feb 24 16:22:05 2017
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=gnu++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=gnu++11 %s
 
 // C++-specific tests for integral constant expressions.
 
@@ -16,9 +18,21 @@ void f() {
 }
 
 int a() {
-  const int t=t; // expected-note {{declared here}} expected-note {{read of 
object outside its lifetime}}
-  switch(1) { // expected-warning {{no case matching constant switch condition 
'1'}}
-case t:; // expected-error {{not an integral constant expression}} 
expected-note {{initializer of 't' is not a constant expression}}
+  const int t=t; // expected-note {{declared here}}
+#if __cplusplus <= 199711L
+  // expected-note@-2 {{read of object outside its lifetime}}
+#endif
+
+  switch(1) {
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{no case matching constant switch condition '1'}}
+#endif
+case t:; // expected-note {{initializer of 't' is not a constant 
expression}}
+#if __cplusplus <= 199711L
+// expected-error@-2 {{not an integral constant expression}}
+#else
+// expected-error@-4 {{case value is not a constant expression}}
+#endif
   }
 }
 
@@ -48,7 +62,10 @@ void pr6373(const unsigned x = 0) {
 namespace rdar9204520 {
   
 struct A {
-  static const int B = int(0.75 * 1000 * 1000); // expected-warning {{not a 
constant expression; folding it to a constant is a GNU extension}}
+  static const int B = int(0.75 * 1000 * 1000);
+#if __cplusplus <= 199711L
+  // expected-warning@-2 {{not a constant expression; folding it to a constant 
is a GNU extension}}
+#endif
 };
 
 int foo() { return A::B; }
@@ -59,10 +76,24 @@ const int x = 10;
 int* y = reinterpret_cast(x); // expected-error {{cannot 
initialize}}
 
 // This isn't an integral constant expression, but make sure it folds anyway.
-struct PR8836 { char _; long long a; }; // expected-warning {{long 

r296256 - Also test OpenBSD/powerpc here for the various types expected to be the same across archs.

2017-02-25 Thread Brad Smith via cfe-commits
Author: brad
Date: Sat Feb 25 10:35:18 2017
New Revision: 296256

URL: http://llvm.org/viewvc/llvm-project?rev=296256=rev
Log:
Also test OpenBSD/powerpc here for the various types expected to be the same 
across archs.

Modified:
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=296256=296255=296256=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Sat Feb 25 10:35:18 2017
@@ -8765,6 +8765,7 @@
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
 // RUN: %clang_cc1 -E -dM -ffreestanding 
-triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck 
-match-full-lines -check-prefix OPENBSD %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
 // OPENBSD:#define __ELF__ 1
 // OPENBSD:#define __INT16_TYPE__ short


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


Re: r296166 - clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

2017-02-25 Thread NAKAMURA Takumi via cfe-commits
Reverted in r296237 .

 (MemoryBuffer)Code is referred after Code.reset().

On Sun, Feb 26, 2017 at 12:40 AM Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Thanks, I had fixed this in 171 a bit over an hour before your mail.
>
> On Feb 24, 2017 5:17 PM, "Renato Golin via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
>
> On 24 February 2017 at 20:49, Nico Weber via cfe-commits
>  wrote:
> > Author: nico
> > Date: Fri Feb 24 14:49:00 2017
> > New Revision: 296166
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=296166=rev
> > Log:
> > clang-format: Don't leave behind temp files in -i mode on Windows,
> PR26125
> >
> > Fix and analysis by Wei Mao  (see bug), test by me.
>
> Hi Nico,
>
> This one looks yours:
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/5005
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4075
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/4386
>
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/4439
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/4450
>
> cheers,
> --renato
> ___
> 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
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r296166 - clang-format: Don't leave behind temp files in -i mode on Windows, PR26125

2017-02-25 Thread Nico Weber via cfe-commits
Thanks, I had fixed this in 171 a bit over an hour before your mail.

On Feb 24, 2017 5:17 PM, "Renato Golin via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> On 24 February 2017 at 20:49, Nico Weber via cfe-commits
>  wrote:
> > Author: nico
> > Date: Fri Feb 24 14:49:00 2017
> > New Revision: 296166
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=296166=rev
> > Log:
> > clang-format: Don't leave behind temp files in -i mode on Windows,
> PR26125
> >
> > Fix and analysis by Wei Mao  (see bug), test by me.
>
> Hi Nico,
>
> This one looks yours:
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/5005
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4075
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/4386
>
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/4439
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/4450
>
> cheers,
> --renato
> ___
> 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: r296171 - Try to unbreak tests after r296166

2017-02-25 Thread Nico Weber via cfe-commits
Can't you just put gnuwin rm on your bot? Our Windows bots are happy with
the test, and having to support an rm without wildcard support seems pretty
strange. (Https://is.gd/chromeclang -> tools -> gnuwin-6.zip are the
executables our bot uses to run llvm tests)

On Feb 24, 2017 8:13 PM, "Yung, Douglas via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> Hi Nico,
>
> The test you added is causing a failure on the PS4 Windows bot. The root
> of the cause is that the Windows version of rm does not accept wildcards
> unfortunately. To fix make it work on Windows, you likely need to specify
> exactly what files/directories you want to delete without using a wildcard:
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_
> 64-scei-ps4-windows10pro-fast/builds/6030:
>
> $ "rm" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.obj\tools\clang\test\Format\Output/*"
> # command stderr:
> rm: cannot remove `C:\\Buildbot\\Slave\\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\\llvm.obj\\tools\\clang\\test\\Format\\Output/*':
> Invalid argument
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_
> 64-scei-ps4-windows10pro-fast/builds/6031:
>
> $ "rm" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.obj\tools\clang\test\Format\Output/inplace*"
> # command stderr:
> rm: cannot remove `C:\\Buildbot\\Slave\\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\\llvm.obj\\tools\\clang\\test\\Format\\Output/inplace*':
> Invalid argument
>
> Can you fix the test?
>
> Douglas Yung
>
> > -Original Message-
> > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of
> > Nico Weber via cfe-commits
> > Sent: Friday, February 24, 2017 13:02
> > To: cfe-commits@lists.llvm.org
> > Subject: r296171 - Try to unbreak tests after r296166
> >
> > Author: nico
> > Date: Fri Feb 24 15:01:43 2017
> > New Revision: 296171
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=296171=rev
> > Log:
> > Try to unbreak tests after r296166
> >
> > Looks like %T isn't per-test but per-test-directory, and the rm was
> deleting
> > temp files written by other tests in test/Format.  Limit the rm's scope
> a bit.
> >
> > Modified:
> > cfe/trunk/test/Format/inplace.cpp
> >
> > Modified: cfe/trunk/test/Format/inplace.cpp
> > URL: http://llvm.org/viewvc/llvm-
> > project/cfe/trunk/test/Format/inplace.cpp?rev=296171=
> 296170=296171=
> > diff
> > 
> ==
> > --- cfe/trunk/test/Format/inplace.cpp (original)
> > +++ cfe/trunk/test/Format/inplace.cpp Fri Feb 24 15:01:43 2017
> > @@ -1,6 +1,6 @@
> >  // Regression test to check that clang-format does not leave behind
> temporary
> > // files on Windows when doing in-place formatting.
> > -// RUN: rm %T/*
> > +// RUN: rm %T/inplace*
> >  // RUN: cp %s %T/inplace.cpp
> >  // RUN: clang-format -style=LLVM -i %T/inplace.cpp  // RUN: ls %T >
> > %T/files.txt
> >
> >
> > ___
> > 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
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30378: [DebugInfo] [DWARFv5] Collect calling convention info for C++ types during codegen

2017-02-25 Thread Victor Leschuk via Phabricator via cfe-commits
vleschuk created this revision.

When generating debug info collect information on calling convention for types 
(http://www.dwarfstd.org/ShowIssue.php?issue=141215.1) and pass it to backend.


https://reviews.llvm.org/D30378

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-type-calling-conventions.cpp


Index: test/CodeGenCXX/debug-info-type-calling-conventions.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-type-calling-conventions.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -dwarf-version=5 -std=c++11 -debug-info-kind=limited 
-emit-llvm -o - | FileCheck %s
+
+struct DefaultDtor {
+  ~DefaultDtor() = default;
+};
+
+void f(DefaultDtor arg) {}
+
+// CHECK: !DICompositeType({{.*}}name: "DefaultDtor"{{.*}}argABI: 
DW_CC_pass_by_value
+
+class UserDtor {
+public:
+  ~UserDtor() {}
+};
+
+void f(UserDtor arg) {}
+
+// CHECK: !DICompositeType({{.*}}name: "UserDtor"{{.*}}argABI: 
DW_CC_pass_by_reference
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -287,6 +287,9 @@
   void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F,
  SmallVectorImpl ,
  llvm::DICompositeType *RecordTy);
+
+  void CollectArgABIInfo(const CXXRecordDecl *Decl,
+ llvm::DICompositeType *RecordTy);
   /// @}
 
   /// Create a new lexical block node and push it on the stack.
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -944,6 +944,21 @@
   return 0;
 }
 
+static llvm::dwarf::CallingConvention getArgABI(const CodeGenModule ,
+const CXXRecordDecl *CXXDecl) {
+  switch (CGM.getCXXABI().getRecordArgABI(CXXDecl)) {
+  case CGCXXABI::RAA_Default:
+return llvm::dwarf::DW_CC_pass_by_value;
+  case CGCXXABI::RAA_Indirect:
+return llvm::dwarf::DW_CC_pass_by_reference;
+  case CGCXXABI::RAA_DirectInMemory:
+// DWARFv5 doesn't specify explicit DW_CC_* value for this case,
+// thus we just return 'normal' here.
+return llvm::dwarf::DW_CC_normal;
+  }
+  return llvm::dwarf::DW_CC_normal;
+}
+
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
   llvm::DIFile *Unit) {
   SmallVector EltTys;
@@ -1671,6 +1686,11 @@
   EltTys.push_back(VPtrMember);
 }
 
+void CGDebugInfo::CollectArgABIInfo(const CXXRecordDecl *Decl,
+llvm::DICompositeType *RecordTy) {
+  DBuilder.replaceArgABI(RecordTy, getArgABI(CGM, Decl));
+}
+
 llvm::DIType *CGDebugInfo::getOrCreateRecordType(QualType RTy,
  SourceLocation Loc) {
   assert(DebugKind >= codegenoptions::LimitedDebugInfo);
@@ -1881,6 +1901,7 @@
   if (CXXDecl) {
 CollectCXXBases(CXXDecl, DefUnit, EltTys, FwdDecl);
 CollectVTableInfo(CXXDecl, DefUnit, EltTys, FwdDecl);
+CollectArgABIInfo(CXXDecl, FwdDecl);
   }
 
   // Collect data fields (including static variables and any initializers).


Index: test/CodeGenCXX/debug-info-type-calling-conventions.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-type-calling-conventions.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -dwarf-version=5 -std=c++11 -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
+
+struct DefaultDtor {
+  ~DefaultDtor() = default;
+};
+
+void f(DefaultDtor arg) {}
+
+// CHECK: !DICompositeType({{.*}}name: "DefaultDtor"{{.*}}argABI: DW_CC_pass_by_value
+
+class UserDtor {
+public:
+  ~UserDtor() {}
+};
+
+void f(UserDtor arg) {}
+
+// CHECK: !DICompositeType({{.*}}name: "UserDtor"{{.*}}argABI: DW_CC_pass_by_reference
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -287,6 +287,9 @@
   void CollectVTableInfo(const CXXRecordDecl *Decl, llvm::DIFile *F,
  SmallVectorImpl ,
  llvm::DICompositeType *RecordTy);
+
+  void CollectArgABIInfo(const CXXRecordDecl *Decl,
+ llvm::DICompositeType *RecordTy);
   /// @}
 
   /// Create a new lexical block node and push it on the stack.
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -944,6 +944,21 @@
   return 0;
 }
 
+static llvm::dwarf::CallingConvention getArgABI(const CodeGenModule ,
+const CXXRecordDecl *CXXDecl) {
+  switch (CGM.getCXXABI().getRecordArgABI(CXXDecl)) {
+  case CGCXXABI::RAA_Default:
+return llvm::dwarf::DW_CC_pass_by_value;
+  case 

[PATCH] D30375: Function with unparsed body is a definition

2017-02-25 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff created this revision.

While a function body is being parsed, the function declaration is not 
considered
as a definition because it does not have a body yet. In some cases it leads to
incorrect interpretation, the case is presented in
https://bugs.llvm.org/show_bug.cgi?id=14785:

  template struct Somewhat {
void internal() const {}
friend void operator+(int const &, Somewhat const &) {}
  };
  void operator+(int const &, Somewhat const ) { x.internal(); }

When statement `x.internal()` in the body of global `operator+` is parsed, the 
type
of `x` must be completed, so the instantiation of `Somewhat` is started. 
It
instantiates the declaration of `operator+` defined inline, and makes a check 
for
redefinition. The check does not detect another definition because the 
declaration
of `operator+` is still not defining as does not have a body yet.

This change solves this problem by using flag `WillHaveBody`. It introduces new
semantic action `ActOnStartFunctionBody`, which set this flag so that 
definitions
that do not have body (such as deleted functions) do not have this flag.

This change fixes PR14785.

The fix requires https://reviews.llvm.org/D26065 be applied otherwise 
diagnostics is awful.


https://reviews.llvm.org/D30375

Files:
  include/clang/AST/Decl.h
  include/clang/Sema/Sema.h
  lib/AST/Decl.cpp
  lib/Parse/Parser.cpp
  lib/Sema/SemaCUDA.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/SemaCXX/friend2.cpp

Index: test/SemaCXX/friend2.cpp
===
--- test/SemaCXX/friend2.cpp
+++ test/SemaCXX/friend2.cpp
@@ -170,3 +170,15 @@
 template class Test;
 
 }
+
+namespace pr14785 {
+template
+struct Somewhat {
+  void internal() const { }
+  friend void operator+(int const &, Somewhat const &) {}  // expected-error{{redefinition of 'operator+'}}
+};
+
+void operator+(int const &, Somewhat const ) {  // expected-note {{previous definition is here}}
+  x.internal();  // expected-note{{in instantiation of template class 'pr14785::Somewhat' requested here}}
+}
+}
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3832,6 +3832,7 @@
 SubstQualifier(*this, PatternDecl, Function, TemplateArgs);
 
 ActOnStartOfFunctionDef(nullptr, Function);
+ActOnStartFunctionBody(Function);
 
 // Enter the scope of this instantiation. We don't use
 // PushDeclContext because we don't have a scope.
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11804,11 +11804,6 @@
   return D;
   }
 
-  // Mark this function as "will have a body eventually".  This lets users to
-  // call e.g. isInlineDefinitionExternallyVisible while we're still parsing
-  // this function.
-  FD->setWillHaveBody();
-
   // If we are instantiating a generic lambda call operator, push
   // a LambdaScopeInfo onto the function stack.  But use the information
   // that's already been calculated (ActOnLambdaExpr) to prime the current
@@ -11978,6 +11973,19 @@
   return Decl;
 }
 
+/// Semantic action called by parser when it expects that the current function
+/// definition will have a body statement.
+void Sema::ActOnStartFunctionBody(Decl *D) {
+  if (!D)
+return;
+  if (FunctionDecl *FD = dyn_cast(D)) {
+// Mark this function as "will have a body eventually".  This lets users to
+// call e.g. isInlineDefinitionExternallyVisible while we're still parsing
+// this function.
+FD->setWillHaveBody();
+  }
+}
+
 Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) {
   return ActOnFinishFunctionBody(D, BodyArg, false);
 }
Index: lib/Sema/SemaCUDA.cpp
===
--- lib/Sema/SemaCUDA.cpp
+++ lib/Sema/SemaCUDA.cpp
@@ -629,12 +629,6 @@
   // emitted, because (say) the definition could include "inline".
   FunctionDecl *Def = FD->getDefinition();
 
-  // We may currently be parsing the body of FD, in which case
-  // FD->getDefinition() will be null, but we still want to treat FD as though
-  // it's a definition.
-  if (!Def && FD->willHaveBody())
-Def = FD;
-
   if (Def &&
   !isDiscardableGVALinkage(S.getASTContext().GetGVALinkageForFunction(Def)))
 return true;
Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -1194,6 +1194,8 @@
 return Actions.ActOnFinishFunctionBody(Res, nullptr, false);
   }
 
+  Actions.ActOnStartFunctionBody(Res);
+
   if (Tok.is(tok::kw_try))
 return ParseFunctionTryBlock(Res, BodyScope);
 
Index: lib/AST/Decl.cpp
===
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -2529,7