r269551 - Handle injected class names in the ASTImporter.

2016-05-13 Thread Sean Callanan via cfe-commits
Author: spyffe
Date: Sat May 14 00:43:57 2016
New Revision: 269551

URL: http://llvm.org/viewvc/llvm-project?rev=269551=rev
Log:
Handle injected class names in the ASTImporter.

Every class as parsed by Clang has a forward declaration of itself as a member:

class A {
  class A;
  ...
}

but when the parser generates this it ensures that the RecordTypes for the two 
are the same.  This makes (among other things) inheritance work.  This patch
fixes a bug where the ASTImporter generated two separate RecordTypes when
importing the class and the contained forward declaration, and adds a test case.

Thanks to Doug Gregor for advice on this.

Added:
cfe/trunk/test/ASTMerge/Inputs/inheritance-base.cpp
cfe/trunk/test/ASTMerge/inheritance.cpp
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=269551=269550=269551=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Sat May 14 00:43:57 2016
@@ -2820,8 +2820,17 @@ Decl *ASTNodeImporter::VisitRecordDecl(R
 Decl *CDecl = Importer.Import(DCXX->getLambdaContextDecl());
 if (DCXX->getLambdaContextDecl() && !CDecl)
   return nullptr;
-D2CXX->setLambdaMangling(DCXX->getLambdaManglingNumber(),
- CDecl);
+D2CXX->setLambdaMangling(DCXX->getLambdaManglingNumber(), CDecl);
+  } else if (DCXX->isInjectedClassName()) {
 
+// We have to be careful to do a similar dance to the one in   
 
+// Sema::ActOnStartCXXMemberDeclarations   
 
+CXXRecordDecl *const PrevDecl = nullptr;   
 
+const bool DelayTypeCreation = true;   
 
+D2CXX = CXXRecordDecl::Create( 
 
+Importer.getToContext(), D->getTagKind(), DC, StartLoc, Loc,   
 
+Name.getAsIdentifierInfo(), PrevDecl, DelayTypeCreation);  
 
+Importer.getToContext().getTypeDeclType(   
 
+D2CXX, llvm::dyn_cast(DC)); 
 
   } else {
 D2CXX = CXXRecordDecl::Create(Importer.getToContext(),
   D->getTagKind(),

Added: cfe/trunk/test/ASTMerge/Inputs/inheritance-base.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/Inputs/inheritance-base.cpp?rev=269551=auto
==
--- cfe/trunk/test/ASTMerge/Inputs/inheritance-base.cpp (added)
+++ cfe/trunk/test/ASTMerge/Inputs/inheritance-base.cpp Sat May 14 00:43:57 2016
@@ -0,0 +1,7 @@
+class A
+{
+public:
+  int x;
+  A(int _x) : x(_x) {
+  }
+};

Added: cfe/trunk/test/ASTMerge/inheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/inheritance.cpp?rev=269551=auto
==
--- cfe/trunk/test/ASTMerge/inheritance.cpp (added)
+++ cfe/trunk/test/ASTMerge/inheritance.cpp Sat May 14 00:43:57 2016
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -emit-pch -o 
%t.1.ast %S/Inputs/inheritance-base.cpp
+// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++1z -ast-merge %t.1.ast 
-fsyntax-only -verify %s
+// expected-no-diagnostics
+
+class B : public A {
+  B(int _a) : A(_a) {
+  }
+};


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


Re: [PATCH] D20261: [compiler-rt] Fix multi-configuration output paths

2016-05-13 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

Great! Lgtm


http://reviews.llvm.org/D20261



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


r269549 - Revert "Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC""

2016-05-13 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Sat May 14 00:39:45 2016
New Revision: 269549

URL: http://llvm.org/viewvc/llvm-project?rev=269549=rev
Log:
Revert "Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, 
NFC""

This reverts commit r269492 as the corresponding LLVM commit was
reverted due to lots of warnings. See the review thread for the original
LLVM commit (r269491) for details.

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269549=269548=269549=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat May 14 00:39:45 2016
@@ -141,13 +141,11 @@ CodeGenModule::CodeGenModule(ASTContext
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (auto E = ReaderOrErr.takeError()) {
+if (std::error_code EC = ReaderOrErr.getError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
-getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-  << EI.message();
-  });
+  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+<< EC.message();
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269549=269548=269549=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Sat May 14 00:39:45 2016
@@ -800,21 +800,20 @@ void CodeGenPGO::loadRegionCounts(llvm::
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::Expected RecordExpected =
+  llvm::ErrorOr RecordErrorOr =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (auto E = RecordExpected.takeError()) {
-auto IPE = llvm::InstrProfError::take(std::move(E));
-if (IPE == llvm::instrprof_error::unknown_function)
+  if (std::error_code EC = RecordErrorOr.getError()) {
+if (EC == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (IPE == llvm::instrprof_error::hash_mismatch)
+else if (EC == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (IPE == llvm::instrprof_error::malformed)
+else if (EC == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  
llvm::make_unique(std::move(RecordExpected.get()));
+  llvm::make_unique(std::move(RecordErrorOr.get()));
   RegionCounts = ProfRecord->Counts;
 }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269549=269548=269549=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat May 14 00:39:45 2016
@@ -403,8 +403,7 @@ static void setPGOUseInstrumentor(CodeGe
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (auto E = ReaderOrErr.takeError()) {
-llvm::consumeError(std::move(E));
+  if (ReaderOrErr.getError()) {
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


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


r269546 - Added support to the ASTImporter for C++ constructor initializers.

2016-05-13 Thread Sean Callanan via cfe-commits
Author: spyffe
Date: Sat May 14 00:20:31 2016
New Revision: 269546

URL: http://llvm.org/viewvc/llvm-project?rev=269546=rev
Log:
Added support to the ASTImporter for C++ constructor initializers.

Thanks to Aleksei Sidorin for review and advice.

Added:
cfe/trunk/test/ASTMerge/Inputs/init-ctors-classes.cpp
cfe/trunk/test/ASTMerge/init-ctors.cpp
Modified:
cfe/trunk/include/clang/AST/ASTImporter.h
cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/include/clang/AST/ASTImporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTImporter.h?rev=269546=269545=269546=diff
==
--- cfe/trunk/include/clang/AST/ASTImporter.h (original)
+++ cfe/trunk/include/clang/AST/ASTImporter.h Sat May 14 00:20:31 2016
@@ -23,6 +23,7 @@
 
 namespace clang {
   class ASTContext;
+  class CXXCtorInitializer;
   class Decl;
   class DeclContext;
   class DiagnosticsEngine;
@@ -204,6 +205,14 @@ namespace clang {
 /// \returns the equivalent file ID in the source manager of the "to"
 /// context.
 FileID Import(FileID);
+
+/// \brief Import the given C++ constructor initializer from the "from"
+/// context into the "to" context.
+///
+/// \returns the equivalent initializer in the "to" context.
+CXXCtorInitializer *Import(CXXCtorInitializer *FromInit);
+
+
 
 /// \brief Import the definition of the given declaration, including all of
 /// the declarations it contains.

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=269546=269545=269546=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Sat May 14 00:20:31 2016
@@ -3020,6 +3020,22 @@ Decl *ASTNodeImporter::VisitFunctionDecl
 D->isInlineSpecified(), 
 D->isImplicit(),
 D->isConstexpr());
+if (unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) {
+  SmallVector CtorInitializers;
+  for (CXXCtorInitializer *I : FromConstructor->inits()) {
+CXXCtorInitializer *ToI =
+cast_or_null(Importer.Import(I));
+if (!ToI && I)
+  return nullptr;
+CtorInitializers.push_back(ToI);
+  }
+  CXXCtorInitializer **Memory =
+  new (Importer.getToContext()) CXXCtorInitializer *[NumInitializers];
+  std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
+  CXXConstructorDecl *ToCtor = llvm::cast(ToFunction);
+  ToCtor->setCtorInitializers(Memory);
+  ToCtor->setNumCtorInitializers(NumInitializers);
+}
   } else if (isa(D)) {
 ToFunction = CXXDestructorDecl::Create(Importer.getToContext(),
cast(DC),
@@ -6351,6 +6367,72 @@ FileID ASTImporter::Import(FileID FromID
   return ToID;
 }
 
+CXXCtorInitializer *ASTImporter::Import(CXXCtorInitializer *From) {
+  Expr *ToExpr = Import(From->getInit());
+  if (!ToExpr && From->getInit())
+return nullptr;
+
+  if (From->isBaseInitializer()) {
+TypeSourceInfo *ToTInfo = Import(From->getTypeSourceInfo());
+if (!ToTInfo && From->getTypeSourceInfo())
+  return nullptr;
+
+return new (ToContext) CXXCtorInitializer(
+ToContext, ToTInfo, From->isBaseVirtual(), 
Import(From->getLParenLoc()),
+ToExpr, Import(From->getRParenLoc()),
+From->isPackExpansion() ? Import(From->getEllipsisLoc())
+: SourceLocation());
+  } else if (From->isMemberInitializer()) {
+FieldDecl *ToField =
+llvm::cast_or_null(Import(From->getMember()));
+if (!ToField && From->getMember())
+  return nullptr;
+
+return new (ToContext) CXXCtorInitializer(
+ToContext, ToField, Import(From->getMemberLocation()),
+Import(From->getLParenLoc()), ToExpr, Import(From->getRParenLoc()));
+  } else if (From->isIndirectMemberInitializer()) {
+IndirectFieldDecl *ToIField = llvm::cast_or_null(
+Import(From->getIndirectMember()));
+if (!ToIField && From->getIndirectMember())
+  return nullptr;
+
+return new (ToContext) CXXCtorInitializer(
+ToContext, ToIField, Import(From->getMemberLocation()),
+Import(From->getLParenLoc()), ToExpr, Import(From->getRParenLoc()));
+  } else if (From->isDelegatingInitializer()) {
+TypeSourceInfo *ToTInfo = Import(From->getTypeSourceInfo());
+if (!ToTInfo && From->getTypeSourceInfo())
+  return nullptr;
+
+return new (ToContext)
+CXXCtorInitializer(ToContext, ToTInfo, Import(From->getLParenLoc()),
+   ToExpr, Import(From->getRParenLoc()));
+  } else if (unsigned NumArrayIndices = From->getNumArrayIndices()) {
+FieldDecl *ToField =
+

Re: [PATCH] D20261: [compiler-rt] Fix multi-configuration output paths

2016-05-13 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

In http://reviews.llvm.org/D20261#430151, @rnk wrote:

> Will this put the libraries in build/Release/bin/../lib/. aka 
> build/Release/lib, or will they collide between build types?


If I get your question correctly, they won't collide since the first folder 
below build is the configuration (a.k.a Debug/Release).

Before the patch, this is the output directory:

  build/Release/lib/clang/3.9.0/lib/windows/Release

The value in MSVC is:

  C:\src\llvm\build\$(Configuration)\lib\clang\3.9.0\lib\windows\Release\

The last `Release` folder is redundant.

After applying this patch, the MSVC value is:

  C:\src\llvm\build\$(Configuration)\lib\clang\3.9.0\lib\windows\

Library files are produced in this folder:

  build/Release/lib/clang/3.9.0/lib/windows


http://reviews.llvm.org/D20261



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


Re: r269220 - [MSVC] Implementation of __unaligned as a proper type qualifier

2016-05-13 Thread David Majnemer via cfe-commits
FYI, the following is a little shorter:
using Ty = int () __unaligned;

Also, this case (in C mode) is interesting:
void f(int x[__unaligned 4]);

DeclaratorChunk::getArray will truncate the TypeQuals
because ArrayTypeInfo's TypeQuals doesn't have enough bits.

similar issues arise with:
struct A;

void (A::*__unaligned vpa)();

On Fri, May 13, 2016 at 4:03 PM,  wrote:

> Hi David,
>
> Thanks for letting me know -- will investigate after the weekend.
>
> Yours,
> Andrey
>
> Отправлено с iPad
>
> 13 мая 2016 г., в 20:33, David Majnemer 
> написал(а):
>
> This seems to crash clang:
> struct S {
>   void f() __unaligned;
> };
> void S::f() __unaligned {
> }
>
> clang/lib/Sema/DeclSpec.cpp:214: static clang::DeclaratorChunk
> clang::DeclaratorChunk::getFunction(bool, bool, clang::SourceLocation,
> clang::DeclaratorChunk::ParamInfo *, unsigned int, clang::SourceLocation,
> clang::SourceLocation, unsigned int, bool, clang::SourceLocation,
> clang::SourceLocation, clang::SourceLocation, clang::SourceLocation,
> clang::SourceLocation, clang::ExceptionSpecificationType,
> clang::SourceRange, ParsedType *, clang::SourceRange *, unsigned int,
> clang::Expr *, CachedTokens *, clang::SourceLocation,
> clang::SourceLocation, clang::Declarator &, TypeResult): Assertion
> `I.Fun.TypeQuals == TypeQuals && "bitfield overflow"' failed.
>
>
> On Wed, May 11, 2016 at 11:38 AM, Andrey Bokhanko via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: asbokhan
>> Date: Wed May 11 13:38:21 2016
>> New Revision: 269220
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=269220=rev
>> Log:
>> [MSVC] Implementation of __unaligned as a proper type qualifier
>>
>> This patch implements __unaligned (MS extension) as a proper type
>> qualifier
>> (before that, it was implemented as an ignored attribute).
>>
>> It also fixes PR27367 and PR27666.
>>
>> Differential Revision: http://reviews.llvm.org/D20103
>>
>> Modified:
>> cfe/trunk/include/clang/AST/Type.h
>> cfe/trunk/include/clang/Basic/AddressSpaces.h
>> cfe/trunk/include/clang/Basic/Attr.td
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/include/clang/Sema/DeclSpec.h
>> cfe/trunk/include/clang/Sema/Sema.h
>> cfe/trunk/lib/AST/MicrosoftMangle.cpp
>> cfe/trunk/lib/AST/TypePrinter.cpp
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Parse/ParseTentative.cpp
>> cfe/trunk/lib/Sema/DeclSpec.cpp
>> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
>> cfe/trunk/lib/Sema/SemaDecl.cpp
>> cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>> cfe/trunk/lib/Sema/SemaExpr.cpp
>> cfe/trunk/lib/Sema/SemaOverload.cpp
>> cfe/trunk/lib/Sema/SemaType.cpp
>> cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
>> cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp
>> cfe/trunk/test/Sema/MicrosoftExtensions.c
>> cfe/trunk/test/Sema/address_spaces.c
>> cfe/trunk/test/Sema/invalid-assignment-constant-address-space.c
>> cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/Type.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=269220=269219=269220=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/Type.h (original)
>> +++ cfe/trunk/include/clang/AST/Type.h Wed May 11 13:38:21 2016
>> @@ -111,6 +111,7 @@ namespace clang {
>>  /// The collection of all-type qualifiers we support.
>>  /// Clang supports five independent qualifiers:
>>  /// * C99: const, volatile, and restrict
>> +/// * MS: __unaligned
>>  /// * Embedded C (TR18037): address spaces
>>  /// * Objective C: the GC attributes (none, weak, or strong)
>>  class Qualifiers {
>> @@ -152,8 +153,8 @@ public:
>>
>>enum {
>>  /// The maximum supported address space number.
>> -/// 24 bits should be enough for anyone.
>> -MaxAddressSpace = 0xffu,
>> +/// 23 bits should be enough for anyone.
>> +MaxAddressSpace = 0x7fu,
>>
>>  /// The width of the "fast" qualifier mask.
>>  FastWidth = 3,
>> @@ -265,6 +266,13 @@ public:
>>  Mask |= mask;
>>}
>>
>> +  bool hasUnaligned() const { return Mask & UMask; }
>> +  void setUnaligned(bool flag) {
>> +Mask = (Mask & ~UMask) | (flag ? UMask : 0);
>> +  }
>> +  void removeUnaligned() { Mask &= ~UMask; }
>> +  void addUnaligned() { Mask |= UMask; }
>> +
>>bool hasObjCGCAttr() const { return Mask & GCAttrMask; }
>>GC getObjCGCAttr() const { return GC((Mask & GCAttrMask) >>
>> GCAttrShift); }
>>void setObjCGCAttr(GC type) {
>> @@ -433,7 +441,9 @@ public:
>> // ObjC lifetime qualifiers must match exactly.
>> getObjCLifetime() == other.getObjCLifetime() &&
>> // CVR qualifiers may subset.
>> -   (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask &
>> CVRMask));
>> +   (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask &

r269530 - When typo-correcting a using-declaration, actually correct the name of the

2016-05-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri May 13 20:58:49 2016
New Revision: 269530

URL: http://llvm.org/viewvc/llvm-project?rev=269530=rev
Log:
When typo-correcting a using-declaration, actually correct the name of the
UsingDecl (so that redeclaration lookup can find it).

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/using-decl-1.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=269530=269529=269530=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri May 13 20:58:49 2016
@@ -7998,6 +7998,9 @@ public:
 if (Candidate.WillReplaceSpecifier() && 
!Candidate.getCorrectionSpecifier())
   return false;
 
+// FIXME: Don't correct to a name that CheckUsingDeclRedeclaration would
+// reject.
+
 if (RequireMemberOf) {
   auto *FoundRecord = dyn_cast(ND);
   if (FoundRecord && FoundRecord->isInjectedClassName()) {
@@ -8207,6 +8210,7 @@ NamedDecl *Sema::BuildUsingDeclaration(S
   R.addDecl(Ctor);
   } else {
 // FIXME: Pick up all the declarations if we found an overloaded 
function.
+NameInfo.setName(ND->getDeclName());
 R.addDecl(ND);
   }
 } else {

Modified: cfe/trunk/test/SemaCXX/using-decl-1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-1.cpp?rev=269530=269529=269530=diff
==
--- cfe/trunk/test/SemaCXX/using-decl-1.cpp (original)
+++ cfe/trunk/test/SemaCXX/using-decl-1.cpp Fri May 13 20:58:49 2016
@@ -243,6 +243,41 @@ namespace PR19171 {
   struct F : E {
 using E::EE; // expected-error-re {{no member named 'EE' in 
'PR19171::E'{{$
   };
+
+  struct TypoDuplicate { // expected-note 0-4{{here}}
+TypoDuplicate(int);
+void foobar(); // expected-note 2{{here}}
+  };
+  struct TypoDuplicateDerived1 : TypoDuplicate {
+#if __cplusplus >= 201103L
+using TypoDuplicate::TypoFuplicate; // expected-error {{did you mean 
'TypoDuplicate'}} expected-note {{previous}}
+using TypoDuplicate::TypoDuplicate; // expected-error {{redeclaration}}
+#endif
+using TypoDuplicate::goobar; // expected-error {{did you mean 'foobar'}} 
expected-note {{previous}}
+using TypoDuplicate::foobar; // expected-error {{redeclaration}}
+  };
+  struct TypoDuplicateDerived2 : TypoDuplicate {
+#if __cplusplus >= 201103L
+using TypoFuplicate::TypoDuplicate; // expected-error {{did you mean 
'TypoDuplicate'}} expected-note {{previous}}
+using TypoDuplicate::TypoDuplicate; // expected-error {{redeclaration}}
+#endif
+  };
+  struct TypoDuplicateDerived3 : TypoDuplicate {
+#if __cplusplus >= 201103L
+// FIXME: Don't suggest a correction that would lead to a redeclaration
+// error here... or at least diagnose the error.
+using TypoDuplicate::TypoDuplicate;
+using TypoDuplicate::TypoFuplicate; // expected-error {{did you mean 
'TypoDuplicate'}}
+#endif
+using TypoDuplicate::foobar;
+using TypoDuplicate::goobar; // expected-error {{did you mean 'foobar'}}
+  };
+  struct TypoDuplicateDerived4 : TypoDuplicate {
+#if __cplusplus >= 201103L
+using TypoDuplicate::TypoDuplicate; // expected-note {{previous}}
+using TypoFuplicate::TypoDuplicate; // expected-error {{did you mean 
'TypoDuplicate'}} expected-error {{redeclaration}}
+#endif
+  };
 }
 
 namespace TypoCorrectTemplateMember {


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


Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-13 Thread Richard Smith via cfe-commits
rsmith accepted this revision.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5369
@@ -5368,1 +5368,3 @@
+def warn_binding_null_to_reference : Warning<
+  "binding null pointer to reference has undefined behavior">, 
InGroup;
 def note_indirection_through_null : Note<

Maybe "binding dereferenced null pointer [...]"?


Comment at: lib/Sema/SemaInit.cpp:6203
@@ +6202,3 @@
+UO->getSubExpr()->IgnoreParenCasts()->
+   isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull)) {
+S.DiagRuntimeBehavior(UO->getOperatorLoc(), UO,

Something fishy in the indentation here?


http://reviews.llvm.org/D19851



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


r269528 - Fix some typos.

2016-05-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri May 13 20:21:40 2016
New Revision: 269528

URL: http://llvm.org/viewvc/llvm-project?rev=269528=rev
Log:
Fix some typos.

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

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=269528=269527=269528=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri May 13 20:21:40 2016
@@ -519,10 +519,10 @@ Address EmitVAArgInstr(CodeGenFunction &
 
   if (AI.isIndirect()) {
 assert(!AI.getPaddingType() &&
-   "Unepxected PaddingType seen in arginfo in generic VAArg emitter!");
+   "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
 assert(
 !AI.getIndirectRealign() &&
-"Unepxected IndirectRealign seen in arginfo in generic VAArg 
emitter!");
+"Unexpected IndirectRealign seen in arginfo in generic VAArg 
emitter!");
 
 auto TyInfo = CGF.getContext().getTypeInfoInChars(Ty);
 CharUnits TyAlignForABI = TyInfo.second;
@@ -537,13 +537,13 @@ Address EmitVAArgInstr(CodeGenFunction &
"Unexpected ArgInfo Kind in generic VAArg emitter!");
 
 assert(!AI.getInReg() &&
-   "Unepxected InReg seen in arginfo in generic VAArg emitter!");
+   "Unexpected InReg seen in arginfo in generic VAArg emitter!");
 assert(!AI.getPaddingType() &&
-   "Unepxected PaddingType seen in arginfo in generic VAArg emitter!");
+   "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
 assert(!AI.getDirectOffset() &&
-   "Unepxected DirectOffset seen in arginfo in generic VAArg 
emitter!");
+   "Unexpected DirectOffset seen in arginfo in generic VAArg 
emitter!");
 assert(!AI.getCoerceToType() &&
-   "Unepxected CoerceToType seen in arginfo in generic VAArg 
emitter!");
+   "Unexpected CoerceToType seen in arginfo in generic VAArg 
emitter!");
 
 Address Temp = CGF.CreateMemTemp(Ty, "varet");
 Val = CGF.Builder.CreateVAArg(VAListAddr.getPointer(), 
CGF.ConvertType(Ty));
@@ -633,7 +633,7 @@ private:
   ABIArgInfo classifyArgumentType(QualType Ty) const;
 
   // DefaultABIInfo's classifyReturnType and classifyArgumentType are
-  // non-virtual, but computeInfo and EmitVAArg is virtual, so we
+  // non-virtual, but computeInfo and EmitVAArg are virtual, so we
   // overload them.
   void computeInfo(CGFunctionInfo ) const override {
 if (!getCXXABI().classifyReturnType(FI))


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


[PATCH] D20266: [Modules] Use vfs for (recursive) directory iteration

2016-05-13 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added a reviewer: benlangmuir.
bruno added a subscriber: cfe-commits.

Clang performs directory walk while searching headers inside modules by
using the ::sys::fs instead of ::vfs. This prevents any code that uses
the VFS (e.g, reproducer scripts) to actually find such headers, since
the VFS will never be searched for those.

Change these places to use vfs::recursive_directory_iterator and
vfs::directory_iterator instead.

http://reviews.llvm.org/D20266

Files:
  lib/Frontend/FrontendActions.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/ModuleMap.cpp
  test/Modules/crash-vfs-umbrella-frameworks.m

Index: test/Modules/crash-vfs-umbrella-frameworks.m
===
--- test/Modules/crash-vfs-umbrella-frameworks.m
+++ test/Modules/crash-vfs-umbrella-frameworks.m
@@ -40,3 +40,16 @@
 // CHECKYAML-NEXT:  'external-contents': "/[[PATH]]/i/Frameworks/B.framework/Headers/B.h"
 
 @import I;
+
+// Run the reproducer script - regular exit code is enough to test it works. The
+// intent here is to guarantee that the collect umbrella headers into the VFS
+// can be used, testing that vfs::recursive_directory_iterator is used correctly
+// Make sure to erase the include paths used to build the modules to guarantee
+// that the VFS overlay won't fallback to use it. Also wipe out the module cache
+// to force header search.
+//
+// RUN: cd %t
+// RUN: rm -rf i
+// RUN: rm -rf crash-vfs-umbrella-*.cache/modules/*
+// RUN: chmod 755 crash-vfs-*.sh
+// RUN: ./crash-vfs-*.sh
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -711,13 +711,15 @@
 = StringRef(FrameworkDir->getName());
   llvm::sys::path::append(SubframeworksDirName, "Frameworks");
   llvm::sys::path::native(SubframeworksDirName);
-  for (llvm::sys::fs::directory_iterator Dir(SubframeworksDirName, EC), DirEnd;
+  vfs::FileSystem  = *FileMgr.getVirtualFileSystem();
+  for (vfs::directory_iterator Dir = FS.dir_begin(SubframeworksDirName, EC),
+   DirEnd;
Dir != DirEnd && !EC; Dir.increment(EC)) {
-if (!StringRef(Dir->path()).endswith(".framework"))
+if (!StringRef(Dir->getName()).endswith(".framework"))
   continue;
 
-if (const DirectoryEntry *SubframeworkDir
-  = FileMgr.getDirectory(Dir->path())) {
+if (const DirectoryEntry *SubframeworkDir =
+FileMgr.getDirectory(Dir->getName())) {
   // Note: as an egregious but useful hack, we use the real path here and
   // check whether it is actually a subdirectory of the parent directory.
   // This will not be the case if the 'subframework' is actually a symlink
@@ -1931,11 +1933,13 @@
 // uncommonly used Tcl module on Darwin platforms.
 std::error_code EC;
 SmallVector Headers;
-for (llvm::sys::fs::recursive_directory_iterator I(Dir->getName(), EC), E;
+vfs::FileSystem  = *SourceMgr.getFileManager().getVirtualFileSystem();
+for (vfs::recursive_directory_iterator I(FS, Dir->getName(), EC), E;
  I != E && !EC; I.increment(EC)) {
-  if (const FileEntry *FE = SourceMgr.getFileManager().getFile(I->path())) {
+  if (const FileEntry *FE =
+  SourceMgr.getFileManager().getFile(I->getName())) {
 
-Module::Header Header = {I->path(), FE};
+Module::Header Header = {I->getName(), FE};
 Headers.push_back(std::move(Header));
   }
 }
Index: lib/Lex/HeaderSearch.cpp
===
--- lib/Lex/HeaderSearch.cpp
+++ lib/Lex/HeaderSearch.cpp
@@ -1341,19 +1341,20 @@
 DirNative);
 
 // Search each of the ".framework" directories to load them as modules.
-for (llvm::sys::fs::directory_iterator Dir(DirNative, EC), DirEnd;
+vfs::FileSystem  = *FileMgr.getVirtualFileSystem();
+for (vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd;
  Dir != DirEnd && !EC; Dir.increment(EC)) {
-  if (llvm::sys::path::extension(Dir->path()) != ".framework")
+  if (llvm::sys::path::extension(Dir->getName()) != ".framework")
 continue;
 
   const DirectoryEntry *FrameworkDir =
-  FileMgr.getDirectory(Dir->path());
+  FileMgr.getDirectory(Dir->getName());
   if (!FrameworkDir)
 continue;
 
   // Load this framework module.
-  loadFrameworkModule(llvm::sys::path::stem(Dir->path()), FrameworkDir,
-  IsSystem);
+  loadFrameworkModule(llvm::sys::path::stem(Dir->getName()),
+  FrameworkDir, IsSystem);
 }
 continue;
   }
@@ -1408,11 +1409,13 @@
   std::error_code EC;
   SmallString<128> DirNative;
   llvm::sys::path::native(SearchDir.getDir()->getName(), DirNative);
-  for 

r269527 - [AVX512] Update pshufd type strings to match the backend. Also mark the immediate as an ICE instead of marking the previous vector as const.

2016-05-13 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri May 13 19:49:36 2016
New Revision: 269527

URL: http://llvm.org/viewvc/llvm-project?rev=269527=rev
Log:
[AVX512] Update pshufd type strings to match the backend. Also mark the 
immediate as an ICE instead of marking the previous vector as const.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=269527=269526=269527=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Fri May 13 19:49:36 2016
@@ -2230,9 +2230,9 @@ TARGET_BUILTIN(__builtin_ia32_movshdup12
 TARGET_BUILTIN(__builtin_ia32_movshdup256_mask, "V8fV8fV8fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movsldup128_mask, "V4fV4fV4fUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movsldup256_mask, "V8fV8fV8fUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshufd512_mask, "V16iV16iCsV16iUc","","avx512f")
-TARGET_BUILTIN(__builtin_ia32_pshufd256_mask, "V8iV8iCsV8iUc","","avx512vl")
-TARGET_BUILTIN(__builtin_ia32_pshufd128_mask, "V4iV4iCsV4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshufd512_mask, "V16iV16iIiV16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_pshufd256_mask, "V8iV8iIiV8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pshufd128_mask, "V4iV4iIiV4iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_expanddf512_mask, "V8dV8dV8dUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expanddi512_mask, 
"V8LLiV8LLiV8LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_expandloaddf512_mask, "V8dvC*V8dUc","","avx512f")


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


Re: [PATCH] D20170: [clang-tidy] TypeTraits - Type is not expensive to copy when it has a deleted copy constructor.

2016-05-13 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good after addressing Etienne's comment.

Thanks!


http://reviews.llvm.org/D20170



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


Re: [PATCH] D20171: Support for MSVS default calling convention options (/Gd, /Gz, /Gv, /Gr)

2016-05-13 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


Comment at: include/clang/Driver/CC1Options.td:615
@@ +614,3 @@
+  HelpText<"Set default MS calling convention">;
+def mrtd : Flag<["-"], "mrtd">, Group,
+  Alias, AliasArgs<["stdcall"]>,

Doesn't this have to live in Options.td if you want it to be available in the 
driver interface? Otherwise it's a -cc1-only flag.


Comment at: lib/Sema/SemaDeclAttr.cpp:3898
@@ -3897,6 +3897,3 @@
 // method calling convention.
-TargetInfo::CallingConvMethodType MT = TargetInfo::CCMT_Unknown;
-if (FD)
-  MT = FD->isCXXInstanceMember() ? TargetInfo::CCMT_Member : 
-TargetInfo::CCMT_NonMember;
-CC = TI.getDefaultCallingConv(MT);
+bool isCXXMethod = false, isVariadic = false;
+if (FD) {

Use leading upper case variables to achieve consistency with our insanity, 
please. :)


http://reviews.llvm.org/D20171



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


r269520 - [VFS] Add level() method to vfs::recursive_directory_iterator

2016-05-13 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Fri May 13 19:00:18 2016
New Revision: 269520

URL: http://llvm.org/viewvc/llvm-project?rev=269520=rev
Log:
[VFS] Add level() method to vfs::recursive_directory_iterator

Unlike sys::fs::recursive_directory_iterator,
vfs::recursive_directory_iterator does not implement the level() method,
which tells how deep in the directory tree the current iterator is. This
is needed in the vfs::recursive_directory_iterator so that future
improvements to the crash reproducer will be able to properly access
header for umbrellas when looking into the VFS.

rdar://problem/25880368

Modified:
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=269520=269519=269520=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Fri May 13 19:00:18 2016
@@ -176,6 +176,11 @@ public:
   bool operator!=(const recursive_directory_iterator ) const {
 return !(*this == RHS);
   }
+  /// \brief Gets the current level. Starting path is at level 0.
+  int level() const {
+assert(State->size() && "Cannot get level without any iteration state");
+return State->size()-1;
+  }
 };
 
 /// \brief The virtual file system interface.

Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=269520=269519=269520=diff
==
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Fri May 13 19:00:18 2016
@@ -1122,3 +1122,45 @@ TEST_F(VFSFromYAMLTest, DirectoryIterati
   checkContents(O->dir_begin("//root/baz/", EC),
 {"//root/baz/x", "//root/baz/y"});
 }
+
+TEST_F(VFSFromYAMLTest, RecursiveDirectoryIterationLevel) {
+
+  IntrusiveRefCntPtr Lower(new DummyFileSystem());
+  Lower->addDirectory("//root/a");
+  Lower->addDirectory("//root/a/b");
+  Lower->addDirectory("//root/a/b/c");
+  Lower->addRegularFile("//root/a/b/c/file");
+  IntrusiveRefCntPtr FS = getFromYAMLString(
+  "{ 'use-external-names': false,\n"
+  "  'roots': [\n"
+  "{\n"
+  "  'type': 'directory',\n"
+  "  'name': '//root/a/b/c/',\n"
+  "  'contents': [ {\n"
+  "  'type': 'file',\n"
+  "  'name': 'file',\n"
+  "  'external-contents': '//root/a/b/c/file'\n"
+  "}\n"
+  "  ]\n"
+  "},\n"
+  "]\n"
+  "}",
+  Lower);
+  ASSERT_TRUE(FS.get() != nullptr);
+
+  IntrusiveRefCntPtr O(
+  new vfs::OverlayFileSystem(Lower));
+  O->pushOverlay(FS);
+
+  std::error_code EC;
+
+  // Test recursive_directory_iterator level()
+  vfs::recursive_directory_iterator I = vfs::recursive_directory_iterator(
+*O, "//root", EC), E;
+  ASSERT_FALSE(EC);
+  for (int l = 0; I != E; I.increment(EC), ++l) {
+ASSERT_FALSE(EC);
+EXPECT_EQ(I.level(), l);
+  }
+  EXPECT_EQ(I, E);
+}


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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Steven Wu via cfe-commits

> On May 13, 2016, at 3:56 PM, Duncan P. N. Exon Smith  
> wrote:
> 
> Is this something that you need the linker to treat as "used", or just 
> something you don't want the compiler to drop?  If the latter, 
> @llvm.compiler.used seems more appropriate.

Bitcode is actually not really used by the compiler during compilation and 
shouldn't really used by any part of the code. llvm.compiler.used then.

New patch.



0001-Fix-embed-bitcode-linkage-type.patch
Description: Binary data


Steven

> 
>> On 2016-May-13, at 14:01, Steven Wu  wrote:
>> 
>> Attach a patch using private linkage type and adding to llvm.used. I have to 
>> recreate llvm.used when embedding bitcode. I don't really like it but I 
>> don't have better solutions.
>> Few other options:
>> 1. Not allowing re-embedded bitcode will simplify the code a bit but not a 
>> lot.
>> 2. Create a new "llvm.*.used" variable in llvm.metadata section.
>> 3. Teach optimizer do not optimize away llvm.* variables.   
>> 
>> <0001-Fix-embed-bitcode-linkage-type.patch>
>> 
>> Steven
>> 
>>> On May 13, 2016, at 10:10 AM, Rafael Espíndola  
>>> wrote:
>>> 
>>> On 13 May 2016 at 13:02, Steven Wu  wrote:
 Hi Rafael
 
 Thanks for notice this! That would definitely cause duplicated symbol 
 error and I should definitely change that.
 Here is some background:
 ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but 
 not the ones in earlier Xcode. The old ld64 will simply concatenate the 
 bitcode files which is not the right thing to do. So there is a symbol 
 generated at the place to prevent user to link the bitcode object file 
 with old ld64 because older ld64 will fail and report duplicated symbols.
 I have a radar tracking to change the linkage type when upstream but I 
 dropped the ball on that one. The correct thing to do is to make it 
 internal and add to llvm.used. I will come up with a patch.
>>> 
>>> Thank you so much!
>>> 
>>> Cheers,
>>> Rafael
>> 
> 

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


Re: [PATCH] D19667: [ubsan] Minimize size of data for type_mismatch

2016-05-13 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/CodeGen/CGExpr.cpp:579
@@ -578,1 +578,3 @@
+// Make sure we're not losing information. Alignment needs to be a power 
of 2
+assert(!AlignVal || (uint64_t)1 << llvm::Log2_64(AlignVal) == AlignVal);
 llvm::Constant *StaticData[] = {

filcab wrote:
> Would it be acceptable to set AlignVal to 1 if it's 0?
Yes, that seems fine. The alignment check will never fire if `AlignVal` is zero 
(that only happens if the type in question is incomplete, and we don't emit a 
check for it in that case). Setting it to 1 should prevent the runtime library 
from thinking that we detected an alignment problem.

It looks like the current patch will emit 255 as the alignment in that case; 
that also seems fine as a way of indicating "no alignment check". I doubt we'll 
ever need to deal with a real alignment value of 2^255 :)


http://reviews.llvm.org/D19667



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


[clang-tools-extra] r269517 - [Release notes] Mention Clang-tidy modernize-avoid-bind check.

2016-05-13 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Fri May 13 18:35:56 2016
New Revision: 269517

URL: http://llvm.org/viewvc/llvm-project?rev=269517=rev
Log:
[Release notes] Mention Clang-tidy modernize-avoid-bind check.

Fix some problems in its documentation.

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=269517=269516=269517=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Fri May 13 18:35:56 2016
@@ -180,6 +180,11 @@ identified.  The improvements since the
 
   Finds unused ``using`` declarations.
 
+- New `modernize-avoid-bind
+  `_ 
check
+
+  Finds uses of ``std::bind`` and replaces simple uses with lambdas.
+
 - New `modernize-deprecated-headers
   
`_
 check
 

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst?rev=269517=269516=269517=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-avoid-bind.rst Fri 
May 13 18:35:56 2016
@@ -1,7 +1,7 @@
-.. title:: clang-tidy - modernize-avoid-std-bind
+.. title:: clang-tidy - modernize-avoid-bind
 
 modernize-avoid-bind
-==
+
 
 The check finds uses of ``std::bind`` and replaces simple uses with lambdas.
 Lambdas will use value-capture where required.


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


Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-13 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Frontend/ASTUnit.cpp:1402-1406
@@ +1401,7 @@
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+

Suppose file names A and B refer to file (inode) X, and the map contains X -> 
(A, hash). If B is deleted (and maybe recreated pointing at a new inode), this 
approach won't detect that anything has changed.


http://reviews.llvm.org/D20137



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


r269515 - Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Fri May 13 18:20:11 2016
New Revision: 269515

URL: http://llvm.org/viewvc/llvm-project?rev=269515=rev
Log:
Get default -fms-compatibility-version from cl.exe's version

-fms-compatibility-version was defaulting to 18 (VS 2013), which is a pain if 
your environment is pointing to version 19 (VS 2015) libraries.

If cl.exe can be found, this patch uses its version number as the default 
instead. It re-uses the existing code to find the Visual Studio binaries folder 
and WinAPI methods to check its version. You can still explicitly specify a 
compatibility version on the command line. If you don't have cl.exe, this 
should be a no-op and you'll get the old default of 18.

This affected the tests, which assumed that if you didn't specific a version, 
that it would default to 18, but this won't be true for all machines. So a 
couple test cases had to be eliminated and a couple others had to be tweaked to 
allow for various outputs.

Addresses: https://llvm.org/bugs/show_bug.cgi?id=27215

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

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
cfe/trunk/test/Driver/cl-options.c
cfe/trunk/test/Driver/msc-version.c
cfe/trunk/test/Driver/msvc-triple.c
cfe/trunk/test/Misc/diag-format.c

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=269515=269514=269515=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri May 13 18:20:11 2016
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_DRIVER_TOOLCHAIN_H
 
 #include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/VersionTuple.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Multilib.h"
 #include "clang/Driver/Types.h"
@@ -422,6 +423,10 @@ public:
 
   /// \brief Return sanitizers which are enabled by default.
   virtual SanitizerMask getDefaultSanitizers() const { return 0; }
+
+  /// \brief On Windows, returns the version of cl.exe.  On other platforms,
+  /// returns an empty VersionTuple.
+  virtual VersionTuple getMSVCVersionFromExe() const { return VersionTuple(); }
 };
 
 } // end namespace driver

Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=269515=269514=269515=diff
==
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Fri May 13 18:20:11 2016
@@ -19,6 +19,7 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Process.h"
@@ -37,6 +38,8 @@
 #define NOMINMAX
   #endif
   #include 
+
+  #pragma comment(lib, "version.lib")
 #endif
 
 using namespace clang::driver;
@@ -457,6 +460,45 @@ bool MSVCToolChain::getVisualStudioBinar
   return true;
 }
 
+VersionTuple MSVCToolChain::getMSVCVersionFromExe() const {
+  VersionTuple Version;
+#ifdef USE_WIN32
+  std::string BinPath;
+  if (!getVisualStudioBinariesFolder("", BinPath))
+return Version;
+  SmallString<128> ClExe = BinPath;
+  llvm::sys::path::append(ClExe, "cl.exe");
+
+  std::wstring ClExeWide;
+  if (!llvm::ConvertUTF8toWide(ClExe.c_str(), ClExeWide))
+return Version;
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);
+  if (VersionSize == 0)
+return Version;
+
+  SmallVector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,
+ VersionBlock.data()))
+return Version;
+
+  VS_FIXEDFILEINFO *FileInfo = nullptr;
+  UINT FileInfoSize = 0;
+  if (!::VerQueryValueW(VersionBlock.data(), L"\\",
+reinterpret_cast(), ) 
||
+  FileInfoSize < sizeof(*FileInfo))
+return Version;
+
+  const unsigned Major = (FileInfo->dwFileVersionMS >> 16) & 0x;
+  const unsigned Minor = (FileInfo->dwFileVersionMS  ) & 0x;
+  const unsigned Micro = (FileInfo->dwFileVersionLS >> 16) & 0x;
+
+  Version = VersionTuple(Major, Minor, Micro);
+#endif
+  return Version;
+}
+
 // Get Visual Studio installation directory.
 bool MSVCToolChain::getVisualStudioInstallDir(std::string ) const {
   // First check the environment variables that vsvars32.bat sets.
@@ -618,7 +660,7 @@ MSVCToolChain::ComputeEffectiveClangTrip
   ToolChain::ComputeEffectiveClangTriple(Args, InputType);
   llvm::Triple Triple(TripleStr);
   VersionTuple MSVT =
-  

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
This revision was automatically updated to reflect the committed changes.
amccarth marked an inline comment as done.
Closed by commit rL269515: Get default -fms-compatibility-version from cl.exe's 
version (authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D20136?vs=57196=57267#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20136

Files:
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/MSVCToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Driver/Tools.h
  cfe/trunk/test/Driver/cl-options.c
  cfe/trunk/test/Driver/msc-version.c
  cfe/trunk/test/Driver/msvc-triple.c
  cfe/trunk/test/Misc/diag-format.c

Index: cfe/trunk/include/clang/Driver/ToolChain.h
===
--- cfe/trunk/include/clang/Driver/ToolChain.h
+++ cfe/trunk/include/clang/Driver/ToolChain.h
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_DRIVER_TOOLCHAIN_H
 
 #include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/VersionTuple.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Multilib.h"
 #include "clang/Driver/Types.h"
@@ -422,6 +423,10 @@
 
   /// \brief Return sanitizers which are enabled by default.
   virtual SanitizerMask getDefaultSanitizers() const { return 0; }
+
+  /// \brief On Windows, returns the version of cl.exe.  On other platforms,
+  /// returns an empty VersionTuple.
+  virtual VersionTuple getMSVCVersionFromExe() const { return VersionTuple(); }
 };
 
 } // end namespace driver
Index: cfe/trunk/test/Misc/diag-format.c
===
--- cfe/trunk/test/Misc/diag-format.c
+++ cfe/trunk/test/Misc/diag-format.c
@@ -37,7 +37,7 @@
 // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
-// MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
+// MSVC: {{.*}}(36,8){{ ?}}: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015_ORIG: {{.*}}(36): warning: extra tokens at end of #endif directive [-Wextra-tokens]
Index: cfe/trunk/test/Driver/msvc-triple.c
===
--- cfe/trunk/test/Driver/msvc-triple.c
+++ cfe/trunk/test/Driver/msvc-triple.c
@@ -1,9 +1,7 @@
-// RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
 // RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
 // RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
 // RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
 
-// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
 // TARGET-19:   target triple = "i686-pc-windows-msvc19.0.0"
 // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
-// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc{{.*}}-elf"
Index: cfe/trunk/test/Driver/cl-options.c
===
--- cfe/trunk/test/Driver/cl-options.c
+++ cfe/trunk/test/Driver/cl-options.c
@@ -387,7 +387,7 @@
 // RTTI-NOT: "-fno-rtti"
 
 // thread safe statics are off for versions < 19.
-// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // NoThreadSafeStatics: "-fno-threadsafe-statics"
 
Index: cfe/trunk/test/Driver/msc-version.c
===
--- cfe/trunk/test/Driver/msc-version.c
+++ cfe/trunk/test/Driver/msc-version.c
@@ -1,15 +1,4 @@
 //
-// Verify defaults
-//
-
-// RUN: %clang -target i686-windows -fms-compatibility -dM -E - 
+
+  #pragma comment(lib, "version.lib")
 #endif
 
 using namespace clang::driver;
@@ -457,6 +460,45 @@
   return true;
 }
 
+VersionTuple MSVCToolChain::getMSVCVersionFromExe() const {
+  VersionTuple Version;
+#ifdef USE_WIN32
+  std::string BinPath;
+  if (!getVisualStudioBinariesFolder("", BinPath))
+return Version;
+  SmallString<128> ClExe = BinPath;
+  llvm::sys::path::append(ClExe, "cl.exe");
+
+  std::wstring ClExeWide;
+  if (!llvm::ConvertUTF8toWide(ClExe.c_str(), ClExeWide))
+return Version;
+
+  const DWORD 

Re: r269398 - Add support for derived class special members hiding functions brought in from

2016-05-13 Thread Richard Smith via cfe-commits
Update: Vassil and I have dug into this a bit offline. It looks like the
root cause is a likely-pre-existing bug where we somehow import a default
constructor for a class from a module but don't set the "has a default
constructor" flag on the class definition.

On Fri, May 13, 2016 at 2:54 AM, Vassil Vassilev 
wrote:

> Hi Richard,
>   I believe this broke our modules builds. Last successful one was with
> r269388 and the current with r269389 fails with:
>
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/type_traits:69:12:
>  error: constructor cannot be redeclared
> struct integral_constant
>^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/type_traits:69:12:
>  note: previous implicit declaration is here
> struct integral_constant
>^
> /mnt/build/workspace/root-nightly-master-cxxmodules/BUILDTYPE/Release/COMPILER/native/LABEL/sft-fedora-1/clang_build_269398/ROOT/src/core/meta/src/TGenericClassInfo.cxx:18:10:
>  fatal error: could not build module 'TCollectionProxyInfo.h'
> #include "TCollectionProxyInfo.h"
>  ^~~~
> 2 errors generated.
>
> and
>
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/new:99:10:
>  error: multiple overloads of 'nothrow_t' instantiate to the same signature 
> 'void ()'
>   struct nothrow_t { };
>  ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:253:8:
>  note: in instantiation of function template specialization 
> '__gnu_cxx::new_allocator >::construct int>, const std::pair &>' requested here
> { __a.construct(__p, std::forward<_Args>(__args)...); }
>   ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:399:4:
>  note: in instantiation of function template specialization 
> 'std::allocator_traits > 
> >::_S_construct, const std::pair &>' requested 
> here
> { _S_construct(__a, __p, std::forward<_Args>(__args)...); }
>   ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:917:21:
>  note: in instantiation of function template specialization 
> 'std::allocator_traits > 
> >::construct, const std::pair &>' requested here
> _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
>^
> /mnt/build/workspace/root-nightly-master-cxxmodules/BUILDTYPE/Release/COMPILER/native/LABEL/sft-fedora-1/clang_build_269398/ROOT/src/core/meta/src/TSchemaRule.cxx:873:21:
>  note: in instantiation of member function 'std::vector, 
> std::allocator > >::push_back' requested here
>   fVersionVect->push_back( verpair );
> ^
> /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/new:99:10:
>  note: previous implicit declaration is here
>   struct nothrow_t { };
>
>
> Shall I start reducing the issues one by one or we can revert this patch?
> Vassil On 13/05/16 08:47, Richard Smith via cfe-commits wrote:
>
> Author: rsmith
> Date: Fri May 13 01:47:56 2016
> New Revision: 269398
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269398=rev
> Log:
> Add support for derived class special members hiding functions brought in from
> a base class via a using-declaration. If a class has a using-declaration
> declaring either a constructor or an assignment operator, eagerly declare its
> special members in case they need to displace a shadow declaration from a
> using-declaration.
>
> Modified:
> cfe/trunk/include/clang/AST/DeclCXX.h
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/AST/ASTImporter.cpp
> cfe/trunk/lib/AST/DeclCXX.cpp
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> cfe/trunk/lib/Serialization/ASTWriter.cpp
> cfe/trunk/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p12.cpp
> cfe/trunk/test/SemaCUDA/implicit-member-target.cu
> cfe/trunk/test/SemaCXX/constructor-recovery.cpp
>
> Modified: cfe/trunk/include/clang/AST/DeclCXX.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=269398=269397=269398=diff
> ==
> --- cfe/trunk/include/clang/AST/DeclCXX.h (original)
> +++ cfe/trunk/include/clang/AST/DeclCXX.h Fri May 13 01:47:56 2016
> @@ -382,6 +382,14 @@ class CXXRecordDecl : public RecordDecl
>  /// provided default ctor also doesn't have an in-class initializer.
>  unsigned HasUninitializedFields : 1;
>
> +/// \brief True if there are any member using-declarations that inherit
> +/// constructors from a base class.
> +unsigned HasInheritedConstructor : 1;
> +
> +/// \brief 

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

LG, sounds like people are happy with this


http://reviews.llvm.org/D20136



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


Re: [PATCH] D18953: [ms][dll] #26935 Defining a dllimport function should cause it to be exported

2016-05-13 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


Comment at: test/SemaCXX/dllimport.cpp:179
@@ -140,1 +178,3 @@
+template 
+int ExternVarTmplDeclInit = 1;
 

avt77 wrote:
> majnemer wrote:
> > avt77 wrote:
> > > rnk wrote:
> > > > Can you check with MSVC 2015 update 2 actually does with definitions of 
> > > > dllimport variable templates? I bet it doesn't export them.
> > > They don't support variable templates at all:
> > > 
> > > error C2399: variable templates are not supported in this release
> > Your compiler is too old, they are definitely supported.
> > 
> > > Previously a template declaration was only allowed to be a function, 
> > > class, or alias. Now, in the MSVC compiler it can be a variable as well.
> > 
> > https://blogs.msdn.microsoft.com/vcblog/2016/02/11/compiler-improvements-in-vs-2015-update-2/
> OK, I updated several additional components and now CL supports variable 
> templates. I checked the issue again and got the following:
> 
> C:\_bugs>cl -c  t1.cpp
> Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23918 for x86
> Copyright (C) Microsoft Corporation.  All rights reserved.
> 
> t1.cpp
> t1.cpp(8): warning C4273: 'ExternVarTmplDeclInit': inconsistent dll linkage
> t1.cpp(2): note: see previous definition of 'ExternVarTmplDeclInit'
> 
> C:\_bugs>dumpbin /directives t1.obj
> Microsoft (R) COFF/PE Dumper Version 14.00.23918.0
> Copyright (C) Microsoft Corporation.  All rights reserved.
> 
> 
> Dump of file t1.obj
> 
> File Type: COFF OBJECT
> 
>Linker Directives
>-
>/DEFAULTLIB:LIBCMT
>/DEFAULTLIB:OLDNAMES
>/EXPORT:??$ExternVarTmplDeclInit@H@@3HA,DATA//
> 
> As you see they produce warning and change the export attribute. I suppose 
> Clang should do the same, right?
Yep, sounds good for now.


Comment at: test/SemaCXX/dllimport.cpp:1137
@@ -1017,1 +1136,3 @@
+template 
+void ImportClassTmplMembers::normalDef() {}
 #ifdef GNU

avt77 wrote:
> avt77 wrote:
> > rnk wrote:
> > > I'm pretty sure MSVC considers all free function templates to be 
> > > 'inline', i.e. they put them in comdats. I doubt MSVC exports these. Can 
> > > you verify what it does?
> > They prohibit such a definition in the latest MSVC: 
> > 
> > error C2491: 'ImportClassTmplMembers::normalDef': definition of 
> > dllimport function not allowed
> > 
> > The same error I see for other definitions as well
> With the latest compiler they disallow the definition of dllimport functions 
> as well. I suppose Clang should do the same, right?
Seems like a weird special case. I wouldn't worry about addressing it right now.


http://reviews.llvm.org/D18953



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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Duncan P. N. Exon Smith via cfe-commits
Is this something that you need the linker to treat as "used", or just 
something you don't want the compiler to drop?  If the latter, 
@llvm.compiler.used seems more appropriate.

> On 2016-May-13, at 14:01, Steven Wu  wrote:
> 
> Attach a patch using private linkage type and adding to llvm.used. I have to 
> recreate llvm.used when embedding bitcode. I don't really like it but I don't 
> have better solutions.
> Few other options:
> 1. Not allowing re-embedded bitcode will simplify the code a bit but not a 
> lot.
> 2. Create a new "llvm.*.used" variable in llvm.metadata section.
> 3. Teach optimizer do not optimize away llvm.* variables.   
> 
> <0001-Fix-embed-bitcode-linkage-type.patch>
> 
> Steven
> 
>> On May 13, 2016, at 10:10 AM, Rafael Espíndola  
>> wrote:
>> 
>> On 13 May 2016 at 13:02, Steven Wu  wrote:
>>> Hi Rafael
>>> 
>>> Thanks for notice this! That would definitely cause duplicated symbol error 
>>> and I should definitely change that.
>>> Here is some background:
>>> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but not 
>>> the ones in earlier Xcode. The old ld64 will simply concatenate the bitcode 
>>> files which is not the right thing to do. So there is a symbol generated at 
>>> the place to prevent user to link the bitcode object file with old ld64 
>>> because older ld64 will fail and report duplicated symbols.
>>> I have a radar tracking to change the linkage type when upstream but I 
>>> dropped the ball on that one. The correct thing to do is to make it 
>>> internal and add to llvm.used. I will come up with a patch.
>> 
>> Thank you so much!
>> 
>> Cheers,
>> Rafael
> 

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


Re: [PATCH] D20261: [compiler-rt] Fix multi-configuration output paths

2016-05-13 Thread Reid Kleckner via cfe-commits
rnk added a comment.

Will this put the libraries in build/Release/bin/../lib/. aka 
build/Release/lib, or will they collide between build types?


http://reviews.llvm.org/D20261



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


Re: [PATCH] D20194: [ModuleMap][CrashReproducer] Collect headers from inner frameworks

2016-05-13 Thread Bruno Cardoso Lopes via cfe-commits
bruno closed this revision.
bruno added a comment.

Thanks Ben!

Committed r269502


http://reviews.llvm.org/D20194



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


r269502 - [ModuleMap][CrashReproducer] Collect headers from inner frameworks

2016-05-13 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Fri May 13 17:21:51 2016
New Revision: 269502

URL: http://llvm.org/viewvc/llvm-project?rev=269502=rev
Log:
[ModuleMap][CrashReproducer] Collect headers from inner frameworks

(1) Collect headers under inner frameworks (frameworks inside other
other frameworks).
(2) Make sure we also collect the right header files inside them.

More info on (2):

Consider a dummy framework module B, with header Frameworks/B/B.h. Now
consider that another framework A, with header Frameworks/A/A.h, has a
layout with a inner framework Frameworks/A/Frameworks/B/B.h, where the
"B/B.h" part is a symlink for Frameworks/B/B.h. Also assume that
Frameworks/A/A.h includes .

When parsing header Frameworks/A/A.h, framework module lookup is
performed in search for B, and it happens that
"Frameworks/A/Frameworks/B/B.h" path is registered in the module instead
of real "Frameworks/B/B.h". This occurs because
"Frameworks/A/Frameworks/B/B.h" is scanned first by the FileManager,
when looking for inner framework modules under Frameworks/A/Frameworks.
This makes Frameworks/A/Frameworks/B/B.h the default cached named inside
the FileManager for the B.h file UID.

This leads to modules being built without consistent paths to underlying
header files. This is usually not a problem in regular compilation flow,
but it's an issue when running the crash reproducer. The issue is that
clangs collect "Frameworks/A/Frameworks/B/B.h" but not
"Frameworks/B/B.h" into the VFS, leading to err_mmap_umbrella_clash. So
make sure we also collect the original header.

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

rdar://problem/25880368

Added:
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/A.framework/
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/A.framework/Headers/

cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/A.framework/Headers/A.h
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/B.framework/
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Headers/

cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Headers/B.h
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Modules/

cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Modules/module.modulemap
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/I.framework/
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Headers/

cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Headers/I.h
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Modules/

cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Modules/module.modulemap
cfe/trunk/test/Modules/Inputs/crash-recovery/Frameworks/module.modulemap
cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m
Modified:
cfe/trunk/include/clang/Lex/ModuleMap.h
cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/include/clang/Lex/ModuleMap.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleMap.h?rev=269502=269501=269502=diff
==
--- cfe/trunk/include/clang/Lex/ModuleMap.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleMap.h Fri May 13 17:21:51 2016
@@ -55,6 +55,13 @@ public:
   ///
   /// \param Filename The header file itself.
   virtual void moduleMapAddHeader(StringRef Filename) {}
+
+  /// \brief Called when an umbrella header is added during module map parsing.
+  ///
+  /// \param FileMgr FileManager instance
+  /// \param Filename The umbreall header to collect.
+  virtual void moduleMapAddUmbrellaHeader(FileManager *FileMgr,
+  const FileEntry *Header) {}
 };
   
 class ModuleMap {

Modified: cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp?rev=269502=269501=269502=diff
==
--- cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp (original)
+++ cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp Fri May 13 17:21:51 
2016
@@ -48,6 +48,34 @@ struct ModuleDependencyMMCallbacks : pub
 if (llvm::sys::path::is_absolute(HeaderPath))
   Collector.addFile(HeaderPath);
   }
+  void moduleMapAddUmbrellaHeader(FileManager *FileMgr,
+  const FileEntry *Header) override {
+StringRef HeaderFilename = Header->getName();
+moduleMapAddHeader(HeaderFilename);
+// The FileManager can find and cache the symbolic link for a framework
+// header before its real path, this means a module can have some of its
+// headers to use other paths. Although this is usually not a problem, it's
+// inconsistent, and not collecting the original 

Re: [PATCH] D20194: [ModuleMap][CrashReproducer] Collect headers from inner frameworks

2016-05-13 Thread Bruno Cardoso Lopes via cfe-commits
bruno updated this revision to Diff 57263.
bruno added a comment.

Updated after Ben's suggestions!


http://reviews.llvm.org/D20194

Files:
  include/clang/Lex/ModuleMap.h
  lib/Frontend/ModuleDependencyCollector.cpp
  lib/Lex/ModuleMap.cpp
  test/Modules/Inputs/crash-recovery/Frameworks/A.framework/Headers/A.h
  test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Headers/B.h
  
test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Modules/module.modulemap
  test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Headers/I.h
  
test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Modules/module.modulemap
  test/Modules/Inputs/crash-recovery/Frameworks/module.modulemap
  test/Modules/crash-vfs-umbrella-frameworks.m

Index: test/Modules/crash-vfs-umbrella-frameworks.m
===
--- /dev/null
+++ test/Modules/crash-vfs-umbrella-frameworks.m
@@ -0,0 +1,42 @@
+// REQUIRES: crash-recovery, shell
+
+// FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it?
+// XFAIL: mingw32
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/i %t/m %t
+// RUN: cp -a %S/Inputs/crash-recovery/Frameworks %t/i/
+// RUN: mkdir -p %t/i/Frameworks/A.framework/Frameworks
+// RUN: ln -s ../../B.framework %t/i/Frameworks/A.framework/Frameworks/B.framework
+
+// RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
+// RUN: %clang -nostdinc -fsyntax-only %s \
+// RUN: -F %/t/i/Frameworks -fmodules \
+// RUN: -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
+
+// RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
+// RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
+// RUN: find %t/crash-vfs-*.cache/vfs | \
+// RUN:   grep "B.framework/Headers/B.h" | count 1
+
+// CHECK: Preprocessed source(s) and associated run script(s) are located at:
+// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
+// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
+
+// CHECKYAML:  'type': 'directory',
+// CHECKYAML:  'name': "/[[PATH:.*]]/i/Frameworks/A.framework/Frameworks/B.framework/Headers",
+// CHECKYAML-NEXT:  'contents': [
+// CHECKYAML-NEXT:{
+// CHECKYAML-NEXT:  'type': 'file',
+// CHECKYAML-NEXT:  'name': "B.h",
+// CHECKYAML-NEXT:  'external-contents': "/[[PATH]]/i/Frameworks/B.framework/Headers/B.h"
+
+// CHECKYAML:  'type': 'directory',
+// CHECKYAML:  'name': "/[[PATH]]/i/Frameworks/B.framework/Headers",
+// CHECKYAML-NEXT:  'contents': [
+// CHECKYAML-NEXT:{
+// CHECKYAML-NEXT:  'type': 'file',
+// CHECKYAML-NEXT:  'name': "B.h",
+// CHECKYAML-NEXT:  'external-contents': "/[[PATH]]/i/Frameworks/B.framework/Headers/B.h"
+
+@import I;
Index: test/Modules/Inputs/crash-recovery/Frameworks/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/crash-recovery/Frameworks/module.modulemap
@@ -0,0 +1,2 @@
+framework module * [extern_c] {
+}
Index: test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Modules/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Modules/module.modulemap
@@ -0,0 +1,5 @@
+framework module I [extern_c] {
+  umbrella header "I.h"
+  export *
+  module * { export * }
+}
Index: test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Headers/I.h
===
--- /dev/null
+++ test/Modules/Inputs/crash-recovery/Frameworks/I.framework/Headers/I.h
@@ -0,0 +1,2 @@
+
+#import 
Index: test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Modules/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Modules/module.modulemap
@@ -0,0 +1,5 @@
+framework module B [extern_c] {
+  umbrella header "B.h"
+  export *
+  module * { export * }
+}
Index: test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Headers/B.h
===
--- /dev/null
+++ test/Modules/Inputs/crash-recovery/Frameworks/B.framework/Headers/B.h
@@ -0,0 +1 @@
+// B.h
Index: test/Modules/Inputs/crash-recovery/Frameworks/A.framework/Headers/A.h
===
--- /dev/null
+++ test/Modules/Inputs/crash-recovery/Frameworks/A.framework/Headers/A.h
@@ -0,0 +1 @@
+#include 
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -760,6 +760,10 @@
   Mod->Umbrella = UmbrellaHeader;
   Mod->UmbrellaAsWritten = NameAsWritten.str();
   UmbrellaDirs[UmbrellaHeader->getDir()] = Mod;
+
+  // Notify callbacks that we just added a new header.
+  for (const auto  : Callbacks)
+Cb->moduleMapAddUmbrellaHeader((), UmbrellaHeader);
 }
 
 void 

[PATCH] D20261: [compiler-rt] Fix multi-configuration output paths

2016-05-13 Thread Etienne Bergeron via cfe-commits
etienneb created this revision.
etienneb added a reviewer: rnk.
etienneb added a subscriber: cfe-commits.

When using a multi-configuration build (i.e. MSVC) the output path where
libraries are dropped is incorrect.

Example:
```
C:\src\llvm\examples>d:\src\llvm\build\Release\bin\clang-cl.exe 
-fsanitize=address test.cc
LINK : fatal error LNK1181: cannot open input file 
'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\clang_rt.asan-i386.lib'
```

The dropped executable path contains the configuration 'Release':
'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\Release\clang_rt.asan-i386.lib'


The variable 'RUNTIME_OUTPUT_DIRECTORY' is used to specify the output directory.
But CMAKE is appending the current configuration (i.e. Debug, Release).

see: https://cmake.org/cmake/help/v3.0/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html
```
"Multi-configuration generators (VS, Xcode) append a per-configuration 
subdirectory to the specified directory."
```

To avoid this problem, the configuration specific variable must be set:
'RUNTIME_OUTPUT_DIRECTORY_DEBUG', 'RUNTIME_OUTPUT_DIRECTORY_RELEASE', and so on.

http://reviews.llvm.org/D20261

Files:
  cmake/Modules/AddCompilerRT.cmake

Index: cmake/Modules/AddCompilerRT.cmake
===
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -155,10 +155,27 @@
 set_target_link_flags(${libname} ${extra_linkflags_${libname}})
 set_property(TARGET ${libname} APPEND PROPERTY 
 COMPILE_DEFINITIONS ${LIB_DEFS})
-set_target_properties(${libname} PROPERTIES
-ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
-LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
-RUNTIME_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+
+# For RUNTIME_OUTPUT_DIRECTORY variable, Multi-configuration generators
+# append a per-configuration subdirectory to the specified directory.
+# To avoid the appended folder, the configuration specific variable must be
+# set 'RUNTIME_OUTPUT_DIRECTORY_${CONF}':
+# ARCHIVE_OUTPUT_DIRECTORY_DEBUG, ARCHIVE_OUTPUT_DIRECTORY_RELEASE, ...
+if(CMAKE_CONFIGURATION_TYPES)
+  foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
+string(TOUPPER "${build_mode}" CONFIG_SUFFIX)
+set_target_properties(${libname} PROPERTIES
+"ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" 
${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+"LIBRARY_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" 
${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+"RUNTIME_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" 
${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+  endforeach()
+else()
+  set_target_properties(${libname} PROPERTIES
+  ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+  LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+  RUNTIME_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+endif()
+
 set_target_properties(${libname} PROPERTIES
 OUTPUT_NAME ${output_name_${libname}})
 if(LIB_LINK_LIBS AND ${type} STREQUAL "SHARED")


Index: cmake/Modules/AddCompilerRT.cmake
===
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -155,10 +155,27 @@
 set_target_link_flags(${libname} ${extra_linkflags_${libname}})
 set_property(TARGET ${libname} APPEND PROPERTY 
 COMPILE_DEFINITIONS ${LIB_DEFS})
-set_target_properties(${libname} PROPERTIES
-ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
-LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
-RUNTIME_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+
+# For RUNTIME_OUTPUT_DIRECTORY variable, Multi-configuration generators
+# append a per-configuration subdirectory to the specified directory.
+# To avoid the appended folder, the configuration specific variable must be
+# set 'RUNTIME_OUTPUT_DIRECTORY_${CONF}':
+# ARCHIVE_OUTPUT_DIRECTORY_DEBUG, ARCHIVE_OUTPUT_DIRECTORY_RELEASE, ...
+if(CMAKE_CONFIGURATION_TYPES)
+  foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
+string(TOUPPER "${build_mode}" CONFIG_SUFFIX)
+set_target_properties(${libname} PROPERTIES
+"ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+"LIBRARY_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+"RUNTIME_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+  endforeach()
+else()
+  set_target_properties(${libname} PROPERTIES
+  ARCHIVE_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+  LIBRARY_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+  RUNTIME_OUTPUT_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
+endif()
+
 set_target_properties(${libname} PROPERTIES
 OUTPUT_NAME 

Re: [PATCH] D19902: [ProfileData] (clang) Use Error in InstrProf and Coverage

2016-05-13 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269492: Reapply "[ProfileData] (clang) Use Error in 
InstrProf and Coverage, NFC" (authored by vedantk).

Changed prior to commit:
  http://reviews.llvm.org/D19902?vs=56346=57259#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19902

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Index: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
@@ -800,20 +800,21 @@
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::ErrorOr RecordErrorOr =
+  llvm::Expected RecordExpected =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (std::error_code EC = RecordErrorOr.getError()) {
-if (EC == llvm::instrprof_error::unknown_function)
+  if (auto E = RecordExpected.takeError()) {
+auto IPE = llvm::InstrProfError::take(std::move(E));
+if (IPE == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (EC == llvm::instrprof_error::hash_mismatch)
+else if (IPE == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (EC == llvm::instrprof_error::malformed)
+else if (IPE == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  llvm::make_unique(std::move(RecordErrorOr.get()));
+  
llvm::make_unique(std::move(RecordExpected.get()));
   RegionCounts = ProfRecord->Counts;
 }
 
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -141,11 +141,13 @@
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (std::error_code EC = ReaderOrErr.getError()) {
+if (auto E = ReaderOrErr.takeError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-<< EC.message();
+  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
+getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+  << EI.message();
+  });
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -403,7 +403,8 @@
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (ReaderOrErr.getError()) {
+  if (auto E = ReaderOrErr.takeError()) {
+llvm::consumeError(std::move(E));
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


Index: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
@@ -800,20 +800,21 @@
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::ErrorOr RecordErrorOr =
+  llvm::Expected RecordExpected =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (std::error_code EC = RecordErrorOr.getError()) {
-if (EC == llvm::instrprof_error::unknown_function)
+  if (auto E = RecordExpected.takeError()) {
+auto IPE = llvm::InstrProfError::take(std::move(E));
+if (IPE == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (EC == llvm::instrprof_error::hash_mismatch)
+else if (IPE == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (EC == llvm::instrprof_error::malformed)
+else if (IPE == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  llvm::make_unique(std::move(RecordErrorOr.get()));
+  llvm::make_unique(std::move(RecordExpected.get()));
   RegionCounts = ProfRecord->Counts;
 }
 
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp

r269492 - Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"

2016-05-13 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Fri May 13 16:51:02 2016
New Revision: 269492

URL: http://llvm.org/viewvc/llvm-project?rev=269492=rev
Log:
Reapply "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"

Sync up with "(llvm) Use Error in InstrProf and Coverage".

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

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269492=269491=269492=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri May 13 16:51:02 2016
@@ -141,11 +141,13 @@ CodeGenModule::CodeGenModule(ASTContext
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (std::error_code EC = ReaderOrErr.getError()) {
+if (auto E = ReaderOrErr.takeError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-<< EC.message();
+  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
+getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+  << EI.message();
+  });
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269492=269491=269492=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri May 13 16:51:02 2016
@@ -800,20 +800,21 @@ void CodeGenPGO::loadRegionCounts(llvm::
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::ErrorOr RecordErrorOr =
+  llvm::Expected RecordExpected =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (std::error_code EC = RecordErrorOr.getError()) {
-if (EC == llvm::instrprof_error::unknown_function)
+  if (auto E = RecordExpected.takeError()) {
+auto IPE = llvm::InstrProfError::take(std::move(E));
+if (IPE == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (EC == llvm::instrprof_error::hash_mismatch)
+else if (IPE == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (EC == llvm::instrprof_error::malformed)
+else if (IPE == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  llvm::make_unique(std::move(RecordErrorOr.get()));
+  
llvm::make_unique(std::move(RecordExpected.get()));
   RegionCounts = ProfRecord->Counts;
 }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269492=269491=269492=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 13 16:51:02 2016
@@ -403,7 +403,8 @@ static void setPGOUseInstrumentor(CodeGe
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (ReaderOrErr.getError()) {
+  if (auto E = ReaderOrErr.takeError()) {
+llvm::consumeError(std::move(E));
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


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


r269487 - ARM-MachO: stop claiming to be EABI

2016-05-13 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Fri May 13 16:26:45 2016
New Revision: 269487

URL: http://llvm.org/viewvc/llvm-project?rev=269487=rev
Log:
ARM-MachO: stop claiming to be EABI

Embedded ARM MachO targets are AAPCS but not full EABI (we don't use
__aeabi_whatever and the functions are allowed to be hard-float).

Turns out there was already a test for this, but its original purpose had
become corrupted over the years.

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=269487=269486=269487=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 13 16:26:45 2016
@@ -5067,7 +5067,7 @@ public:
 if (ABI == "aapcs" || ABI == "aapcs-linux" || ABI == "aapcs-vfp") {
   // Embedded targets on Darwin follow AAPCS, but not EABI.
   // Windows on ARM follows AAPCS VFP, but does not conform to EABI.
-  if (!getTriple().isOSDarwin() && !getTriple().isOSWindows())
+  if (!getTriple().isOSBinFormatMachO() && !getTriple().isOSWindows())
 Builder.defineMacro("__ARM_EABI__");
   Builder.defineMacro("__ARM_PCS", "1");
 }

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=269487=269486=269487=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Fri May 13 16:26:45 2016
@@ -2170,13 +2170,13 @@
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabi < /dev/null | 
FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
 // ARM-NONE-EABI: #define __ELF__ 1
 
-// RUN: %clang -target arm-apple-darwin-eabi -arch armv7s -x c -E -dM %s -o - 
| FileCheck -match-full-lines --check-prefix=ARM-DARWIN-NO-EABI %s
-// RUN: %clang -target arm-apple-darwin-eabi -arch armv6m -x c -E -dM %s -o - 
| FileCheck -match-full-lines --check-prefix=ARM-DARWIN-EABI %s
-// RUN: %clang -target arm-apple-darwin-eabi -arch armv7m -x c -E -dM %s -o - 
| FileCheck -match-full-lines --check-prefix=ARM-DARWIN-EABI %s
-// RUN: %clang -target arm-apple-darwin-eabi -arch armv7em -x c -E -dM %s -o - 
| FileCheck -match-full-lines --check-prefix=ARM-DARWIN-EABI %s
-// RUN: %clang -target thumbv7-apple-darwin-eabi -arch armv7 -x c -E -dM %s -o 
- | FileCheck -match-full-lines --check-prefix=ARM-DARWIN-NO-EABI %s
-// ARM-DARWIN-NO-EABI-NOT: #define __ARM_EABI__ 1
-// ARM-DARWIN-EABI: #define __ARM_EABI__ 1
+// No MachO targets use the full EABI, even if AAPCS is used.
+// RUN: %clang -target x86_64-apple-darwin -arch armv7s -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARM-MACHO-NO-EABI %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv6m -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARM-MACHO-NO-EABI %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARM-MACHO-NO-EABI %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7em -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARM-MACHO-NO-EABI %s
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -x c -E -dM %s -o - | 
FileCheck -match-full-lines --check-prefix=ARM-MACHO-NO-EABI %s
+// ARM-MACHO-NO-EABI-NOT: #define __ARM_EABI__ 1
 
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=armv7-bitrig-gnueabihf < 
/dev/null | FileCheck -match-full-lines -check-prefix ARM-BITRIG %s
 // ARM-BITRIG:#define __ARM_DWARF_EH__ 1


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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Rafael Espíndola via cfe-commits
You can probably use collectUsedGlobalVariables.

You can probably also delete the FIXME about llvm.used and appending
linkage. I think the way to fix this is to make "can be dropped" an
independent property from the linkage and then we don't need llvm.used
at all.

Cheers,
Rafael


On 13 May 2016 at 17:01, Steven Wu  wrote:
> Attach a patch using private linkage type and adding to llvm.used. I have to 
> recreate llvm.used when embedding bitcode. I don't really like it but I don't 
> have better solutions.
> Few other options:
> 1. Not allowing re-embedded bitcode will simplify the code a bit but not a 
> lot.
> 2. Create a new "llvm.*.used" variable in llvm.metadata section.
> 3. Teach optimizer do not optimize away llvm.* variables.
>
>
>
>
> Steven
>
>> On May 13, 2016, at 10:10 AM, Rafael Espíndola  
>> wrote:
>>
>> On 13 May 2016 at 13:02, Steven Wu  wrote:
>>> Hi Rafael
>>>
>>> Thanks for notice this! That would definitely cause duplicated symbol error 
>>> and I should definitely change that.
>>> Here is some background:
>>> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but not 
>>> the ones in earlier Xcode. The old ld64 will simply concatenate the bitcode 
>>> files which is not the right thing to do. So there is a symbol generated at 
>>> the place to prevent user to link the bitcode object file with old ld64 
>>> because older ld64 will fail and report duplicated symbols.
>>> I have a radar tracking to change the linkage type when upstream but I 
>>> dropped the ball on that one. The correct thing to do is to make it 
>>> internal and add to llvm.used. I will come up with a patch.
>>
>> Thank you so much!
>>
>> Cheers,
>> Rafael
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-13 Thread Cameron via cfe-commits
cameron314 updated this revision to Diff 57253.
cameron314 added a comment.

Removed workaround for case that can no longer happen.


http://reviews.llvm.org/D20137

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

Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -1378,7 +1378,7 @@
   
   // First, make a record of those files that have been overridden via
   // remapping or unsaved_files.
-  llvm::StringMap OverriddenFiles;
+  std::map OverriddenFiles;
   for (const auto  : PreprocessorOpts.RemappedFiles) {
 if (AnyFileChanged)
   break;
@@ -1391,40 +1391,47 @@
   break;
 }
 
-OverriddenFiles[R.first] = PreambleFileHash::createForFile(
+OverriddenFiles[Status.getUniqueID()] = PreambleFileHash::createForFile(
 Status.getSize(), Status.getLastModificationTime().toEpochTime());
   }
 
   for (const auto  : PreprocessorOpts.RemappedFileBuffers) {
 if (AnyFileChanged)
   break;
-OverriddenFiles[RB.first] =
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+
+OverriddenFiles[Status.getUniqueID()] =
 PreambleFileHash::createForMemoryBuffer(RB.second);
   }

   // Check whether anything has changed.
-  for (llvm::StringMap::iterator 
+  for (FilesInPreambleMap::iterator
  F = FilesInPreamble.begin(), FEnd = FilesInPreamble.end();
!AnyFileChanged && F != FEnd; 
++F) {
-llvm::StringMap::iterator Overridden
-  = OverriddenFiles.find(F->first());
+std::map::iterator Overridden
+  = OverriddenFiles.find(F->first);
 if (Overridden != OverriddenFiles.end()) {
   // This file was remapped; check whether the newly-mapped file 
   // matches up with the previous mapping.
-  if (Overridden->second != F->second)
+  if (Overridden->second != F->second.second)
 AnyFileChanged = true;
   continue;
 }
 
 // The file was not remapped; check whether it has changed on disk.
 vfs::Status Status;
-if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
+if (FileMgr->getNoncachedStatValue(F->second.first, Status)) {
   // If we can't stat the file, assume that something horrible happened.
   AnyFileChanged = true;
-} else if (Status.getSize() != uint64_t(F->second.Size) ||
+} else if (Status.getSize() != uint64_t(F->second.second.Size) ||
Status.getLastModificationTime().toEpochTime() !=
-   uint64_t(F->second.ModTime))
+   uint64_t(F->second.second.ModTime))
   AnyFileChanged = true;
   }
   
@@ -1612,12 +1619,14 @@
 if (!File || File == SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()))
   continue;
 if (time_t ModTime = File->getModificationTime()) {
-  FilesInPreamble[File->getName()] = PreambleFileHash::createForFile(
-  File->getSize(), ModTime);
+  FilesInPreamble[File->getUniqueID()] = std::make_pair(
+File->getName(),
+PreambleFileHash::createForFile(File->getSize(), ModTime));
 } else {
   llvm::MemoryBuffer *Buffer = SourceMgr.getMemoryBufferForFile(File);
-  FilesInPreamble[File->getName()] =
-  PreambleFileHash::createForMemoryBuffer(Buffer);
+  FilesInPreamble[File->getUniqueID()] = std::make_pair(
+File->getName(),
+PreambleFileHash::createForMemoryBuffer(Buffer));
 }
   }
 
Index: include/clang/Frontend/ASTUnit.h
===
--- include/clang/Frontend/ASTUnit.h
+++ include/clang/Frontend/ASTUnit.h
@@ -31,6 +31,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/FileSystem.h"
 #include 
 #include 
 #include 
@@ -264,12 +265,15 @@
   /// a line after skipping the preamble.
   bool PreambleEndsAtStartOfLine;
 
+  typedef std::map> FilesInPreambleMap;
+
   /// \brief Keeps track of the files that were used when computing the 
   /// preamble, with both their buffer size and their modification time.
   ///
   /// If any of the files have changed from one compile to the next,
   /// the preamble must be thrown away.
-  llvm::StringMap FilesInPreamble;
+  FilesInPreambleMap FilesInPreamble;
 
   /// \brief When non-NULL, this is the buffer used to store the contents of
   /// the main file when it has been padded for use with the precompiled

Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-13 Thread Cameron via cfe-commits
cameron314 added inline comments.


Comment at: lib/Basic/FileManager.cpp:304-307
@@ -303,1 +303,6 @@
 
+  if (UFE.isVirtual()) {
+UFE.Name = InterndFileName;
+return 
+  }
+

rsmith wrote:
> It looks like this is unreachable: `IsVirtual` is only ever `true` when 
> `IsValid` is also `true`, and we don't reach this line if `UFE.isValid()`. As 
> this is the only consumer of `FileEntry::IsValid`, it looks like it does 
> nothing. Am I missing something?
Hmm, interesting, good catch. Back when I made this change UFE.IsValid was 
//not// set to true in the fall-through after this if, which is why I had to 
introduce `IsVirtual` in the first place.

But looking at the history on this file, it seems it //was// set to true since 
the very beginning. I think we'd removed it in our local fork at one point to 
work around a different bug, but it's back to normal in ours as well. So I 
guess this part of the patch is unnecessary now. Yay! I'll remove it, it wasn't 
very pretty anyway.


Comment at: lib/Frontend/ASTUnit.cpp:1402-1406
@@ +1401,7 @@
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+

rsmith wrote:
> If there are multiple file names with the same inode, `RB.first` is an 
> arbitrarily-chosen one of those names, and stat'ing it isn't sufficient to 
> check that none of the other names for the file have changed. Maybe we need 
> to store a list of filenames used for each `UniqueID`?
I'm not sure I understand -- if the file changed on disk, why would it matter 
which name we're accessing it by?


http://reviews.llvm.org/D20137



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


Re: [PATCH] D20118: Add support for injected class names and constructor initializers in C++

2016-05-13 Thread Sean Callanan via cfe-commits
spyffe added a comment.

I’m just going to use clang-format to resolve trailing whitespace/etc issues.  
It changes around some indentation in the class declaration for ASTImporter but 
that probably needs to be taken care of anyway…

Sean


Repository:
  rL LLVM

http://reviews.llvm.org/D20118



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


Re: [PATCH] D20118: Add support for injected class names and constructor initializers in C++

2016-05-13 Thread Sean Callanan via cfe-commits
I’m just going to use clang-format to resolve trailing whitespace/etc issues.  
It changes around some indentation in the class declaration for ASTImporter but 
that probably needs to be taken care of anyway…

Sean

> On May 13, 2016, at 1:40 PM, Sean Callanan  wrote:
> 
> spyffe added a subscriber: spyffe.
> spyffe added a comment.
> 
> Thank you for your comments, I’m working on them now.
> 
> Sean
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D20118
> 
> 
> 

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


Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Steven Wu via cfe-commits
Attach a patch using private linkage type and adding to llvm.used. I have to 
recreate llvm.used when embedding bitcode. I don't really like it but I don't 
have better solutions.
Few other options:
1. Not allowing re-embedded bitcode will simplify the code a bit but not a lot.
2. Create a new "llvm.*.used" variable in llvm.metadata section.
3. Teach optimizer do not optimize away llvm.* variables.   



0001-Fix-embed-bitcode-linkage-type.patch
Description: Binary data


Steven

> On May 13, 2016, at 10:10 AM, Rafael Espíndola  
> wrote:
> 
> On 13 May 2016 at 13:02, Steven Wu  wrote:
>> Hi Rafael
>> 
>> Thanks for notice this! That would definitely cause duplicated symbol error 
>> and I should definitely change that.
>> Here is some background:
>> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but not 
>> the ones in earlier Xcode. The old ld64 will simply concatenate the bitcode 
>> files which is not the right thing to do. So there is a symbol generated at 
>> the place to prevent user to link the bitcode object file with old ld64 
>> because older ld64 will fail and report duplicated symbols.
>> I have a radar tracking to change the linkage type when upstream but I 
>> dropped the ball on that one. The correct thing to do is to make it internal 
>> and add to llvm.used. I will come up with a patch.
> 
> Thank you so much!
> 
> Cheers,
> Rafael

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


Re: [PATCH] D20254: [Clang] Fix some Clang-tidy modernize-use-bool-literals warnings; other minor fixes.

2016-05-13 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko updated this revision to Diff 57250.
Eugene.Zelenko added a comment.

Include mode context.


Repository:
  rL LLVM

http://reviews.llvm.org/D20254

Files:
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/IdentifierTable.h
  lib/Basic/FileManager.cpp

Index: lib/Basic/FileManager.cpp
===
--- lib/Basic/FileManager.cpp
+++ lib/Basic/FileManager.cpp
@@ -20,16 +20,19 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
 #include 
-#include 
 #include 
-#include 
+#include 
 
 using namespace clang;
 
@@ -494,7 +497,6 @@
   UniqueRealFiles.erase(Entry->getUniqueID());
 }
 
-
 void FileManager::GetUniqueIDMapping(
SmallVectorImpl ) const {
   UIDToFiles.clear();
Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -11,13 +11,14 @@
 //  traverses the entire AST.
 //
 //===--===//
+
 #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 
-#include 
-
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclarationName.h"
+#include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -27,15 +28,25 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprOpenMP.h"
+#include "clang/AST/LambdaCapture.h"
 #include "clang/AST/NestedNameSpecifier.h"
+#include "clang/AST/OpenMPClause.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/StmtOpenMP.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
+#include "clang/Basic/OpenMPKinds.h"
+#include "clang/Basic/Specifiers.h"
+#include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Casting.h"
+#include 
+#include 
+#include 
 
 // The following three macros are used for meta programming.  The code
 // using them is responsible for defining macro OPERATOR().
@@ -70,7 +81,7 @@
   do { \
 if (!getDerived().CALL_EXPR)   \
   return false;\
-  } while (0)
+  } while (false)
 
 /// \brief A class that does preorder depth-first traversal on the
 /// entire Clang AST and visits each node.
@@ -320,7 +331,7 @@
   do { \
 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
   return false;\
-  } while (0)
+  } while (false)
 
 public:
 // Declare Traverse*() for all concrete Stmt classes.
@@ -2000,6 +2011,7 @@
 DEF_TRAVERSE_STMT(ObjCAtTryStmt, {})
 DEF_TRAVERSE_STMT(ObjCForCollectionStmt, {})
 DEF_TRAVERSE_STMT(ObjCAutoreleasePoolStmt, {})
+
 DEF_TRAVERSE_STMT(CXXForRangeStmt, {
   if (!getDerived().shouldVisitImplicitCode()) {
 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLoopVarStmt());
@@ -2009,10 +2021,12 @@
 return true;
   }
 })
+
 DEF_TRAVERSE_STMT(MSDependentExistsStmt, {
   TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
   TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
 })
+
 DEF_TRAVERSE_STMT(ReturnStmt, {})
 DEF_TRAVERSE_STMT(SwitchStmt, {})
 DEF_TRAVERSE_STMT(WhileStmt, {})
@@ -2254,29 +2268,35 @@
 DEF_TRAVERSE_STMT(AddrLabelExpr, {})
 DEF_TRAVERSE_STMT(ArraySubscriptExpr, {})
 DEF_TRAVERSE_STMT(OMPArraySectionExpr, {})
+
 DEF_TRAVERSE_STMT(BlockExpr, {
   TRY_TO(TraverseDecl(S->getBlockDecl()));
   return true; // no child statements to loop through.
 })
+
 DEF_TRAVERSE_STMT(ChooseExpr, {})
+
 DEF_TRAVERSE_STMT(CompoundLiteralExpr, {
   TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
 })
+
 DEF_TRAVERSE_STMT(CXXBindTemporaryExpr, {})
 DEF_TRAVERSE_STMT(CXXBoolLiteralExpr, {})
 DEF_TRAVERSE_STMT(CXXDefaultArgExpr, {})
 DEF_TRAVERSE_STMT(CXXDefaultInitExpr, {})
 DEF_TRAVERSE_STMT(CXXDeleteExpr, {})
 DEF_TRAVERSE_STMT(ExprWithCleanups, {})
 DEF_TRAVERSE_STMT(CXXNullPtrLiteralExpr, {})
 DEF_TRAVERSE_STMT(CXXStdInitializerListExpr, {})
+
 DEF_TRAVERSE_STMT(CXXPseudoDestructorExpr, {
   TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
   if 

Re: [PATCH] D20254: [Clang] Fix some Clang-tidy modernize-use-bool-literals warnings; other minor fixes.

2016-05-13 Thread Piotr Padlewski via cfe-commits
Prazek added a subscriber: Prazek.
Prazek added a comment.

Can you post this review with more context? (diff -U9)


Repository:
  rL LLVM

http://reviews.llvm.org/D20254



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


Re: [PATCH] D20118: Add support for injected class names and constructor initializers in C++

2016-05-13 Thread Sean Callanan via cfe-commits
spyffe added a subscriber: spyffe.
spyffe added a comment.

Thank you for your comments, I’m working on them now.

Sean


Repository:
  rL LLVM

http://reviews.llvm.org/D20118



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


Re: [PATCH] D20118: Add support for injected class names and constructor initializers in C++

2016-05-13 Thread Sean Callanan via cfe-commits
Thank you for your comments, I’m working on them now.

Sean

> On May 11, 2016, at 4:39 AM, Aleksei Sidorin  wrote:
> 
> a.sidorin added a comment.
> 
> I' d like to have some tests for this. CXXCtorInitializers can be tested with 
> D14224 -like stuff or with ASTMatchers 
> (ASTImporterTest.cpp).
> Some code samples may be found in CXX/Sema tests, you just need to 
> port/simplify them.
> 
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:3034
> @@ +3033,3 @@
> +SmallVector CtorInitializers;
> +for (const CXXCtorInitializer *I : FromConstructor->inits()) {
> +  CXXCtorInitializer *ToI =cast_or_null(
> 
> In my latest patch, I have introduced a function named 
> `ImportContainerChecked()`. I think it could make this code a bit more clean. 
> What do you think?
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:3035
> @@ +3034,3 @@
> +for (const CXXCtorInitializer *I : FromConstructor->inits()) {
> +  CXXCtorInitializer *ToI =cast_or_null(
> +  Importer.Import(I));
> 
> Space after '='
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:3041
> @@ +3040,3 @@
> +}
> +if (unsigned NumInitializers = CtorInitializers.size()) {
> +  CXXCtorInitializer **Memory = new (Importer.getToContext())
> 
> If we move this condition (I suggest to use 
> `FromConstructor->getNumCtorIintializers()` instead) upper to cover the 
> importing loop, we may skip this loop as well.
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:3045
> @@ +3044,3 @@
> +  std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
> +  
> llvm::cast(ToFunction)->setCtorInitializers(Memory);
> +  llvm::cast(ToFunction)->setNumCtorInitializers(
> 
> As I can see, LLVM code style avoids qualified `cast`s.
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:6384
> @@ +6383,3 @@
> +  return nullptr;
> +
> +return new (ToContext)
> 
> Trailing whitespace.
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:6389
> @@ +6388,3 @@
> + Import(From->getRParenLoc()),
> + From->isPackExpansion() ?
> + Import(From->getEllipsisLoc()) : SourceLocation());
> 
> The indentation for `?:` here is a bit confusing.
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:6396
> @@ +6395,3 @@
> +  return nullptr;
> +
> +return new (ToContext)
> 
> Training whitespace. It's pretty difficult to find them with Phabricator, 
> could you check your patch for them?
> 
> 
> Comment at: lib/AST/ASTImporter.cpp:6423
> @@ +6422,3 @@
> +  } else {
> +return nullptr;
> +  }
> 
> It seems like a case with indexed initializer is missed here. You can find my 
> implementation on 
> https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp#L2456-L2464.
> A sample that requires it is `auto parens4 = [p4(1)] {};` 
> (test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp)
> 
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D20118
> 
> 
> 

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


[PATCH] D20254: [Clang] Fix some Clang-tidy modernize-use-bool-literals warnings; other minor fixes.

2016-05-13 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko created this revision.
Eugene.Zelenko added reviewers: hans, aaron.ballman.
Eugene.Zelenko added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.

Fix some Include What You Use warnings.

I checked this patch on my own build on RHEL 6. Regressions were OK.

Repository:
  rL LLVM

http://reviews.llvm.org/D20254

Files:
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/IdentifierTable.h
  lib/Basic/FileManager.cpp

Index: lib/Basic/FileManager.cpp
===
--- lib/Basic/FileManager.cpp
+++ lib/Basic/FileManager.cpp
@@ -20,16 +20,19 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
 #include 
-#include 
 #include 
-#include 
+#include 
 
 using namespace clang;
 
@@ -494,7 +497,6 @@
   UniqueRealFiles.erase(Entry->getUniqueID());
 }
 
-
 void FileManager::GetUniqueIDMapping(
SmallVectorImpl ) const {
   UIDToFiles.clear();
Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -11,13 +11,14 @@
 //  traverses the entire AST.
 //
 //===--===//
+
 #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 
-#include 
-
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclarationName.h"
+#include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -27,7 +28,9 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprOpenMP.h"
+#include "clang/AST/LambdaCapture.h"
 #include "clang/AST/NestedNameSpecifier.h"
+#include "clang/AST/OpenMPClause.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
@@ -36,6 +39,14 @@
 #include "clang/AST/TemplateName.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLoc.h"
+#include "clang/Basic/OpenMPKinds.h"
+#include "clang/Basic/Specifiers.h"
+#include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Casting.h"
+#include 
+#include 
+#include 
 
 // The following three macros are used for meta programming.  The code
 // using them is responsible for defining macro OPERATOR().
@@ -70,7 +81,7 @@
   do { \
 if (!getDerived().CALL_EXPR)   \
   return false;\
-  } while (0)
+  } while (false)
 
 /// \brief A class that does preorder depth-first traversal on the
 /// entire Clang AST and visits each node.
@@ -320,7 +331,7 @@
   do { \
 if (!TRAVERSE_STMT_BASE(Stmt, Stmt, S, Queue)) \
   return false;\
-  } while (0)
+  } while (false)
 
 public:
 // Declare Traverse*() for all concrete Stmt classes.
@@ -2000,6 +2011,7 @@
 DEF_TRAVERSE_STMT(ObjCAtTryStmt, {})
 DEF_TRAVERSE_STMT(ObjCForCollectionStmt, {})
 DEF_TRAVERSE_STMT(ObjCAutoreleasePoolStmt, {})
+
 DEF_TRAVERSE_STMT(CXXForRangeStmt, {
   if (!getDerived().shouldVisitImplicitCode()) {
 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLoopVarStmt());
@@ -2009,10 +2021,12 @@
 return true;
   }
 })
+
 DEF_TRAVERSE_STMT(MSDependentExistsStmt, {
   TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
   TRY_TO(TraverseDeclarationNameInfo(S->getNameInfo()));
 })
+
 DEF_TRAVERSE_STMT(ReturnStmt, {})
 DEF_TRAVERSE_STMT(SwitchStmt, {})
 DEF_TRAVERSE_STMT(WhileStmt, {})
@@ -2254,14 +2268,18 @@
 DEF_TRAVERSE_STMT(AddrLabelExpr, {})
 DEF_TRAVERSE_STMT(ArraySubscriptExpr, {})
 DEF_TRAVERSE_STMT(OMPArraySectionExpr, {})
+
 DEF_TRAVERSE_STMT(BlockExpr, {
   TRY_TO(TraverseDecl(S->getBlockDecl()));
   return true; // no child statements to loop through.
 })
+
 DEF_TRAVERSE_STMT(ChooseExpr, {})
+
 DEF_TRAVERSE_STMT(CompoundLiteralExpr, {
   TRY_TO(TraverseTypeLoc(S->getTypeSourceInfo()->getTypeLoc()));
 })
+
 DEF_TRAVERSE_STMT(CXXBindTemporaryExpr, {})
 DEF_TRAVERSE_STMT(CXXBoolLiteralExpr, {})
 DEF_TRAVERSE_STMT(CXXDefaultArgExpr, {})
@@ -2270,6 +2288,7 @@
 DEF_TRAVERSE_STMT(ExprWithCleanups, {})
 DEF_TRAVERSE_STMT(CXXNullPtrLiteralExpr, {})
 DEF_TRAVERSE_STMT(CXXStdInitializerListExpr, {})
+
 

r269468 - Revert "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"

2016-05-13 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Fri May 13 15:10:22 2016
New Revision: 269468

URL: http://llvm.org/viewvc/llvm-project?rev=269468=rev
Log:
Revert "[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC"

This reverts commit r269463. It fails two llvm-profdata tests.

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269468=269467=269468=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri May 13 15:10:22 2016
@@ -141,13 +141,11 @@ CodeGenModule::CodeGenModule(ASTContext
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (auto E = ReaderOrErr.takeError()) {
+if (std::error_code EC = ReaderOrErr.getError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
-getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-  << EI.message();
-  });
+  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+<< EC.message();
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269468=269467=269468=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri May 13 15:10:22 2016
@@ -800,21 +800,20 @@ void CodeGenPGO::loadRegionCounts(llvm::
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::Expected RecordExpected =
+  llvm::ErrorOr RecordErrorOr =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (auto E = RecordExpected.takeError()) {
-auto IPE = llvm::InstrProfError::take(std::move(E));
-if (IPE == llvm::instrprof_error::unknown_function)
+  if (std::error_code EC = RecordErrorOr.getError()) {
+if (EC == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (IPE == llvm::instrprof_error::hash_mismatch)
+else if (EC == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (IPE == llvm::instrprof_error::malformed)
+else if (EC == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  
llvm::make_unique(std::move(RecordExpected.get()));
+  llvm::make_unique(std::move(RecordErrorOr.get()));
   RegionCounts = ProfRecord->Counts;
 }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269468=269467=269468=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 13 15:10:22 2016
@@ -403,8 +403,7 @@ static void setPGOUseInstrumentor(CodeGe
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (auto E = ReaderOrErr.takeError()) {
-llvm::consumeError(std::move(E));
+  if (ReaderOrErr.getError()) {
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


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


r269465 - [MS ABI] Delegating constructors should not assume they are most derived

2016-05-13 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Fri May 13 15:05:09 2016
New Revision: 269465

URL: http://llvm.org/viewvc/llvm-project?rev=269465=rev
Log:
[MS ABI] Delegating constructors should not assume they are most derived

A constructor needs to know whether or not it is most derived in order
to determine if it is responsible for virtual bases.  Delegating
constructors assumed they were most derived.

Modified:
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-structors.cpp

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=269465=269464=269465=diff
==
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Fri May 13 15:05:09 2016
@@ -1467,16 +1467,18 @@ unsigned MicrosoftCXXABI::addImplicitCon
 
   // Add the 'most_derived' argument second if we are variadic or last if not.
   const FunctionProtoType *FPT = D->getType()->castAs();
-  llvm::Value *MostDerivedArg =
-  llvm::ConstantInt::get(CGM.Int32Ty, Type == Ctor_Complete);
-  RValue RV = RValue::get(MostDerivedArg);
-  if (MostDerivedArg) {
-if (FPT->isVariadic())
-  Args.insert(Args.begin() + 1,
-  CallArg(RV, getContext().IntTy, /*needscopy=*/false));
-else
-  Args.add(RV, getContext().IntTy);
+  llvm::Value *MostDerivedArg;
+  if (Delegating) {
+MostDerivedArg = getStructorImplicitParamValue(CGF);
+  } else {
+MostDerivedArg = llvm::ConstantInt::get(CGM.Int32Ty, Type == 
Ctor_Complete);
   }
+  RValue RV = RValue::get(MostDerivedArg);
+  if (FPT->isVariadic())
+Args.insert(Args.begin() + 1,
+CallArg(RV, getContext().IntTy, /*needscopy=*/false));
+  else
+Args.add(RV, getContext().IntTy);
 
   return 1;  // Added one arg.
 }

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-structors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-structors.cpp?rev=269465=269464=269465=diff
==
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-structors.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-structors.cpp Fri May 13 15:05:09 
2016
@@ -7,7 +7,7 @@
 // RUN: FileCheck --check-prefix DTORS3 %s < %t
 // RUN: FileCheck --check-prefix DTORS4 %s < %t
 //
-// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases 
-triple=x86_64-pc-win32 -fno-rtti | FileCheck --check-prefix DTORS-X64 %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -mconstructor-aliases 
-triple=x86_64-pc-win32 -fno-rtti -std=c++11 | FileCheck --check-prefix 
DTORS-X64 %s
 
 namespace basic {
 
@@ -443,6 +443,20 @@ void g() { new MoveOnly(f()); }
 // CHECK: store {{.*}} @"\01??_7MoveOnly@implicit_copy_vtable@@6B@"
 }
 
+namespace delegating_ctor {
+struct Y {};
+struct X : virtual Y {
+  X(int);
+  X();
+};
+X::X(int) : X() {}
+}
+// CHECK: define x86_thiscallcc %"struct.delegating_ctor::X"* 
@"\01??0X@delegating_ctor@@QAE@H@Z"(
+// CHECK:  %[[is_most_derived_addr:.*]] = alloca i32, align 4
+// CHECK:  store i32 %is_most_derived, i32* %[[is_most_derived_addr]]
+// CHECK:  %[[is_most_derived:.*]] = load i32, i32* %[[is_most_derived_addr]]
+// CHECK:  call x86_thiscallcc {{.*}}* 
@"\01??0X@delegating_ctor@@QAE@XZ"({{.*}} i32 %[[is_most_derived]])
+
 // Dtor thunks for classes in anonymous namespaces should be internal, not
 // linkonce_odr.
 namespace {
@@ -471,4 +485,3 @@ class G {
 extern void testG() {
   G g;
 }
-


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


r269463 - [ProfileData] (clang) Use Error in InstrProf and Coverage, NFC

2016-05-13 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Fri May 13 15:01:34 2016
New Revision: 269463

URL: http://llvm.org/viewvc/llvm-project?rev=269463=rev
Log:
[ProfileData] (clang) Use Error in InstrProf and Coverage, NFC

Sync up with "(llvm) Use Error in InstrProf and Coverage".

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=269463=269462=269463=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri May 13 15:01:34 2016
@@ -141,11 +141,13 @@ CodeGenModule::CodeGenModule(ASTContext
   if (CodeGenOpts.hasProfileClangUse()) {
 auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
 CodeGenOpts.ProfileInstrumentUsePath);
-if (std::error_code EC = ReaderOrErr.getError()) {
+if (auto E = ReaderOrErr.takeError()) {
   unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
   "Could not read profile %0: %1");
-  getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
-<< EC.message();
+  llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase ) {
+getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath
+  << EI.message();
+  });
 } else
   PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=269463=269462=269463=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri May 13 15:01:34 2016
@@ -800,20 +800,21 @@ void CodeGenPGO::loadRegionCounts(llvm::
   bool IsInMainFile) {
   CGM.getPGOStats().addVisited(IsInMainFile);
   RegionCounts.clear();
-  llvm::ErrorOr RecordErrorOr =
+  llvm::Expected RecordExpected =
   PGOReader->getInstrProfRecord(FuncName, FunctionHash);
-  if (std::error_code EC = RecordErrorOr.getError()) {
-if (EC == llvm::instrprof_error::unknown_function)
+  if (auto E = RecordExpected.takeError()) {
+auto IPE = llvm::InstrProfError::take(std::move(E));
+if (IPE == llvm::instrprof_error::unknown_function)
   CGM.getPGOStats().addMissing(IsInMainFile);
-else if (EC == llvm::instrprof_error::hash_mismatch)
+else if (IPE == llvm::instrprof_error::hash_mismatch)
   CGM.getPGOStats().addMismatched(IsInMainFile);
-else if (EC == llvm::instrprof_error::malformed)
+else if (IPE == llvm::instrprof_error::malformed)
   // TODO: Consider a more specific warning for this case.
   CGM.getPGOStats().addMismatched(IsInMainFile);
 return;
   }
   ProfRecord =
-  llvm::make_unique(std::move(RecordErrorOr.get()));
+  
llvm::make_unique(std::move(RecordExpected.get()));
   RegionCounts = ProfRecord->Counts;
 }
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=269463=269462=269463=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 13 15:01:34 2016
@@ -403,7 +403,8 @@ static void setPGOUseInstrumentor(CodeGe
   const std::string ProfileName) {
   auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
   // In error, return silently and let Clang PGOUse report the error message.
-  if (ReaderOrErr.getError()) {
+  if (auto E = ReaderOrErr.takeError()) {
+llvm::consumeError(std::move(E));
 Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
 return;
   }


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


r269460 - Add an AST matcher for CastExpr kind

2016-05-13 Thread Etienne Bergeron via cfe-commits
Author: etienneb
Date: Fri May 13 14:36:55 2016
New Revision: 269460

URL: http://llvm.org/viewvc/llvm-project?rev=269460=rev
Log:
Add an AST matcher for CastExpr kind

Summary:
This AST matcher will match a given CastExpr kind.
It's an narrowing matcher on CastExpr.

Reviewers: klimek, alexfh, sbenza, aaron.ballman

Subscribers: Prazek, jroelofs, aaron.ballman, klimek, cfe-commits

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

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=269460=269459=269460=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Fri May 13 14:36:55 2016
@@ -2159,6 +2159,15 @@ Example matches f(0, 0) (matcher = callE
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CastExpr.html;>CastExprhasCastKindCastKind Kind
+Matches casts that has 
a given cast kind.
+
+Example: matches the implicit cast around 0
+(matcher = castExpr(hasCastKind(CK_NullToPointer)))
+  int *p = 0;
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html;>CharacterLiteralequalsValueT  Value
 Matches literals that are 
equal to the given value.
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=269460=269459=269460=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri May 13 14:36:55 2016
@@ -3551,6 +3551,17 @@ AST_POLYMORPHIC_MATCHER_P(hasSourceExpre
   InnerMatcher.matches(*SubExpression, Finder, Builder));
 }
 
+/// \brief Matches casts that has a given cast kind.
+///
+/// Example: matches the implicit cast around \c 0
+/// (matcher = castExpr(hasCastKind(CK_NullToPointer)))
+/// \code
+///   int *p = 0;
+/// \endcode
+AST_MATCHER_P(CastExpr, hasCastKind, CastKind, Kind) {
+  return Node.getCastKind() == Kind;
+}
+
 /// \brief Matches casts whose destination type matches a given matcher.
 ///
 /// (Note: Clang's AST refers to other conversions as "casts" too, and calls

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h?rev=269460=269459=269460=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h Fri May 13 14:36:55 2016
@@ -96,6 +96,28 @@ public:
   }
 };
 
+template <> struct ArgTypeTraits {
+private:
+  static clang::CastKind getCastKind(llvm::StringRef AttrKind) {
+return llvm::StringSwitch(AttrKind)
+#define CAST_OPERATION(Name) .Case( #Name, CK_##Name)
+#include "clang/AST/OperationKinds.def"
+.Default(CK_Invalid);
+  }
+
+public:
+  static bool is(const VariantValue ) {
+return Value.isString() &&  
+getCastKind(Value.getString()) != CK_Invalid;
+  }
+  static clang::CastKind get(const VariantValue ) {
+return getCastKind(Value.getString());
+  }
+  static ArgKind getKind() {
+return ArgKind(ArgKind::AK_String);
+  }
+};
+
 /// \brief Matcher descriptor interface.
 ///
 /// Provides a \c create() method that constructs the matcher from the provided

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=269460=269459=269460=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Fri May 13 14:36:55 2016
@@ -210,6 +210,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(hasBody);
   REGISTER_MATCHER(hasCanonicalType);
   REGISTER_MATCHER(hasCaseConstant);
+  REGISTER_MATCHER(hasCastKind);
   REGISTER_MATCHER(hasCondition);
   REGISTER_MATCHER(hasConditionVariableStatement);
   REGISTER_MATCHER(hasDecayedType);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=269460=269459=269460=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Fri May 13 14:36:55 2016
@@ -3485,6 +3485,15 @@ TEST(CastExpression, DoesNotMatchNonCast
   

Re: [PATCH] D20240: [clang-rename] Fix broken dependency on shared build.

2016-05-13 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

In http://reviews.llvm.org/D20240#429910, @vmiklos wrote:

> Thanks for fixing the problem I introduced. :-)


No worries, I did the same twice this week.


http://reviews.llvm.org/D20240



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


Re: [PATCH] D20240: [clang-rename] Fix broken dependency on shared build.

2016-05-13 Thread Miklos Vajna via cfe-commits
vmiklos added a subscriber: vmiklos.
vmiklos added a comment.

Thanks for fixing the problem I introduced. :-)


http://reviews.llvm.org/D20240



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


Re: [PATCH] D20253: clang-rename: fix missing clangLex dependency

2016-05-13 Thread Miklos Vajna via cfe-commits
vmiklos abandoned this revision.
vmiklos added a comment.

Ah, already fixed by http://reviews.llvm.org/D20240, sorry for the noise. :-)


http://reviews.llvm.org/D20253



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


[PATCH] D20253: clang-rename: fix missing clangLex dependency

2016-05-13 Thread Miklos Vajna via cfe-commits
vmiklos created this revision.
vmiklos added reviewers: cfe-commits, klimek.

Blind fix for 
.

http://reviews.llvm.org/D20253

Files:
  clang-rename/CMakeLists.txt

Index: clang-rename/CMakeLists.txt
===
--- clang-rename/CMakeLists.txt
+++ clang-rename/CMakeLists.txt
@@ -10,6 +10,7 @@
   clangAST
   clangBasic
   clangIndex
+  clangLex
   clangToolingCore
   )
 


Index: clang-rename/CMakeLists.txt
===
--- clang-rename/CMakeLists.txt
+++ clang-rename/CMakeLists.txt
@@ -10,6 +10,7 @@
   clangAST
   clangBasic
   clangIndex
+  clangLex
   clangToolingCore
   )
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269457 - Use marginally more appropriate functions to detect if we should declare an

2016-05-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri May 13 13:48:05 2016
New Revision: 269457

URL: http://llvm.org/viewvc/llvm-project?rev=269457=rev
Log:
Use marginally more appropriate functions to detect if we should declare an
implicit copy constructor/assignment, and other minor cleanups. No
functionality change intended.

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=269457=269456=269457=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri May 13 13:48:05 2016
@@ -6463,7 +6463,7 @@ void Sema::AddImplicitlyDeclaredMembersT
   ClassDecl->hasInheritedConstructor())
 DeclareImplicitDefaultConstructor(ClassDecl);
 
-  if (!ClassDecl->hasUserDeclaredCopyConstructor()) {
+  if (ClassDecl->needsImplicitCopyConstructor()) {
 ++ASTContext::NumImplicitCopyConstructors;
 
 // If the properties or semantics of the copy constructor couldn't be
@@ -6482,7 +6482,7 @@ void Sema::AddImplicitlyDeclaredMembersT
   DeclareImplicitMoveConstructor(ClassDecl);
   }
 
-  if (!ClassDecl->hasUserDeclaredCopyAssignment()) {
+  if (ClassDecl->needsImplicitCopyAssignment()) {
 ++ASTContext::NumImplicitCopyAssignmentOperators;
 
 // If we have a dynamic class, then the copy assignment operator may be
@@ -6505,7 +6505,7 @@ void Sema::AddImplicitlyDeclaredMembersT
   DeclareImplicitMoveAssignment(ClassDecl);
   }
 
-  if (!ClassDecl->hasUserDeclaredDestructor()) {
+  if (ClassDecl->needsImplicitDestructor()) {
 ++ASTContext::NumImplicitDestructors;
 
 // If we have a dynamic class, then the destructor may be virtual, so we
@@ -8946,6 +8946,7 @@ void Sema::CheckImplicitSpecialMemberDec
 if (auto *Acceptable = R.getAcceptableDecl(D))
   R.addDecl(Acceptable);
   R.resolveKind();
+  R.suppressDiagnostics();
 
   CheckFunctionDeclaration(S, FD, R, /*IsExplicitSpecialization*/false);
 }

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=269457=269456=269457=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri May 13 13:48:05 2016
@@ -738,11 +738,11 @@ void Sema::ForceDeclarationOfImplicitMem
   if (getLangOpts().CPlusPlus11) {
 // If the move constructor has not yet been declared, do so now.
 if (Class->needsImplicitMoveConstructor())
-  DeclareImplicitMoveConstructor(Class); // might not actually do it
+  DeclareImplicitMoveConstructor(Class);
 
 // If the move assignment operator has not yet been declared, do so now.
 if (Class->needsImplicitMoveAssignment())
-  DeclareImplicitMoveAssignment(Class); // might not actually do it
+  DeclareImplicitMoveAssignment(Class);
   }
 
   // If the destructor has not yet been declared, do so now.


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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth marked an inline comment as done.


Comment at: lib/Driver/MSVCToolChain.cpp:481
@@ +480,3 @@
+
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

majnemer wrote:
> amccarth wrote:
> > majnemer wrote:
> > > It might be nicer to use a `SmallVector > > sizeof(VS_FIXEDFILEINFO)>`, or whatever `VersionSize` typically is, here 
> > > to avoid heap allocation in the common case.
> > What's the cutoff for "small"?  The version block in cl.exe is about 9KB.
> Using 10K is probably fine, the default stack size on Windows is a massive 1 
> MB and this function is not reentrant.
My mistake.  It's a smidge over 1KB, (still more than sizeof(VS_FIXEDFILEINFO)) 
so I've make a SmallVector of 2KB.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-13 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Basic/FileManager.cpp:304-307
@@ -303,1 +303,6 @@
 
+  if (UFE.isVirtual()) {
+UFE.Name = InterndFileName;
+return 
+  }
+

It looks like this is unreachable: `IsVirtual` is only ever `true` when 
`IsValid` is also `true`, and we don't reach this line if `UFE.isValid()`. As 
this is the only consumer of `FileEntry::IsValid`, it looks like it does 
nothing. Am I missing something?


Comment at: lib/Frontend/ASTUnit.cpp:1402-1406
@@ +1401,7 @@
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+

If there are multiple file names with the same inode, `RB.first` is an 
arbitrarily-chosen one of those names, and stat'ing it isn't sufficient to 
check that none of the other names for the file have changed. Maybe we need to 
store a list of filenames used for each `UniqueID`?


http://reviews.llvm.org/D20137



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


Re: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Steven Wu via cfe-commits
It is part of -Wall group and it should be on by default when you building 
clang. That warning is added into clang some time in 2014. Make sure you are 
not using a compiler that is too old.

Steven

> On May 13, 2016, at 10:58 AM, Liu, Yaxun (Sam)  wrote:
> 
> BTW is there a way to turn on this warning with CMake? I could not see this 
> warning in my own build.
> 
> Thanks.
> 
> Sam
> 
> -Original Message-
> From: Liu, Yaxun (Sam) 
> Sent: Friday, May 13, 2016 1:33 PM
> To: 'steve...@apple.com' 
> Cc: cfe-commits@lists.llvm.org
> Subject: RE: r269431 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Thanks Steven.
> 
> I have reverted my change. I will apply your patch and re-commit.
> 
> Sam
> 
> -Original Message-
> From: steve...@apple.com [mailto:steve...@apple.com]
> Sent: Friday, May 13, 2016 1:27 PM
> To: Liu, Yaxun (Sam) 
> Cc: cfe-commits@lists.llvm.org
> Subject: Re: r269431 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Hi Yaxun
> 
> You seems missing some override keyword that triggers 
> -Winconsistent-missing-override. See:
> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/24442/warnings8Result/new/
> 
> Here is a patch to fix them:
> 
> diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 
> b1b12e4..20f1e95 100644
> --- a/lib/Basic/Targets.cpp
> +++ b/lib/Basic/Targets.cpp
> @@ -2087,7 +2087,7 @@ public:
> return true;
>   }
> 
> -   void setSupportedOpenCLOpts() {
> +   void setSupportedOpenCLOpts() override {
>  auto  = getSupportedOpenCLOpts();
>  Opts.cl_clang_storage_class_specifiers = 1;
>  Opts.cl_khr_gl_sharing = 1;
> @@ -2731,7 +2731,7 @@ public:
> return true;
>   }
> 
> -  void setSupportedOpenCLOpts() {
> +  void setSupportedOpenCLOpts() override {
> getSupportedOpenCLOpts().setAll();
>   }
> };
> @@ -7877,7 +7877,7 @@ public:
> return CC_SpirFunction;
>   }
> 
> -  void setSupportedOpenCLOpts() {
> +  void setSupportedOpenCLOpts() override {
> // Assume all OpenCL extensions and optional core features are supported
> // for SPIR since it is a generic target.
> getSupportedOpenCLOpts().setAll();
> 
> Thanks
> 
> Steven
> 
>> On May 13, 2016, at 8:44 AM, Yaxun Liu via cfe-commits 
>>  wrote:
>> 
>> Author: yaxunl
>> Date: Fri May 13 10:44:37 2016
>> New Revision: 269431
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=269431=rev
>> Log:
>> [OpenCL] Add supported OpenCL extensions to target info.
>> 
>> Add supported OpenCL extensions to target info. It serves as default values 
>> to save the users of the burden setting each supported extensions and 
>> optional core features in command line.
>> 
>> Differential Revision: http://reviews.llvm.org/D19484
>> 
>> Added:
>>   cfe/trunk/include/clang/Basic/OpenCLOptions.h
>>   cfe/trunk/test/SemaOpenCL/extensions.cl
>> Removed:
>>   cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
>>   cfe/trunk/test/SemaOpenCL/extension-fp64.cl
>>   cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
>>   cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
>> Modified:
>>   cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>>   cfe/trunk/include/clang/Basic/LangOptions.h
>>   cfe/trunk/include/clang/Basic/OpenCLExtensions.def
>>   cfe/trunk/include/clang/Basic/TargetInfo.h
>>   cfe/trunk/include/clang/Basic/TargetOptions.h
>>   cfe/trunk/lib/Basic/Targets.cpp
>>   cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>   cfe/trunk/lib/Parse/ParsePragma.cpp
>>   cfe/trunk/lib/Sema/Sema.cpp
>>   cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
>>   cfe/trunk/test/CodeGenOpenCL/fpmath.cl
>>   cfe/trunk/test/CodeGenOpenCL/half.cl
>>   cfe/trunk/test/Lexer/opencl-half-literal.cl
>>   cfe/trunk/test/Misc/languageOptsOpenCL.cl
>>   cfe/trunk/test/PCH/opencl-extensions.cl
>>   cfe/trunk/test/Parser/opencl-astype.cl
>>   cfe/trunk/test/Parser/opencl-atomics-cl20.cl
>>   cfe/trunk/test/Parser/opencl-pragma.cl
>>   cfe/trunk/test/Parser/opencl-storage-class.cl
>>   cfe/trunk/test/SemaOpenCL/half.cl
>>   cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
>>   cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diag
>> nosticParseKinds.td?rev=269431=269430=269431=diff
>> ==
>> 
>> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 13
>> +++ 10:44:37 2016
>> @@ -926,6 +926,10 @@ def warn_pragma_expected_enable_disable
>>  "expected 'enable' or 'disable' - ignoring">, 
>> InGroup; def warn_pragma_unknown_extension : Warning<
>>  "unknown OpenCL extension %0 - ignoring">, InGroup;
>> +def warn_pragma_unsupported_extension : Warning<
>> +  

Re: [PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

2016-05-13 Thread Cameron via cfe-commits
cameron314 updated this revision to Diff 57222.
cameron314 added a comment.

Updated patch to include later fixes I had made after the initial change.


http://reviews.llvm.org/D20137

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

Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -1378,7 +1378,7 @@
   
   // First, make a record of those files that have been overridden via
   // remapping or unsaved_files.
-  llvm::StringMap OverriddenFiles;
+  std::map OverriddenFiles;
   for (const auto  : PreprocessorOpts.RemappedFiles) {
 if (AnyFileChanged)
   break;
@@ -1391,40 +1391,47 @@
   break;
 }
 
-OverriddenFiles[R.first] = PreambleFileHash::createForFile(
+OverriddenFiles[Status.getUniqueID()] = PreambleFileHash::createForFile(
 Status.getSize(), Status.getLastModificationTime().toEpochTime());
   }
 
   for (const auto  : PreprocessorOpts.RemappedFileBuffers) {
 if (AnyFileChanged)
   break;
-OverriddenFiles[RB.first] =
+
+vfs::Status Status;
+if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+  AnyFileChanged = true;
+  break;
+}
+
+OverriddenFiles[Status.getUniqueID()] =
 PreambleFileHash::createForMemoryBuffer(RB.second);
   }

   // Check whether anything has changed.
-  for (llvm::StringMap::iterator 
+  for (FilesInPreambleMap::iterator
  F = FilesInPreamble.begin(), FEnd = FilesInPreamble.end();
!AnyFileChanged && F != FEnd; 
++F) {
-llvm::StringMap::iterator Overridden
-  = OverriddenFiles.find(F->first());
+std::map::iterator Overridden
+  = OverriddenFiles.find(F->first);
 if (Overridden != OverriddenFiles.end()) {
   // This file was remapped; check whether the newly-mapped file 
   // matches up with the previous mapping.
-  if (Overridden->second != F->second)
+  if (Overridden->second != F->second.second)
 AnyFileChanged = true;
   continue;
 }
 
 // The file was not remapped; check whether it has changed on disk.
 vfs::Status Status;
-if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
+if (FileMgr->getNoncachedStatValue(F->second.first, Status)) {
   // If we can't stat the file, assume that something horrible happened.
   AnyFileChanged = true;
-} else if (Status.getSize() != uint64_t(F->second.Size) ||
+} else if (Status.getSize() != uint64_t(F->second.second.Size) ||
Status.getLastModificationTime().toEpochTime() !=
-   uint64_t(F->second.ModTime))
+   uint64_t(F->second.second.ModTime))
   AnyFileChanged = true;
   }
   
@@ -1612,12 +1619,14 @@
 if (!File || File == SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()))
   continue;
 if (time_t ModTime = File->getModificationTime()) {
-  FilesInPreamble[File->getName()] = PreambleFileHash::createForFile(
-  File->getSize(), ModTime);
+  FilesInPreamble[File->getUniqueID()] = std::make_pair(
+File->getName(),
+PreambleFileHash::createForFile(File->getSize(), ModTime));
 } else {
   llvm::MemoryBuffer *Buffer = SourceMgr.getMemoryBufferForFile(File);
-  FilesInPreamble[File->getName()] =
-  PreambleFileHash::createForMemoryBuffer(Buffer);
+  FilesInPreamble[File->getUniqueID()] = std::make_pair(
+File->getName(),
+PreambleFileHash::createForMemoryBuffer(Buffer));
 }
   }
 
Index: lib/Basic/FileManager.cpp
===
--- lib/Basic/FileManager.cpp
+++ lib/Basic/FileManager.cpp
@@ -301,6 +301,11 @@
 return 
   }
 
+  if (UFE.isVirtual()) {
+UFE.Name = InterndFileName;
+return 
+  }
+
   // Otherwise, we don't have this file yet, add it.
   UFE.Name= InterndFileName;
   UFE.Size = Data.Size;
@@ -312,6 +317,7 @@
   UFE.InPCH = Data.InPCH;
   UFE.File = std::move(F);
   UFE.IsValid = true;
+  UFE.IsVirtual = true;
   return 
 }
 
Index: include/clang/Frontend/ASTUnit.h
===
--- include/clang/Frontend/ASTUnit.h
+++ include/clang/Frontend/ASTUnit.h
@@ -31,6 +31,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/FileSystem.h"
 #include 
 #include 
 #include 
@@ -264,12 +265,15 @@
   /// a line after skipping the preamble.
   bool PreambleEndsAtStartOfLine;
 
+  typedef 

Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

2016-05-13 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Headers/opencl-c.h:14057
@@ +14056,3 @@
+event_t __attribute__((overloadable)) async_work_group_copy(__local float2 
*dst, const __global float2 *src, size_t num_elements, event_t event);
+event_t __attribute__((overloadable)) async_work_group_copy(__local char3 
*dst, const __global char3 *src, size_t num_elements, event_t event);
+event_t __attribute__((overloadable)) async_work_group_copy(__local uchar3 
*dst, const __global uchar3 *src, size_t num_elements, event_t event);

yaxunl wrote:
> Anastasia wrote:
> > yaxunl wrote:
> > > If this representation is not generic enough. Any suggestion for an 
> > > alternative? Thanks.
> > I don't think Spec imposes any specific implementation of this macro.
> > 
> > I am thinking we might better leave it out to allow adding in a way 
> > suitable for other implementations.
> How about this?
> 
>   #ifndef ATOMIC_VAR_INIT
>   #define ATOMIC_VAR_INIT(x) (x)
>   #endif
> 
> This way we have a default declaration and also allows user to override it.
> 
> Another way is to remove it from header and define it in Clang on target by 
> target basis.
> 
Not sure. I guess this way would work too.


http://reviews.llvm.org/D18369



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


Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

2016-05-13 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Headers/opencl-c.h:7452
@@ +7451,3 @@
+
+// OpenCL v1.2 s6.12.2, v2.0 s6.13.2 - Math functions
+

Could you put OpenCL v1.1 section too?


Comment at: lib/Headers/opencl-c.h:7767
@@ +7766,3 @@
+/**
+ * Round to integral value using the round to +ve
+ * infinity rounding mode.

What does +ve mean?


Comment at: lib/Headers/opencl-c.h:7795
@@ +7794,3 @@
+ * Returns x with its sign changed to match the sign of
+ * y.
+ */

Could y be merged with the previous line?


Comment at: lib/Headers/opencl-c.h:7952
@@ +7951,3 @@
+/**
+ * Compute the base- e exponential of x.
+ */

Can't read this comment.

Perhaps: "Compute base e exponent"?


Comment at: lib/Headers/opencl-c.h:8306
@@ +8305,3 @@
+#else
+float __attribute__((overloadable)) fract(float x, __global float *iptr);
+float2 __attribute__((overloadable)) fract(float2 x, __global float2 *iptr);

Does this mean that all non-generic versions are not available in CL2.0 forcing 
the dynamic AS conversion for all BIFs with a pointer type?

Wondering if adding those unconditionally would be better thing to do...


Comment at: lib/Headers/opencl-c.h:8457
@@ +8456,3 @@
+/**
+ * Compute the value of the square root of x^2+ y^2
+ * without undue overflow or underflow.

Could you add space please: x^2 + y^2


Comment at: lib/Headers/opencl-c.h:9110
@@ +9109,3 @@
+ */
+float __const_func remainder(float x, float y);
+float2 __const_func remainder(float2 x, float2 y);

Overloadable here and in other places too?


Comment at: lib/Headers/opencl-c.h:12772
@@ +12771,3 @@
+#ifdef cl_khr_fp16
+half __attribute__((overloadable)) vload(size_t offset, const half *p);
+half2 __attribute__((overloadable)) vload2(size_t offset, const half *p);

Should it be vload_half instead?


Comment at: lib/Headers/opencl-c.h:14484
@@ +14483,3 @@
+long __attribute__((overloadable)) atom_sub(volatile __global long *p, long 
val);
+unsigned long __attribute__((overloadable)) atom_sub(volatile __global 
unsigned long *p, unsigned long val);
+long __attribute__((overloadable)) atom_sub(volatile __local long *p, long 
val);

btw, perhaps it's a good idea to have a macro for 
__attribute__((overloadable)). This should be relatively simple to replace 
everywhere.


Comment at: lib/Headers/opencl-c.h:14766
@@ +14765,3 @@
+
+ATOMIC_INIT_PROTOTYPE(int)
+ATOMIC_INIT_PROTOTYPE(uint)

Let's not have macros for function declarations. As commented earlier they can 
break proper diagnostics reporting (ie. diagnostics will display macro instead 
of actual function).


Comment at: lib/Headers/opencl-c.h:15674
@@ +15673,3 @@
+/**
+ * Use the coordinate (coord.z) to index into the
+ * 2D image array object and (coord.x, coord.y) to do an

I feel that some bits of this description are being repeated multiple times. 
Could we have a common description at the beginning instead that would cover 
all the different cases.


Comment at: lib/Headers/opencl-c.h:16220
@@ +16219,3 @@
+/**
+ * Write color value to location specified by coordinate
+ * (coord.x) in the 1D image object specified by index

The same here. Could we unify the description for all write_image functions 
somehow?


Comment at: lib/Headers/opencl-c.h:16960
@@ +16959,3 @@
+
+#define WG_BROADCAST_1D_DECL(type) \
+type __attribute__((overloadable)) work_group_broadcast(type a, size_t 
local_id);

Let's remove macros from here too.


Comment at: lib/Headers/opencl-c.h:17051
@@ +17050,3 @@
+#define CLK_SUCCESS 0
+#define CLK_ENQUEUE_FAILURE -101
+#define CLK_INVALID_QUEUE   -102

Are those arbitrary taken values I am guessing?


Comment at: lib/Headers/opencl-c.h:17099
@@ +17098,3 @@
+
+// ToDo: Add enqueue_kernel as a Clang builtin because it requires custom 
check of type of variadic 
+// arguments as well as block arguments.

Could we remove the enqueue_kernel as it's being added as Clang builtin? It's 
prototype is incorrect here anyways.

Btw, I have started the review for it: http://reviews.llvm.org/D20249


Comment at: lib/Headers/opencl-c.h:17252
@@ +17251,3 @@
+/**
+ * Use the coordinate (x) to do an element lookup in
+ * the mip-level specified by the Level-of-Detail (lod)

I think this should be better grouped with other image functions above.


http://reviews.llvm.org/D18369



___
cfe-commits mailing list
cfe-commits@lists.llvm.org

RE: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Liu, Yaxun (Sam) via cfe-commits
BTW is there a way to turn on this warning with CMake? I could not see this 
warning in my own build.

Thanks.

Sam

-Original Message-
From: Liu, Yaxun (Sam) 
Sent: Friday, May 13, 2016 1:33 PM
To: 'steve...@apple.com' 
Cc: cfe-commits@lists.llvm.org
Subject: RE: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

Thanks Steven.

I have reverted my change. I will apply your patch and re-commit.

Sam

-Original Message-
From: steve...@apple.com [mailto:steve...@apple.com]
Sent: Friday, May 13, 2016 1:27 PM
To: Liu, Yaxun (Sam) 
Cc: cfe-commits@lists.llvm.org
Subject: Re: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

Hi Yaxun

You seems missing some override keyword that triggers 
-Winconsistent-missing-override. See:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/24442/warnings8Result/new/

Here is a patch to fix them:

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 
b1b12e4..20f1e95 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2087,7 +2087,7 @@ public:
 return true;
   }
 
-   void setSupportedOpenCLOpts() {
+   void setSupportedOpenCLOpts() override {
  auto  = getSupportedOpenCLOpts();
  Opts.cl_clang_storage_class_specifiers = 1;
  Opts.cl_khr_gl_sharing = 1;
@@ -2731,7 +2731,7 @@ public:
 return true;
   }
 
-  void setSupportedOpenCLOpts() {
+  void setSupportedOpenCLOpts() override {
 getSupportedOpenCLOpts().setAll();
   }
 };
@@ -7877,7 +7877,7 @@ public:
 return CC_SpirFunction;
   }
 
-  void setSupportedOpenCLOpts() {
+  void setSupportedOpenCLOpts() override {
 // Assume all OpenCL extensions and optional core features are supported
 // for SPIR since it is a generic target.
 getSupportedOpenCLOpts().setAll();

Thanks

Steven

> On May 13, 2016, at 8:44 AM, Yaxun Liu via cfe-commits 
>  wrote:
> 
> Author: yaxunl
> Date: Fri May 13 10:44:37 2016
> New Revision: 269431
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=269431=rev
> Log:
> [OpenCL] Add supported OpenCL extensions to target info.
> 
> Add supported OpenCL extensions to target info. It serves as default values 
> to save the users of the burden setting each supported extensions and 
> optional core features in command line.
> 
> Differential Revision: http://reviews.llvm.org/D19484
> 
> Added:
>cfe/trunk/include/clang/Basic/OpenCLOptions.h
>cfe/trunk/test/SemaOpenCL/extensions.cl
> Removed:
>cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
>cfe/trunk/test/SemaOpenCL/extension-fp64.cl
>cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
>cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
> Modified:
>cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>cfe/trunk/include/clang/Basic/LangOptions.h
>cfe/trunk/include/clang/Basic/OpenCLExtensions.def
>cfe/trunk/include/clang/Basic/TargetInfo.h
>cfe/trunk/include/clang/Basic/TargetOptions.h
>cfe/trunk/lib/Basic/Targets.cpp
>cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>cfe/trunk/lib/Parse/ParsePragma.cpp
>cfe/trunk/lib/Sema/Sema.cpp
>cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
>cfe/trunk/test/CodeGenOpenCL/fpmath.cl
>cfe/trunk/test/CodeGenOpenCL/half.cl
>cfe/trunk/test/Lexer/opencl-half-literal.cl
>cfe/trunk/test/Misc/languageOptsOpenCL.cl
>cfe/trunk/test/PCH/opencl-extensions.cl
>cfe/trunk/test/Parser/opencl-astype.cl
>cfe/trunk/test/Parser/opencl-atomics-cl20.cl
>cfe/trunk/test/Parser/opencl-pragma.cl
>cfe/trunk/test/Parser/opencl-storage-class.cl
>cfe/trunk/test/SemaOpenCL/half.cl
>cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
>cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diag
> nosticParseKinds.td?rev=269431=269430=269431=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 13
> +++ 10:44:37 2016
> @@ -926,6 +926,10 @@ def warn_pragma_expected_enable_disable
>   "expected 'enable' or 'disable' - ignoring">, 
> InGroup; def warn_pragma_unknown_extension : Warning<
>   "unknown OpenCL extension %0 - ignoring">, InGroup;
> +def warn_pragma_unsupported_extension : Warning<
> +  "unsupported OpenCL extension %0 - ignoring">, 
> +InGroup; def warn_pragma_extension_is_core : Warning<
> +  "OpenCL extension %0 is core feature or supported optional core 
> +feature - ignoring">, InGroup;
> 
> // OpenCL errors.
> def err_opencl_taking_function_address_parser : Error<
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Lang
> 

Re: [PATCH] D20243: [PCH] Disable inclusion of timestamps when generating pch files on windows.

2016-05-13 Thread Paul Robinson via cfe-commits
probinson added a subscriber: probinson.
probinson added a comment.

Please make sure the test files have newlines at the end.
"touch-pragma-once.cpp" should probably be named something like 
"pragma-once-timestamp.cpp".


http://reviews.llvm.org/D20243



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


Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-05-13 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: include/clang/Basic/Builtins.h:39
@@ -38,3 +38,3 @@
   MS_LANG = 0x10, // builtin requires MS mode.
-  OCLC_LANG = 0x20,   // builtin for OpenCL C only.
+  OCLC20_LANG = 0x20, // builtin for OpenCL C only.
   ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.

This is necessary in order to remove CL2.0 BIFs from the list of Clang 
identifiers in other CL versions.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7820
@@ +7819,3 @@
+def err_opencl_function_not_supported : Error<
+  "this function is not supported in this version of CL">;
+def err_opencl_enqueue_kernel_incorrect_args : Error<

This diagnostic should follow the latest version reporting style.


http://reviews.llvm.org/D20249



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


[PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-05-13 Thread Anastasia Stulova via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: bader, yaxunl.
Anastasia added subscribers: pekka.jaaskelainen, pxli168, cfe-commits.

An implementation of device side enqueue (DSE) - enqueue_kernel and related 
BIFs from OpenCL v2.0 s6.13.17.

This change includes:

1. adding enqueue_kernel, get_kernel_work_group_size and 
get_kernel_preferred_work_group_size_multiple as Clang builtins with a custom 
check. 

Example:
  enqueue_kernel(.../*ommited params*/, block, /*optional sizes of passed block 
args if any*/)

This allows diagnosing parameters of the passed block variable (the spec 
mandates them to be 'local void*' type) and we can check different overloads 
too (Table 6.31).

2. IR generation with an internal library call for each new builtins used in 
the CL code, reusing ObjC block generation.

For the following example of CL code:

  kernel void device_side_enqueue(…) {
… /*declare default_queue, flags, ndrange, a, b here*/
enqueue_kernel(default_queue, flags, ndrange, ^(void) { a + b; });
  }

The generated IR could be:

  ; from ObjC block CodeGen (the second field contains the size of the block 
literal record)
  @__block_descriptor_tmp = internal constant { i64, i64, i8*, i8* } { i64 0, 
i64 52, i8* getelementptr inbounds ([35 x i8]* @.str, i32 0, i32 0), i8* null } 
  ...
  define void @device_side_enqueue() {
...
; from ObjC block CodeGen (block literal record with a capture)
%block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32, 
i32}>
; from ObjC block CodeGen - store block descriptor and block captures below
...
; from ObjC block CodeGen (set pointer to block definition code)
%block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, 
%struct.__block_descriptor*, i32, i32}>* %block, i64 0, i32 3 * 
store i8* bitcast (void (i8*)* @__device_side_enqueue_block_invoke to i8*), 
i8** %block.invoke *
; potential impl of OpenCL CodeGen (cast from block literal record ptr to 
void ptr)
%1 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32, 
i32}>* %block to i8*
; potential impl of OpenCL CodeGen (this function will have additional 
integer params at the end if the block has any parameters to be passed to)
 ... call i32 @__enqueue_kernel_impl(..., i8* %1)
...
  }

  define internal void @__device_side_enqueue_block_invoke(i8* nocapture 
readonly %.block_descriptor) { ; from ObjC block CodeGen (this can have more 
params of local void* type)
; from ObjC block CodeGen - load captures below
…
; from ObjC block CodeGen - original body of block
…
  }

Note that there are different versions of __enqueue_kernel_impl with unique 
name each. These functions will have to be implemented as a part of an OpenCL 
runtime library which will get a block literal data structure (allocated 
locally as in this example if capture is present or as a global variable 
otherwise), sizes of each block literal parameter (from 'local void*' list) and 
other omitted arguments at the beginning - mainly opaque objects, and will 
perform necessary steps to enqueue work specified by the block. The block 
literal record itself contains all important bits to facilitate basic 
implementation of DSE: a pointer to a block function definition, captured 
fields, and size of the block literal record. We can also discuss and implement 
some optimisations later on or as a part of this work. The implementation of 
__enqueue_kernel_impl will have to take care of (1) initiating execution of the 
block invoke code pointed to by the block literal record (%block.invoke in the 
example above), (2) copying captured variables in the accessible memory 
location, (3) performing some sort of memory management to allocate space for 
'local void*' parameters passed to the block if any.

Additional changes not included in this change:

1. Modifications of ObjC blocks IR generation. A block literal record currently 
contains a number of fields that are not needed for OpenCL, i.e. isa, flags, 
copy and dispose helpers. They can be removed when compiling in OpenCL mode. We 
might potentially add extra fields to enable more efficient support of DSE or 
facilitate compiler optimisations. Ideas are welcome! I expect some places 
might require taking care of address spaces too.

2. Potentially change of existing OpenCL types is needed. At least it seems 
like we might need to handle the ndrange_t type differently than we do 
currently. It's an opaque type now, but we need it to be allocated on a stack 
because a local variable of that type can be declared in CL code.


http://reviews.llvm.org/D20249

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Basic/Builtins.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Sema/SemaChecking.cpp
  test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/clang-builtin-version.cl


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread David Majnemer via cfe-commits
majnemer added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:481
@@ +480,3 @@
+
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

amccarth wrote:
> majnemer wrote:
> > It might be nicer to use a `SmallVector > sizeof(VS_FIXEDFILEINFO)>`, or whatever `VersionSize` typically is, here to 
> > avoid heap allocation in the common case.
> What's the cutoff for "small"?  The version block in cl.exe is about 9KB.
Using 10K is probably fine, the default stack size on Windows is a massive 1 MB 
and this function is not reentrant.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:481
@@ +480,3 @@
+
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

majnemer wrote:
> It might be nicer to use a `SmallVector`, 
> or whatever `VersionSize` typically is, here to avoid heap allocation in the 
> common case.
What's the cutoff for "small"?  The version block in cl.exe is about 9KB.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20245: [include-fixer] Fix broken dependency shared build

2016-05-13 Thread Etienne Bergeron via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269441: [include-fixer] Fix broken dependency shared build 
(authored by etienneb).

Changed prior to commit:
  http://reviews.llvm.org/D20245?vs=57208=57221#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20245

Files:
  clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
  clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
  clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt

Index: clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
===
--- clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
+++ clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
@@ -22,6 +22,7 @@
   clangRewrite
   clangTooling
   clangToolingCore
+  findAllSymbols
   )
 
 add_subdirectory(find-all-symbols)
Index: clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
@@ -8,4 +8,5 @@
   clangRewrite
   clangTooling
   clangToolingCore
+  findAllSymbols
   )
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
@@ -47,7 +47,7 @@
 
   // The default constructor is required by YAML traits in
   // LLVM_YAML_IS_DOCUMENT_LIST_VECTOR.
-  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {};
+  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {}
 
   SymbolInfo(llvm::StringRef Name, SymbolKind Type, llvm::StringRef FilePath,
  int LineNumber, const std::vector );


Index: clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
===
--- clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
+++ clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt
@@ -22,6 +22,7 @@
   clangRewrite
   clangTooling
   clangToolingCore
+  findAllSymbols
   )
 
 add_subdirectory(find-all-symbols)
Index: clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
@@ -8,4 +8,5 @@
   clangRewrite
   clangTooling
   clangToolingCore
+  findAllSymbols
   )
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
@@ -47,7 +47,7 @@
 
   // The default constructor is required by YAML traits in
   // LLVM_YAML_IS_DOCUMENT_LIST_VECTOR.
-  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {};
+  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {}
 
   SymbolInfo(llvm::StringRef Name, SymbolKind Type, llvm::StringRef FilePath,
  int LineNumber, const std::vector );
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r269441 - [include-fixer] Fix broken dependency shared build

2016-05-13 Thread Etienne Bergeron via cfe-commits
Author: etienneb
Date: Fri May 13 12:38:22 2016
New Revision: 269441

URL: http://llvm.org/viewvc/llvm-project?rev=269441=rev
Log:
[include-fixer] Fix broken dependency shared build

Summary:
The shared build is broken (again).

To repro: [Release + Shared]
```
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
```

Errors:
```
tools/clang/tools/extra/include-fixer/tool/CMakeFiles/clang-include-fixer.dir/ClangIncludeFixer.cpp.o:
 In function `(anonymous namespace)::includeFixerMain(int, char const**)':
ClangIncludeFixer.cpp:(.text._ZN12_GLOBAL__N_116includeFixerMainEiPPKc+0xbe9): 
undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
collect2: error: ld returned 1 exit status
```

```
tools/clang/tools/extra/unittests/include-fixer/CMakeFiles/IncludeFixerTests.dir/IncludeFixerTest.cpp.o:
 In function `clang::include_fixer::(anonymous 
namespace)::runIncludeFixer(llvm::StringRef, std::vector const&)':
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x10e):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x1dc):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x2f3):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x40e):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x526):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
```

Reviewers: bkramer, hokein

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
clang-tools-extra/trunk/unittests/include-fixer/CMakeLists.txt

Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h?rev=269441=269440=269441=diff
==
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h 
(original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h Fri May 
13 12:38:22 2016
@@ -47,7 +47,7 @@ public:
 
   // The default constructor is required by YAML traits in
   // LLVM_YAML_IS_DOCUMENT_LIST_VECTOR.
-  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {};
+  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {}
 
   SymbolInfo(llvm::StringRef Name, SymbolKind Type, llvm::StringRef FilePath,
  int LineNumber, const std::vector );

Modified: clang-tools-extra/trunk/include-fixer/tool/CMakeLists.txt
URL: 

Re: [PATCH] D19322: Concepts: Create space for requires-clause in TemplateParameterList; NFC

2016-05-13 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast updated this revision to Diff 57216.
hubert.reinterpretcast added a comment.

Set requires-clause when creating TemplateParameterLists; NFC

Removes the default argument for the requires-clause constraint expression in 
TemplateParameterList::Create.

An appropriate argument is supplied at the various call sites. Serialization 
changes will be left until the feature is otherwise complete so that the 
version number does not need to be bumped multiple times.


http://reviews.llvm.org/D19322

Files:
  include/clang/AST/DeclTemplate.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/DeclTemplate.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp

Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -5359,6 +5359,7 @@
   AddSourceLocation(TemplateParams->getTemplateLoc());
   AddSourceLocation(TemplateParams->getLAngleLoc());
   AddSourceLocation(TemplateParams->getRAngleLoc());
+  // TODO: Concepts
   Record->push_back(TemplateParams->size());
   for (const auto  : *TemplateParams)
 AddDeclRef(P);
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -7892,9 +7892,10 @@
   while (NumParams--)
 Params.push_back(ReadDeclAs(F, Record, Idx));
 
+  // TODO: Concepts
   TemplateParameterList* TemplateParams =
 TemplateParameterList::Create(Context, TemplateLoc, LAngleLoc,
-  Params, RAngleLoc);
+  Params, RAngleLoc, nullptr);
   return TemplateParams;
 }
 
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -2947,10 +2947,14 @@
   if (Invalid)
 return nullptr;
 
+  // Note: we substitute into associated constraints later
+  Expr *const UninstantiatedRequiresClause = L->getRequiresClause();
+
   TemplateParameterList *InstL
 = TemplateParameterList::Create(SemaRef.Context, L->getTemplateLoc(),
 L->getLAngleLoc(), Params,
-L->getRAngleLoc());
+L->getRAngleLoc(),
+UninstantiatedRequiresClause);
   return InstL;
 }
 
Index: lib/Sema/SemaTemplateDeduction.cpp
===
--- lib/Sema/SemaTemplateDeduction.cpp
+++ lib/Sema/SemaTemplateDeduction.cpp
@@ -4022,8 +4022,8 @@
  nullptr, false, false);
   QualType TemplArg = QualType(TemplParam->getTypeForDecl(), 0);
   NamedDecl *TemplParamPtr = TemplParam;
-  FixedSizeTemplateParameterListStorage<1> TemplateParamsSt(
-  Loc, Loc, TemplParamPtr, Loc);
+  FixedSizeTemplateParameterListStorage<1, false> TemplateParamsSt(
+  Loc, Loc, TemplParamPtr, Loc, nullptr);
 
   QualType FuncParam = SubstituteAutoTransform(*this, TemplArg).Apply(Type);
   assert(!FuncParam.isNull() &&
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -831,11 +831,10 @@
   if (ExportLoc.isValid())
 Diag(ExportLoc, diag::warn_template_export_unsupported);
 
-  // FIXME: store RequiresClause
   return TemplateParameterList::Create(
   Context, TemplateLoc, LAngleLoc,
   llvm::makeArrayRef((NamedDecl *const *)Params.data(), Params.size()),
-  RAngleLoc);
+  RAngleLoc, RequiresClause);
 }
 
 static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec ) {
@@ -1953,7 +1952,7 @@
   // Fabricate an empty template parameter list for the invented header.
   return TemplateParameterList::Create(Context, SourceLocation(),
SourceLocation(), None,
-   SourceLocation());
+   SourceLocation(), nullptr);
 }
 
 return nullptr;
Index: lib/Sema/SemaLambda.cpp
===
--- lib/Sema/SemaLambda.cpp
+++ lib/Sema/SemaLambda.cpp
@@ -235,7 +235,7 @@
 /*Template kw loc*/ SourceLocation(), LAngleLoc,
 llvm::makeArrayRef((NamedDecl *const *)LSI->AutoTemplateParams.data(),
LSI->AutoTemplateParams.size()),
-RAngleLoc);
+RAngleLoc, nullptr);
   }
   return LSI->GLTemplateParameterList;
 }
Index: lib/AST/DeclTemplate.cpp
===
--- lib/AST/DeclTemplate.cpp
+++ 

r269440 - Fix module map typo in r269347.

2016-05-13 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri May 13 12:28:51 2016
New Revision: 269440

URL: http://llvm.org/viewvc/llvm-project?rev=269440=rev
Log:
Fix module map typo in r269347.

Modified:
cfe/trunk/include/clang/module.modulemap

Modified: cfe/trunk/include/clang/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=269440=269439=269440=diff
==
--- cfe/trunk/include/clang/module.modulemap (original)
+++ cfe/trunk/include/clang/module.modulemap Fri May 13 12:28:51 2016
@@ -12,6 +12,7 @@ module Clang_AST {
   umbrella "AST"
 
   textual header "AST/BuiltinTypes.def"
+  textual header "AST/OperationKinds.def"
   textual header "AST/TypeLocNodes.def"
   textual header "AST/TypeNodes.def"
 
@@ -43,7 +44,6 @@ module Clang_Basic {
   textual header "Basic/OpenCLExtensions.def"
   textual header "Basic/OpenCLImageTypes.def"
   textual header "Basic/OpenMPKinds.def"
-  textual header "Basic/OperationKinds.def"
   textual header "Basic/OperatorKinds.def"
   textual header "Basic/Sanitizers.def"
   textual header "Basic/TokenKinds.def"


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


Re: r269220 - [MSVC] Implementation of __unaligned as a proper type qualifier

2016-05-13 Thread David Majnemer via cfe-commits
This seems to crash clang:
struct S {
  void f() __unaligned;
};
void S::f() __unaligned {
}

clang/lib/Sema/DeclSpec.cpp:214: static clang::DeclaratorChunk
clang::DeclaratorChunk::getFunction(bool, bool, clang::SourceLocation,
clang::DeclaratorChunk::ParamInfo *, unsigned int, clang::SourceLocation,
clang::SourceLocation, unsigned int, bool, clang::SourceLocation,
clang::SourceLocation, clang::SourceLocation, clang::SourceLocation,
clang::SourceLocation, clang::ExceptionSpecificationType,
clang::SourceRange, ParsedType *, clang::SourceRange *, unsigned int,
clang::Expr *, CachedTokens *, clang::SourceLocation,
clang::SourceLocation, clang::Declarator &, TypeResult): Assertion
`I.Fun.TypeQuals == TypeQuals && "bitfield overflow"' failed.


On Wed, May 11, 2016 at 11:38 AM, Andrey Bokhanko via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: asbokhan
> Date: Wed May 11 13:38:21 2016
> New Revision: 269220
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269220=rev
> Log:
> [MSVC] Implementation of __unaligned as a proper type qualifier
>
> This patch implements __unaligned (MS extension) as a proper type qualifier
> (before that, it was implemented as an ignored attribute).
>
> It also fixes PR27367 and PR27666.
>
> Differential Revision: http://reviews.llvm.org/D20103
>
> Modified:
> cfe/trunk/include/clang/AST/Type.h
> cfe/trunk/include/clang/Basic/AddressSpaces.h
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Sema/DeclSpec.h
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/AST/MicrosoftMangle.cpp
> cfe/trunk/lib/AST/TypePrinter.cpp
> cfe/trunk/lib/Parse/ParseDecl.cpp
> cfe/trunk/lib/Parse/ParseTentative.cpp
> cfe/trunk/lib/Sema/DeclSpec.cpp
> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/lib/Sema/SemaDeclObjC.cpp
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/lib/Sema/SemaOverload.cpp
> cfe/trunk/lib/Sema/SemaType.cpp
> cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
> cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp
> cfe/trunk/test/Sema/MicrosoftExtensions.c
> cfe/trunk/test/Sema/address_spaces.c
> cfe/trunk/test/Sema/invalid-assignment-constant-address-space.c
> cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
>
> Modified: cfe/trunk/include/clang/AST/Type.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=269220=269219=269220=diff
>
> ==
> --- cfe/trunk/include/clang/AST/Type.h (original)
> +++ cfe/trunk/include/clang/AST/Type.h Wed May 11 13:38:21 2016
> @@ -111,6 +111,7 @@ namespace clang {
>  /// The collection of all-type qualifiers we support.
>  /// Clang supports five independent qualifiers:
>  /// * C99: const, volatile, and restrict
> +/// * MS: __unaligned
>  /// * Embedded C (TR18037): address spaces
>  /// * Objective C: the GC attributes (none, weak, or strong)
>  class Qualifiers {
> @@ -152,8 +153,8 @@ public:
>
>enum {
>  /// The maximum supported address space number.
> -/// 24 bits should be enough for anyone.
> -MaxAddressSpace = 0xffu,
> +/// 23 bits should be enough for anyone.
> +MaxAddressSpace = 0x7fu,
>
>  /// The width of the "fast" qualifier mask.
>  FastWidth = 3,
> @@ -265,6 +266,13 @@ public:
>  Mask |= mask;
>}
>
> +  bool hasUnaligned() const { return Mask & UMask; }
> +  void setUnaligned(bool flag) {
> +Mask = (Mask & ~UMask) | (flag ? UMask : 0);
> +  }
> +  void removeUnaligned() { Mask &= ~UMask; }
> +  void addUnaligned() { Mask |= UMask; }
> +
>bool hasObjCGCAttr() const { return Mask & GCAttrMask; }
>GC getObjCGCAttr() const { return GC((Mask & GCAttrMask) >>
> GCAttrShift); }
>void setObjCGCAttr(GC type) {
> @@ -433,7 +441,9 @@ public:
> // ObjC lifetime qualifiers must match exactly.
> getObjCLifetime() == other.getObjCLifetime() &&
> // CVR qualifiers may subset.
> -   (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask &
> CVRMask));
> +   (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask &
> CVRMask)) &&
> +   // U qualifier may superset.
> +   (!other.hasUnaligned() || hasUnaligned());
>}
>
>/// \brief Determines if these qualifiers compatibly include another
> set of
> @@ -501,16 +511,19 @@ public:
>
>  private:
>
> -  // bits: |0 1 2|3 .. 4|5  ..  7|8   ...   31|
> -  //   |C R V|GCAttr|Lifetime|AddressSpace|
> +  // bits: |0 1 2|3|4 .. 5|6  ..  8|9   ...   31|
> +  //   |C R V|U|GCAttr|Lifetime|AddressSpace|
>uint32_t Mask;
>
> -  static const uint32_t GCAttrMask = 0x18;
> -  static const uint32_t GCAttrShift = 3;
> -  static const uint32_t LifetimeMask = 0xE0;
> -  static const uint32_t LifetimeShift = 5;
> -  static const uint32_t AddressSpaceMask =
> 

RE: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Liu, Yaxun (Sam) via cfe-commits
Thanks Steven.

I have reverted my change. I will apply your patch and re-commit.

Sam

-Original Message-
From: steve...@apple.com [mailto:steve...@apple.com] 
Sent: Friday, May 13, 2016 1:27 PM
To: Liu, Yaxun (Sam) 
Cc: cfe-commits@lists.llvm.org
Subject: Re: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

Hi Yaxun

You seems missing some override keyword that triggers 
-Winconsistent-missing-override. See:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/24442/warnings8Result/new/

Here is a patch to fix them:

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 
b1b12e4..20f1e95 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2087,7 +2087,7 @@ public:
 return true;
   }
 
-   void setSupportedOpenCLOpts() {
+   void setSupportedOpenCLOpts() override {
  auto  = getSupportedOpenCLOpts();
  Opts.cl_clang_storage_class_specifiers = 1;
  Opts.cl_khr_gl_sharing = 1;
@@ -2731,7 +2731,7 @@ public:
 return true;
   }
 
-  void setSupportedOpenCLOpts() {
+  void setSupportedOpenCLOpts() override {
 getSupportedOpenCLOpts().setAll();
   }
 };
@@ -7877,7 +7877,7 @@ public:
 return CC_SpirFunction;
   }
 
-  void setSupportedOpenCLOpts() {
+  void setSupportedOpenCLOpts() override {
 // Assume all OpenCL extensions and optional core features are supported
 // for SPIR since it is a generic target.
 getSupportedOpenCLOpts().setAll();

Thanks

Steven

> On May 13, 2016, at 8:44 AM, Yaxun Liu via cfe-commits 
>  wrote:
> 
> Author: yaxunl
> Date: Fri May 13 10:44:37 2016
> New Revision: 269431
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=269431=rev
> Log:
> [OpenCL] Add supported OpenCL extensions to target info.
> 
> Add supported OpenCL extensions to target info. It serves as default values 
> to save the users of the burden setting each supported extensions and 
> optional core features in command line.
> 
> Differential Revision: http://reviews.llvm.org/D19484
> 
> Added:
>cfe/trunk/include/clang/Basic/OpenCLOptions.h
>cfe/trunk/test/SemaOpenCL/extensions.cl
> Removed:
>cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
>cfe/trunk/test/SemaOpenCL/extension-fp64.cl
>cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
>cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
> Modified:
>cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>cfe/trunk/include/clang/Basic/LangOptions.h
>cfe/trunk/include/clang/Basic/OpenCLExtensions.def
>cfe/trunk/include/clang/Basic/TargetInfo.h
>cfe/trunk/include/clang/Basic/TargetOptions.h
>cfe/trunk/lib/Basic/Targets.cpp
>cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>cfe/trunk/lib/Parse/ParsePragma.cpp
>cfe/trunk/lib/Sema/Sema.cpp
>cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
>cfe/trunk/test/CodeGenOpenCL/fpmath.cl
>cfe/trunk/test/CodeGenOpenCL/half.cl
>cfe/trunk/test/Lexer/opencl-half-literal.cl
>cfe/trunk/test/Misc/languageOptsOpenCL.cl
>cfe/trunk/test/PCH/opencl-extensions.cl
>cfe/trunk/test/Parser/opencl-astype.cl
>cfe/trunk/test/Parser/opencl-atomics-cl20.cl
>cfe/trunk/test/Parser/opencl-pragma.cl
>cfe/trunk/test/Parser/opencl-storage-class.cl
>cfe/trunk/test/SemaOpenCL/half.cl
>cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
>cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diag
> nosticParseKinds.td?rev=269431=269430=269431=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 13 
> +++ 10:44:37 2016
> @@ -926,6 +926,10 @@ def warn_pragma_expected_enable_disable
>   "expected 'enable' or 'disable' - ignoring">, 
> InGroup; def warn_pragma_unknown_extension : Warning<
>   "unknown OpenCL extension %0 - ignoring">, InGroup;
> +def warn_pragma_unsupported_extension : Warning<
> +  "unsupported OpenCL extension %0 - ignoring">, 
> +InGroup; def warn_pragma_extension_is_core : Warning<
> +  "OpenCL extension %0 is core feature or supported optional core 
> +feature - ignoring">, InGroup;
> 
> // OpenCL errors.
> def err_opencl_taking_function_address_parser : Error<
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Lang
> Options.h?rev=269431=269430=269431=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/LangOptions.h (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.h Fri May 13 10:44:37 
> +++ 2016
> @@ -160,18 +160,6 @@ public:
> fp_contract(LangOpts.DefaultFPContract) {} };
> 
> -/// \brief 

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread David Majnemer via cfe-commits
majnemer added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:481
@@ +480,3 @@
+
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

It might be nicer to use a `SmallVector`, or 
whatever `VersionSize` typically is, here to avoid heap allocation in the 
common case.


http://reviews.llvm.org/D20136



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


Re: r269431 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Steven Wu via cfe-commits
Hi Yaxun

You seems missing some override keyword that triggers 
-Winconsistent-missing-override. See:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/24442/warnings8Result/new/

Here is a patch to fix them:

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index b1b12e4..20f1e95 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -2087,7 +2087,7 @@ public:
 return true;
   }
 
-   void setSupportedOpenCLOpts() {
+   void setSupportedOpenCLOpts() override {
  auto  = getSupportedOpenCLOpts();
  Opts.cl_clang_storage_class_specifiers = 1;
  Opts.cl_khr_gl_sharing = 1;
@@ -2731,7 +2731,7 @@ public:
 return true;
   }
 
-  void setSupportedOpenCLOpts() {
+  void setSupportedOpenCLOpts() override {
 getSupportedOpenCLOpts().setAll();
   }
 };
@@ -7877,7 +7877,7 @@ public:
 return CC_SpirFunction;
   }
 
-  void setSupportedOpenCLOpts() {
+  void setSupportedOpenCLOpts() override {
 // Assume all OpenCL extensions and optional core features are supported
 // for SPIR since it is a generic target.
 getSupportedOpenCLOpts().setAll();

Thanks

Steven

> On May 13, 2016, at 8:44 AM, Yaxun Liu via cfe-commits 
>  wrote:
> 
> Author: yaxunl
> Date: Fri May 13 10:44:37 2016
> New Revision: 269431
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=269431=rev
> Log:
> [OpenCL] Add supported OpenCL extensions to target info.
> 
> Add supported OpenCL extensions to target info. It serves as default values 
> to save the users of the burden setting each supported extensions and 
> optional core features in command line.
> 
> Differential Revision: http://reviews.llvm.org/D19484
> 
> Added:
>cfe/trunk/include/clang/Basic/OpenCLOptions.h
>cfe/trunk/test/SemaOpenCL/extensions.cl
> Removed:
>cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
>cfe/trunk/test/SemaOpenCL/extension-fp64.cl
>cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
>cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
> Modified:
>cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>cfe/trunk/include/clang/Basic/LangOptions.h
>cfe/trunk/include/clang/Basic/OpenCLExtensions.def
>cfe/trunk/include/clang/Basic/TargetInfo.h
>cfe/trunk/include/clang/Basic/TargetOptions.h
>cfe/trunk/lib/Basic/Targets.cpp
>cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>cfe/trunk/lib/Parse/ParsePragma.cpp
>cfe/trunk/lib/Sema/Sema.cpp
>cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
>cfe/trunk/test/CodeGenOpenCL/fpmath.cl
>cfe/trunk/test/CodeGenOpenCL/half.cl
>cfe/trunk/test/Lexer/opencl-half-literal.cl
>cfe/trunk/test/Misc/languageOptsOpenCL.cl
>cfe/trunk/test/PCH/opencl-extensions.cl
>cfe/trunk/test/Parser/opencl-astype.cl
>cfe/trunk/test/Parser/opencl-atomics-cl20.cl
>cfe/trunk/test/Parser/opencl-pragma.cl
>cfe/trunk/test/Parser/opencl-storage-class.cl
>cfe/trunk/test/SemaOpenCL/half.cl
>cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
>cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=269431=269430=269431=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 13 10:44:37 
> 2016
> @@ -926,6 +926,10 @@ def warn_pragma_expected_enable_disable
>   "expected 'enable' or 'disable' - ignoring">, InGroup;
> def warn_pragma_unknown_extension : Warning<
>   "unknown OpenCL extension %0 - ignoring">, InGroup;
> +def warn_pragma_unsupported_extension : Warning<
> +  "unsupported OpenCL extension %0 - ignoring">, InGroup;
> +def warn_pragma_extension_is_core : Warning<
> +  "OpenCL extension %0 is core feature or supported optional core feature - 
> ignoring">, InGroup;
> 
> // OpenCL errors.
> def err_opencl_taking_function_address_parser : Error<
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=269431=269430=269431=diff
> ==
> --- cfe/trunk/include/clang/Basic/LangOptions.h (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.h Fri May 13 10:44:37 2016
> @@ -160,18 +160,6 @@ public:
> fp_contract(LangOpts.DefaultFPContract) {}
> };
> 
> -/// \brief OpenCL volatile options
> -class OpenCLOptions {
> -public:
> -#define OPENCLEXT(nm)  unsigned nm : 1;
> -#include "clang/Basic/OpenCLExtensions.def"
> -
> -  OpenCLOptions() {
> -#define OPENCLEXT(nm)   nm = 0;
> -#include "clang/Basic/OpenCLExtensions.def"
> -  }
> -};
> -
> /// \brief Describes the kind of translation unit being processed.
> enum TranslationUnitKind {
>   /// 

RE: [PATCH] D19484: [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Liu, Yaxun (Sam) via cfe-commits
Done. Thanks for letting me know.

Sam

-Original Message-
From: Jun Bum Lim [mailto:junb...@codeaurora.org] 
Sent: Friday, May 13, 2016 1:10 PM
To: Liu, Yaxun (Sam) ; anastasia.stul...@arm.com; 
aleksey.ba...@mail.ru
Cc: junb...@codeaurora.org; Stellard, Thomas ; 
xiuli...@outlook.com; cfe-commits@lists.llvm.org
Subject: Re: [PATCH] D19484: [OpenCL] Add supported OpenCL extensions to target 
info.

junbuml added a subscriber: junbuml.
junbuml added a comment.

In current trunk, I got build error :

  llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 
'setSupportedOpenCLOpts' overrides a member function but is not marked 
'override' [-Werror,-Winconsistent-missing-override]
   void setSupportedOpenCLOpts() {

Can you revert this change if this error is related with this change ?


Repository:
  rL LLVM

http://reviews.llvm.org/D19484



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


r269435 - Revert "[OpenCL] Add supported OpenCL extensions to target info."

2016-05-13 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Fri May 13 12:16:26 2016
New Revision: 269435

URL: http://llvm.org/viewvc/llvm-project?rev=269435=rev
Log:
Revert "[OpenCL] Add supported OpenCL extensions to target info."

Revert r269431 due to build failure caused by warning msg:

  llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 
'setSupportedOpenCLOpts' overrides a member function but is not marked 
'override' [-Werror,-Winconsistent-missing-override]
   void setSupportedOpenCLOpts() {


Added:
cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
  - copied unchanged from r269430, 
cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
cfe/trunk/test/SemaOpenCL/extension-fp64.cl
  - copied unchanged from r269430, 
cfe/trunk/test/SemaOpenCL/extension-fp64.cl
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
  - copied unchanged from r269430, 
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
  - copied unchanged from r269430, 
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
Removed:
cfe/trunk/include/clang/Basic/OpenCLOptions.h
cfe/trunk/test/SemaOpenCL/extensions.cl
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Basic/OpenCLExtensions.def
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/include/clang/Basic/TargetOptions.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
cfe/trunk/test/CodeGenOpenCL/fpmath.cl
cfe/trunk/test/CodeGenOpenCL/half.cl
cfe/trunk/test/Lexer/opencl-half-literal.cl
cfe/trunk/test/Misc/languageOptsOpenCL.cl
cfe/trunk/test/PCH/opencl-extensions.cl
cfe/trunk/test/Parser/opencl-astype.cl
cfe/trunk/test/Parser/opencl-atomics-cl20.cl
cfe/trunk/test/Parser/opencl-pragma.cl
cfe/trunk/test/Parser/opencl-storage-class.cl
cfe/trunk/test/SemaOpenCL/half.cl
cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=269435=269434=269435=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 13 12:16:26 
2016
@@ -926,10 +926,6 @@ def warn_pragma_expected_enable_disable
   "expected 'enable' or 'disable' - ignoring">, InGroup;
 def warn_pragma_unknown_extension : Warning<
   "unknown OpenCL extension %0 - ignoring">, InGroup;
-def warn_pragma_unsupported_extension : Warning<
-  "unsupported OpenCL extension %0 - ignoring">, InGroup;
-def warn_pragma_extension_is_core : Warning<
-  "OpenCL extension %0 is core feature or supported optional core feature - 
ignoring">, InGroup;
 
 // OpenCL errors.
 def err_opencl_taking_function_address_parser : Error<

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=269435=269434=269435=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Fri May 13 12:16:26 2016
@@ -160,6 +160,18 @@ public:
 fp_contract(LangOpts.DefaultFPContract) {}
 };
 
+/// \brief OpenCL volatile options
+class OpenCLOptions {
+public:
+#define OPENCLEXT(nm)  unsigned nm : 1;
+#include "clang/Basic/OpenCLExtensions.def"
+
+  OpenCLOptions() {
+#define OPENCLEXT(nm)   nm = 0;
+#include "clang/Basic/OpenCLExtensions.def"
+  }
+};
+
 /// \brief Describes the kind of translation unit being processed.
 enum TranslationUnitKind {
   /// \brief The translation unit is a complete translation unit.

Modified: cfe/trunk/include/clang/Basic/OpenCLExtensions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLExtensions.def?rev=269435=269434=269435=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLExtensions.def (original)
+++ cfe/trunk/include/clang/Basic/OpenCLExtensions.def Fri May 13 12:16:26 2016
@@ -11,67 +11,25 @@
 //
 
//===--===//
 
-// Macro OPENCLEXT or OPENCLEXT_INTERNAL can be defined to enumerate the
-// OpenCL extensions listed in this file.
-//
-// If the extensions are to be enumerated without the supported OpenCL version,
-// define OPENCLEXT(ext) where ext is the name of the extension.
-//
-// If the extensions are to be enumerated with supported OpenCL version,
-// define OPENCLEXT_INTERNAL(ext, avail, core) where
-//   ext - 

Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Rafael Espíndola via cfe-commits
On 13 May 2016 at 13:02, Steven Wu  wrote:
> Hi Rafael
>
> Thanks for notice this! That would definitely cause duplicated symbol error 
> and I should definitely change that.
> Here is some background:
> ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but not 
> the ones in earlier Xcode. The old ld64 will simply concatenate the bitcode 
> files which is not the right thing to do. So there is a symbol generated at 
> the place to prevent user to link the bitcode object file with old ld64 
> because older ld64 will fail and report duplicated symbols.
> I have a radar tracking to change the linkage type when upstream but I 
> dropped the ball on that one. The correct thing to do is to make it internal 
> and add to llvm.used. I will come up with a patch.

Thank you so much!

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


Re: [PATCH] D19484: [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Jun Bum Lim via cfe-commits
junbuml added a subscriber: junbuml.
junbuml added a comment.

In current trunk, I got build error :

  llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 
'setSupportedOpenCLOpts' overrides a member function but is not marked 
'override' [-Werror,-Winconsistent-missing-override]
   void setSupportedOpenCLOpts() {

Can you revert this change if this error is related with this change ?


Repository:
  rL LLVM

http://reviews.llvm.org/D19484



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


[PATCH] D20245: [include-fixer] Fix broken dependency shared build

2016-05-13 Thread Etienne Bergeron via cfe-commits
etienneb created this revision.
etienneb added reviewers: bkramer, hokein.
etienneb added a subscriber: cfe-commits.

The shared build is broken (again).

To repro: [Release + Shared]
```
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
```

Errors:
```
tools/clang/tools/extra/include-fixer/tool/CMakeFiles/clang-include-fixer.dir/ClangIncludeFixer.cpp.o:
 In function `(anonymous namespace)::includeFixerMain(int, char const**)':
ClangIncludeFixer.cpp:(.text._ZN12_GLOBAL__N_116includeFixerMainEiPPKc+0xbe9): 
undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
collect2: error: ld returned 1 exit status
```

```
tools/clang/tools/extra/unittests/include-fixer/CMakeFiles/IncludeFixerTests.dir/IncludeFixerTest.cpp.o:
 In function `clang::include_fixer::(anonymous 
namespace)::runIncludeFixer(llvm::StringRef, std::vector const&)':
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x10e):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x1dc):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x2f3):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x40e):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x526):
 undefined reference to 
`clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, 
clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, 
std::vector, 
std::allocator > > const&)'
```

http://reviews.llvm.org/D20245

Files:
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/tool/CMakeLists.txt
  unittests/include-fixer/CMakeLists.txt

Index: unittests/include-fixer/CMakeLists.txt
===
--- unittests/include-fixer/CMakeLists.txt
+++ unittests/include-fixer/CMakeLists.txt
@@ -22,6 +22,7 @@
   clangRewrite
   clangTooling
   clangToolingCore
+  findAllSymbols
   )
 
 add_subdirectory(find-all-symbols)
Index: include-fixer/tool/CMakeLists.txt
===
--- include-fixer/tool/CMakeLists.txt
+++ include-fixer/tool/CMakeLists.txt
@@ -8,4 +8,5 @@
   clangRewrite
   clangTooling
   clangToolingCore
+  findAllSymbols
   )
Index: include-fixer/find-all-symbols/SymbolInfo.h
===
--- include-fixer/find-all-symbols/SymbolInfo.h
+++ include-fixer/find-all-symbols/SymbolInfo.h
@@ -47,7 +47,7 @@
 
   // The default constructor is required by YAML traits in
   // LLVM_YAML_IS_DOCUMENT_LIST_VECTOR.
-  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {};
+  SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {}
 
   SymbolInfo(llvm::StringRef Name, SymbolKind Type, llvm::StringRef FilePath,
  int LineNumber, const std::vector );


Index: 

Re: [patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Steven Wu via cfe-commits
Hi Rafael

Thanks for notice this! That would definitely cause duplicated symbol error and 
I should definitely change that. 
Here is some background:
ld64 in Xcode 7+ knows how to handle the embedded bitcode correctly but not the 
ones in earlier Xcode. The old ld64 will simply concatenate the bitcode files 
which is not the right thing to do. So there is a symbol generated at the place 
to prevent user to link the bitcode object file with old ld64 because older 
ld64 will fail and report duplicated symbols.
I have a radar tracking to change the linkage type when upstream but I dropped 
the ball on that one. The correct thing to do is to make it internal and add to 
llvm.used. I will come up with a patch.

Steven

> On May 13, 2016, at 9:46 AM, Rafael Espíndola  
> wrote:
> 
> Hi Steven,
> 
> I think there was a mistake when picking this linkage. The appending
> linkage is really just for things that llvm itself special cases. By
> an historical artifact it was codegened just like external.
> 
> The attached patch changes it to external linkage. I tested that the
> produced .o file is bit by bit identical with this change.
> 
> But I have to ask, what is the intended use? I was under the
> impression that the idea was to allow multiple .o files to have their
> IR embedded and have the liker concatenate them.
> 
> Currently, with or without this patch, I expect you to get a
> duplicated symbol error. To implement the above the symbol should be
> internal end the GV added to llvm.used.
> 
> Cheers,
> Rafael
> 

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


[patch] Don't use appending linkage for embeded bitcode

2016-05-13 Thread Rafael Espíndola via cfe-commits
Hi Steven,

I think there was a mistake when picking this linkage. The appending
linkage is really just for things that llvm itself special cases. By
an historical artifact it was codegened just like external.

The attached patch changes it to external linkage. I tested that the
produced .o file is bit by bit identical with this change.

But I have to ask, what is the intended use? I was under the
impression that the idea was to allow multiple .o files to have their
IR embedded and have the liker concatenate them.

Currently, with or without this patch, I expect you to get a
duplicated symbol error. To implement the above the symbol should be
internal end the GV added to llvm.used.

Cheers,
Rafael
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index bffa621..4f0a3ca 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/lib/CodeGen/BackendUtil.cpp
@@ -820,9 +820,8 @@ void clang::EmbedBitcode(llvm::Module *M, const 
CodeGenOptions ,
   }
   llvm::Constant *ModuleConstant =
   llvm::ConstantDataArray::get(M->getContext(), ModuleData);
-  // Use Appending linkage so it doesn't get optimized out.
   llvm::GlobalVariable *GV = new llvm::GlobalVariable(
-  *M, ModuleConstant->getType(), true, llvm::GlobalValue::AppendingLinkage,
+  *M, ModuleConstant->getType(), true, llvm::GlobalValue::ExternalLinkage,
   ModuleConstant);
   GV->setSection(getSectionNameForBitcode(T));
   if (llvm::GlobalVariable *Old =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


LLVM buildmaster will be updated and restarted tonight

2016-05-13 Thread Galina Kistanova via cfe-commits
Hello everyone,

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

Thanks

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


RE: r269411 - [mips] Consult triple's vendor field before using musl's interpreter.

2016-05-13 Thread Daniel Sanders via cfe-commits
Hi,

This change makes sense but it needs a test case.

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Vasileios Kalintiris via cfe-commits
> Sent: 13 May 2016 13:13
> To: cfe-commits@lists.llvm.org
> Subject: r269411 - [mips] Consult triple's vendor field before using musl's
> interpreter.
> 
> Author: vkalintiris
> Date: Fri May 13 07:13:13 2016
> New Revision: 269411
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=269411=rev
> Log:
> [mips] Consult triple's vendor field before using musl's interpreter.
> 
> This should affect only the mips-mti-linux toolchain.
> 
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=269411=269410=269411&
> view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:13:13 2016
> @@ -8991,7 +8991,9 @@ static std::string getLinuxDynamicLinker
>  bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
>  if (mips::isUCLibc(Args))
>LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
> -else if (!ToolChain.getTriple().hasEnvironment()) {
> +else if (!ToolChain.getTriple().hasEnvironment() &&
> + ToolChain.getTriple().getVendor() ==
> + llvm::Triple::VendorType::MipsTechnologies) {
>bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
>  (ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
>LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";
> 
> 
> ___
> 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] D20243: [PCH] Disable inclusion of timestamps when generating pch files on windows.

2016-05-13 Thread pierre gousseau via cfe-commits
pgousseau created this revision.
pgousseau added a reviewer: rsmith.
pgousseau added a subscriber: cfe-commits.

On Linux, if a header file included in the pch is modified then a fatal error 
is emitted, which is reasonable.
On Windows the check is ifdefed out, allowing the compilation to continue in a 
broken state.
This leads to "#pragma once" directives to be ignored.
This change disables the inclusion of timestamps in pch files on Windows, for 
now.

http://reviews.llvm.org/D20243

Files:
  lib/Frontend/FrontendActions.cpp
  lib/Serialization/ASTReader.cpp
  test/PCH/Inputs/pragma-once2-pch.h
  test/PCH/Inputs/pragma-once2.h
  test/PCH/touch-pragma-once.cpp

Index: test/PCH/touch-pragma-once.cpp
===
--- /dev/null
+++ test/PCH/touch-pragma-once.cpp
@@ -0,0 +1,23 @@
+// On Windows, timestamps for pch are not handled correctly.
+// This would cause pragma once to be ignored on distributed builds.
+// pragma-once2-pch.h includes pragma-once2.h which has a pragma once 
directive.
+// pragma-once2.h is then touched before using the generated pch.
+// On Linux this will cause an expected error, but on Windows we want to
+// ignore the timestamp as the timestamp handling on Windows is
+// inconsistent at the moment.
+
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/Inputs/pragma-once2-pch.h -fsyntax-only -verify 
%s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t -x c++-header %S/Inputs/pragma-once2-pch.h
+// RUN: touch %S/Inputs/pragma-once2.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+
+// REQUIRES: system-windows
+
+// expected-no-diagnostics
+
+#include "Inputs/pragma-once2.h"
+
+void g() { f(); }
\ No newline at end of file
Index: test/PCH/Inputs/pragma-once2.h
===
--- /dev/null
+++ test/PCH/Inputs/pragma-once2.h
@@ -0,0 +1,3 @@
+#pragma once
+
+inline void f() {}
\ No newline at end of file
Index: test/PCH/Inputs/pragma-once2-pch.h
===
--- /dev/null
+++ test/PCH/Inputs/pragma-once2-pch.h
@@ -0,0 +1 @@
+#include "pragma-once2.h"
\ No newline at end of file
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -2013,6 +2013,8 @@
// In our regression testing, the Windows file system seems to
// have inconsistent modification times that sometimes
// erroneously trigger this error-handling path.
+   // For now timestamps are disabled for pch files on Windows (c.f
+   // GeneratePCHAction::CreateASTConsumer).
//
// FIXME: This probably also breaks HeaderFileInfo lookups on Windows.
(StoredTime && StoredTime != File->getModificationTime() &&
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -90,9 +90,15 @@
 
   auto Buffer = std::make_shared();
   std::vector Consumers;
+  // FIXME: There is a known issue with timestamps appearing to be inconsistent
+  // on Windows (c.f. ASTReader::getInputFile) so we disable timestamps checks
+  // on Windows for now.
+  llvm::Triple HostTriple(LLVM_HOST_TRIPLE);
   Consumers.push_back(llvm::make_unique(
 CI.getPreprocessor(), OutputFile, nullptr, Sysroot,
-Buffer, CI.getFrontendOpts().ModuleFileExtensions));
+Buffer, CI.getFrontendOpts().ModuleFileExtensions,
+/*AllowASTWithErrors*/false,
+/*IncludeTimestamps*/!HostTriple.isOSWindows()));
   Consumers.push_back(CI.getPCHContainerWriter().CreatePCHContainerGenerator(
   CI, InFile, OutputFile, OS, Buffer));
 


Index: test/PCH/touch-pragma-once.cpp
===
--- /dev/null
+++ test/PCH/touch-pragma-once.cpp
@@ -0,0 +1,23 @@
+// On Windows, timestamps for pch are not handled correctly.
+// This would cause pragma once to be ignored on distributed builds.
+// pragma-once2-pch.h includes pragma-once2.h which has a pragma once directive.
+// pragma-once2.h is then touched before using the generated pch.
+// On Linux this will cause an expected error, but on Windows we want to
+// ignore the timestamp as the timestamp handling on Windows is
+// inconsistent at the moment.
+
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/Inputs/pragma-once2-pch.h -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t -x c++-header %S/Inputs/pragma-once2-pch.h
+// RUN: touch %S/Inputs/pragma-once2.h
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+
+// REQUIRES: system-windows
+
+// expected-no-diagnostics
+
+#include "Inputs/pragma-once2.h"
+
+void g() { f(); }
\ 

Re: [PATCH] D20194: [ModuleMap][CrashReproducer] Collect headers from inner frameworks

2016-05-13 Thread Ben Langmuir via cfe-commits
benlangmuir added a comment.

Let's move the code looks up the alternate name out of the ModuleMap parser, 
and into the dependency collector callbacks.  This feels like an implementation 
detail of the dependency collector.  We could add a new callback specifically 
for umbrella headers and handle this inside there.


http://reviews.llvm.org/D20194



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


Re: [PATCH] D20157: Add test for D20156

2016-05-13 Thread Diana Picus via cfe-commits
rovka abandoned this revision.
rovka added a comment.

With the new diagnostic handler in r269428, we no longer need this test (it 
will be covered by the existing tests such as 
CodeGen/AArch64/arm64-inline-asm-error-N.ll, by removing the -exit-on-error 
flag).


http://reviews.llvm.org/D20157



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


Re: [PATCH] D19484: [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Yaxun Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269431: [OpenCL] Add supported OpenCL extensions to target 
info. (authored by yaxunl).

Changed prior to commit:
  http://reviews.llvm.org/D19484?vs=57177=57201#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19484

Files:
  cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
  cfe/trunk/include/clang/Basic/LangOptions.h
  cfe/trunk/include/clang/Basic/OpenCLExtensions.def
  cfe/trunk/include/clang/Basic/OpenCLOptions.h
  cfe/trunk/include/clang/Basic/TargetInfo.h
  cfe/trunk/include/clang/Basic/TargetOptions.h
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Frontend/InitPreprocessor.cpp
  cfe/trunk/lib/Parse/ParsePragma.cpp
  cfe/trunk/lib/Sema/Sema.cpp
  cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
  cfe/trunk/test/CodeGenOpenCL/fpmath.cl
  cfe/trunk/test/CodeGenOpenCL/half.cl
  cfe/trunk/test/Lexer/opencl-half-literal.cl
  cfe/trunk/test/Misc/languageOptsOpenCL.cl
  cfe/trunk/test/PCH/opencl-extensions.cl
  cfe/trunk/test/Parser/opencl-astype.cl
  cfe/trunk/test/Parser/opencl-atomics-cl20.cl
  cfe/trunk/test/Parser/opencl-pragma.cl
  cfe/trunk/test/Parser/opencl-storage-class.cl
  cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
  cfe/trunk/test/SemaOpenCL/extension-fp64.cl
  cfe/trunk/test/SemaOpenCL/extensions.cl
  cfe/trunk/test/SemaOpenCL/half.cl
  cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
  cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl
  cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
  cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl

Index: cfe/trunk/lib/Sema/Sema.cpp
===
--- cfe/trunk/lib/Sema/Sema.cpp
+++ cfe/trunk/lib/Sema/Sema.cpp
@@ -207,8 +207,14 @@
 addImplicitTypedef("size_t", Context.getSizeType());
   }
 
-  // Initialize predefined OpenCL types.
+  // Initialize predefined OpenCL types and supported optional core features.
   if (getLangOpts().OpenCL) {
+#define OPENCLEXT(Ext) \
+ if (Context.getTargetInfo().getSupportedOpenCLOpts().is_##Ext##_supported_core( \
+ getLangOpts().OpenCLVersion)) \
+   getOpenCLOptions().Ext = 1;
+#include "clang/Basic/OpenCLExtensions.def"
+
 addImplicitTypedef("sampler_t", Context.OCLSamplerTy);
 addImplicitTypedef("event_t", Context.OCLEventTy);
 if (getLangOpts().OpenCLVersion >= 200) {
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -1999,17 +1999,6 @@
   Builder.defineMacro("__HAS_FMAF__");
 if (hasLDEXPF)
   Builder.defineMacro("__HAS_LDEXPF__");
-if (hasFP64 && Opts.OpenCL)
-  Builder.defineMacro("cl_khr_fp64");
-if (Opts.OpenCL) {
-  if (GPU >= GK_NORTHERN_ISLANDS) {
-Builder.defineMacro("cl_khr_byte_addressable_store");
-Builder.defineMacro("cl_khr_global_int32_base_atomics");
-Builder.defineMacro("cl_khr_global_int32_extended_atomics");
-Builder.defineMacro("cl_khr_local_int32_base_atomics");
-Builder.defineMacro("cl_khr_local_int32_extended_atomics");
-  }
-}
   }
 
   BuiltinVaListKind getBuiltinVaListKind() const override {
@@ -2097,6 +2086,31 @@
 
 return true;
   }
+
+   void setSupportedOpenCLOpts() {
+ auto  = getSupportedOpenCLOpts();
+ Opts.cl_clang_storage_class_specifiers = 1;
+ Opts.cl_khr_gl_sharing = 1;
+ Opts.cl_khr_gl_event = 1;
+ Opts.cl_khr_d3d10_sharing = 1;
+ Opts.cl_khr_subgroups = 1;
+
+ if (hasFP64)
+   Opts.cl_khr_fp64 = 1;
+ if (GPU >= GK_NORTHERN_ISLANDS) {
+   Opts.cl_khr_byte_addressable_store = 1;
+   Opts.cl_khr_global_int32_base_atomics = 1;
+   Opts.cl_khr_global_int32_extended_atomics = 1;
+   Opts.cl_khr_local_int32_base_atomics = 1;
+   Opts.cl_khr_local_int32_extended_atomics = 1;
+ }
+ if (GPU >= GK_SOUTHERN_ISLANDS)
+   Opts.cl_khr_fp16 = 1;
+   Opts.cl_khr_int64_base_atomics = 1;
+   Opts.cl_khr_int64_extended_atomics = 1;
+   Opts.cl_khr_3d_image_writes = 1;
+   Opts.cl_khr_gl_msaa_sharing = 1;
+  }
 };
 
 const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = {
@@ -2716,6 +2730,10 @@
   bool hasSjLjLowering() const override {
 return true;
   }
+
+  void setSupportedOpenCLOpts() {
+getSupportedOpenCLOpts().setAll();
+  }
 };
 
 bool X86TargetInfo::setFPMath(StringRef Name) {
@@ -7858,6 +7876,12 @@
   CallingConv getDefaultCallingConv(CallingConvMethodType MT) const override {
 return CC_SpirFunction;
   }
+
+  void setSupportedOpenCLOpts() {
+// Assume all OpenCL extensions and optional core features are supported
+// for SPIR since it is a generic target.
+getSupportedOpenCLOpts().setAll();
+  }
 };
 
 class SPIR32TargetInfo : public SPIRTargetInfo {
@@ -8458,5 +8482,7 @@
   if (!Target->handleTargetFeatures(Opts->Features, Diags))
 return nullptr;
 
+  

r269431 - [OpenCL] Add supported OpenCL extensions to target info.

2016-05-13 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Fri May 13 10:44:37 2016
New Revision: 269431

URL: http://llvm.org/viewvc/llvm-project?rev=269431=rev
Log:
[OpenCL] Add supported OpenCL extensions to target info.

Add supported OpenCL extensions to target info. It serves as default values to 
save the users of the burden setting each supported extensions and optional 
core features in command line.

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

Added:
cfe/trunk/include/clang/Basic/OpenCLOptions.h
cfe/trunk/test/SemaOpenCL/extensions.cl
Removed:
cfe/trunk/test/SemaOpenCL/extension-fp64-cl1.1.cl
cfe/trunk/test/SemaOpenCL/extension-fp64.cl
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl1.2.cl
cfe/trunk/test/SemaOpenCL/optional-core-fp64-cl2.0.cl
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Basic/OpenCLExtensions.def
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/include/clang/Basic/TargetOptions.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
cfe/trunk/test/CodeGenOpenCL/fpmath.cl
cfe/trunk/test/CodeGenOpenCL/half.cl
cfe/trunk/test/Lexer/opencl-half-literal.cl
cfe/trunk/test/Misc/languageOptsOpenCL.cl
cfe/trunk/test/PCH/opencl-extensions.cl
cfe/trunk/test/Parser/opencl-astype.cl
cfe/trunk/test/Parser/opencl-atomics-cl20.cl
cfe/trunk/test/Parser/opencl-pragma.cl
cfe/trunk/test/Parser/opencl-storage-class.cl
cfe/trunk/test/SemaOpenCL/half.cl
cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
cfe/trunk/test/SemaOpenCL/invalid-logical-ops-1.2.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=269431=269430=269431=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri May 13 10:44:37 
2016
@@ -926,6 +926,10 @@ def warn_pragma_expected_enable_disable
   "expected 'enable' or 'disable' - ignoring">, InGroup;
 def warn_pragma_unknown_extension : Warning<
   "unknown OpenCL extension %0 - ignoring">, InGroup;
+def warn_pragma_unsupported_extension : Warning<
+  "unsupported OpenCL extension %0 - ignoring">, InGroup;
+def warn_pragma_extension_is_core : Warning<
+  "OpenCL extension %0 is core feature or supported optional core feature - 
ignoring">, InGroup;
 
 // OpenCL errors.
 def err_opencl_taking_function_address_parser : Error<

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=269431=269430=269431=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Fri May 13 10:44:37 2016
@@ -160,18 +160,6 @@ public:
 fp_contract(LangOpts.DefaultFPContract) {}
 };
 
-/// \brief OpenCL volatile options
-class OpenCLOptions {
-public:
-#define OPENCLEXT(nm)  unsigned nm : 1;
-#include "clang/Basic/OpenCLExtensions.def"
-
-  OpenCLOptions() {
-#define OPENCLEXT(nm)   nm = 0;
-#include "clang/Basic/OpenCLExtensions.def"
-  }
-};
-
 /// \brief Describes the kind of translation unit being processed.
 enum TranslationUnitKind {
   /// \brief The translation unit is a complete translation unit.

Modified: cfe/trunk/include/clang/Basic/OpenCLExtensions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLExtensions.def?rev=269431=269430=269431=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLExtensions.def (original)
+++ cfe/trunk/include/clang/Basic/OpenCLExtensions.def Fri May 13 10:44:37 2016
@@ -11,25 +11,67 @@
 //
 
//===--===//
 
+// Macro OPENCLEXT or OPENCLEXT_INTERNAL can be defined to enumerate the
+// OpenCL extensions listed in this file.
+//
+// If the extensions are to be enumerated without the supported OpenCL version,
+// define OPENCLEXT(ext) where ext is the name of the extension.
+//
+// If the extensions are to be enumerated with supported OpenCL version,
+// define OPENCLEXT_INTERNAL(ext, avail, core) where
+//   ext - name of the extension or optional core feature.
+//   avail - minimum OpenCL version supporting it.
+//   core - minimum OpenCL version when the extension becomes optional core
+//  feature or core feature. ~0U indicates not a core feature or an
+//  optional core feature.
+
+#ifndef OPENCLEXT_INTERNAL
+#ifndef OPENCLEXT
+#pragma error "macro OPENCLEXT or OPENCLEXT_INTERNAL is required"

Re: [PATCH] D20205: [include-fixer] Use scope contexts information to improve query.

2016-05-13 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269430: [include-fixer] Use scope contexts information to 
improve query. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D20205?vs=57197=57200#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20205

Files:
  clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
  clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp
  clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp

Index: clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
===
--- clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
+++ clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
@@ -59,6 +59,9 @@
   SymbolInfo("foo", SymbolInfo::SymbolKind::Class, "\"dir/otherdir/qux.h\"",
  1, {{SymbolInfo::ContextType::Namespace, "b"},
  {SymbolInfo::ContextType::Namespace, "a"}}),
+  SymbolInfo("bar", SymbolInfo::SymbolKind::Class, "\"bar.h\"",
+ 1, {{SymbolInfo::ContextType::Namespace, "b"},
+ {SymbolInfo::ContextType::Namespace, "a"}}),
   };
   auto SymbolIndexMgr = llvm::make_unique();
   SymbolIndexMgr->addSymbolIndex(
@@ -137,6 +140,20 @@
 runIncludeFixer("std::string bar;\nstd::sting foo;\n"));
 }
 
+TEST(IncludeFixer, ScopedNamespaceSymbols) {
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a { b::bar b; }\n",
+runIncludeFixer("namespace a { b::bar b; }\n"));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace A { a::b::bar b; }\n",
+runIncludeFixer("namespace A { a::b::bar b; }\n"));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a { void func() { b::bar b; } }\n",
+runIncludeFixer("namespace a { void func() { b::bar b; } }\n"));
+  EXPECT_EQ("namespace A { c::b::bar b; }\n",
+runIncludeFixer("namespace A { c::b::bar b; }\n"));
+  // FIXME: The header should not be added here. Remove this after we support
+  // full match.
+  EXPECT_EQ("#include \"bar.h\"\nnamespace A { b::bar b; }\n",
+runIncludeFixer("namespace A { b::bar b; }\n"));
+}
 } // namespace
 } // namespace include_fixer
 } // namespace clang
Index: clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp
===
--- clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp
+++ clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp
@@ -39,18 +39,20 @@
 if (Symbol.getName() == Names.back()) {
   bool IsMatched = true;
   auto SymbolContext = Symbol.getContexts().begin();
+  auto IdentiferContext = Names.rbegin() + 1; // Skip identifier name;
   // Match the remaining context names.
-  for (auto IdentiferContext = Names.rbegin() + 1;
-   IdentiferContext != Names.rend() &&
-   SymbolContext != Symbol.getContexts().end();
+  for (; IdentiferContext != Names.rend() &&
+ SymbolContext != Symbol.getContexts().end();
++IdentiferContext, ++SymbolContext) {
 if (SymbolContext->second != *IdentiferContext) {
   IsMatched = false;
   break;
 }
   }
 
-  if (IsMatched) {
+  // FIXME: Support full match. At this point, we only find symbols in
+  // database which end with the same contexts with the identifier.
+  if (IsMatched && IdentiferContext == Names.rend()) {
 // FIXME: file path should never be in the form of <...> or "...", but
 // the unit test with fixed database use <...> file path, which might
 // need to be changed.
Index: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
===
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
@@ -116,6 +116,19 @@
 if (getCompilerInstance().getSema().isSFINAEContext())
   return clang::TypoCorrection();
 
+std::string TypoScopeString;
+if (S) {
+  // FIXME: Currently we only use namespace contexts. Use other context
+  // types for query.
+  for (const auto *Context = S->getEntity(); Context;
+   Context = Context->getParent()) {
+if (const auto *ND = dyn_cast(Context)) {
+  if (!ND->getName().empty())
+TypoScopeString = ND->getNameAsString() + "::" + TypoScopeString;
+}
+  }
+}
+
 /// If we have a scope specification, use that to get more precise results.
 std::string QueryString;
 if (SS && SS->getRange().isValid()) {
@@ -150,7 +163,23 @@
   QueryString = Typo.getAsString();
 }
 
-return query(QueryString, Typo.getLoc());
+// Follow C++ Lookup rules. Firstly, lookup the identifier with scoped
+// namespace contexts. If fails, falls back to identifier.
+// For example:
+//
+// namespace a {

[clang-tools-extra] r269430 - [include-fixer] Use scope contexts information to improve query.

2016-05-13 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri May 13 10:44:16 2016
New Revision: 269430

URL: http://llvm.org/viewvc/llvm-project?rev=269430=rev
Log:
[include-fixer] Use scope contexts information to improve query.

Reviewers: bkramer

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp
clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=269430=269429=269430=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Fri May 13 10:44:16 
2016
@@ -116,6 +116,19 @@ public:
 if (getCompilerInstance().getSema().isSFINAEContext())
   return clang::TypoCorrection();
 
+std::string TypoScopeString;
+if (S) {
+  // FIXME: Currently we only use namespace contexts. Use other context
+  // types for query.
+  for (const auto *Context = S->getEntity(); Context;
+   Context = Context->getParent()) {
+if (const auto *ND = dyn_cast(Context)) {
+  if (!ND->getName().empty())
+TypoScopeString = ND->getNameAsString() + "::" + TypoScopeString;
+}
+  }
+}
+
 /// If we have a scope specification, use that to get more precise results.
 std::string QueryString;
 if (SS && SS->getRange().isValid()) {
@@ -150,7 +163,23 @@ public:
   QueryString = Typo.getAsString();
 }
 
-return query(QueryString, Typo.getLoc());
+// Follow C++ Lookup rules. Firstly, lookup the identifier with scoped
+// namespace contexts. If fails, falls back to identifier.
+// For example:
+//
+// namespace a {
+// b::foo f;
+// }
+//
+// 1. lookup a::b::foo.
+// 2. lookup b::foo.
+if (!query(TypoScopeString + QueryString, Typo.getLoc()))
+  query(QueryString, Typo.getLoc());
+
+// FIXME: We should just return the name we got as input here and prevent
+// clang from trying to correct the typo by itself. That may change the
+// identifier to something that's not wanted by the user.
+return clang::TypoCorrection();
   }
 
   StringRef filename() const { return Filename; }
@@ -235,12 +264,12 @@ public:
 
 private:
   /// Query the database for a given identifier.
-  clang::TypoCorrection query(StringRef Query, SourceLocation Loc) {
+  bool query(StringRef Query, SourceLocation Loc) {
 assert(!Query.empty() && "Empty query!");
 
 // Save database lookups by not looking up identifiers multiple times.
 if (!SeenQueries.insert(Query).second)
-  return clang::TypoCorrection();
+  return true;
 
 DEBUG(llvm::dbgs() << "Looking up '" << Query << "' at ");
 DEBUG(Loc.print(llvm::dbgs(), getCompilerInstance().getSourceManager()));
@@ -250,16 +279,13 @@ private:
 auto SearchReply = SymbolIndexMgr.search(Query);
 DEBUG(llvm::dbgs() << SearchReply.size() << " replies\n");
 if (SearchReply.empty())
-  return clang::TypoCorrection();
+  return false;
 
 // Add those files to the set of includes to try out.
 // FIXME: Rank the results and pick the best one instead of the first one.
 TryInclude(Query, SearchReply[0]);
 
-// FIXME: We should just return the name we got as input here and prevent
-// clang from trying to correct the typo by itself. That may change the
-// identifier to something that's not wanted by the user.
-return clang::TypoCorrection();
+return true;
   }
 
   /// The client to use to find cross-references.

Modified: clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp?rev=269430=269429=269430=diff
==
--- clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp Fri May 13 
10:44:16 2016
@@ -39,10 +39,10 @@ SymbolIndexManager::search(llvm::StringR
 if (Symbol.getName() == Names.back()) {
   bool IsMatched = true;
   auto SymbolContext = Symbol.getContexts().begin();
+  auto IdentiferContext = Names.rbegin() + 1; // Skip identifier name;
   // Match the remaining context names.
-  for (auto IdentiferContext = Names.rbegin() + 1;
-   IdentiferContext != Names.rend() &&
-   SymbolContext != Symbol.getContexts().end();
+  for (; IdentiferContext != Names.rend() &&
+ SymbolContext != Symbol.getContexts().end();
++IdentiferContext, ++SymbolContext) {
 if (SymbolContext->second != *IdentiferContext) {
   

[clang-tools-extra] r269429 - [clang-rename] Fix broken dependency on shared build.

2016-05-13 Thread Etienne Bergeron via cfe-commits
Author: etienneb
Date: Fri May 13 10:38:54 2016
New Revision: 269429

URL: http://llvm.org/viewvc/llvm-project?rev=269429=rev
Log:
[clang-rename] Fix broken dependency on shared build.

Summary:
The build is broken due to a missing dependency.

To repro: [Release + Shared]
```
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
```

Which produce this error:
```
tools/clang/tools/extra/clang-rename/CMakeFiles/clangRename.dir/USRLocFinder.cpp.o:
 In function `clang::RecursiveASTVisitor::TraverseCXXConstructorDecl(clang::CXXConstructorDecl*)':
USRLocFinder.cpp:(.text._ZN5clang19RecursiveASTVisitorINS_6rename12_GLOBAL__N_123USRLocFindingASTVisitorEE26TraverseCXXConstructorDeclEPNS_18CXXConstructorDeclE+0x170):
 undefined reference to `clang::Lexer::getSourceText(clang::CharSourceRange, 
clang::SourceManager const&, clang::LangOptions const&, bool*)'
```

Reviewers: alexfh, yaron.keren

Subscribers: yaron.keren, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-rename/CMakeLists.txt

Modified: clang-tools-extra/trunk/clang-rename/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/CMakeLists.txt?rev=269429=269428=269429=diff
==
--- clang-tools-extra/trunk/clang-rename/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-rename/CMakeLists.txt Fri May 13 10:38:54 2016
@@ -10,6 +10,7 @@ add_clang_library(clangRename
   clangAST
   clangBasic
   clangIndex
+  clangLex
   clangToolingCore
   )
 


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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 57196.
amccarth marked an inline comment as done.
amccarth added a comment.

Addressed additional comments.


http://reviews.llvm.org/D20136

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/cl-options.c
  test/Driver/msc-version.c
  test/Driver/msvc-triple.c
  test/Misc/diag-format.c

Index: test/Misc/diag-format.c
===
--- test/Misc/diag-format.c
+++ test/Misc/diag-format.c
@@ -37,7 +37,7 @@
 // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
-// MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
+// MSVC: {{.*}}(36,8){{ ?}}: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015_ORIG: {{.*}}(36): warning: extra tokens at end of #endif directive [-Wextra-tokens]
Index: test/Driver/msvc-triple.c
===
--- test/Driver/msvc-triple.c
+++ test/Driver/msvc-triple.c
@@ -1,9 +1,7 @@
-// RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
 // RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
 // RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
 // RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
 
-// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
 // TARGET-19:   target triple = "i686-pc-windows-msvc19.0.0"
 // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
-// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc{{.*}}-elf"
Index: test/Driver/msc-version.c
===
--- test/Driver/msc-version.c
+++ test/Driver/msc-version.c
@@ -1,15 +1,4 @@
 //
-// Verify defaults
-//
-
-// RUN: %clang -target i686-windows -fms-compatibility -dM -E - &1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // NoThreadSafeStatics: "-fno-threadsafe-statics"
 
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -682,7 +682,8 @@
 
 /// Visual studio tools.
 namespace visualstudio {
-VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple ,
+VersionTuple getMSVCVersion(const Driver *D, const ToolChain ,
+const llvm::Triple ,
 const llvm::opt::ArgList , bool IsWindowsMSVC);
 
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3291,7 +3291,7 @@
   Result.append(UID.begin(), UID.end());
 }
 
-VersionTuple visualstudio::getMSVCVersion(const Driver *D,
+VersionTuple visualstudio::getMSVCVersion(const Driver *D, const ToolChain ,
   const llvm::Triple ,
   const llvm::opt::ArgList ,
   bool IsWindowsMSVC) {
@@ -,8 +,14 @@
 if (Major || Minor || Micro)
   return VersionTuple(Major, Minor, Micro);
 
-// FIXME: Consider bumping this to 19 (MSVC2015) soon.
-return VersionTuple(18);
+if (IsWindowsMSVC) {
+  VersionTuple MSVT = TC.getMSVCVersionFromExe();
+  if (!MSVT.empty())
+return MSVT;
+
+  // FIXME: Consider bumping this to 19 (MSVC2015) soon.
+  return VersionTuple(18);
+}
   }
   return VersionTuple();
 }
@@ -5224,7 +5230,7 @@
 
   // -fms-compatibility-version=18.00 is default.
   VersionTuple MSVT = visualstudio::getMSVCVersion(
-  , getToolChain().getTriple(), Args, IsWindowsMSVC);
+  , getToolChain(), getToolChain().getTriple(), Args, IsWindowsMSVC);
   if (!MSVT.empty())
 CmdArgs.push_back(
 Args.MakeArgString("-fms-compatibility-version=" + MSVT.getAsString()));
Index: lib/Driver/ToolChains.h
===
--- 

Re: [PATCH] D20205: [include-fixer] Use scope contexts information to improve query.

2016-05-13 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 57197.
hokein added a comment.

Rebase.


http://reviews.llvm.org/D20205

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/SymbolIndexManager.cpp
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -59,6 +59,9 @@
   SymbolInfo("foo", SymbolInfo::SymbolKind::Class, "\"dir/otherdir/qux.h\"",
  1, {{SymbolInfo::ContextType::Namespace, "b"},
  {SymbolInfo::ContextType::Namespace, "a"}}),
+  SymbolInfo("bar", SymbolInfo::SymbolKind::Class, "\"bar.h\"",
+ 1, {{SymbolInfo::ContextType::Namespace, "b"},
+ {SymbolInfo::ContextType::Namespace, "a"}}),
   };
   auto SymbolIndexMgr = llvm::make_unique();
   SymbolIndexMgr->addSymbolIndex(
@@ -137,6 +140,20 @@
 runIncludeFixer("std::string bar;\nstd::sting foo;\n"));
 }
 
+TEST(IncludeFixer, ScopedNamespaceSymbols) {
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a { b::bar b; }\n",
+runIncludeFixer("namespace a { b::bar b; }\n"));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace A { a::b::bar b; }\n",
+runIncludeFixer("namespace A { a::b::bar b; }\n"));
+  EXPECT_EQ("#include \"bar.h\"\nnamespace a { void func() { b::bar b; } }\n",
+runIncludeFixer("namespace a { void func() { b::bar b; } }\n"));
+  EXPECT_EQ("namespace A { c::b::bar b; }\n",
+runIncludeFixer("namespace A { c::b::bar b; }\n"));
+  // FIXME: The header should not be added here. Remove this after we support
+  // full match.
+  EXPECT_EQ("#include \"bar.h\"\nnamespace A { b::bar b; }\n",
+runIncludeFixer("namespace A { b::bar b; }\n"));
+}
 } // namespace
 } // namespace include_fixer
 } // namespace clang
Index: include-fixer/SymbolIndexManager.cpp
===
--- include-fixer/SymbolIndexManager.cpp
+++ include-fixer/SymbolIndexManager.cpp
@@ -39,18 +39,20 @@
 if (Symbol.getName() == Names.back()) {
   bool IsMatched = true;
   auto SymbolContext = Symbol.getContexts().begin();
+  auto IdentiferContext = Names.rbegin() + 1; // Skip identifier name;
   // Match the remaining context names.
-  for (auto IdentiferContext = Names.rbegin() + 1;
-   IdentiferContext != Names.rend() &&
-   SymbolContext != Symbol.getContexts().end();
+  for (; IdentiferContext != Names.rend() &&
+ SymbolContext != Symbol.getContexts().end();
++IdentiferContext, ++SymbolContext) {
 if (SymbolContext->second != *IdentiferContext) {
   IsMatched = false;
   break;
 }
   }
 
-  if (IsMatched) {
+  // FIXME: Support full match. At this point, we only find symbols in
+  // database which end with the same contexts with the identifier.
+  if (IsMatched && IdentiferContext == Names.rend()) {
 // FIXME: file path should never be in the form of <...> or "...", but
 // the unit test with fixed database use <...> file path, which might
 // need to be changed.
Index: include-fixer/IncludeFixer.cpp
===
--- include-fixer/IncludeFixer.cpp
+++ include-fixer/IncludeFixer.cpp
@@ -116,6 +116,19 @@
 if (getCompilerInstance().getSema().isSFINAEContext())
   return clang::TypoCorrection();
 
+std::string TypoScopeString;
+if (S) {
+  // FIXME: Currently we only use namespace contexts. Use other context
+  // types for query.
+  for (const auto *Context = S->getEntity(); Context;
+   Context = Context->getParent()) {
+if (const auto *ND = dyn_cast(Context)) {
+  if (!ND->getName().empty())
+TypoScopeString = ND->getNameAsString() + "::" + TypoScopeString;
+}
+  }
+}
+
 /// If we have a scope specification, use that to get more precise results.
 std::string QueryString;
 if (SS && SS->getRange().isValid()) {
@@ -150,7 +163,23 @@
   QueryString = Typo.getAsString();
 }
 
-return query(QueryString, Typo.getLoc());
+// Follow C++ Lookup rules. Firstly, lookup the identifier with scoped
+// namespace contexts. If fails, falls back to identifier.
+// For example:
+//
+// namespace a {
+// b::foo f;
+// }
+//
+// 1. lookup a::b::foo.
+// 2. lookup b::foo.
+if (!query(TypoScopeString + QueryString, Typo.getLoc()))
+  query(QueryString, Typo.getLoc());
+
+// FIXME: We should just return the name we got as input here and prevent
+// clang from trying to correct the typo by itself. That may change the
+// identifier to something that's not wanted by the user.
+return clang::TypoCorrection();
   }
 
   StringRef filename() const { return 

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth marked 2 inline comments as done.


Comment at: lib/Driver/MSVCToolChain.cpp:42
@@ -40,1 +41,3 @@
+
+  #pragma comment(lib, "version.lib")
 #endif

aaron.ballman wrote:
> Eh, I am lightening up on this sort of thing, so this is fine by me.
I was following the pattern I saw in llvm\lib\Support\Windows\Path.inc (and 
elsewhere), so I thought it was the way we did things around here.


Comment at: lib/Driver/MSVCToolChain.cpp:483
@@ +482,3 @@
+  }
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

aaron.ballman wrote:
> Pure pedantry: `uint8_t` instead of `char`, or is this data really a textual 
> string in practice?
It's a mix.  The part we're looking at is binary data, but the rest of the 
block is text.

I though the API wanted a pointer to char, so I chose `char` to avoid 
unnecessary casts.

But I must've misread the reference page, because just now I double-checked and 
I see that the API wants a void pointer, so I'll go ahead and use `uint8_t`, 
which satisfies my inner pedant as well.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20240: [clang-rename] Fix broken dependency on shared build.

2016-05-13 Thread Etienne Bergeron via cfe-commits
etienneb added a comment.

thanks, landing as soon as my other checkouts complete their tests (few 
minutes).


http://reviews.llvm.org/D20240



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


r269419 - [CodeGen] Clang does not choose aapcs-vfp calling convention for ARM bare metal target with hard float (EABIHF)

2016-05-13 Thread Oleg Ranevskyy via cfe-commits
Author: oleg
Date: Fri May 13 09:45:57 2016
New Revision: 269419

URL: http://llvm.org/viewvc/llvm-project?rev=269419=rev
Log:
[CodeGen] Clang does not choose aapcs-vfp calling convention for ARM bare metal 
target with hard float (EABIHF)

Summary:
Clang does not detect `aapcs-vfp` for the EABIHF environment. The reason is 
that only GNUEABIHF is considered while choosing calling convention, EABIHF is 
ignored.

This causes clang to use `aapcs` for EABIHF and add the `arm_aapcscc` specifier 
to functions in generated IR.

The modified `arm-cc.c` test checks that no calling convention specifier is 
added to functions for EABIHF, which means the default one is used 
(`CallingConv::ARM_AAPCS_VFP`).

Reviewers: rengolin, compnerd, t.p.northover

Subscribers: aemerson, rengolin, asl, cfe-commits

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

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/arm-cc.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=269419=269418=269419=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri May 13 09:45:57 2016
@@ -7878,7 +7878,8 @@ const TargetCodeGenInfo ::
   Kind = ARMABIInfo::AAPCS16_VFP;
 else if (CodeGenOpts.FloatABI == "hard" ||
  (CodeGenOpts.FloatABI != "soft" &&
-  Triple.getEnvironment() == llvm::Triple::GNUEABIHF))
+  (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+   Triple.getEnvironment() == llvm::Triple::EABIHF)))
   Kind = ARMABIInfo::AAPCS_VFP;
 
 return SetCGInfo(new ARMTargetCodeGenInfo(Types, Kind));

Modified: cfe/trunk/test/CodeGen/arm-cc.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-cc.c?rev=269419=269418=269419=diff
==
--- cfe/trunk/test/CodeGen/arm-cc.c (original)
+++ cfe/trunk/test/CodeGen/arm-cc.c Fri May 13 09:45:57 2016
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi aapcs  -emit-llvm 
-w -o - %s | FileCheck -check-prefix=DARWIN-AAPCS %s
 // RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-abi apcs-gnu 
-emit-llvm -w -o - %s | FileCheck -check-prefix=LINUX-APCS %s
 // RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-abi aapcs  
-emit-llvm -w -o - %s | FileCheck -check-prefix=LINUX-AAPCS %s
+// RUN: %clang_cc1 -triple armv7-none-eabihf -target-abi aapcs-vfp -emit-llvm 
-w -o - %s | FileCheck -check-prefix=BAREMETAL-AAPCS_VFP %s
 
 
 // DARWIN-APCS-LABEL: define void @f()
@@ -13,6 +14,9 @@
 // LINUX-APCS: call arm_apcscc void @g
 // LINUX-AAPCS-LABEL: define void @f()
 // LINUX-AAPCS: call void @g
+// BAREMETAL-AAPCS_VFP-LABEL: define void @f()
+// BAREMETAL-AAPCS_VFP: call void @g
+// BAREMETAL-AAPCS_VFP: declare void @g()
 void g(void);
 void f(void) {
   g();


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


Re: [PATCH] D20196: [clang-tidy] Inefficient string operation

2016-05-13 Thread Bittner Barni via cfe-commits
bittnerbarni updated this revision to Diff 57181.

http://reviews.llvm.org/D20196

Files:
  docs/clang-tidy/checks/performance-inefficient-string-addition.rst

Index: docs/clang-tidy/checks/performance-inefficient-string-addition.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-addition.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-addition.rst
@@ -12,7 +12,7 @@
 std::string a("Foo"), b("Bar");
 a = a + b;
 
-Instead of this structure you should use `operator+=` or std::string's 
(std::basic_string) class member function `append`. For instance:
+Instead of this structure you should use ``operator+=`` or std::string's 
(std::basic_string) class member function ``append``. For instance:

 .. code:: c++
 


Index: docs/clang-tidy/checks/performance-inefficient-string-addition.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-addition.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-addition.rst
@@ -12,7 +12,7 @@
 std::string a("Foo"), b("Bar");
 a = a + b;
 
-Instead of this structure you should use `operator+=` or std::string's (std::basic_string) class member function `append`. For instance:
+Instead of this structure you should use ``operator+=`` or std::string's (std::basic_string) class member function ``append``. For instance:

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


Re: [PATCH] D20196: [clang-tidy] Inefficient string operation

2016-05-13 Thread Bittner Barni via cfe-commits
bittnerbarni updated this revision to Diff 57185.

http://reviews.llvm.org/D20196

Files:
  docs/clang-tidy/checks/performance-inefficient-string-addition.rst

Index: docs/clang-tidy/checks/performance-inefficient-string-addition.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-addition.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-addition.rst
@@ -5,7 +5,7 @@
 
 The problem
 ---
-This check is to warn about the performance overhead arising from 
concatenating strings, using the operator+, for instance:
+This check is to warn about the performance overhead arising from 
concatenating strings, using the ``operator+``, for instance:
 
 .. code:: c++
 


Index: docs/clang-tidy/checks/performance-inefficient-string-addition.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-addition.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-addition.rst
@@ -5,7 +5,7 @@
 
 The problem
 ---
-This check is to warn about the performance overhead arising from concatenating strings, using the operator+, for instance:
+This check is to warn about the performance overhead arising from concatenating strings, using the ``operator+``, for instance:
 
 .. code:: c++
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20240: [clang-rename] Fix broken dependency on shared build.

2016-05-13 Thread Yaron Keren via cfe-commits
yaron.keren added a subscriber: yaron.keren.
yaron.keren accepted this revision.
yaron.keren added a reviewer: yaron.keren.
yaron.keren added a comment.
This revision is now accepted and ready to land.

result of r269402,  LGTM


http://reviews.llvm.org/D20240



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


Re: [PATCH] D19667: [ubsan] Minimize size of data for type_mismatch

2016-05-13 Thread Filipe Cabecinhas via cfe-commits
filcab added a comment.

Hi Richard. Just want to double-check something. If we have no alignment value, 
for this check, can we assume 1?
It seems to me that that shouldn't be a problem, but wanted to double-check.



Comment at: lib/CodeGen/CGExpr.cpp:579
@@ -578,1 +578,3 @@
+// Make sure we're not losing information. Alignment needs to be a power 
of 2
+assert(!AlignVal || (uint64_t)1 << llvm::Log2_64(AlignVal) == AlignVal);
 llvm::Constant *StaticData[] = {

Would it be acceptable to set AlignVal to 1 if it's 0?


http://reviews.llvm.org/D19667



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


Re: [PATCH] D20232: [include-fixer] Simplify unittest code.

2016-05-13 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269427: [include-fixer] Simplify unittest code. (authored by 
hokein).

Changed prior to commit:
  http://reviews.llvm.org/D20232?vs=57193=57194#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20232

Files:
  clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp
  clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.h
  clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
  clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
  clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
  clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
  clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp
  
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp
===
--- clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp
+++ clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp
@@ -15,24 +15,9 @@
 namespace include_fixer {
 
 InMemorySymbolIndex::InMemorySymbolIndex(
-const std::map ) {
-  for (const auto  : LookupTable) {
-llvm::StringRef Identifier(Entry.first);
-llvm::SmallVector Names;
-Identifier.split(Names, "::");
-for (const auto  : Entry.second) {
-  std::vector Contexts;
-  for (auto IdentiferContext = Names.rbegin() + 1;
-   IdentiferContext != Names.rend(); ++IdentiferContext) {
-Contexts.emplace_back(SymbolInfo::ContextType::Namespace,
-  *IdentiferContext);
-  }
-
-  SymbolInfo Symbol(Names.back(), SymbolInfo::SymbolKind::Class, Header,
-Contexts, 1);
-  this->LookupTable[Symbol.getName()].push_back(Symbol);
-}
-  }
+const std::vector ) {
+  for (const auto  : Symbols)
+LookupTable[Symbol.getName()].push_back(Symbol);
 }
 
 std::vector
Index: clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
===
--- clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
+++ clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
@@ -62,18 +62,20 @@
 std::map SymbolsMap;
 SmallVector SemicolonSplits;
 StringRef(Input).split(SemicolonSplits, ";");
+std::vector Symbols;
 for (StringRef Pair : SemicolonSplits) {
   auto Split = Pair.split('=');
   std::vector Headers;
   SmallVector CommaSplits;
   Split.second.split(CommaSplits, ",");
   for (StringRef Header : CommaSplits)
-Headers.push_back(Header.trim());
-  SymbolsMap[Split.first.trim()] = std::move(Headers);
+Symbols.push_back(find_all_symbols::SymbolInfo(
+Split.first.trim(),
+find_all_symbols::SymbolInfo::SymbolKind::Unknown, Header.trim(), 1,
+{}));
 }
 SymbolIndexMgr->addSymbolIndex(
-llvm::make_unique(
-std::move(SymbolsMap)));
+llvm::make_unique(Symbols));
 break;
   }
   case yaml: {
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
@@ -92,7 +92,7 @@
 return llvm::None;
 
   return SymbolInfo(ND->getNameAsString(), Type, FilePath.str(),
-GetContexts(ND), SM.getExpansionLineNumber(Loc));
+SM.getExpansionLineNumber(Loc), GetContexts(ND));
 }
 
 } // namespace
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
@@ -70,8 +70,8 @@
 namespace find_all_symbols {
 
 SymbolInfo::SymbolInfo(llvm::StringRef Name, SymbolKind Type,
-   llvm::StringRef FilePath,
-   const std::vector , int LineNumber)
+   llvm::StringRef FilePath, int LineNumber,
+   const std::vector )
 : Name(Name), Type(Type), FilePath(FilePath), Contexts(Contexts),
   LineNumber(LineNumber) {}
 
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
@@ -50,7 +50,7 @@
   SymbolInfo() : Type(SymbolKind::Unknown), LineNumber(-1) {};
 
   

[clang-tools-extra] r269427 - [include-fixer] Simplify unittest code.

2016-05-13 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Fri May 13 10:17:17 2016
New Revision: 269427

URL: http://llvm.org/viewvc/llvm-project?rev=269427=rev
Log:
[include-fixer] Simplify unittest code.

Summary:
The InMemorySymbolIndex only constructs hard-coded Class symbols from a string
map. The patch provide a flexable way in InMemorySymbolIndex to create a custom
SymbolInfo in the include-fixer unittest.

Reviewers: bkramer

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp
clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.h
clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
clang-tools-extra/trunk/unittests/include-fixer/IncludeFixerTest.cpp

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp?rev=269427=269426=269427=diff
==
--- clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.cpp Fri May 13 
10:17:17 2016
@@ -15,24 +15,9 @@ namespace clang {
 namespace include_fixer {
 
 InMemorySymbolIndex::InMemorySymbolIndex(
-const std::map ) {
-  for (const auto  : LookupTable) {
-llvm::StringRef Identifier(Entry.first);
-llvm::SmallVector Names;
-Identifier.split(Names, "::");
-for (const auto  : Entry.second) {
-  std::vector Contexts;
-  for (auto IdentiferContext = Names.rbegin() + 1;
-   IdentiferContext != Names.rend(); ++IdentiferContext) {
-Contexts.emplace_back(SymbolInfo::ContextType::Namespace,
-  *IdentiferContext);
-  }
-
-  SymbolInfo Symbol(Names.back(), SymbolInfo::SymbolKind::Class, Header,
-Contexts, 1);
-  this->LookupTable[Symbol.getName()].push_back(Symbol);
-}
-  }
+const std::vector ) {
+  for (const auto  : Symbols)
+LookupTable[Symbol.getName()].push_back(Symbol);
 }
 
 std::vector

Modified: clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.h?rev=269427=269426=269427=diff
==
--- clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.h (original)
+++ clang-tools-extra/trunk/include-fixer/InMemorySymbolIndex.h Fri May 13 
10:17:17 2016
@@ -21,8 +21,7 @@ namespace include_fixer {
 /// Xref database with fixed content.
 class InMemorySymbolIndex : public SymbolIndex {
 public:
-  InMemorySymbolIndex(
-  const std::map );
+  InMemorySymbolIndex(const std::vector 
);
 
   std::vector
   search(llvm::StringRef Identifier) override;

Modified: 
clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp?rev=269427=269426=269427=diff
==
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp 
(original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp 
Fri May 13 10:17:17 2016
@@ -92,7 +92,7 @@ llvm::Optional CreateSymbolI
 return llvm::None;
 
   return SymbolInfo(ND->getNameAsString(), Type, FilePath.str(),
-GetContexts(ND), SM.getExpansionLineNumber(Loc));
+SM.getExpansionLineNumber(Loc), GetContexts(ND));
 }
 
 } // namespace

Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp?rev=269427=269426=269427=diff
==
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp 
(original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp Fri 
May 13 10:17:17 2016
@@ -70,8 +70,8 @@ namespace clang {
 namespace find_all_symbols {
 
 SymbolInfo::SymbolInfo(llvm::StringRef Name, SymbolKind Type,
-   llvm::StringRef FilePath,
-   const std::vector , int LineNumber)
+   llvm::StringRef FilePath, int LineNumber,
+   const std::vector )
 : Name(Name), Type(Type), FilePath(FilePath), Contexts(Contexts),

  1   2   >