Re: [PATCH] D20415: Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

2016-05-18 Thread Peter Collingbourne via cfe-commits
pcc planned changes to this revision.
pcc added a comment.

One thing that I forgot to do here was to add a test covering my changes to 
`CGDebugInfo::EmitGlobalVariable`. I'll do that momentarily.


http://reviews.llvm.org/D20415



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


[PATCH] D20415: Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

2016-05-18 Thread Peter Collingbourne via cfe-commits
pcc created this revision.
pcc added reviewers: dexonsmith, dblaikie, aprantl.
pcc added a subscriber: cfe-commits.

http://reviews.llvm.org/D20415

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/2009-10-20-GlobalDebug.c
  test/CodeGen/debug-info-packed-struct.c
  test/CodeGen/debug-info-static.c
  test/CodeGenCXX/debug-info-access.cpp
  test/CodeGenCXX/debug-info-alias.cpp
  test/CodeGenCXX/debug-info-anon-namespace.cpp
  test/CodeGenCXX/debug-info-anon-union-vars.cpp
  test/CodeGenCXX/debug-info-method.cpp
  test/CodeGenCXX/debug-info-namespace.cpp
  test/CodeGenCXX/debug-info-static-member.cpp
  test/CodeGenCXX/debug-info-template-explicit-specialization.cpp
  test/CodeGenCXX/debug-info-template-member.cpp
  test/CodeGenCXX/debug-info-template.cpp
  test/CodeGenCXX/debug-info-uuid.cpp
  test/CodeGenCXX/debug-info.cpp
  test/CodeGenCXX/debug-lambda-expressions.cpp
  test/CodeGenCXX/inline-dllexport-member.cpp
  test/Driver/darwin-debug-flags.c
  test/Modules/ExtDebugInfo.cpp
  test/Modules/ExtDebugInfo.m

Index: test/Modules/ExtDebugInfo.m
===
--- test/Modules/ExtDebugInfo.m
+++ test/Modules/ExtDebugInfo.m
@@ -34,14 +34,8 @@
   return [c property];
 }
 
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
-// CHECK-SAME: flags: DIFlagObjcClassComplete
-
 // CHECK: ![[MOD:.*]] = !DIModule(scope: null, name: "DebugObjC
 
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar",
-// CHECK-SAME:   flags: DIFlagPrivate)
-
 // CHECK: !DIGlobalVariable(name: "GlobalUnion",
 // CHECK-SAME:  type: ![[GLOBAL_UNION:[0-9]+]]
 // CHECK: ![[GLOBAL_UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,
@@ -52,10 +46,11 @@
 // CHECK: ![[GLOBAL_STRUCT]] = distinct !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK-SAME:elements: !{{[0-9]+}})
 
-// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
-// CHECK-SAME:   baseType: ![[TD_UNION:.*]])
-// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
-// CHECK-SAME: flags: DIFlagFwdDecl)
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
+// CHECK-SAME: flags: DIFlagObjcClassComplete
+
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar",
+// CHECK-SAME:   flags: DIFlagPrivate)
 
 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
 // CHECK-SAME:   baseType: ![[TD_ENUM:.*]])
@@ -67,6 +62,11 @@
 // CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
 // CHECK-SAME: flags: DIFlagFwdDecl)
 
+// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
+// CHECK-SAME:   baseType: ![[TD_UNION:.*]])
+// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
+// CHECK-SAME: flags: DIFlagFwdDecl)
+
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MOD]],
 // CHECK-SAME: flags: DIFlagFwdDecl)
Index: test/Modules/ExtDebugInfo.cpp
===
--- test/Modules/ExtDebugInfo.cpp
+++ test/Modules/ExtDebugInfo.cpp
@@ -67,20 +67,14 @@
   anon.i = GlobalStruct.i = GlobalUnion.i = GlobalEnum;
 }
 
-
-// CHECK: ![[STRUCT:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Struct",
+// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum",
 // CHECK-SAME: scope: ![[NS:[0-9]+]],
 // CHECK-SAME: flags: DIFlagFwdDecl,
-// CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
+// CHECK-SAME: identifier:  "_ZTSN8DebugCXX4EnumE")
 
 // CHECK: ![[NS]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]],
 // CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugCXX
 
-// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum",
-// CHECK-SAME: scope: ![[NS]],
-// CHECK-SAME: flags: DIFlagFwdDecl,
-// CHECK-SAME: identifier:  "_ZTSN8DebugCXX4EnumE")
-
 // This type is anchored in the module by an explicit template instantiation.
 // CHECK: !DICompositeType(tag: DW_TAG_class_type,
 // CHECK-SAME: name: "Template",
@@ -119,7 +113,12 @@
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
 
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "static_member",
-// CHECK-SAME:   scope: ![[STRUCT]]
+// CHECK-SAME:   scope: ![[STRUCT:[0-9]*]]
+
+// CHECK: ![[STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Struct",
+// CHECK-SAME: scope: ![[NS]],
+// CHECK-SAME: flags: DIFlagFwdDecl,
+// CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
 
 // CHECK: 

Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Faisal Vali via cfe-commits
faisalv updated this revision to Diff 57733.
faisalv marked an inline comment as done.
faisalv added a comment.

This patch addresses all of Richard's comments - except one (on which I'm 
awaiting some additional clarity on, before I make any changes).


http://reviews.llvm.org/D19783

Files:
  include/clang/Sema/ScopeInfo.h
  lib/Parse/ParseDeclCXX.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/cxx1z-lambda-star-this.cpp

Index: test/SemaCXX/cxx1z-lambda-star-this.cpp
===
--- test/SemaCXX/cxx1z-lambda-star-this.cpp
+++ test/SemaCXX/cxx1z-lambda-star-this.cpp
@@ -3,6 +3,8 @@
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -DMS_EXTENSIONS
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s -DMS_EXTENSIONS -DDELAYED_TEMPLATE_PARSING
 
+template constexpr bool is_same = false;
+template constexpr bool is_same = true;
 
 namespace test_star_this {
 namespace ns1 {
@@ -69,4 +71,137 @@
   b.foo(); //expected-note{{in instantiation}}
 } // end main  
 } // end ns4
+namespace ns5 {
+
+struct X {
+  double d = 3.14;
+  X(const volatile X&);
+  void foo() {
+  
+  }
+  
+  void foo() const { //expected-note{{const}}
+
+auto L = [*this] () mutable { 
+  static_assert(is_same);
+  ++d;
+  auto M = [this] { 
+static_assert(is_same);  
+++d;
+auto N = [] {
+  static_assert(is_same); 
+};
+  };
+};
+
+auto L1 = [*this] { 
+  static_assert(is_same);
+  auto M = [this] () mutable { 
+static_assert(is_same);  
+auto N = [] {
+  static_assert(is_same); 
+};
+  };
+  auto M2 = [*this] () mutable { 
+static_assert(is_same);  
+auto N = [] {
+  static_assert(is_same); 
+};
+  };
+};
+auto L2 = [this] () mutable {
+  static_assert(is_same);  
+  ++d; //expected-error{{cannot assign}}
+};
+auto GL = [*this] (auto a) mutable {
+  static_assert(is_same);
+  ++d;
+  auto M = [this] (auto b) { 
+static_assert(is_same);  
+++d;
+auto N = [] (auto c) {
+  static_assert(is_same); 
+};
+N(3.14);
+  };
+  M("abc");
+};
+GL(3.14);
+ 
+  }
+  void foo() volatile const {
+auto L = [this] () {
+  static_assert(is_same);
+  auto M = [*this] () mutable { 
+static_assert(is_same);
+auto N = [this] {
+  static_assert(is_same);
+  auto M = [] {
+static_assert(is_same);
+  };
+};
+auto N2 = [*this] {
+  static_assert(is_same);
+};
+  };
+  auto M2 = [*this] () {
+static_assert(is_same); 
+auto N = [this] {
+  static_assert(is_same);
+};
+  };
+};
+  }
+  
+};
+
+} //end ns5
+namespace ns6 {
+struct X {
+  double d;
+  auto foo() const {
+auto L = [*this] () mutable {
+  auto M = [=] (auto a) {
+auto N = [this] {
+  ++d;
+  static_assert(is_same);
+  auto O = [*this] {
+static_assert(is_same);
+  };
+};
+N();
+static_assert(is_same);
+  };
+  return M;
+};
+return L;
+  }
+}; 
+
+int main() {
+  auto L = X{}.foo();
+  auto M = L();
+  M(3.14);
+}
+} // end ns6
+namespace ns7 {
+
+struct X {
+  double d;
+  X();
+  X(const X&); 
+  X(X&) = delete;
+  auto foo() const {
+//OK - the object used to initialize our capture is a const object and so prefers the non-deleted ctor.
+const auto & = [*this] { };
+  }
+  
+}; 
+int main() {
+  X x;
+  x.foo();
+}
+} // end ns7
+
 } //end ns test_star_this
+
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -872,6 +872,92 @@
   return false;
 }
 
+static QualType adjustCVQualifiersForCXXThisWithinLambda(
+ArrayRef FunctionScopes, QualType ThisTy,
+DeclContext *CurSemaContext, ASTContext ) {
+
+  QualType ClassType = ThisTy->getPointeeType();
+  LambdaScopeInfo *CurLSI = nullptr;
+  DeclContext *CurDC = CurSemaContext;
+
+  // Iterate through the stack of lambdas starting from the innermost lambda to
+  // the outermost lambda, checking if '*this' is ever captured by copy - since
+  // that could change 

Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Faisal Vali via cfe-commits
faisalv marked 5 inline comments as done.
faisalv added a comment.

OK - agree (and addressed in a forthcoming patch) all your comments - except 
for the one I could use some clarity on - please see below



Comment at: lib/Sema/SemaExprCXX.cpp:910
@@ +909,3 @@
+  assert(IsFirstIteration);
+  assert(CurLSI->CallOperator->getParent()->getParent() == CurDC);
+  CurDC = CurLSI->CallOperator;

rsmith wrote:
> Please add a comment explaining this, I have no idea what special case you're 
> checking for here.
That special case should have been removed before submission - it crept in as I 
was making incremental changes to the initial patch, and getCurrentThisType was 
still being called from RebuildLambdaScopeInfo. (Alternatively, I might have 
left it in to give Richard a sense of purpose ;) 


Comment at: lib/Sema/SemaExprCXX.cpp:952
@@ +951,3 @@
+while (Closure &&
+   IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
+  if (IsByCopyCapture) {

rsmith wrote:
> Should you really stop here if this is not captured? There could still be a 
> surrounding lambda with a mutable *this capture.
Do you have the following example in mind?  Or is it something different?

void foo() const {
  auto L1 = [*this] { 
  static_assert(is_same);

  auto M2 = [*this] () mutable { 
static_assert(is_same);  
auto N = [] {
  static_assert(is_same); 
};
  };
};
}


http://reviews.llvm.org/D19783



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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Faisal Vali via cfe-commits
There are tests from the test file in my patch that don't pass(*) if
you just apply Oh's fix .  That's not surprising since Oh's patch only
meant to fix the crash, but not the 'cv' qualification issue of
'*this' that we didn't have to deal with prior to by-value captures of
'*this' and my initial implementation of feature patch
incorrectly/incompletely handled.  Also my patch attempts to simplify
the code by removing the storage of 'ThisType' in the Capture, since
it never gets queried, so no reason to store it (which was also what
was triggering the assertion initially).


(*) error: 'error' diagnostics seen but not expected:
  File F:\clang-trunk\llvm\tools\clang\test\semacxx\cxx1z-lambda-star-this.cpp
Line 88: static_assert failed
  File F:\clang-trunk\llvm\tools\clang\test\semacxx\cxx1z-lambda-star-this.cpp
Line 89: cannot assign to non-static data
 member within const member function 'foo'
  File F:\clang-trunk\llvm\tools\clang\test\semacxx\cxx1z-lambda-star-this.cpp
Line 91: static_assert failed
  File F:\clang-trunk\llvm\tools\clang\test\semacxx\cxx1z-lambda-star-this.cpp
Line 92: cannot assign to non-static data
 member within const member function 'foo'

Faisal Vali



On Wed, May 18, 2016 at 12:34 PM, Richard Smith  wrote:
> I'd also like to know whether there are cases that this patch addresses but
> Taewook Oh's patch does not, as the other patch involves a lot less
> complexity.
>
> On 18 May 2016 10:15 a.m., "Richard Smith via cfe-commits"
>  wrote:
>>
>> rsmith added inline comments.
>>
>> 
>> Comment at: lib/Sema/SemaExprCXX.cpp:898
>> @@ +897,3 @@
>> +  // end of the TU) we need to be able to examine its enclosing lambdas
>> and so
>> +  // we use the DeclContext to get a hold of the ClosureClass and query
>> it for
>> +  // capture information.  The reason we don't just resort to always
>> using the
>> 
>> No camel case for ClosureClass.
>>
>> 
>> Comment at: lib/Sema/SemaExprCXX.cpp:910
>> @@ +909,3 @@
>> +  assert(IsFirstIteration);
>> +  assert(CurLSI->CallOperator->getParent()->getParent() == CurDC);
>> +  CurDC = CurLSI->CallOperator;
>> 
>> Please add a comment explaining this, I have no idea what special case
>> you're checking for here.
>>
>> 
>> Comment at: lib/Sema/SemaExprCXX.cpp:952
>> @@ +951,3 @@
>> +while (Closure &&
>> +   IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
>> +  if (IsByCopyCapture) {
>> 
>> Should you really stop here if this is not captured? There could still be
>> a surrounding lambda with a mutable *this capture.
>>
>> 
>> Comment at: lib/Sema/SemaExprCXX.cpp:1062
>> @@ -964,1 +1061,3 @@
>> +  Expr *This =
>> +  new (Context) CXXThisExpr(Loc, AdjustedThisTy, /*isImplicit*/
>> true);
>>if (ByCopy) {
>> 
>> faisalv wrote:
>> > Hmm - I wonder if instead of using AdjustedThisTy, I should always use
>> > 'ThisTy' since it is being used in the initializer expression, and should
>> > probably inherit its cv qualifiers from an enclosing lambda? correct?
>> Yes, don't use AdjustedThisTy here. You can test for this bug by giving
>> the class both a (const T&) and a (T&)=delete copy ctor.
>>
>>
>> http://reviews.llvm.org/D19783
>>
>>
>>
>> ___
>> 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


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

2016-05-18 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed May 18 22:54:54 2016
New Revision: 270021

URL: http://llvm.org/viewvc/llvm-project?rev=270021=rev
Log:
Reapply^3 "[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=270021=270020=270021=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed May 18 22:54:54 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=270021=270020=270021=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Wed May 18 22:54:54 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=270021=270020=270021=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 18 22:54:54 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


Re: [PATCH] D20407: [CodeGen][ObjC] zero-ext an i1 value to i8

2016-05-18 Thread John McCall via cfe-commits
rjmccall added a comment.

_Atomic is functionally a type qualifier and should be removed in Sema when 
computing the result type of the getter and the parameter type of the setter.  
That is, if the user declares a property of type _Atomic(_Bool), we should 
pretend that the property has type _Bool when creating the getter and setter.


http://reviews.llvm.org/D20407



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


Re: r266719 - Warn if function or variable cannot be implicitly instantiated

2016-05-18 Thread Sean Silva via cfe-commits
On Thu, Apr 21, 2016 at 12:44 AM, Serge Pavlov  wrote:

> Let me demonstrate the problem using excerpt from v8 sources:
>
> -- lithium.h 
> template 
> struct LSubKindOperand {
>   static int* Create(int index) { return [index]; }
>   static void SetUpCache();
>   static int* cache;
> };
>
> struct LOperand {
>   static void SetUpCaches();
> };
>
> #define LITHIUM_OPERAND_LIST(V)   \
>   V(DoubleRegister,  1,   16)
>
> #define LITHIUM_TYPEDEF_SUBKIND_OPERAND_CLASS(name, type, number)   \
> typedef LSubKindOperand L##name;
> LITHIUM_OPERAND_LIST(LITHIUM_TYPEDEF_SUBKIND_OPERAND_CLASS)
> /* Expands to: typedef LSubKindOperand<1, 16> LDoubleRegister; */
> #undef LITHIUM_TYPEDEF_SUBKIND_OPERAND_CLASS
>
> -- lithium.cc
> #include "lithium.h"
>
> template
> int* LSubKindOperand::cache = 0;
>
> template
> void LSubKindOperand::SetUpCache() {
>   cache = new int[kNumCachedOperands];
> }
>
> void LOperand::SetUpCaches() {
> #define LITHIUM_OPERAND_SETUP(name, type, number) L##name::SetUpCache();
>   LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP)
>   /* Expands to: LDoubleRegister::SetUpCache(); */
> #undef LITHIUM_OPERAND_SETUP
> }
>
> -- lithium-x64.cc ---
> #include "lithium.h"
>
> int* GetNextSpillSlot(int kind) {
>   return LSubKindOperand<1,16>::Create(0);
> }
>
> int main(int argc, char *argv[]) {
>   return 0;
> }
>
> -- build.sh -
> g++ lithium.cc lithium-x64.cc
> -
>
> When compiler generates code for 'GetNextSpillSlot' it implicitly
> instantiates the method 'Create'. It can do it as definition of the
> template entity 'LSubKindOperand::Create' is available from lithium.h. Then
> it attempts to instantiate static field 'LSubKindOperand::cache', as it is
> used in the body of just instantiated method 'Create'. But definition of
> this template entity  is not available while compiling lithium-x64.cc.
> Failure to implicitly instantiate a template is not an error, but this
> template must be instantiated somewhere else otherwise linker founds
> undefined references.
>
> Indeed, 'LSubKindOperand<1,16>::cache' is instantiated while compiling
> lithium.cc. Method 'LOperand::SetUpCaches' is not a template, it references
> 'LSubKindOperand::SetUpCache', which in turn uses 'LSubKindOperand::cache'.
> Definitions of these templates are available in lithium.cc, compiler
> instantiates them and the program builds successfully. This solution is
> fragile however, if lithium-x64.cc referenced
> 'LSubKindOperand<1,1>::Create', the build would break because in lithium.cc
> this specialization is not instantiated.
>
> Putting templates definitions into source files rather than headers is
> similar to moving forward declarations into source files. It makes sense if
> user wants to encapsulate some functionality. In this example he should
> also move the definition 'LSubKindOperand::Create' to source file, just for
> the sake of encapsulation. This would prevent compiler from implicit
> instantiation of this method and thus from instantiation of the static
> field as well.
>
> If encapsulation is not an aim, moving template definition into header
> seems to be more natural solution. It would allow for compiler to
> instantiate all entities implicitly.
>
> Static variables of template classes are a source of confusion for some
> reason. Probably people tend to confuse them with static member template
> specializations. Anyway this type of errors is too widespread, the
> aforementioned https://llvm.org/bugs/show_bug.cgi?id=24425 is just one
> example.  The change introduced in r266719 attempts to provide user with
> some assistance in these cases.
>
> I don't know details about  Singleton, but only existence of static
> fields should not produce the warning. There must be a reference to the
> field in some method defined inline. Solution could be similar: either the
> method that references the static field should be encapsulated into source
> file or the static field template should be exposed in header.
>
The use case of Singleton I gave wasn't complete. It was more like this:

template 
struct Singleton {
... other stuff ...
  static T *getInstance() { return Singleton::instance; }
private:
  static T *instance;
};

Making the method private to a .cpp file would defeat the entire purpose of
having the class.

-- Sean Silva


> 2016-04-21 5:36 GMT+06:00 Sean Silva :
>
>>
>>
>> On Tue, Apr 19, 2016 at 7:28 AM, Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> (sorry, accidentally sent this mid-mail)
>>>
>>> ../../v8/src/crankshaft/lithium.h:322:45: error: instantiation of
>>> variable
>>> 

r270016 - Fix PR27601 by reverting [r267453] - Refactor traversal of bases in deduction of template parameters from base

2016-05-18 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Wed May 18 21:28:21 2016
New Revision: 270016

URL: http://llvm.org/viewvc/llvm-project?rev=270016=rev
Log:
Fix PR27601 by reverting [r267453] - Refactor traversal of bases in deduction 
of template parameters from base

This reversal is being done with r267453's author's (i.e. Richard Smith's) 
permission.

This fixes https://llvm.org/bugs/show_bug.cgi?id=27601 

Also, per Richard's request the examples from the bug report have been added to 
our test suite.


Modified:
cfe/trunk/lib/AST/CXXInheritance.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/test/SemaTemplate/deduction.cpp

Modified: cfe/trunk/lib/AST/CXXInheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXInheritance.cpp?rev=270016=270015=270016=diff
==
--- cfe/trunk/lib/AST/CXXInheritance.cpp (original)
+++ cfe/trunk/lib/AST/CXXInheritance.cpp Wed May 18 21:28:21 2016
@@ -137,7 +137,6 @@ CXXRecordDecl::isCurrentInstantiation(co
 bool CXXRecordDecl::forallBases(ForallBasesCallback BaseMatches,
 bool AllowShortCircuit) const {
   SmallVector Queue;
-  llvm::SmallPtrSet Enqueued;
 
   const CXXRecordDecl *Record = this;
   bool AllMatches = true;
@@ -159,14 +158,12 @@ bool CXXRecordDecl::forallBases(ForallBa
 AllMatches = false;
 continue;
   }
-
-  if (Enqueued.insert(Base).second) {
-Queue.push_back(Base);
-if (!BaseMatches(Base)) {
-  if (AllowShortCircuit) return false;
-  AllMatches = false;
-  continue;
-}
+  
+  Queue.push_back(Base);
+  if (!BaseMatches(Base)) {
+if (AllowShortCircuit) return false;
+AllMatches = false;
+continue;
   }
 }
 

Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=270016=270015=270016=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Wed May 18 21:28:21 2016
@@ -1454,35 +1454,54 @@ DeduceTemplateArgumentsByTypeMatch(Sema
   //   otherwise fail. If they yield more than one possible deduced A, the
   //   type deduction fails.
 
+  // Reset the incorrectly deduced argument from above.
+  Deduced = DeducedOrig;
+
+  // Use data recursion to crawl through the list of base classes.
+  // Visited contains the set of nodes we have already visited, while
+  // ToVisit is our stack of records that we still need to visit.
+  llvm::SmallPtrSet Visited;
+  SmallVector ToVisit;
+  ToVisit.push_back(RecordT);
   bool Successful = false;
-  RecordT->getAsCXXRecordDecl()->forallBases([&](
-  const CXXRecordDecl *Base) {
-// Start with a fresh copy of the old deduced arguments.
-SmallVector 
DeducedBase(DeducedOrig.begin(),
-DeducedOrig.end());
-
-TemplateDeductionInfo BaseInfo(Info.getLocation());
-Sema::TemplateDeductionResult BaseResult =
-DeduceTemplateArguments(S, TemplateParams, SpecParam,
-S.Context.getRecordType(Base),
-BaseInfo, DeducedBase);
-
-// If template argument deduction for this base was successful,
-// note that we had some success. Otherwise, ignore any deductions
-// from this base class.
-if (BaseResult == Sema::TDK_Success) {
-  // FIXME: If we've already been successful, deduction should fail
-  // due to ambiguity.
-  Successful = true;
-  Deduced.swap(DeducedBase);
-  Info.Param = BaseInfo.Param;
-  Info.FirstArg = BaseInfo.FirstArg;
-  Info.SecondArg = BaseInfo.SecondArg;
+  while (!ToVisit.empty()) {
+// Retrieve the next class in the inheritance hierarchy.
+const RecordType *NextT = ToVisit.pop_back_val();
+
+// If we have already seen this type, skip it.
+if (!Visited.insert(NextT).second)
+  continue;
+
+// If this is a base class, try to perform template argument
+// deduction from it.
+if (NextT != RecordT) {
+  TemplateDeductionInfo BaseInfo(Info.getLocation());
+  Sema::TemplateDeductionResult BaseResult =
+  DeduceTemplateArguments(S, TemplateParams, SpecParam,
+  QualType(NextT, 0), BaseInfo, Deduced);
+
+  // If template argument deduction for this base was successful,
+  // note that we had some success. Otherwise, ignore any deductions
+  // from this base class.
+  if (BaseResult == Sema::TDK_Success) {
+Successful = true;
+

Re: [PATCH] D20341: [CUDA] Enable fusing FP ops for CUDA by default.

2016-05-18 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In http://reviews.llvm.org/D20341#432586, @jlebar wrote:

> > But people also don't expect IEEE compliance on GPUs
>
>
> Is that true?


Yes.

> You have a lot more experience with this than I do, but my observation of 
> nvidia's hardware is that it's moved to add *more* IEEE compliance as it's 
> matured.  For example, older hardware didn't support denormals, but newer 
> chips do.  Surely that's in response to some users.


This is also true, but user expectations change slowly.

> One of our goals with CUDA in clang is to make device code as similar as 
> possible to host code.  Throwing out IEEE compliance seems counter to that 
> goal.

> 

> I also don't see the bright line here.  Like, if we can FMA to our heart's 
> content, where do we draw the line wrt IEEE compliance?  Do we turn on 
> flush-denormals-to-zero by default?  Do we use approximate transcendental 
> functions instead of the more accurate ones?  Do we assume floating point 
> arithmetic is associative?  What is the principle that leads us to do FMAs 
> but not these other optimizations?

> 

> In addition, CUDA != GPUs.  Maybe this is something to turn on by default for 
> NVPTX, although I'm still pretty uncomfortable with that.  Prior art in other 
> compilers is interesting, but I think it's notable that clang doesn't do this 
> for any other targets (afaict?) despite the fact that gcc does.

> 

> The main argument I see for this is "nvcc does it, and people will think 
> clang is slow if we don't".  That's maybe not a bad argument, but it makes me 
> sad.  :(




In http://reviews.llvm.org/D20341#433344, @tra wrote:

> I don't think using FMA throws away IEEE compliance.
>
> IEEE 784-2008 says:
>
> > A language standard should also define, and require implementations to 
> > provide, attributes that allow and
>
> >  disallow value-changing optimizations, separately or collectively, for a 
> > block. These optimizations might
>
> >  include, but are not limited to:
>
> >  ...
>
> >  ― Synthesis of a fusedMultiplyAdd operation from a multiplication and an 
> > addition
>
>
> It sounds like FMA use is up to user/language and IEEE standard is fine with 
> it either way.


That's correct. FMA formation is allowed, although the default for this, and 
how it's done is unfortunately a function of many aspects of the programming 
environment (language, target platform, etc.).

> We need to establish what is the language standard that we need to adhere to. 
> C++ standard itself does not seem to say much about FP precision or 
> particular FP format.

> 

> C11 standard (ISO/IEC 9899:201x draft, 7.12.2) says:

> 

> > The default state (‘‘on’’ or ‘‘off’’) for the [FP_CONTRACT] pragma is 
> > implementation-defined.

> 

> 

> Nvidia has fairly detailed description of their FP.

>  http://docs.nvidia.com/cuda/floating-point/index.html#fused-multiply-add-fma

> 

> > The fused multiply-add operator on the GPU has high performance and 
> > increases the accuracy of computations. **No special flags or function 
> > calls are needed to gain this benefit in CUDA programs**. Understand that a 
> > hardware fused multiply-add operation is not yet available on the CPU, 
> > which can cause differences in numerical results.

> 

> 

> At the moment it's the most specific guideline I managed to find regarding 
> expected FP behavior applicable to CUDA.


I think this is the most important point. IEEE allows an implementation choice 
here, and users who already have working CUDA code have tested that code within 
that context. This is different from the host's choice (at least on x86), but 
users already expect this. There is a performance impact, but there's also a 
numerical impact, and I don't think we do our users any favors by differing 
from NVIDIA here.


http://reviews.llvm.org/D20341



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


Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics

2016-05-18 Thread Duncan P. N. Exon Smith via cfe-commits
I don't think we even need a helper.

Clang::ConstructJob takes a `Compilation`, which has a `Driver`, which has a 
`DiagnosticsEngine`, which has a `DiagnosticsOptions`.

In other words, I think you can delete the code in Clang::ConstructJob (change 
it to a lookup) now that you've changed clang::ParseDiagnosticArgs to update 
`DiagnosticsOptions`.

> On 2016-May-18, at 18:54, Sean Silva  wrote:
> 
> silvas added a subscriber: silvas.
> silvas added a comment.
> 
> I don't see an issue with putthing this as a helper in libBasic. We may need 
> to add a libOption dependency to it but that sounds fine.
> 
> 
> http://reviews.llvm.org/D20404
> 
> 
> 

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


Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics

2016-05-18 Thread Sean Silva via cfe-commits
silvas added a subscriber: silvas.
silvas added a comment.

I don't see an issue with putthing this as a helper in libBasic. We may need to 
add a libOption dependency to it but that sounds fine.


http://reviews.llvm.org/D20404



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


Re: r270009 - Make Sema::getPrintingPolicy less ridiculously expensive. This used to perform

2016-05-18 Thread Richard Smith via cfe-commits
On Wed, May 18, 2016 at 6:49 PM, Sean Silva via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Wed, May 18, 2016 at 6:39 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Wed May 18 20:39:10 2016
>> New Revision: 270009
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=270009=rev
>> Log:
>> Make Sema::getPrintingPolicy less ridiculously expensive. This used to
>> perform
>> an identifier table lookup, *and* copy the LangOptions (including various
>> std::vectors). Twice. We call this function once each time
>> we start
>> parsing a declaration specifier sequence, and once for each call to
>> Sema::Diag.
>>
>> This reduces the compile time for a sample .c file from the linux kernel
>> by 20%.
>>
>> Modified:
>> cfe/trunk/include/clang/AST/ASTContext.h
>> cfe/trunk/include/clang/AST/PrettyPrinter.h
>> cfe/trunk/lib/AST/DeclarationName.cpp
>> cfe/trunk/lib/AST/StmtPrinter.cpp
>> cfe/trunk/lib/AST/TypePrinter.cpp
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Sema/Sema.cpp
>> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
>> cfe/trunk/test/Analysis/initializers-cfg-output.cpp
>> cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp
>> cfe/trunk/test/SemaCXX/member-pointer.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/ASTContext.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=270009=270008=270009=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
>> +++ cfe/trunk/include/clang/AST/ASTContext.h Wed May 18 20:39:10 2016
>> @@ -243,6 +243,9 @@ class ASTContext : public RefCountedBase
>>QualType ObjCClassRedefinitionType;
>>QualType ObjCSelRedefinitionType;
>>
>> +  /// The identifier 'bool'.
>> +  mutable IdentifierInfo *BoolName = nullptr;
>> +
>>/// The identifier 'NSObject'.
>>IdentifierInfo *NSObjectName = nullptr;
>>
>> @@ -1457,6 +1460,13 @@ public:
>>  return NSCopyingName;
>>}
>>
>> +  /// Retrieve the identifier 'bool'.
>> +  IdentifierInfo *getBoolName() const {
>> +if (!BoolName)
>> +  BoolName = ("bool");
>> +return BoolName;
>> +  }
>> +
>>IdentifierInfo *getMakeIntegerSeqName() const {
>>  if (!MakeIntegerSeqName)
>>MakeIntegerSeqName = ("__make_integer_seq");
>>
>> Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=270009=270008=270009=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
>> +++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed May 18 20:39:10 2016
>> @@ -32,22 +32,35 @@ public:
>>
>>  /// \brief Describes how types, statements, expressions, and
>>  /// declarations should be printed.
>> +///
>> +/// This type is intended to be small and suitable for passing by value.
>> +/// It is very frequently copied.
>>  struct PrintingPolicy {
>> -  /// \brief Create a default printing policy for C.
>> +  /// \brief Create a default printing policy for the specified language.
>>PrintingPolicy(const LangOptions )
>> -: LangOpts(LO), Indentation(2), SuppressSpecifiers(false),
>> -  SuppressTagKeyword(false),
>> +: Indentation(2), SuppressSpecifiers(false),
>> +  SuppressTagKeyword(LO.CPlusPlus),
>>IncludeTagDefinition(false), SuppressScope(false),
>>SuppressUnwrittenScope(false), SuppressInitializers(false),
>>ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
>>SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
>>SuppressTemplateArgsInCXXConstructors(false),
>> -  Bool(LO.Bool), TerseOutput(false), PolishForDeclaration(false),
>> +  Bool(LO.Bool), Restrict(LO.C99),
>> +  Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
>> +  UseVoidForZeroParams(!LO.CPlusPlus),
>> +  TerseOutput(false), PolishForDeclaration(false),
>>Half(LO.Half), MSWChar(LO.MicrosoftExt && !LO.WChar),
>>IncludeNewlines(true), MSVCFormatting(false) { }
>>
>> -  /// \brief What language we're printing.
>> -  LangOptions LangOpts;
>> +  /// \brief Adjust this printing policy for cases where it's known that
>> +  /// we're printing C++ code (for instance, if AST dumping reaches a
>> +  /// C++-only construct). This should not be used if a real LangOptions
>> +  /// object is available.
>> +  void adjustForCPlusPlus() {
>> +SuppressTagKeyword = true;
>> +Bool = true;
>> +UseVoidForZeroParams = false;
>> +  }
>>
>>/// \brief The number of spaces to use to indent each line.
>>unsigned Indentation : 8;
>> @@ -143,10 +156,23 @@ struct PrintingPolicy {
>>/// constructors.
>>unsigned SuppressTemplateArgsInCXXConstructors : 1;
>>
>> -  /// \brief Whether we can use 'bool' rather than '_Bool', even 

Re: r270009 - Make Sema::getPrintingPolicy less ridiculously expensive. This used to perform

2016-05-18 Thread Sean Silva via cfe-commits
Ah, just saw 270010

On Wed, May 18, 2016 at 6:49 PM, Sean Silva  wrote:

>
>
> On Wed, May 18, 2016 at 6:39 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Wed May 18 20:39:10 2016
>> New Revision: 270009
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=270009=rev
>> Log:
>> Make Sema::getPrintingPolicy less ridiculously expensive. This used to
>> perform
>> an identifier table lookup, *and* copy the LangOptions (including various
>> std::vectors). Twice. We call this function once each time
>> we start
>> parsing a declaration specifier sequence, and once for each call to
>> Sema::Diag.
>>
>> This reduces the compile time for a sample .c file from the linux kernel
>> by 20%.
>>
>> Modified:
>> cfe/trunk/include/clang/AST/ASTContext.h
>> cfe/trunk/include/clang/AST/PrettyPrinter.h
>> cfe/trunk/lib/AST/DeclarationName.cpp
>> cfe/trunk/lib/AST/StmtPrinter.cpp
>> cfe/trunk/lib/AST/TypePrinter.cpp
>> cfe/trunk/lib/Parse/ParseDecl.cpp
>> cfe/trunk/lib/Sema/Sema.cpp
>> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
>> cfe/trunk/test/Analysis/initializers-cfg-output.cpp
>> cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp
>> cfe/trunk/test/SemaCXX/member-pointer.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/ASTContext.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=270009=270008=270009=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
>> +++ cfe/trunk/include/clang/AST/ASTContext.h Wed May 18 20:39:10 2016
>> @@ -243,6 +243,9 @@ class ASTContext : public RefCountedBase
>>QualType ObjCClassRedefinitionType;
>>QualType ObjCSelRedefinitionType;
>>
>> +  /// The identifier 'bool'.
>> +  mutable IdentifierInfo *BoolName = nullptr;
>> +
>>/// The identifier 'NSObject'.
>>IdentifierInfo *NSObjectName = nullptr;
>>
>> @@ -1457,6 +1460,13 @@ public:
>>  return NSCopyingName;
>>}
>>
>> +  /// Retrieve the identifier 'bool'.
>> +  IdentifierInfo *getBoolName() const {
>> +if (!BoolName)
>> +  BoolName = ("bool");
>> +return BoolName;
>> +  }
>> +
>>IdentifierInfo *getMakeIntegerSeqName() const {
>>  if (!MakeIntegerSeqName)
>>MakeIntegerSeqName = ("__make_integer_seq");
>>
>> Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=270009=270008=270009=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
>> +++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed May 18 20:39:10 2016
>> @@ -32,22 +32,35 @@ public:
>>
>>  /// \brief Describes how types, statements, expressions, and
>>  /// declarations should be printed.
>> +///
>> +/// This type is intended to be small and suitable for passing by value.
>> +/// It is very frequently copied.
>>  struct PrintingPolicy {
>> -  /// \brief Create a default printing policy for C.
>> +  /// \brief Create a default printing policy for the specified language.
>>PrintingPolicy(const LangOptions )
>> -: LangOpts(LO), Indentation(2), SuppressSpecifiers(false),
>> -  SuppressTagKeyword(false),
>> +: Indentation(2), SuppressSpecifiers(false),
>> +  SuppressTagKeyword(LO.CPlusPlus),
>>IncludeTagDefinition(false), SuppressScope(false),
>>SuppressUnwrittenScope(false), SuppressInitializers(false),
>>ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
>>SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
>>SuppressTemplateArgsInCXXConstructors(false),
>> -  Bool(LO.Bool), TerseOutput(false), PolishForDeclaration(false),
>> +  Bool(LO.Bool), Restrict(LO.C99),
>> +  Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
>> +  UseVoidForZeroParams(!LO.CPlusPlus),
>> +  TerseOutput(false), PolishForDeclaration(false),
>>Half(LO.Half), MSWChar(LO.MicrosoftExt && !LO.WChar),
>>IncludeNewlines(true), MSVCFormatting(false) { }
>>
>> -  /// \brief What language we're printing.
>> -  LangOptions LangOpts;
>> +  /// \brief Adjust this printing policy for cases where it's known that
>> +  /// we're printing C++ code (for instance, if AST dumping reaches a
>> +  /// C++-only construct). This should not be used if a real LangOptions
>> +  /// object is available.
>> +  void adjustForCPlusPlus() {
>> +SuppressTagKeyword = true;
>> +Bool = true;
>> +UseVoidForZeroParams = false;
>> +  }
>>
>>/// \brief The number of spaces to use to indent each line.
>>unsigned Indentation : 8;
>> @@ -143,10 +156,23 @@ struct PrintingPolicy {
>>/// constructors.
>>unsigned SuppressTemplateArgsInCXXConstructors : 1;
>>
>> -  /// \brief Whether we can use 'bool' rather than '_Bool', 

Re: r270009 - Make Sema::getPrintingPolicy less ridiculously expensive. This used to perform

2016-05-18 Thread Sean Silva via cfe-commits
On Wed, May 18, 2016 at 6:39 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Wed May 18 20:39:10 2016
> New Revision: 270009
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270009=rev
> Log:
> Make Sema::getPrintingPolicy less ridiculously expensive. This used to
> perform
> an identifier table lookup, *and* copy the LangOptions (including various
> std::vectors). Twice. We call this function once each time we
> start
> parsing a declaration specifier sequence, and once for each call to
> Sema::Diag.
>
> This reduces the compile time for a sample .c file from the linux kernel
> by 20%.
>
> Modified:
> cfe/trunk/include/clang/AST/ASTContext.h
> cfe/trunk/include/clang/AST/PrettyPrinter.h
> cfe/trunk/lib/AST/DeclarationName.cpp
> cfe/trunk/lib/AST/StmtPrinter.cpp
> cfe/trunk/lib/AST/TypePrinter.cpp
> cfe/trunk/lib/Parse/ParseDecl.cpp
> cfe/trunk/lib/Sema/Sema.cpp
> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> cfe/trunk/test/Analysis/initializers-cfg-output.cpp
> cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp
> cfe/trunk/test/SemaCXX/member-pointer.cpp
>
> Modified: cfe/trunk/include/clang/AST/ASTContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=270009=270008=270009=diff
>
> ==
> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
> +++ cfe/trunk/include/clang/AST/ASTContext.h Wed May 18 20:39:10 2016
> @@ -243,6 +243,9 @@ class ASTContext : public RefCountedBase
>QualType ObjCClassRedefinitionType;
>QualType ObjCSelRedefinitionType;
>
> +  /// The identifier 'bool'.
> +  mutable IdentifierInfo *BoolName = nullptr;
> +
>/// The identifier 'NSObject'.
>IdentifierInfo *NSObjectName = nullptr;
>
> @@ -1457,6 +1460,13 @@ public:
>  return NSCopyingName;
>}
>
> +  /// Retrieve the identifier 'bool'.
> +  IdentifierInfo *getBoolName() const {
> +if (!BoolName)
> +  BoolName = ("bool");
> +return BoolName;
> +  }
> +
>IdentifierInfo *getMakeIntegerSeqName() const {
>  if (!MakeIntegerSeqName)
>MakeIntegerSeqName = ("__make_integer_seq");
>
> Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=270009=270008=270009=diff
>
> ==
> --- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
> +++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed May 18 20:39:10 2016
> @@ -32,22 +32,35 @@ public:
>
>  /// \brief Describes how types, statements, expressions, and
>  /// declarations should be printed.
> +///
> +/// This type is intended to be small and suitable for passing by value.
> +/// It is very frequently copied.
>  struct PrintingPolicy {
> -  /// \brief Create a default printing policy for C.
> +  /// \brief Create a default printing policy for the specified language.
>PrintingPolicy(const LangOptions )
> -: LangOpts(LO), Indentation(2), SuppressSpecifiers(false),
> -  SuppressTagKeyword(false),
> +: Indentation(2), SuppressSpecifiers(false),
> +  SuppressTagKeyword(LO.CPlusPlus),
>IncludeTagDefinition(false), SuppressScope(false),
>SuppressUnwrittenScope(false), SuppressInitializers(false),
>ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
>SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
>SuppressTemplateArgsInCXXConstructors(false),
> -  Bool(LO.Bool), TerseOutput(false), PolishForDeclaration(false),
> +  Bool(LO.Bool), Restrict(LO.C99),
> +  Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
> +  UseVoidForZeroParams(!LO.CPlusPlus),
> +  TerseOutput(false), PolishForDeclaration(false),
>Half(LO.Half), MSWChar(LO.MicrosoftExt && !LO.WChar),
>IncludeNewlines(true), MSVCFormatting(false) { }
>
> -  /// \brief What language we're printing.
> -  LangOptions LangOpts;
> +  /// \brief Adjust this printing policy for cases where it's known that
> +  /// we're printing C++ code (for instance, if AST dumping reaches a
> +  /// C++-only construct). This should not be used if a real LangOptions
> +  /// object is available.
> +  void adjustForCPlusPlus() {
> +SuppressTagKeyword = true;
> +Bool = true;
> +UseVoidForZeroParams = false;
> +  }
>
>/// \brief The number of spaces to use to indent each line.
>unsigned Indentation : 8;
> @@ -143,10 +156,23 @@ struct PrintingPolicy {
>/// constructors.
>unsigned SuppressTemplateArgsInCXXConstructors : 1;
>
> -  /// \brief Whether we can use 'bool' rather than '_Bool', even if the
> language
> -  /// doesn't actually have 'bool' (because, e.g., it is defined as a
> macro).
> +  /// \brief Whether we can use 'bool' rather than '_Bool' (even if the
> language
> +  /// doesn't actually have 

r270010 - Revert accidentally-committed test for PR27558 (which currently fails...)

2016-05-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed May 18 20:41:52 2016
New Revision: 270010

URL: http://llvm.org/viewvc/llvm-project?rev=270010=rev
Log:
Revert accidentally-committed test for PR27558 (which currently fails...)

Modified:
cfe/trunk/test/SemaCXX/member-pointer.cpp

Modified: cfe/trunk/test/SemaCXX/member-pointer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-pointer.cpp?rev=270010=270009=270010=diff
==
--- cfe/trunk/test/SemaCXX/member-pointer.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-pointer.cpp Wed May 18 20:41:52 2016
@@ -323,12 +323,3 @@ namespace test8 {
  .**(int A::**) 0; // expected-warning {{indirection of 
non-volatile null pointer will be deleted}} expected-note {{consider}}
   }
 }
-
-namespace PR27558 {
-  template struct A { void f(); };
-  template struct B : A {
-using A::f;
-B() { (void)::f; }
-  };
-  B b;
-}


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


r270009 - Make Sema::getPrintingPolicy less ridiculously expensive. This used to perform

2016-05-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed May 18 20:39:10 2016
New Revision: 270009

URL: http://llvm.org/viewvc/llvm-project?rev=270009=rev
Log:
Make Sema::getPrintingPolicy less ridiculously expensive. This used to perform
an identifier table lookup, *and* copy the LangOptions (including various
std::vectors). Twice. We call this function once each time we start
parsing a declaration specifier sequence, and once for each call to Sema::Diag.

This reduces the compile time for a sample .c file from the linux kernel by 20%.

Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/PrettyPrinter.h
cfe/trunk/lib/AST/DeclarationName.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Analysis/initializers-cfg-output.cpp
cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp
cfe/trunk/test/SemaCXX/member-pointer.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=270009=270008=270009=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Wed May 18 20:39:10 2016
@@ -243,6 +243,9 @@ class ASTContext : public RefCountedBase
   QualType ObjCClassRedefinitionType;
   QualType ObjCSelRedefinitionType;
 
+  /// The identifier 'bool'.
+  mutable IdentifierInfo *BoolName = nullptr;
+
   /// The identifier 'NSObject'.
   IdentifierInfo *NSObjectName = nullptr;
 
@@ -1457,6 +1460,13 @@ public:
 return NSCopyingName;
   }
 
+  /// Retrieve the identifier 'bool'.
+  IdentifierInfo *getBoolName() const {
+if (!BoolName)
+  BoolName = ("bool");
+return BoolName;
+  }
+
   IdentifierInfo *getMakeIntegerSeqName() const {
 if (!MakeIntegerSeqName)
   MakeIntegerSeqName = ("__make_integer_seq");

Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=270009=270008=270009=diff
==
--- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed May 18 20:39:10 2016
@@ -32,22 +32,35 @@ public:
 
 /// \brief Describes how types, statements, expressions, and
 /// declarations should be printed.
+///
+/// This type is intended to be small and suitable for passing by value.
+/// It is very frequently copied.
 struct PrintingPolicy {
-  /// \brief Create a default printing policy for C.
+  /// \brief Create a default printing policy for the specified language.
   PrintingPolicy(const LangOptions )
-: LangOpts(LO), Indentation(2), SuppressSpecifiers(false),
-  SuppressTagKeyword(false),
+: Indentation(2), SuppressSpecifiers(false),
+  SuppressTagKeyword(LO.CPlusPlus),
   IncludeTagDefinition(false), SuppressScope(false),
   SuppressUnwrittenScope(false), SuppressInitializers(false),
   ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
   SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
   SuppressTemplateArgsInCXXConstructors(false),
-  Bool(LO.Bool), TerseOutput(false), PolishForDeclaration(false),
+  Bool(LO.Bool), Restrict(LO.C99),
+  Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
+  UseVoidForZeroParams(!LO.CPlusPlus),
+  TerseOutput(false), PolishForDeclaration(false),
   Half(LO.Half), MSWChar(LO.MicrosoftExt && !LO.WChar),
   IncludeNewlines(true), MSVCFormatting(false) { }
 
-  /// \brief What language we're printing.
-  LangOptions LangOpts;
+  /// \brief Adjust this printing policy for cases where it's known that
+  /// we're printing C++ code (for instance, if AST dumping reaches a
+  /// C++-only construct). This should not be used if a real LangOptions
+  /// object is available.
+  void adjustForCPlusPlus() {
+SuppressTagKeyword = true;
+Bool = true;
+UseVoidForZeroParams = false;
+  }
 
   /// \brief The number of spaces to use to indent each line.
   unsigned Indentation : 8;
@@ -143,10 +156,23 @@ struct PrintingPolicy {
   /// constructors.
   unsigned SuppressTemplateArgsInCXXConstructors : 1;
 
-  /// \brief Whether we can use 'bool' rather than '_Bool', even if the 
language
-  /// doesn't actually have 'bool' (because, e.g., it is defined as a macro).
+  /// \brief Whether we can use 'bool' rather than '_Bool' (even if the 
language
+  /// doesn't actually have 'bool', because, e.g., it is defined as a macro).
   unsigned Bool : 1;
 
+  /// \brief Whether we can use 'restrict' rather than '__restrict'.
+  unsigned Restrict : 1;
+
+  /// \brief Whether we can use 'alignof' rather than '__alignof'.
+  unsigned Alignof : 1;
+
+  /// \brief Whether we can use '_Alignof' rather than 

Re: [PATCH] D7982: Add readability-duplicate-include check to clang-tidy

2016-05-18 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Include What You Use detect duplicated include directives. I think will be good 
idea to use it instead of Clang-tidy for much deeper analysis.


http://reviews.llvm.org/D7982



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


Re: [PATCH] D20407: [CodeGen][ObjC] zero-ext an i1 value to i8

2016-05-18 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

Also, it seems that there are bugs in the way clang handles functions whose 
return types are atomic. Clang asserts when compiling the following test case:

$ cat t1.c

  _Atomic _Bool b1;
  
  _Atomic _Bool foo1() {
return b1;
  }

$ clang -std=c11 -o - -S t1.c -emit-llvm


http://reviews.llvm.org/D20407



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


Re: [PATCH] D15089: Patch to google checks in clang-tidy

2016-05-18 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Please update you patch to current code. Looks like addresses were fixed in 
files where they existed, but still need to be added to files without them.


Repository:
  rL LLVM

http://reviews.llvm.org/D15089



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


[PATCH] D20407: [CodeGen][ObjC] zero-ext an i1 value to i8

2016-05-18 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a reviewer: rjmccall.
ahatanak added a subscriber: cfe-commits.

This patch fixes an assert that fires when there is a property that has 
attribute nonatomic and type _Atomic(_Bool). The assert fires when an i1 value 
is bitcast to i8 (which is the type ConvertType(propType) returns).

I have a couple of questions as I wasn't sure this was the right way to fix the 
assert.

1. Is it legal to have attribute nonatomic on a property that has an atomic 
type? Should clang error out?
2. Should the return type of the getter method be i1 or i8? I chose not to 
change the return type (which was i8), but I think there are cases where 
changing it to i1 might make more sense. For example, the following code 
currently doesn't compile because foo1 and the getter for "p" (which is the 
property of A in the test case) have different return types.

```
_Bool foo1() {
  A *a = [A new];
  return i.p;
}
```

rdar://problem/26322972

http://reviews.llvm.org/D20407

Files:
  lib/CodeGen/CGObjC.cpp
  test/CodeGenObjC/property-atomic-bool.m

Index: test/CodeGenObjC/property-atomic-bool.m
===
--- /dev/null
+++ test/CodeGenObjC/property-atomic-bool.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -emit-llvm -x objective-c %s 
-o - | FileCheck %s
+
+// CHECK: define internal i8 @"\01-[A p]"(
+// CHECK:   %[[ATOMIC_LOAD:.*]] = load atomic i8, i8* %{{.*}} seq_cst
+// CHECK:   %[[TOBOOL:.*]] = trunc i8 %[[ATOMIC_LOAD]] to i1
+// CHECK:   %[[RETVAL:.*]] = zext i1 %[[TOBOOL]] to i8
+// CHECK:   ret i8 %[[RETVAL]]
+
+@interface A
+@property(nonatomic) _Atomic(_Bool) p;
+@end
+@implementation A
+@end
Index: lib/CodeGen/CGObjC.cpp
===
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -1010,7 +1010,7 @@
   AutoreleaseResult = false;
 }
 
-value = Builder.CreateBitCast(value, ConvertType(propType));
+value = Builder.CreateZExtOrBitCast(value, ConvertType(propType));
 value = Builder.CreateBitCast(
 value, ConvertType(GetterMethodDecl->getReturnType()));
   }


Index: test/CodeGenObjC/property-atomic-bool.m
===
--- /dev/null
+++ test/CodeGenObjC/property-atomic-bool.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -emit-llvm -x objective-c %s -o - | FileCheck %s
+
+// CHECK: define internal i8 @"\01-[A p]"(
+// CHECK:   %[[ATOMIC_LOAD:.*]] = load atomic i8, i8* %{{.*}} seq_cst
+// CHECK:   %[[TOBOOL:.*]] = trunc i8 %[[ATOMIC_LOAD]] to i1
+// CHECK:   %[[RETVAL:.*]] = zext i1 %[[TOBOOL]] to i8
+// CHECK:   ret i8 %[[RETVAL]]
+
+@interface A
+@property(nonatomic) _Atomic(_Bool) p;
+@end
+@implementation A
+@end
Index: lib/CodeGen/CGObjC.cpp
===
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -1010,7 +1010,7 @@
   AutoreleaseResult = false;
 }
 
-value = Builder.CreateBitCast(value, ConvertType(propType));
+value = Builder.CreateZExtOrBitCast(value, ConvertType(propType));
 value = Builder.CreateBitCast(
 value, ConvertType(GetterMethodDecl->getReturnType()));
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20383: PCH + Module: make sure we write out macros associated with builtin identifiers

2016-05-18 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a subscriber: bruno.
bruno added a comment.

Hi Manman,



Comment at: lib/Serialization/ASTWriter.cpp:2191
@@ -2191,1 +2190,3 @@
+// We write out exported module macros for PCH as well.
+if (true) {
   auto Leafs = PP.getLeafModuleMacros(Name);

Is this intended?


http://reviews.llvm.org/D20383



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


Re: r269910 - Update for llvm change.

2016-05-18 Thread Rafael Espíndola via cfe-commits
yes, thanks.

Cheers,
Rafael


On 18 May 2016 at 19:10, Sean Silva  wrote:
>
>
> On Wed, May 18, 2016 at 4:58 AM, Rafael Espindola via cfe-commits
>  wrote:
>>
>> Author: rafael
>> Date: Wed May 18 06:58:56 2016
>> New Revision: 269910
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=269910=rev
>> Log:
>> Update for llvm change.
>>
>> Modified:
>> cfe/trunk/lib/Parse/ParseStmtAsm.cpp
>> cfe/trunk/tools/driver/cc1as_main.cpp
>>
>> Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=269910=269909=269910=diff
>>
>> ==
>> --- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Wed May 18 06:58:56 2016
>> @@ -572,8 +572,8 @@ StmtResult Parser::ParseMicrosoftAsmStat
>>
>>llvm::SourceMgr TempSrcMgr;
>>llvm::MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), );
>> -  MOFI->InitMCObjectFileInfo(TheTriple, llvm::Reloc::Default,
>> - llvm::CodeModel::Default, Ctx);
>> +  MOFI->InitMCObjectFileInfo(TheTriple, /*PIG*/ false,
>> llvm::CodeModel::Default,
>
>
> Did you mean "PIC" here insted of PIG?
>
> -- Sean Silva
>
>>
>> + Ctx);
>>std::unique_ptr Buffer =
>>llvm::MemoryBuffer::getMemBuffer(AsmString, "");
>>
>>
>> Modified: cfe/trunk/tools/driver/cc1as_main.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=269910=269909=269910=diff
>>
>> ==
>> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)
>> +++ cfe/trunk/tools/driver/cc1as_main.cpp Wed May 18 06:58:56 2016
>> @@ -326,19 +326,18 @@ static bool ExecuteAssembler(AssemblerIn
>>
>>MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), );
>>
>> -  llvm::Reloc::Model RM = llvm::Reloc::Default;
>> +  bool PIC = false;
>>if (Opts.RelocationModel == "static") {
>> -RM = llvm::Reloc::Static;
>> +PIC = false;
>>} else if (Opts.RelocationModel == "pic") {
>> -RM = llvm::Reloc::PIC_;
>> +PIC = true;
>>} else {
>>  assert(Opts.RelocationModel == "dynamic-no-pic" &&
>> "Invalid PIC model!");
>> -RM = llvm::Reloc::DynamicNoPIC;
>> +PIC = false;
>>}
>>
>> -  MOFI->InitMCObjectFileInfo(Triple(Opts.Triple), RM,
>> - CodeModel::Default, Ctx);
>> +  MOFI->InitMCObjectFileInfo(Triple(Opts.Triple), PIC,
>> CodeModel::Default, Ctx);
>>if (Opts.SaveTemporaryLabels)
>>  Ctx.setAllowTemporaryLabels(false);
>>if (Opts.GenDwarfForAssembly)
>>
>>
>> ___
>> 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


r270006 - Fix a funny Dvorak typo.

2016-05-18 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Wed May 18 19:16:09 2016
New Revision: 270006

URL: http://llvm.org/viewvc/llvm-project?rev=270006=rev
Log:
Fix a funny Dvorak typo.

Modified:
cfe/trunk/lib/Parse/ParseStmtAsm.cpp

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=270006=270005=270006=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Wed May 18 19:16:09 2016
@@ -572,7 +572,7 @@ StmtResult Parser::ParseMicrosoftAsmStat
 
   llvm::SourceMgr TempSrcMgr;
   llvm::MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), );
-  MOFI->InitMCObjectFileInfo(TheTriple, /*PIG*/ false, 
llvm::CodeModel::Default,
+  MOFI->InitMCObjectFileInfo(TheTriple, /*PIC*/ false, 
llvm::CodeModel::Default,
  Ctx);
   std::unique_ptr Buffer =
   llvm::MemoryBuffer::getMemBuffer(AsmString, "");


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


Re: [PATCH] D20394: Fix cdp intrinsic

2016-05-18 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


http://reviews.llvm.org/D20394



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


[PATCH] D20405: [CUDA] allow sm_50,52,53 GPUs

2016-05-18 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added a reviewer: jlebar.
tra added a subscriber: cfe-commits.

LLVM accepts them since r233575.


http://reviews.llvm.org/D20405

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  test/CodeGen/nvptx-cpus.c

Index: test/CodeGen/nvptx-cpus.c
===
--- test/CodeGen/nvptx-cpus.c
+++ test/CodeGen/nvptx-cpus.c
@@ -3,6 +3,9 @@
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_30 -O3 -S -o 
%t %s -emit-llvm
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_35 -O3 -S -o 
%t %s -emit-llvm
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_37 -O3 -S -o 
%t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_50 -O3 -S -o 
%t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_52 -O3 -S -o 
%t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_53 -O3 -S -o 
%t %s -emit-llvm
 
 // Make sure clang accepts all supported architectures.
 
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1750,6 +1750,10 @@
   } else if (GpuArch == "compute_35") {
 CudaLibDeviceMap["sm_35"] = FilePath;
 CudaLibDeviceMap["sm_37"] = FilePath;
+  } else if (GpuArch == "compute_50") {
+CudaLibDeviceMap["sm_50"] = FilePath;
+CudaLibDeviceMap["sm_52"] = FilePath;
+CudaLibDeviceMap["sm_53"] = FilePath;
   }
 }
 
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1689,6 +1689,9 @@
 GK_SM30,
 GK_SM35,
 GK_SM37,
+GK_SM50,
+GK_SM52,
+GK_SM53,
   } GPU;
 
 public:
@@ -1787,6 +1790,15 @@
   case GK_SM37:
 CUDAArchCode = "370";
 break;
+  case GK_SM50:
+CUDAArchCode = "500";
+break;
+  case GK_SM52:
+CUDAArchCode = "520";
+break;
+  case GK_SM53:
+CUDAArchCode = "530";
+break;
   default:
 llvm_unreachable("Unhandled target CPU");
   }
@@ -1836,6 +1848,9 @@
   .Case("sm_30", GK_SM30)
   .Case("sm_35", GK_SM35)
   .Case("sm_37", GK_SM37)
+  .Case("sm_50", GK_SM50)
+  .Case("sm_52", GK_SM52)
+  .Case("sm_53", GK_SM53)
   .Default(GK_NONE);
 
 return GPU != GK_NONE;


Index: test/CodeGen/nvptx-cpus.c
===
--- test/CodeGen/nvptx-cpus.c
+++ test/CodeGen/nvptx-cpus.c
@@ -3,6 +3,9 @@
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_30 -O3 -S -o %t %s -emit-llvm
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_35 -O3 -S -o %t %s -emit-llvm
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_37 -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_50 -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_52 -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_53 -O3 -S -o %t %s -emit-llvm
 
 // Make sure clang accepts all supported architectures.
 
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1750,6 +1750,10 @@
   } else if (GpuArch == "compute_35") {
 CudaLibDeviceMap["sm_35"] = FilePath;
 CudaLibDeviceMap["sm_37"] = FilePath;
+  } else if (GpuArch == "compute_50") {
+CudaLibDeviceMap["sm_50"] = FilePath;
+CudaLibDeviceMap["sm_52"] = FilePath;
+CudaLibDeviceMap["sm_53"] = FilePath;
   }
 }
 
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1689,6 +1689,9 @@
 GK_SM30,
 GK_SM35,
 GK_SM37,
+GK_SM50,
+GK_SM52,
+GK_SM53,
   } GPU;
 
 public:
@@ -1787,6 +1790,15 @@
   case GK_SM37:
 CUDAArchCode = "370";
 break;
+  case GK_SM50:
+CUDAArchCode = "500";
+break;
+  case GK_SM52:
+CUDAArchCode = "520";
+break;
+  case GK_SM53:
+CUDAArchCode = "530";
+break;
   default:
 llvm_unreachable("Unhandled target CPU");
   }
@@ -1836,6 +1848,9 @@
   .Case("sm_30", GK_SM30)
   .Case("sm_35", GK_SM35)
   .Case("sm_37", GK_SM37)
+  .Case("sm_50", GK_SM50)
+  .Case("sm_52", GK_SM52)
+  .Case("sm_53", GK_SM53)
   .Default(GK_NONE);
 
 return GPU != GK_NONE;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D20404: [Driver] Fix driver support for color diagnostics

2016-05-18 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added a reviewer: rsmith.
bruno added subscribers: cfe-commits, dexonsmith.

Diagnostics that happen during driver time do not have color output
support unless -fcolor-diagonostic is explicitly passed into the driver.
OTOH, it works great for cc1 mode since dianostic arguments are properly
handled and color is enabled by default if the terminal supports it.

This patch fix this behavior by using the same logic present in -cc1
argument construction to decide whether it should use colors. I tried to
find a way to refactor this logic into a common place that could be used
from both lib/Driver/Tools.cpp and lib/Frontend/CompilerInvocation.cpp,
but could not see any options besides libBasic, which also seems wrong
because it's not the ideal place to put options parsing code either. So
I duplicated part of the logic and changed some driver unrelated logic.
(look for ShowColors in lib/Driver/Tools.cpp for details). Ideas welcome.

I do not see a way to write a testcase for this. 


http://reviews.llvm.org/D20404

Files:
  lib/Frontend/CompilerInvocation.cpp

Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -855,6 +855,44 @@
 ModuleFiles.end());
 }
 
+static bool parseShowColorsArgs(const ArgList ) {
+  // Color diagnostics are the default, unless the terminal doesn't support
+  // them.
+  // Support both clang's -f[no-]color-diagnostics and gcc's
+  // -f[no-]diagnostics-colors[=never|always|auto].
+  enum { Colors_On, Colors_Off, Colors_Auto } ShowColors = Colors_Auto;
+  for (const auto  : Args) {
+const Option  = Arg->getOption();
+if (!O.matches(options::OPT_fcolor_diagnostics) &&
+!O.matches(options::OPT_fdiagnostics_color) &&
+!O.matches(options::OPT_fno_color_diagnostics) &&
+!O.matches(options::OPT_fno_diagnostics_color) &&
+!O.matches(options::OPT_fdiagnostics_color_EQ))
+  continue;
+
+if (O.matches(options::OPT_fcolor_diagnostics) ||
+O.matches(options::OPT_fdiagnostics_color)) {
+  ShowColors = Colors_On;
+} else if (O.matches(options::OPT_fno_color_diagnostics) ||
+   O.matches(options::OPT_fno_diagnostics_color)) {
+  ShowColors = Colors_Off;
+} else {
+  assert(O.matches(options::OPT_fdiagnostics_color_EQ));
+  StringRef Value(Arg->getValue());
+  if (Value == "always")
+ShowColors = Colors_On;
+  else if (Value == "auto")
+ShowColors = Colors_Auto;
+  else // Value == "never" or any other value
+ShowColors = Colors_Off;
+}
+  }
+  if (ShowColors == Colors_On ||
+  (ShowColors == Colors_Auto && 
llvm::sys::Process::StandardErrHasColors()))
+return true;
+  return false;
+}
+
 bool clang::ParseDiagnosticArgs(DiagnosticOptions , ArgList ,
 DiagnosticsEngine *Diags) {
   using namespace options;
@@ -869,7 +907,7 @@
   Opts.Pedantic = Args.hasArg(OPT_pedantic);
   Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
   Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
-  Opts.ShowColors = Args.hasArg(OPT_fcolor_diagnostics);
+  Opts.ShowColors = parseShowColorsArgs(Args);
   Opts.ShowColumn = Args.hasFlag(OPT_fshow_column,
  OPT_fno_show_column,
  /*Default=*/true);


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -855,6 +855,44 @@
 ModuleFiles.end());
 }
 
+static bool parseShowColorsArgs(const ArgList ) {
+  // Color diagnostics are the default, unless the terminal doesn't support
+  // them.
+  // Support both clang's -f[no-]color-diagnostics and gcc's
+  // -f[no-]diagnostics-colors[=never|always|auto].
+  enum { Colors_On, Colors_Off, Colors_Auto } ShowColors = Colors_Auto;
+  for (const auto  : Args) {
+const Option  = Arg->getOption();
+if (!O.matches(options::OPT_fcolor_diagnostics) &&
+!O.matches(options::OPT_fdiagnostics_color) &&
+!O.matches(options::OPT_fno_color_diagnostics) &&
+!O.matches(options::OPT_fno_diagnostics_color) &&
+!O.matches(options::OPT_fdiagnostics_color_EQ))
+  continue;
+
+if (O.matches(options::OPT_fcolor_diagnostics) ||
+O.matches(options::OPT_fdiagnostics_color)) {
+  ShowColors = Colors_On;
+} else if (O.matches(options::OPT_fno_color_diagnostics) ||
+   O.matches(options::OPT_fno_diagnostics_color)) {
+  ShowColors = Colors_Off;
+} else {
+  assert(O.matches(options::OPT_fdiagnostics_color_EQ));
+  StringRef Value(Arg->getValue());
+  if (Value == "always")
+ShowColors = Colors_On;
+  else if (Value == "auto")
+ShowColors = Colors_Auto;
+  

Re: [PATCH] D20401: [Lexer] Don't merge macro args from different macro files

2016-05-18 Thread Vedant Kumar via cfe-commits
vsk updated this revision to Diff 57711.
vsk added a comment.

- Add some comments to the unit test.


http://reviews.llvm.org/D20401

Files:
  lib/Lex/TokenLexer.cpp
  test/CoverageMapping/Inputs/macros.h
  test/CoverageMapping/include-macros.c
  unittests/Lex/LexerTest.cpp

Index: unittests/Lex/LexerTest.cpp
===
--- unittests/Lex/LexerTest.cpp
+++ unittests/Lex/LexerTest.cpp
@@ -58,8 +58,7 @@
 Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
   }
 
-  std::vector CheckLex(StringRef Source,
-  ArrayRef ExpectedTokens) {
+  std::vector Lex(StringRef Source) {
 std::unique_ptr Buf =
 llvm::MemoryBuffer::getMemBuffer(Source);
 SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(Buf)));
@@ -82,6 +81,12 @@
   toks.push_back(tok);
 }
 
+return toks;
+  }
+
+  std::vector CheckLex(StringRef Source,
+  ArrayRef ExpectedTokens) {
+auto toks = Lex(Source);
 EXPECT_EQ(ExpectedTokens.size(), toks.size());
 for (unsigned i = 0, e = ExpectedTokens.size(); i != e; ++i) {
   EXPECT_EQ(ExpectedTokens[i], toks[i].getKind());
@@ -358,4 +363,21 @@
   EXPECT_EQ("N", Lexer::getImmediateMacroName(idLoc4, SourceMgr, LangOpts));
 }
 
+TEST_F(LexerTest, DontMergeMacroArgsFromDifferentMacroFiles) {
+  std::vector toks =
+  Lex("#define helper1 0\n"
+  "void helper2(const char *, ...);\n"
+  "#define M1(a, ...) helper2(a, ##__VA_ARGS__)\n"
+  "#define M2(a, ...) M1(a, helper1, ##__VA_ARGS__)\n"
+  "void f1() { M2(\"a\", \"b\"); }");
+
+  // Check the file corresponding to the "helper1" macro arg in M2.
+  //
+  // The lexer used to report its size as 31, meaning that the end of the
+  // expansion would be on the *next line* (just past `M2("a", "b")`). Make
+  // sure that we get the correct end location (the comma after "helper1").
+  SourceLocation helper1ArgLoc = toks[20].getLocation();
+  EXPECT_EQ(SourceMgr.getFileIDSize(SourceMgr.getFileID(helper1ArgLoc)), 8U);
+}
+
 } // anonymous namespace
Index: test/CoverageMapping/include-macros.c
===
--- /dev/null
+++ test/CoverageMapping/include-macros.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name include-macros.c %s | FileCheck %s
+
+#include "Inputs/macros.h"
+
+void f1() {
+  M2("a", "b");
+}
+
+// CHECK-LABEL: f1:
+// CHECK-NEXT:   File 0, 5:11 -> 7:2 = #0
+// CHECK-NEXT:   Expansion,File 0, 6:3 -> 6:5 = #0 (Expanded file = 1)
+// CHECK-NEXT:   File 1, 13:20 -> 13:50 = #0
+// CHECK-NEXT:   Expansion,File 1, 13:20 -> 13:22 = #0 (Expanded file = 2)
+// CHECK-NEXT:   File 2, 7:20 -> 7:46 = #0
+// CHECK-NEXT:   Expansion,File 2, 7:33 -> 7:44 = #0 (Expanded file = 3)
+// CHECK-NEXT:   File 3, 13:26 -> 13:34 = #0
+// CHECK-NEXT:   Expansion,File 3, 13:26 -> 13:33 = #0 (Expanded file = 4)
+// CHECK-NEXT:   File 4, 3:17 -> 3:18 = #0
Index: test/CoverageMapping/Inputs/macros.h
===
--- /dev/null
+++ test/CoverageMapping/Inputs/macros.h
@@ -0,0 +1,13 @@
+// Assorted macros to help test #include behavior across file boundaries.
+
+#define helper1 0
+
+void helper2(const char *, ...);
+
+#define M1(a, ...) helper2(a, ##__VA_ARGS__);
+
+// Important: The line number on which M2 is defined must be greater than the
+// line number on which one of the expansions of M2 occurs. This is done to
+// test support for regions which start in a header and end in the file which
+// contains the expansion.
+#define M2(a, ...) M1(a, helper1, ##__VA_ARGS__);
Index: lib/Lex/TokenLexer.cpp
===
--- lib/Lex/TokenLexer.cpp
+++ lib/Lex/TokenLexer.cpp
@@ -787,6 +787,9 @@
 if (CurLoc.isFileID() != NextLoc.isFileID())
   break; // Token from different kind of FileID.
 
+if (CurLoc.isMacroID() && !SM.isWrittenInSameFile(CurLoc, NextLoc))
+  break; // Token from a different macro.
+
 int RelOffs;
 if (!SM.isInSameSLocAddrSpace(CurLoc, NextLoc, ))
   break; // Token from different local/loaded location.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r269998 - Cleanup superfluous std:: qualifiers in

2016-05-18 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed May 18 18:09:24 2016
New Revision: 269998

URL: http://llvm.org/viewvc/llvm-project?rev=269998=rev
Log:
Cleanup superfluous std:: qualifiers in 

Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=269998=269997=269998=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed May 18 18:09:24 2016
@@ -1008,8 +1008,8 @@ struct __is_referenceable_impl {
 };
 
 template 
-struct __is_referenceable : std::integral_constant(0)), 
__two>::value> {};
+struct __is_referenceable : integral_constant(0)), __two>::value> 
{};
 
 
 // add_const
@@ -2177,7 +2177,7 @@ move(_Tp&& __t) _NOEXCEPT
 template 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp&&
-forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
+forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT
 {
 return static_cast<_Tp&&>(__t);
 }
@@ -2185,9 +2185,9 @@ forward(typename std::remove_reference<_
 template 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
 _Tp&&
-forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT
+forward(typename remove_reference<_Tp>::type&& __t) _NOEXCEPT
 {
-static_assert(!std::is_lvalue_reference<_Tp>::value,
+static_assert(!is_lvalue_reference<_Tp>::value,
   "Can not forward an rvalue as an lvalue.");
 return static_cast<_Tp&&>(__t);
 }
@@ -2213,7 +2213,7 @@ move(const _Tp& __t)
 template 
 inline _LIBCPP_INLINE_VISIBILITY
 _Tp&
-forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT
+forward(typename remove_reference<_Tp>::type& __t) _NOEXCEPT
 {
 return __t;
 }
@@ -4568,7 +4568,7 @@ struct underlying_type
 #endif // _LIBCPP_UNDERLYING_TYPE
 
 
-template ::value>
+template ::value>
 struct __sfinae_underlying_type
 {
 typedef typename underlying_type<_Tp>::type type;


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


Re: r269910 - Update for llvm change.

2016-05-18 Thread Sean Silva via cfe-commits
On Wed, May 18, 2016 at 4:58 AM, Rafael Espindola via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rafael
> Date: Wed May 18 06:58:56 2016
> New Revision: 269910
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269910=rev
> Log:
> Update for llvm change.
>
> Modified:
> cfe/trunk/lib/Parse/ParseStmtAsm.cpp
> cfe/trunk/tools/driver/cc1as_main.cpp
>
> Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=269910=269909=269910=diff
>
> ==
> --- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Wed May 18 06:58:56 2016
> @@ -572,8 +572,8 @@ StmtResult Parser::ParseMicrosoftAsmStat
>
>llvm::SourceMgr TempSrcMgr;
>llvm::MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), );
> -  MOFI->InitMCObjectFileInfo(TheTriple, llvm::Reloc::Default,
> - llvm::CodeModel::Default, Ctx);
> +  MOFI->InitMCObjectFileInfo(TheTriple, /*PIG*/ false,
> llvm::CodeModel::Default,
>

Did you mean "PIC" here insted of PIG?

-- Sean Silva


> + Ctx);
>std::unique_ptr Buffer =
>llvm::MemoryBuffer::getMemBuffer(AsmString, "");
>
>
> Modified: cfe/trunk/tools/driver/cc1as_main.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=269910=269909=269910=diff
>
> ==
> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)
> +++ cfe/trunk/tools/driver/cc1as_main.cpp Wed May 18 06:58:56 2016
> @@ -326,19 +326,18 @@ static bool ExecuteAssembler(AssemblerIn
>
>MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), );
>
> -  llvm::Reloc::Model RM = llvm::Reloc::Default;
> +  bool PIC = false;
>if (Opts.RelocationModel == "static") {
> -RM = llvm::Reloc::Static;
> +PIC = false;
>} else if (Opts.RelocationModel == "pic") {
> -RM = llvm::Reloc::PIC_;
> +PIC = true;
>} else {
>  assert(Opts.RelocationModel == "dynamic-no-pic" &&
> "Invalid PIC model!");
> -RM = llvm::Reloc::DynamicNoPIC;
> +PIC = false;
>}
>
> -  MOFI->InitMCObjectFileInfo(Triple(Opts.Triple), RM,
> - CodeModel::Default, Ctx);
> +  MOFI->InitMCObjectFileInfo(Triple(Opts.Triple), PIC,
> CodeModel::Default, Ctx);
>if (Opts.SaveTemporaryLabels)
>  Ctx.setAllowTemporaryLabels(false);
>if (Opts.GenDwarfForAssembly)
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20325: Add ARM cdp intrinsics

2016-05-18 Thread Ranjeet Singh via cfe-commits
rs added a comment.

> http://reviews.llvm.org/D20394 which adds a test for the intrinsic in llvm


Wrong link, should be http://reviews.llvm.org/D20393


Repository:
  rL LLVM

http://reviews.llvm.org/D20325



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


Re: [PATCH] D20325: Add ARM cdp intrinsics

2016-05-18 Thread Ranjeet Singh via cfe-commits
rs added a comment.

Hi Renato,

I've created 2 new reviews for this work http://reviews.llvm.org/D20394 which 
adds a test for the intrinsic in llvm and http://reviews.llvm.org/D20394 which 
fixes the builtin signature for the cdp intrinsic.

Thanks,
Ranjeet


Repository:
  rL LLVM

http://reviews.llvm.org/D20325



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


[PATCH] D20394: Fix cdp intrinsic

2016-05-18 Thread Ranjeet Singh via cfe-commits
rs created this revision.
rs added a reviewer: rengolin.
rs added a subscriber: cfe-commits.

Fixed cdp intrinsic to only accept compile time constant values, previously you 
could pass in a variable to the builtin which would result in illegal llvm 
assembly output.

http://reviews.llvm.org/D20394

Files:
  include/clang/Basic/BuiltinsARM.def
  test/CodeGen/builtins-arm.c
  test/Sema/builtins-arm.c

Index: test/Sema/builtins-arm.c
===
--- test/Sema/builtins-arm.c
+++ test/Sema/builtins-arm.c
@@ -48,6 +48,18 @@
 }
 
 void test6(int a, int b, int c) {
+  __builtin_arm_cdp(a, 2, 3, 4, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, a, 3, 4, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, 2, a, 4, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, 2, 3, a, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, 2, 3, 4, 5, a); // expected-error {{argument to 
'__builtin_arm_cdp' must be a constant integer}}
+
+  __builtin_arm_cdp2(a, 2, 3, 4, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, a, 3, 4, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, 2, a, 4, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, 2, 3, a, 5, 6); // expected-error {{argument to 
'__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, 2, 3, 4, 5, a); // expected-error {{argument to 
'__builtin_arm_cdp2' must be a constant integer}}
+
   __builtin_arm_mrc( a, 0, 13, 0, 3); // expected-error {{argument to 
'__builtin_arm_mrc' must be a constant integer}}
   __builtin_arm_mrc(15, a, 13, 0, 3); // expected-error {{argument to 
'__builtin_arm_mrc' must be a constant integer}}
   __builtin_arm_mrc(15, 0,  a, 0, 3); // expected-error {{argument to 
'__builtin_arm_mrc' must be a constant integer}}
Index: test/CodeGen/builtins-arm.c
===
--- test/CodeGen/builtins-arm.c
+++ test/CodeGen/builtins-arm.c
@@ -84,6 +84,20 @@
 // CHECK: call {{.*}} @llvm.prefetch(i8* %{{.*}}, i32 1, i32 3, i32 0)
 }
 
+void cdp() {
+  // CHECK: define void @cdp()
+  // CHECK: call void @llvm.arm.cdp(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6)
+  // CHECK-NEXT: ret void
+  __builtin_arm_cdp(1, 2, 3, 4, 5, 6);
+}
+
+void cdp2() {
+  // CHECK: define void @cdp2()
+  // CHECK: call void @llvm.arm.cdp2(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6)
+  // CHECK-NEXT: ret void
+  __builtin_arm_cdp2(1, 2, 3, 4, 5, 6);
+}
+
 unsigned mrc() {
   // CHECK: define i32 @mrc()
   // CHECK: [[R:%.*]] = call i32 @llvm.arm.mrc(i32 15, i32 0, i32 13, i32 0, 
i32 3)
Index: include/clang/Basic/BuiltinsARM.def
===
--- include/clang/Basic/BuiltinsARM.def
+++ include/clang/Basic/BuiltinsARM.def
@@ -52,8 +52,8 @@
 BUILTIN(__builtin_arm_mcr2, "vUIiUIiUiUIiUIiUIi", "")
 BUILTIN(__builtin_arm_mrc, "UiUIiUIiUIiUIiUIi", "")
 BUILTIN(__builtin_arm_mrc2, "UiUIiUIiUIiUIiUIi", "")
-BUILTIN(__builtin_arm_cdp, "vUiUiUiUiUiUi", "")
-BUILTIN(__builtin_arm_cdp2, "vUiUiUiUiUiUi", "")
+BUILTIN(__builtin_arm_cdp, "vUIiUIiUIiUIiUIiUIi", "")
+BUILTIN(__builtin_arm_cdp2, "vUIiUIiUIiUIiUIiUIi", "")
 BUILTIN(__builtin_arm_mcrr, "vUIiUIiUiUiUIi", "")
 BUILTIN(__builtin_arm_mcrr2, "vUIiUIiUiUiUIi", "")
 


Index: test/Sema/builtins-arm.c
===
--- test/Sema/builtins-arm.c
+++ test/Sema/builtins-arm.c
@@ -48,6 +48,18 @@
 }
 
 void test6(int a, int b, int c) {
+  __builtin_arm_cdp(a, 2, 3, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, a, 3, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, 2, a, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, 2, 3, a, 5, 6); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
+  __builtin_arm_cdp(1, 2, 3, 4, 5, a); // expected-error {{argument to '__builtin_arm_cdp' must be a constant integer}}
+
+  __builtin_arm_cdp2(a, 2, 3, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, a, 3, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, 2, a, 4, 5, 6); // expected-error {{argument to '__builtin_arm_cdp2' must be a constant integer}}
+  __builtin_arm_cdp2(1, 2, 3, a, 5, 6); // expected-error {{argument to '__builtin_arm_cdp2' must be a 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-18 Thread Eric Niebler via cfe-commits
eric_niebler marked 2 inline comments as done.
eric_niebler added a comment.

Thanks for the feedback, @curdeius. What happens now? Do I just wait until 
somebody accepts the llvm diff and this one? How do I increase the likelihood 
that that happens?


http://reviews.llvm.org/D19843



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


[libcxx] r269991 - Optimize declval for compile times. Patch from Eric Niebler.

2016-05-18 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed May 18 17:23:46 2016
New Revision: 269991

URL: http://llvm.org/viewvc/llvm-project?rev=269991=rev
Log:
Optimize declval for compile times. Patch from Eric Niebler.

This patch implements the C++11 version of declval without requiring a template
instantiation.

See PR27798 for more information. https://llvm.org/bugs/show_bug.cgi?id=27798

Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=269991=269990=269991=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed May 18 17:23:46 2016
@@ -1095,8 +1095,11 @@ template  using add_rvalue_re
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
+template  _Tp&& __declval(int);
+template  _Tp   __declval(long);
+
 template 
-typename add_rvalue_reference<_Tp>::type
+decltype(_VSTD::__declval<_Tp>(0))
 declval() _NOEXCEPT;
 
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES


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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-18 Thread don hinton via cfe-commits
hintonda updated this revision to Diff 57686.
hintonda added a comment.

Improved matcher logic and add better range handling to try to deal
with multiple asserts concerning bad ranges when running checker again
real code, e.g., libcxx.

Even so, still seeing some asserts in Lexer::getSourceLocation(), e.g.:

Assertion failed: (Loc >= BufferStart && Loc <= BufferEnd &&
 "Location out of range for this buffer!"), function
 getSourceLocation, file
 /Users/dhinton/projects/clang/llvm/tools/clang/lib/Lex/Lexer.cpp, l
 ine 1073.

in a call to Sources.isBeforeInTranslationUnit(Range.getEnd(),
Tok.getLocation()) in parseDeclTokens().

Looks like my matcher is returning stuff that doesn't parse correctly.
Investigating.


http://reviews.llvm.org/D18575

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNoexceptCheck.cpp
  clang-tidy/modernize/UseNoexceptCheck.h
  clang-tidy/modernize/UseOverrideCheck.cpp
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/modernize-use-noexcept.rst
  test/clang-tidy/modernize-use-noexcept-macro.cpp
  test/clang-tidy/modernize-use-noexcept.cpp

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,43 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+void baz(int = (throw A(), 0)) throw(A, B) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'baz' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {}
+
+void f(void (*fp)(void) throw()) throw(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept]
+// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false);
+
+void g(void (*fp)(void) throw());
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'g' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);
+
+void j() throw(int(int) throw(void(void) throw(int)));
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'j' uses dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept]
+// CHECK-FIXES: void j() noexcept(false);
+
+void k() throw(int(int));
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'k' uses dynamic exception specification 'throw(int(int))' [modernize-use-noexcept]
+// CHECK-FIXES: void k() noexcept(false);
+
+// Should not trigger a replacement.
+void titi() noexcept {}
+void toto() noexcept(true) {}
Index: test/clang-tidy/modernize-use-noexcept-macro.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept-macro.cpp
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \
+// RUN:   -- -std=c++11
+
+// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. 
+#if (__has_feature(cxx_noexcept))
+#define NOEXCEPT noexcept
+#else
+#define NOEXCEPT throw()
+#endif
+
+void bar() throw() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() NOEXCEPT {}
+
+// Should not trigger a FixItHint, since macros only support noexcept, and this
+// case throws.
+class A {};
+class B {};
+void foobar() throw(A, B);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+
+// Should not trigger a replacement.
+void foo() noexcept(true);
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -0,0 +1,55 @@
+.. title:: clang-tidy - modernize-use-noexcept
+

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

2016-05-18 Thread Warren Ristow via cfe-commits
wristow added a comment.

In http://reviews.llvm.org/D20243#433615, @thakis wrote:

> Did you see http://reviews.llvm.org/D19815 ? Does that help? Warren might 
> have opinions on this.


Yes, these are definitely related.  Fixing that other problem does //not //also 
fix the issue here, however the fix here will only work if that other fix is 
also applied.

In my view, that other issue is a fairly overt bug (PR24387) where `#pragma 
once` is blatantly ignored in a header-file processed for creating a PCH.  That 
can result in incorrect behavior, and always results in a misleading/confusing 
warning.  That issue also is independent of the host environment.

Whereas the timestamp issue described here is much more subtle, and it only 
impacts Windows hosts (due to some problem with the timestamps on the Windows 
file system).

Essentially, the proposed fix here is blocked by that other issue.  I should 
have realized and commented here earlier.  Thanks for bringing it to my 
attention.


http://reviews.llvm.org/D20243



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


r269989 - Update for llvm change.

2016-05-18 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Wed May 18 17:04:57 2016
New Revision: 269989

URL: http://llvm.org/viewvc/llvm-project?rev=269989=rev
Log:
Update for llvm change.

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=269989=269988=269989=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed May 18 17:04:57 2016
@@ -528,7 +528,7 @@ TargetMachine *EmitAssemblyHelper::Creat
   llvm::join(TargetOpts.Features.begin(), TargetOpts.Features.end(), ",");
 
   // Keep this synced with the equivalent code in tools/driver/cc1as_main.cpp.
-  llvm::Reloc::Model RM = llvm::Reloc::Default;
+  llvm::Optional RM;
   if (CodeGenOpts.RelocationModel == "static") {
 RM = llvm::Reloc::Static;
   } else if (CodeGenOpts.RelocationModel == "pic") {

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=269989=269988=269989=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed May 18 17:04:57 2016
@@ -3609,8 +3609,6 @@ ParsePICArgs(const ToolChain ,
 
 static const char *RelocationModelName(llvm::Reloc::Model Model) {
   switch (Model) {
-  case llvm::Reloc::Default:
-return nullptr;
   case llvm::Reloc::Static:
 return "static";
   case llvm::Reloc::PIC_:


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


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

2016-05-18 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis.
thakis added a comment.

Did you see http://reviews.llvm.org/D19815 ? Does that help? Warren might have 
opinions on this.


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] D20243: [PCH] Disable inclusion of timestamps when generating pch files on windows.

2016-05-18 Thread Cameron via cfe-commits
cameron314 added a subscriber: cameron314.
cameron314 added a comment.

I've seen rare cases where parses using the PCH files were yielding completely 
invalid data, almost as if they were corrupted. I wonder now if this could be 
the cause. (We're on Windows too.)


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] D20243: [PCH] Disable inclusion of timestamps when generating pch files on windows.

2016-05-18 Thread Paul Robinson via cfe-commits
probinson added a comment.

This is fine as far as I'm concerned, but I think somebody more familiar with 
the area ought to chime in.


http://reviews.llvm.org/D20243



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


[PATCH] D20383: PCH + Module: make sure we write out macros associated with builtin identifiers

2016-05-18 Thread Manman Ren via cfe-commits
manmanren created this revision.
manmanren added reviewers: benlangmuir, rsmith.
manmanren added a subscriber: cfe-commits.

When we import a module that defines a builtin identifier from prefix header 
and precompile the prefix header, the macro information related to the 
identifier is lost.
If we don't precompile the prefix header, the source file can still see the 
macro information.
The reason is that we write out the identifier in the pch but not the macro 
information since the macro is not defined locally.

This seems to be related to r251565: If we read a builtin identifier from a 
module that wasn't "interesting" to that module, we will still write it out to 
a PCH that imports that module.

The fix proposed here is to write exported module macros for PCH as well. I am 
open to other suggestions.

http://reviews.llvm.org/D20383

Files:
  lib/Serialization/ASTWriter.cpp
  test/Modules/Inputs/MacroFabs1.h
  test/Modules/Inputs/module.map
  test/Modules/Inputs/pch-import-module-with-macro.pch
  test/Modules/pch-module-macro.m

Index: test/Modules/pch-module-macro.m
===
--- test/Modules/pch-module-macro.m
+++ test/Modules/pch-module-macro.m
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t -fmodules 
-fimplicit-module-maps -o %t.pch -I %S/Inputs -x objective-c-header 
%S/Inputs/pch-import-module-with-macro.pch
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps 
-fsyntax-only -I %S/Inputs -include-pch %t.pch %s -verify
+// expected-no-diagnostics
+
+int test(int x) {
+  return my_fabs(x) + fabs(x);
+}
+
Index: test/Modules/Inputs/pch-import-module-with-macro.pch
===
--- test/Modules/Inputs/pch-import-module-with-macro.pch
+++ test/Modules/Inputs/pch-import-module-with-macro.pch
@@ -0,0 +1,3 @@
+
+@import MacroFabs1;
+
Index: test/Modules/Inputs/module.map
===
--- test/Modules/Inputs/module.map
+++ test/Modules/Inputs/module.map
@@ -414,3 +414,7 @@
 }
 
 module Empty {}
+
+module MacroFabs1 {
+  header "MacroFabs1.h"
+}
Index: test/Modules/Inputs/MacroFabs1.h
===
--- test/Modules/Inputs/MacroFabs1.h
+++ test/Modules/Inputs/MacroFabs1.h
@@ -0,0 +1,6 @@
+
+#undef fabs
+#define fabs(x) (x)
+
+#undef my_fabs
+#define my_fabs(x) (x)
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -2187,7 +2187,8 @@
 
 // Write out any exported module macros.
 bool EmittedModuleMacros = false;
-if (IsModule) {
+// We write out exported module macros for PCH as well.
+if (true) {
   auto Leafs = PP.getLeafModuleMacros(Name);
   SmallVector Worklist(Leafs.begin(), Leafs.end());
   llvm::DenseMap Visits;


Index: test/Modules/pch-module-macro.m
===
--- test/Modules/pch-module-macro.m
+++ test/Modules/pch-module-macro.m
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -o %t.pch -I %S/Inputs -x objective-c-header %S/Inputs/pch-import-module-with-macro.pch
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fsyntax-only -I %S/Inputs -include-pch %t.pch %s -verify
+// expected-no-diagnostics
+
+int test(int x) {
+  return my_fabs(x) + fabs(x);
+}
+
Index: test/Modules/Inputs/pch-import-module-with-macro.pch
===
--- test/Modules/Inputs/pch-import-module-with-macro.pch
+++ test/Modules/Inputs/pch-import-module-with-macro.pch
@@ -0,0 +1,3 @@
+
+@import MacroFabs1;
+
Index: test/Modules/Inputs/module.map
===
--- test/Modules/Inputs/module.map
+++ test/Modules/Inputs/module.map
@@ -414,3 +414,7 @@
 }
 
 module Empty {}
+
+module MacroFabs1 {
+  header "MacroFabs1.h"
+}
Index: test/Modules/Inputs/MacroFabs1.h
===
--- test/Modules/Inputs/MacroFabs1.h
+++ test/Modules/Inputs/MacroFabs1.h
@@ -0,0 +1,6 @@
+
+#undef fabs
+#define fabs(x) (x)
+
+#undef my_fabs
+#define my_fabs(x) (x)
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -2187,7 +2187,8 @@
 
 // Write out any exported module macros.
 bool EmittedModuleMacros = false;
-if (IsModule) {
+// We write out exported module macros for PCH as well.
+if (true) {
   auto Leafs = PP.getLeafModuleMacros(Name);
   SmallVector Worklist(Leafs.begin(), 

Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=,*this]")

2016-05-18 Thread Faisal Vali via cfe-commits
OK - thanks -  will take a closer look at this hopefuly this evening
or tomorrow - and respond to Richard's other comments too.
Faisal Vali



On Wed, May 18, 2016 at 1:46 PM, Taewook Oh  wrote:
> twoh added a comment.
>
> My patch passes check-clang and the test cases in this patch as well.
>
> BTW, newly added test cases in the patch seem to be passed even without the 
> patch. Isn't the bug appears when template instantiation generates nested 
> lambdas (because template instantiation updates the 'context')?
>
>
> http://reviews.llvm.org/D19783
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20382: Add postorder support to RecursiveASTVisitor

2016-05-18 Thread Raphael Isemann via cfe-commits
teemperor added a comment.

The motivation for this patch is a hashing algorithm for all AST nodes
which reuses child hash values to be O(n) and therefore needs postorder support
(think Java's Object.hashCode() but on AST nodes as an example).

The full code that currently uses this feature can be seen here:
https://github.com/Teemperor/clang/commit/9fdb10a8a910968a795cdd48e1271fe2140fcd2f


http://reviews.llvm.org/D20382



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


[PATCH] D20382: Add postorder support to RecursiveASTVisitor

2016-05-18 Thread Raphael Isemann via cfe-commits
teemperor created this revision.
teemperor added reviewers: zaks.anna, v.g.vassilev, doug.gregor, chandlerc.
teemperor added a subscriber: cfe-commits.

This patch adds postorder traversal support to the RecursiveASTVisitor.

This feature needs to be explicitly enabled by overriding 
shouldTraversePostOrder()
as it has performance drawbacks for the iterative Stmt-traversal.

http://reviews.llvm.org/D20382

Files:
  include/clang/AST/RecursiveASTVisitor.h
  unittests/AST/CMakeLists.txt
  unittests/AST/PostOrderASTVisitor.cpp

Index: unittests/AST/PostOrderASTVisitor.cpp
===
--- /dev/null
+++ unittests/AST/PostOrderASTVisitor.cpp
@@ -0,0 +1,112 @@
+//===- unittests/AST/PostOrderASTVisitor.cpp - Declaration printer tests --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file contains tests for the post-order traversing functionality
+// of RecursiveASTVisitor.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Tooling/Tooling.h"
+
+using namespace clang;
+
+namespace {
+
+  class RecordingVisitor
+: public RecursiveASTVisitor {
+
+bool VisitPostOrder;
+  public:
+explicit RecordingVisitor(bool VisitPostOrder)
+  : VisitPostOrder(VisitPostOrder) {
+}
+
+// List of visited nodes during traversal.
+std::vector VisitedNodes;
+
+bool shouldTraversePostOrder() const { return VisitPostOrder; }
+
+bool PostVisitBinaryOperator(BinaryOperator *Op) {
+  VisitedNodes.push_back(Op->getOpcodeStr());
+  return true;
+}
+
+bool PostVisitIntegerLiteral(IntegerLiteral *Lit) {
+  VisitedNodes.push_back(Lit->getValue().toString(10, false));
+  return true;
+}
+
+bool PostVisitCXXMethodDecl(CXXMethodDecl *D) {
+  VisitedNodes.push_back(D->getQualifiedNameAsString());
+  return true;
+}
+
+bool PostVisitReturnStmt(Stmt *S) {
+  VisitedNodes.push_back("return");
+  return true;
+}
+
+bool PostVisitCXXRecordDecl(CXXRecordDecl *Declaration) {
+  VisitedNodes.push_back(Declaration->getQualifiedNameAsString());
+  return true;
+}
+
+bool PostVisitTemplateTypeParmType(TemplateTypeParmType *T) {
+  VisitedNodes.push_back(T->getDecl()->getQualifiedNameAsString());
+  return true;
+}
+  };
+
+}
+
+TEST(RecursiveASTVisitor, PostOrderTraversal) {
+  auto ASTUnit = tooling::buildASTFromCode(
+"template  class A {"
+"  class B {"
+"int foo() { return 1 + 2; }"
+"  };"
+"};"
+  );
+  auto TU = ASTUnit->getASTContext().getTranslationUnitDecl();
+  // We traverse the translation unit and store all
+  // visited nodes.
+  RecordingVisitor Visitor(true);
+  Visitor.TraverseTranslationUnitDecl(TU);
+
+  std::vector expected = {
+"1", "2", "+", "return", "A::B::foo", "A::B", "A", "A::T"
+  };
+  // Compare the list of actually visited nodes
+  // with the expected list of visited nodes.
+  ASSERT_EQ(expected.size(), Visitor.VisitedNodes.size());
+  for (std::size_t I = 0; I < expected.size(); I++) {
+ASSERT_EQ(expected[I], Visitor.VisitedNodes[I]);
+  }
+}
+
+TEST(RecursiveASTVisitor, DeactivatePostOrderTraversal) {
+  auto ASTUnit = tooling::buildASTFromCode(
+"template  class A {"
+"  class B {"
+"int foo() { return 1 + 2; }"
+"  };"
+"};"
+  );
+  auto TU = ASTUnit->getASTContext().getTranslationUnitDecl();
+  // We try to traverse the translation unit but with deactivated
+  // post order calls.
+  RecordingVisitor Visitor(false);
+  Visitor.TraverseTranslationUnitDecl(TU);
+
+  // We deactivated postorder traversal, so we shouldn't have
+  // recorded any nodes.
+  ASSERT_TRUE(Visitor.VisitedNodes.empty());
+}
Index: unittests/AST/CMakeLists.txt
===
--- unittests/AST/CMakeLists.txt
+++ unittests/AST/CMakeLists.txt
@@ -14,6 +14,7 @@
   EvaluateAsRValueTest.cpp
   ExternalASTSourceTest.cpp
   NamedDeclPrinterTest.cpp
+  PostOrderASTVisitor.cpp
   SourceLocationTest.cpp
   StmtPrinterTest.cpp
   )
Index: include/clang/AST/RecursiveASTVisitor.h
===
--- include/clang/AST/RecursiveASTVisitor.h
+++ include/clang/AST/RecursiveASTVisitor.h
@@ -72,8 +72,8 @@
   return false;\
   } while (0)
 
-/// \brief A class that does preorder depth-first traversal on the
-/// entire Clang AST and visits each node.
+/// \brief A class that does preorder (and optional postorder)
+/// depth-first traversal on the entire Clang AST and visits each node.
 ///
 /// This class performs 

[libcxx] r269973 - Mark LWG2583 as complete. I did this a while ago, and forgot to update the table.

2016-05-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed May 18 14:31:01 2016
New Revision: 269973

URL: http://llvm.org/viewvc/llvm-project?rev=269973=rev
Log:
Mark LWG2583 as complete. I did this a while ago, and forgot to update the 
table.

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=269973=269972=269973=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Wed May 18 14:31:01 2016
@@ -227,7 +227,7 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2579;>2579Inconsistency
 wrt Allocators in basic_string assignment vs. 
basic_string::assignJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2581;>2581Specialization
 of type_traits variable templates should be 
prohibitedJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2582;>2582[res.on.functions]/2's
 prohibition against incomplete types shouldn't apply to type 
traitsJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2583;>2583There
 is no way to supply an allocator for basic_string(str, 
pos)Jacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2583;>2583There
 is no way to supply an allocator for basic_string(str, 
pos)JacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2585;>2585forward_list::resize(size_type,
 const value_type) effects 
incorrectJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2586;>2586Wrong
 value category used in 
scoped_allocator_adaptor::construct()Jacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2590;>2590Aggregate
 initialization for 
std::arrayJacksonvilleComplete
@@ -238,7 +238,7 @@
 
   
 
-  Last Updated: 14-Mar-2016
+  Last Updated: 18-May-2016
 
 
 


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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-18 Thread Marek Kurdej via cfe-commits
curdeius added a comment.

Nice job! Thanks for taking my remarks into account.



Comment at: include/clang/Basic/VirtualFileSystem.h:14


Oops, my fault. 


http://reviews.llvm.org/D19843



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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Taewook Oh via cfe-commits
twoh added a comment.

My patch passes check-clang and the test cases in this patch as well.

BTW, newly added test cases in the patch seem to be passed even without the 
patch. Isn't the bug appears when template instantiation generates nested 
lambdas (because template instantiation updates the 'context')?


http://reviews.llvm.org/D19783



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-18 Thread Eric Niebler via cfe-commits
eric_niebler updated this revision to Diff 57657.
eric_niebler added a comment.

Factor out TrySimplifyPath from Preprocessor::HandleIncludeDirective. Other 
review feedback.


http://reviews.llvm.org/D19843

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticLexKinds.td
  include/clang/Basic/FileManager.h
  include/clang/Basic/VirtualFileSystem.h
  include/clang/Lex/DirectoryLookup.h
  include/clang/Lex/HeaderSearch.h
  lib/Basic/FileManager.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPDirectives.cpp
  test/Lexer/Inputs/case-insensitive-include.h
  test/Lexer/case-insensitive-include.c
  test/PCH/case-insensitive-include.c

Index: test/PCH/case-insensitive-include.c
===
--- test/PCH/case-insensitive-include.c
+++ test/PCH/case-insensitive-include.c
@@ -2,7 +2,7 @@
 
 // Test this without pch.
 // RUN: cp %S/Inputs/case-insensitive-include.h %T
-// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %T -verify
 
 // Test with pch.
 // RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T
Index: test/Lexer/case-insensitive-include.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include.c
@@ -0,0 +1,42 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -DMS_COMPATIBILITY %s -include %s -I %T -verify
+
+#ifndef HEADER
+#define HEADER
+
+#include "case-insensitive-include.h"
+#include "Case-Insensitive-Include.h" // expected-warning {{Non-portable path}}
+
+#include "../Output/./case-insensitive-include.h"
+#include "../Output/./Case-Insensitive-Include.h" // expected-warning {{Non-portable path}}
+#include "../output/./case-insensitive-include.h" // expected-warning {{Non-portable path}}
+
+#include "apath/.././case-insensitive-include.h"
+#include "apath/.././Case-Insensitive-Include.h" // expected-warning {{Non-portable path}}
+#include "APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+
+#include "../Output/./apath/.././case-insensitive-include.h"
+#include "../Output/./APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+#include "../output/./apath/.././case-insensitive-include.h" // expected-warning {{Non-portable path}}
+
+#if MS_COMPATIBILITY
+#include "..\Output\.\case-insensitive-include.h"
+#include "..\Output\.\Case-Insensitive-Include.h" // expected-warning {{Non-portable path}}
+#include "..\output\.\case-insensitive-include.h" // expected-warning {{Non-portable path}}
+
+#include "apath\..\.\case-insensitive-include.h"
+#include "apath\..\.\Case-Insensitive-Include.h" // expected-warning {{Non-portable path}}
+#include "APath\..\.\case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+#endif
+
+#else
+
+#include "Case-Insensitive-Include.h" // expected-warning {{Non-portable path}}
+
+#endif
Index: test/Lexer/Inputs/case-insensitive-include.h
===
--- /dev/null
+++ test/Lexer/Inputs/case-insensitive-include.h
@@ -0,0 +1,5 @@
+#pragma once
+
+struct S {
+  int x;
+};
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -24,6 +24,9 @@
 #include "clang/Lex/ModuleLoader.h"
 #include "clang/Lex/Pragma.h"
 #include "llvm/ADT/APInt.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SaveAndRestore.h"
@@ -1497,6 +1500,40 @@
   ("@import " + PathString + ";").str());
 }
 
+namespace
+{
+  // Given a vector of path components and a string containing the real
+  // path to the file, build a properly-cased replacement in the vector,
+  // and return true if the replacement should be suggested.
+  bool TrySimplifyPath(SmallVectorImpl& Components,
+   StringRef RealPathName) {
+auto iRealPathComponent = llvm::sys::path::rbegin(RealPathName);
+auto iRealPathComponentEnd = llvm::sys::path::rend(RealPathName);
+int Cnt = 0;
+bool SuggestReplacement = false;
+for(auto& Component : llvm::reverse(Components)) {
+  if ("." == Component) {
+  } else if (".." == Component) {
+++Cnt;
+  } else if (Cnt) {
+--Cnt;
+  } else if (iRealPathComponent != iRealPathComponentEnd) {
+if (Component != *iRealPathComponent) {
+  // If these 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-05-18 Thread Eric Niebler via cfe-commits
eric_niebler added inline comments.


Comment at: include/clang/Basic/VirtualFileSystem.h:97
@@ +96,3 @@
+  return Status->getName();
+else
+  return Status.getError();

curdeius wrote:
> No else needed after return.
But then `Status` is not in scope.


http://reviews.llvm.org/D19843



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


r269970 - Revert r269967 (SSE2 builtin checks) due to failed buildbots

2016-05-18 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed May 18 13:22:20 2016
New Revision: 269970

URL: http://llvm.org/viewvc/llvm-project?rev=269970=rev
Log:
Revert r269967 (SSE2 builtin checks) due to failed buildbots

Modified:
cfe/trunk/test/CodeGen/sse2-builtins.c

Modified: cfe/trunk/test/CodeGen/sse2-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse2-builtins.c?rev=269970=269969=269970=diff
==
--- cfe/trunk/test/CodeGen/sse2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse2-builtins.c Wed May 18 13:22:20 2016
@@ -6,8 +6,6 @@
 
 #include 
 
-// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
-
 __m128i test_mm_add_epi8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_add_epi8
   // CHECK: add <16 x i8>
@@ -40,34 +38,31 @@ __m128d test_mm_add_pd(__m128d A, __m128
 
 __m128d test_mm_add_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_add_sd
-  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
-  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
   // CHECK: fadd double
-  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
   return _mm_add_sd(A, B);
 }
 
 __m128i test_mm_adds_epi8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epi8
-  // CHECK: call <16 x i8> @llvm.x86.sse2.padds.b(<16 x i8> %{{.*}}, <16 x i8> 
%{{.*}})
+  // CHECK: call <16 x i8> @llvm.x86.sse2.padds.b
   return _mm_adds_epi8(A, B);
 }
 
 __m128i test_mm_adds_epi16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epi16
-  // CHECK: call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %{{.*}}, <8 x i16> 
%{{.*}})
+  // CHECK: call <8 x i16> @llvm.x86.sse2.padds.w
   return _mm_adds_epi16(A, B);
 }
 
 __m128i test_mm_adds_epu8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epu8
-  // CHECK: call <16 x i8> @llvm.x86.sse2.paddus.b(<16 x i8> %{{.*}}, <16 x 
i8> %{{.*}})
+  // CHECK: call <16 x i8> @llvm.x86.sse2.paddus.b
   return _mm_adds_epu8(A, B);
 }
 
 __m128i test_mm_adds_epu16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epu16
-  // CHECK: call <8 x i16> @llvm.x86.sse2.paddus.w(<8 x i16> %{{.*}}, <8 x 
i16> %{{.*}})
+  // CHECK: call <8 x i16> @llvm.x86.sse2.paddus.w
   return _mm_adds_epu16(A, B);
 }
 
@@ -83,29 +78,15 @@ __m128i test_mm_and_si128(__m128i A, __m
   return _mm_and_si128(A, B);
 }
 
-__m128d test_mm_andnot_pd(__m128d A, __m128d B) {
-  // CHECK-LABEL: test_mm_andnot_pd
-  // CHECK: xor <4 x i32> %{{.*}}, 
-  // CHECK: and <4 x i32>
-  return _mm_andnot_pd(A, B);
-}
-
-__m128i test_mm_andnot_si128(__m128i A, __m128i B) {
-  // CHECK-LABEL: test_mm_andnot_si128
-  // CHECK: xor <2 x i64> %{{.*}}, 
-  // CHECK: and <2 x i64>
-  return _mm_andnot_si128(A, B);
-}
-
 __m128i test_mm_avg_epu8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_avg_epu8
-  // CHECK: call <16 x i8> @llvm.x86.sse2.pavg.b(<16 x i8> %{{.*}}, <16 x i8> 
%{{.*}})
+  // CHECK: call <16 x i8> @llvm.x86.sse2.pavg.b
   return _mm_avg_epu8(A, B);
 }
 
 __m128i test_mm_avg_epu16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_avg_epu16
-  // CHECK: call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %{{.*}}, <8 x i16> 
%{{.*}})
+  // CHECK: call <8 x i16> @llvm.x86.sse2.pavg.w
   return _mm_avg_epu16(A, B);
 }
 
@@ -166,10 +147,6 @@ __m128d test_mm_cmpge_pd(__m128d A, __m1
 __m128d test_mm_cmpge_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpge_sd
   // CHECK: call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}}, i8 2)
-  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
-  // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0
-  // CHECK: extractelement <2 x double> %{{.*}}, i32 1
-  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1
   return _mm_cmpge_sd(A, B);
 }
 
@@ -200,10 +177,6 @@ __m128d test_mm_cmpgt_pd(__m128d A, __m1
 __m128d test_mm_cmpgt_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpgt_sd
   // CHECK: call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}}, i8 1)
-  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
-  // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0
-  // CHECK: extractelement <2 x double> %{{.*}}, i32 1
-  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1
   return _mm_cmpgt_sd(A, B);
 }
 
@@ -335,73 +308,73 @@ __m128d test_mm_cmpunord_sd(__m128d A, _
 
 int test_mm_comieq_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_comieq_sd
-  // CHECK: call i32 @llvm.x86.sse2.comieq.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}})
+  // CHECK: call i32 @llvm.x86.sse2.comieq.sd
   return _mm_comieq_sd(A, B);
 }
 
 int test_mm_comige_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_comige_sd
-  // CHECK: call i32 @llvm.x86.sse2.comige.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}})
+  // CHECK: call i32 @llvm.x86.sse2.comige.sd
   return _mm_comige_sd(A, B);
 }
 
 int test_mm_comigt_sd(__m128d 

r269967 - [X86][SSE2] Sync with llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll

2016-05-18 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed May 18 13:12:34 2016
New Revision: 269967

URL: http://llvm.org/viewvc/llvm-project?rev=269967=rev
Log:
[X86][SSE2] Sync with llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll

Modified:
cfe/trunk/test/CodeGen/sse2-builtins.c

Modified: cfe/trunk/test/CodeGen/sse2-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse2-builtins.c?rev=269967=269966=269967=diff
==
--- cfe/trunk/test/CodeGen/sse2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse2-builtins.c Wed May 18 13:12:34 2016
@@ -6,6 +6,8 @@
 
 #include 
 
+// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/sse2-intrinsics-fast-isel.ll
+
 __m128i test_mm_add_epi8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_add_epi8
   // CHECK: add <16 x i8>
@@ -38,31 +40,34 @@ __m128d test_mm_add_pd(__m128d A, __m128
 
 __m128d test_mm_add_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_add_sd
+  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
+  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
   // CHECK: fadd double
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 0
   return _mm_add_sd(A, B);
 }
 
 __m128i test_mm_adds_epi8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epi8
-  // CHECK: call <16 x i8> @llvm.x86.sse2.padds.b
+  // CHECK: call <16 x i8> @llvm.x86.sse2.padds.b(<16 x i8> %{{.*}}, <16 x i8> 
%{{.*}})
   return _mm_adds_epi8(A, B);
 }
 
 __m128i test_mm_adds_epi16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epi16
-  // CHECK: call <8 x i16> @llvm.x86.sse2.padds.w
+  // CHECK: call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %{{.*}}, <8 x i16> 
%{{.*}})
   return _mm_adds_epi16(A, B);
 }
 
 __m128i test_mm_adds_epu8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epu8
-  // CHECK: call <16 x i8> @llvm.x86.sse2.paddus.b
+  // CHECK: call <16 x i8> @llvm.x86.sse2.paddus.b(<16 x i8> %{{.*}}, <16 x 
i8> %{{.*}})
   return _mm_adds_epu8(A, B);
 }
 
 __m128i test_mm_adds_epu16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_adds_epu16
-  // CHECK: call <8 x i16> @llvm.x86.sse2.paddus.w
+  // CHECK: call <8 x i16> @llvm.x86.sse2.paddus.w(<8 x i16> %{{.*}}, <8 x 
i16> %{{.*}})
   return _mm_adds_epu16(A, B);
 }
 
@@ -78,15 +83,29 @@ __m128i test_mm_and_si128(__m128i A, __m
   return _mm_and_si128(A, B);
 }
 
+__m128d test_mm_andnot_pd(__m128d A, __m128d B) {
+  // CHECK-LABEL: test_mm_andnot_pd
+  // CHECK: xor <4 x i32> %{{.*}}, 
+  // CHECK: and <4 x i32>
+  return _mm_andnot_pd(A, B);
+}
+
+__m128i test_mm_andnot_si128(__m128i A, __m128i B) {
+  // CHECK-LABEL: test_mm_andnot_si128
+  // CHECK: xor <2 x i64> %{{.*}}, 
+  // CHECK: and <2 x i64>
+  return _mm_andnot_si128(A, B);
+}
+
 __m128i test_mm_avg_epu8(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_avg_epu8
-  // CHECK: call <16 x i8> @llvm.x86.sse2.pavg.b
+  // CHECK: call <16 x i8> @llvm.x86.sse2.pavg.b(<16 x i8> %{{.*}}, <16 x i8> 
%{{.*}})
   return _mm_avg_epu8(A, B);
 }
 
 __m128i test_mm_avg_epu16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_avg_epu16
-  // CHECK: call <8 x i16> @llvm.x86.sse2.pavg.w
+  // CHECK: call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %{{.*}}, <8 x i16> 
%{{.*}})
   return _mm_avg_epu16(A, B);
 }
 
@@ -147,6 +166,10 @@ __m128d test_mm_cmpge_pd(__m128d A, __m1
 __m128d test_mm_cmpge_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpge_sd
   // CHECK: call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}}, i8 2)
+  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
+  // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0
+  // CHECK: extractelement <2 x double> %{{.*}}, i32 1
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1
   return _mm_cmpge_sd(A, B);
 }
 
@@ -177,6 +200,10 @@ __m128d test_mm_cmpgt_pd(__m128d A, __m1
 __m128d test_mm_cmpgt_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_cmpgt_sd
   // CHECK: call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}}, i8 1)
+  // CHECK: extractelement <2 x double> %{{.*}}, i32 0
+  // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0
+  // CHECK: extractelement <2 x double> %{{.*}}, i32 1
+  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1
   return _mm_cmpgt_sd(A, B);
 }
 
@@ -308,73 +335,73 @@ __m128d test_mm_cmpunord_sd(__m128d A, _
 
 int test_mm_comieq_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_comieq_sd
-  // CHECK: call i32 @llvm.x86.sse2.comieq.sd
+  // CHECK: call i32 @llvm.x86.sse2.comieq.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}})
   return _mm_comieq_sd(A, B);
 }
 
 int test_mm_comige_sd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_comige_sd
-  // CHECK: call i32 @llvm.x86.sse2.comige.sd
+  // CHECK: call i32 @llvm.x86.sse2.comige.sd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}})
   return _mm_comige_sd(A, B);
 }
 
 int 

r269968 - ObjectiveC Class Properties: warn if a class property accessor is mistakenly an

2016-05-18 Thread Manman Ren via cfe-commits
Author: mren
Date: Wed May 18 13:12:34 2016
New Revision: 269968

URL: http://llvm.org/viewvc/llvm-project?rev=269968=rev
Log:
ObjectiveC Class Properties: warn if a class property accessor is mistakenly an
instance method.

When diagnosing unimplemented class property, make sure we emit
a warning when we only see an instance method with the right selector.

Also warn when we only see a class method for an instance property.

rdar://26141719

Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/objc-class-property.m

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=269968=269967=269968=diff
==
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed May 18 13:12:34 2016
@@ -1763,19 +1763,23 @@ void Sema::DefaultSynthesizeProperties(S
   DefaultSynthesizeProperties(S, IC, IDecl);
 }
 
-static void DiagnoseUnimplementedAccessor(Sema ,
-  ObjCInterfaceDecl *PrimaryClass,
-  Selector Method,
-  ObjCImplDecl* IMPDecl,
-  ObjCContainerDecl *CDecl,
-  ObjCCategoryDecl *C,
-  ObjCPropertyDecl *Prop,
-  Sema::SelectorSet ) {
+static void DiagnoseUnimplementedAccessor(
+Sema , ObjCInterfaceDecl *PrimaryClass, Selector Method,
+ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, ObjCCategoryDecl *C,
+ObjCPropertyDecl *Prop,
+llvm::SmallPtrSet ) {
+  // Check to see if we have a corresponding selector in SMap and with the
+  // right method type.
+  auto I = std::find_if(SMap.begin(), SMap.end(),
+[&](const ObjCMethodDecl *x) {
+  return x->getSelector() == Method &&
+ x->isClassMethod() == Prop->isClassProperty();
+});
   // When reporting on missing property setter/getter implementation in
   // categories, do not report when they are declared in primary class,
   // class's protocol, or one of it super classes. This is because,
   // the class is going to implement them.
-  if (!SMap.count(Method) &&
+  if (I == SMap.end() &&
   (PrimaryClass == nullptr ||
!PrimaryClass->lookupPropertyAccessor(Method, C,
  Prop->isClassProperty( {
@@ -1867,10 +1871,10 @@ void Sema::DiagnoseUnimplementedProperti
   for (const auto *I : IMPDecl->property_impls())
 PropImplMap.insert(I->getPropertyDecl());
 
-  SelectorSet InsMap;
+  llvm::SmallPtrSet InsMap;
   // Collect property accessors implemented in current implementation.
   for (const auto *I : IMPDecl->methods())
-InsMap.insert(I->getSelector());
+InsMap.insert(I);
   
   ObjCCategoryDecl *C = dyn_cast(CDecl);
   ObjCInterfaceDecl *PrimaryClass = nullptr;
@@ -1882,7 +1886,7 @@ void Sema::DiagnoseUnimplementedProperti
 // setter/getter is implemented in category's primary class
 // implementation.
 for (const auto *I : IMP->methods())
-  InsMap.insert(I->getSelector());
+  InsMap.insert(I);
   }
 
   for (ObjCContainerDecl::PropertyMap::iterator

Modified: cfe/trunk/test/SemaObjC/objc-class-property.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-class-property.m?rev=269968=269967=269968=diff
==
--- cfe/trunk/test/SemaObjC/objc-class-property.m (original)
+++ cfe/trunk/test/SemaObjC/objc-class-property.m Wed May 18 13:12:34 2016
@@ -43,3 +43,16 @@ void message_id(id me) {
 void message_class(Class me) {
   [me c2];
 }
+
+@interface NSObject
+@end
+
+@interface MyClass : NSObject
+@property(class, readonly) int classProp; // expected-note {{property declared 
here}}
+@end
+
+@implementation MyClass // expected-warning {{class property 'classProp' 
requires method 'classProp' to be defined}}
+- (int)classProp { // Oops, mistakenly made this an instance method.
+  return 8;
+}
+@end


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


[libcxx] r269965 - Change the control flow in atomic_compare_exchange_strong to avoid a potential deadlock.

2016-05-18 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed May 18 12:50:13 2016
New Revision: 269965

URL: http://llvm.org/viewvc/llvm-project?rev=269965=rev
Log:
Change the control flow in atomic_compare_exchange_strong to avoid a potential 
deadlock.

When you assign a shared_ptr, the deleter gets called and assigned. In this 
routine, the assignment happens inside a critical section, which could 
(potentially) lead to a deadlock, if the deleter did something wonky. Now we 
swap the old value with an (empty) temporary shared_ptr, and then let the 
temporary delete the old value when it goes out of scope (after the lock has 
been released).  This should fix PR#27724. Thanks to Hans Boehm for the bug 
report and the suggested fix.


Modified:
libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=269965=269964=269965=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed May 18 12:50:13 2016
@@ -5541,14 +5541,17 @@ template 
 bool
 atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, 
shared_ptr<_Tp> __w)
 {
+shared_ptr<_Tp> __temp;
 __sp_mut& __m = __get_sp_mut(__p);
 __m.lock();
 if (__p->__owner_equivalent(*__v))
 {
+_VSTD::swap(__temp, *__p);
 *__p = __w;
 __m.unlock();
 return true;
 }
+_VSTD::swap(__temp, *__v);
 *__v = *__p;
 __m.unlock();
 return false;


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


Re: [PATCH] D20341: [CUDA] Enable fusing FP ops for CUDA by default.

2016-05-18 Thread Artem Belevich via cfe-commits
tra added a comment.

I don't think using FMA throws away IEEE compliance.

IEEE 784-2008 says:

> A language standard should also define, and require implementations to 
> provide, attributes that allow and

>  disallow value-changing optimizations, separately or collectively, for a 
> block. These optimizations might

>  include, but are not limited to:

>  ...

>  ― Synthesis of a fusedMultiplyAdd operation from a multiplication and an 
> addition


It sounds like FMA use is up to user/language and IEEE standard is fine with it 
either way.

We need to establish what is the language standard that we need to adhere to. 
C++ standard itself does not seem to say much about FP precision or particular 
FP format.

C11 standard (ISO/IEC 9899:201x draft, 7.12.2) says:

> The default state (‘‘on’’ or ‘‘off’’) for the [FP_CONTRACT] pragma is 
> implementation-defined.


Nvidia has fairly detailed description of their FP.
http://docs.nvidia.com/cuda/floating-point/index.html#fused-multiply-add-fma

> The fused multiply-add operator on the GPU has high performance and increases 
> the accuracy of computations. **No special flags or function calls are needed 
> to gain this benefit in CUDA programs**. Understand that a hardware fused 
> multiply-add operation is not yet available on the CPU, which can cause 
> differences in numerical results.


At the moment it's the most specific guideline I managed to find regarding 
expected FP behavior applicable to CUDA.


http://reviews.llvm.org/D20341



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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

I'd also like to know whether there are cases that this patch addresses but
Taewook Oh's patch does not, as the other patch involves a lot less
complexity.


http://reviews.llvm.org/D19783



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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Richard Smith via cfe-commits
I'd also like to know whether there are cases that this patch addresses but
Taewook Oh's patch does not, as the other patch involves a lot less
complexity.
On 18 May 2016 10:15 a.m., "Richard Smith via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> rsmith added inline comments.
>
> 
> Comment at: lib/Sema/SemaExprCXX.cpp:898
> @@ +897,3 @@
> +  // end of the TU) we need to be able to examine its enclosing lambdas
> and so
> +  // we use the DeclContext to get a hold of the ClosureClass and query
> it for
> +  // capture information.  The reason we don't just resort to always
> using the
> 
> No camel case for ClosureClass.
>
> 
> Comment at: lib/Sema/SemaExprCXX.cpp:910
> @@ +909,3 @@
> +  assert(IsFirstIteration);
> +  assert(CurLSI->CallOperator->getParent()->getParent() == CurDC);
> +  CurDC = CurLSI->CallOperator;
> 
> Please add a comment explaining this, I have no idea what special case
> you're checking for here.
>
> 
> Comment at: lib/Sema/SemaExprCXX.cpp:952
> @@ +951,3 @@
> +while (Closure &&
> +   IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
> +  if (IsByCopyCapture) {
> 
> Should you really stop here if this is not captured? There could still be
> a surrounding lambda with a mutable *this capture.
>
> 
> Comment at: lib/Sema/SemaExprCXX.cpp:1062
> @@ -964,1 +1061,3 @@
> +  Expr *This =
> +  new (Context) CXXThisExpr(Loc, AdjustedThisTy, /*isImplicit*/ true);
>if (ByCopy) {
> 
> faisalv wrote:
> > Hmm - I wonder if instead of using AdjustedThisTy, I should always use
> 'ThisTy' since it is being used in the initializer expression, and should
> probably inherit its cv qualifiers from an enclosing lambda? correct?
> Yes, don't use AdjustedThisTy here. You can test for this bug by giving
> the class both a (const T&) and a (T&)=delete copy ctor.
>
>
> http://reviews.llvm.org/D19783
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

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


Comment at: lib/Sema/SemaExprCXX.cpp:898
@@ +897,3 @@
+  // end of the TU) we need to be able to examine its enclosing lambdas and so
+  // we use the DeclContext to get a hold of the ClosureClass and query it for
+  // capture information.  The reason we don't just resort to always using the

No camel case for ClosureClass.


Comment at: lib/Sema/SemaExprCXX.cpp:910
@@ +909,3 @@
+  assert(IsFirstIteration);
+  assert(CurLSI->CallOperator->getParent()->getParent() == CurDC);
+  CurDC = CurLSI->CallOperator;

Please add a comment explaining this, I have no idea what special case you're 
checking for here.


Comment at: lib/Sema/SemaExprCXX.cpp:952
@@ +951,3 @@
+while (Closure &&
+   IsThisCaptured(Closure, IsByCopyCapture, IsConstCapture)) {
+  if (IsByCopyCapture) {

Should you really stop here if this is not captured? There could still be a 
surrounding lambda with a mutable *this capture.


Comment at: lib/Sema/SemaExprCXX.cpp:1062
@@ -964,1 +1061,3 @@
+  Expr *This =
+  new (Context) CXXThisExpr(Loc, AdjustedThisTy, /*isImplicit*/ true);
   if (ByCopy) {

faisalv wrote:
> Hmm - I wonder if instead of using AdjustedThisTy, I should always use 
> 'ThisTy' since it is being used in the initializer expression, and should 
> probably inherit its cv qualifiers from an enclosing lambda? correct?
Yes, don't use AdjustedThisTy here. You can test for this bug by giving the 
class both a (const T&) and a (T&)=delete copy ctor.


http://reviews.llvm.org/D19783



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


Re: [PATCH] D20374: [Driver] Fix the case when use -fembed-bitcode and -flto= together

2016-05-18 Thread Steven Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269961: [Driver] Fix the case when use -fembed-bitcode and 
-flto= together (authored by steven_wu).

Changed prior to commit:
  http://reviews.llvm.org/D20374?vs=57645=57646#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20374

Files:
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/test/Driver/embed-bitcode.c

Index: cfe/trunk/test/Driver/embed-bitcode.c
===
--- cfe/trunk/test/Driver/embed-bitcode.c
+++ cfe/trunk/test/Driver/embed-bitcode.c
@@ -27,6 +27,8 @@
 // CHECK-SAVE-TEMP: -cc1as
 
 // RUN: %clang -c %s -flto -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=full -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=thin -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
 // CHECK-LTO: -cc1
 // CHECK-LTO: -emit-llvm-bc
 // CHECK-LTO-NOT: warning: argument unused during compilation: 
'-fembed-bitcode'
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -504,9 +504,11 @@
 .Default(SaveTempsCwd);
   }
 
+  setLTOMode(Args);
+
   // Ignore -fembed-bitcode options with LTO
   // since the output will be bitcode anyway.
-  if (!Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) {
+  if (getLTOMode() == LTOK_None) {
 if (Arg *A = Args.getLastArg(options::OPT_fembed_bitcode_EQ)) {
   StringRef Name = A->getValue();
   unsigned Model = llvm::StringSwitch(Name)
@@ -526,8 +528,6 @@
 Args.ClaimAllArgs(options::OPT_fembed_bitcode_EQ);
   }
 
-  setLTOMode(Args);
-
   std::unique_ptr UArgs =
   llvm::make_unique(std::move(Args));
 


Index: cfe/trunk/test/Driver/embed-bitcode.c
===
--- cfe/trunk/test/Driver/embed-bitcode.c
+++ cfe/trunk/test/Driver/embed-bitcode.c
@@ -27,6 +27,8 @@
 // CHECK-SAVE-TEMP: -cc1as
 
 // RUN: %clang -c %s -flto -fembed-bitcode 2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=full -fembed-bitcode 2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=thin -fembed-bitcode 2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO
 // CHECK-LTO: -cc1
 // CHECK-LTO: -emit-llvm-bc
 // CHECK-LTO-NOT: warning: argument unused during compilation: '-fembed-bitcode'
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -504,9 +504,11 @@
 .Default(SaveTempsCwd);
   }
 
+  setLTOMode(Args);
+
   // Ignore -fembed-bitcode options with LTO
   // since the output will be bitcode anyway.
-  if (!Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) {
+  if (getLTOMode() == LTOK_None) {
 if (Arg *A = Args.getLastArg(options::OPT_fembed_bitcode_EQ)) {
   StringRef Name = A->getValue();
   unsigned Model = llvm::StringSwitch(Name)
@@ -526,8 +528,6 @@
 Args.ClaimAllArgs(options::OPT_fembed_bitcode_EQ);
   }
 
-  setLTOMode(Args);
-
   std::unique_ptr UArgs =
   llvm::make_unique(std::move(Args));
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269961 - [Driver] Fix the case when use -fembed-bitcode and -flto= together

2016-05-18 Thread Steven Wu via cfe-commits
Author: steven_wu
Date: Wed May 18 12:04:52 2016
New Revision: 269961

URL: http://llvm.org/viewvc/llvm-project?rev=269961=rev
Log:
[Driver] Fix the case when use -fembed-bitcode and -flto= together

Summary:
-fembed-bitcode was only checking for old style LTO flag (-flto) but not
considering the new -flto= style option. That makes clang output bitcode
embedded in bitcode object when using -flto= and -fembed-bitcode= together.
Now clang should output normal bitcode file when using LTO and ignores
-fembed-bitcode option.

Reviewers: joker.eph

Subscribers: joker.eph, cfe-commits

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

Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/embed-bitcode.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=269961=269960=269961=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed May 18 12:04:52 2016
@@ -504,9 +504,11 @@ Compilation *Driver::BuildCompilation(Ar
 .Default(SaveTempsCwd);
   }
 
+  setLTOMode(Args);
+
   // Ignore -fembed-bitcode options with LTO
   // since the output will be bitcode anyway.
-  if (!Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) {
+  if (getLTOMode() == LTOK_None) {
 if (Arg *A = Args.getLastArg(options::OPT_fembed_bitcode_EQ)) {
   StringRef Name = A->getValue();
   unsigned Model = llvm::StringSwitch(Name)
@@ -526,8 +528,6 @@ Compilation *Driver::BuildCompilation(Ar
 Args.ClaimAllArgs(options::OPT_fembed_bitcode_EQ);
   }
 
-  setLTOMode(Args);
-
   std::unique_ptr UArgs =
   llvm::make_unique(std::move(Args));
 

Modified: cfe/trunk/test/Driver/embed-bitcode.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/embed-bitcode.c?rev=269961=269960=269961=diff
==
--- cfe/trunk/test/Driver/embed-bitcode.c (original)
+++ cfe/trunk/test/Driver/embed-bitcode.c Wed May 18 12:04:52 2016
@@ -27,6 +27,8 @@
 // CHECK-SAVE-TEMP: -cc1as
 
 // RUN: %clang -c %s -flto -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=full -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=thin -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
 // CHECK-LTO: -cc1
 // CHECK-LTO: -emit-llvm-bc
 // CHECK-LTO-NOT: warning: argument unused during compilation: 
'-fembed-bitcode'


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


Re: [PATCH] D20374: [Driver] Fix the case when use -fembed-bitcode and -flto= together

2016-05-18 Thread Mehdi AMINI via cfe-commits
joker.eph accepted this revision.
joker.eph added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D20374



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


[PATCH] D20374: [Driver] Fix the case when use -fembed-bitcode and -flto= together

2016-05-18 Thread Steven Wu via cfe-commits
steven_wu created this revision.
steven_wu added a reviewer: joker.eph.
steven_wu added a subscriber: cfe-commits.
Herald added a subscriber: joker.eph.

-fembed-bitcode was only checking for old style LTO flag (-flto) but not
considering the new -flto= style option. That makes clang output bitcode
embedded in bitcode object when using -flto= and -fembed-bitcode= together.
Now clang should output normal bitcode file when using LTO and ignores
-fembed-bitcode option.

http://reviews.llvm.org/D20374

Files:
  lib/Driver/Driver.cpp
  test/Driver/embed-bitcode.c

Index: test/Driver/embed-bitcode.c
===
--- test/Driver/embed-bitcode.c
+++ test/Driver/embed-bitcode.c
@@ -27,6 +27,8 @@
 // CHECK-SAVE-TEMP: -cc1as
 
 // RUN: %clang -c %s -flto -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=full -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=thin -fembed-bitcode 2>&1 -### | FileCheck %s 
-check-prefix=CHECK-LTO
 // CHECK-LTO: -cc1
 // CHECK-LTO: -emit-llvm-bc
 // CHECK-LTO-NOT: warning: argument unused during compilation: 
'-fembed-bitcode'
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -504,9 +504,11 @@
 .Default(SaveTempsCwd);
   }
 
+  setLTOMode(Args);
+
   // Ignore -fembed-bitcode options with LTO
   // since the output will be bitcode anyway.
-  if (!Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) {
+  if (getLTOMode() == LTOK_None) {
 if (Arg *A = Args.getLastArg(options::OPT_fembed_bitcode_EQ)) {
   StringRef Name = A->getValue();
   unsigned Model = llvm::StringSwitch(Name)
@@ -526,8 +528,6 @@
 Args.ClaimAllArgs(options::OPT_fembed_bitcode_EQ);
   }
 
-  setLTOMode(Args);
-
   std::unique_ptr UArgs =
   llvm::make_unique(std::move(Args));
 


Index: test/Driver/embed-bitcode.c
===
--- test/Driver/embed-bitcode.c
+++ test/Driver/embed-bitcode.c
@@ -27,6 +27,8 @@
 // CHECK-SAVE-TEMP: -cc1as
 
 // RUN: %clang -c %s -flto -fembed-bitcode 2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=full -fembed-bitcode 2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO
+// RUN: %clang -c %s -flto=thin -fembed-bitcode 2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO
 // CHECK-LTO: -cc1
 // CHECK-LTO: -emit-llvm-bc
 // CHECK-LTO-NOT: warning: argument unused during compilation: '-fembed-bitcode'
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -504,9 +504,11 @@
 .Default(SaveTempsCwd);
   }
 
+  setLTOMode(Args);
+
   // Ignore -fembed-bitcode options with LTO
   // since the output will be bitcode anyway.
-  if (!Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) {
+  if (getLTOMode() == LTOK_None) {
 if (Arg *A = Args.getLastArg(options::OPT_fembed_bitcode_EQ)) {
   StringRef Name = A->getValue();
   unsigned Model = llvm::StringSwitch(Name)
@@ -526,8 +528,6 @@
 Args.ClaimAllArgs(options::OPT_fembed_bitcode_EQ);
   }
 
-  setLTOMode(Args);
-
   std::unique_ptr UArgs =
   llvm::make_unique(std::move(Args));
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Haojian Wu via cfe-commits
hokein marked 2 inline comments as done.


Comment at: unittests/ASTMatchers/ASTMatchersNodeTest.cpp:187
@@ +186,3 @@
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));

alexfh wrote:
> thakis wrote:
> > Doesn't referencing `bar()` after it's defined help too? If not, this is 
> > cool too -- maybe add a `/*ExpectMatch=*/` in front of `true` so it's clear 
> > what the true means.
> Yes, please add an argument comment and a FIXME to the code that is known to 
> be broken with delayed template parsing. Thanks!
Done in http://reviews.llvm.org/rL269957.


Repository:
  rL LLVM

http://reviews.llvm.org/D20369



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


r269957 - [ASTMacther] A follow-up on unresolvedLookupExpr test fixing.

2016-05-18 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed May 18 11:48:44 2016
New Revision: 269957

URL: http://llvm.org/viewvc/llvm-project?rev=269957=rev
Log:
[ASTMacther] A follow-up on unresolvedLookupExpr test fixing.

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp?rev=269957=269956=269957=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp Wed May 18 11:48:44 
2016
@@ -178,13 +178,16 @@ TEST(EnumConstant, Matches) {
 }
 
 TEST(Matcher, UnresolvedLookupExpr) {
+  // FIXME: The test is known to be broken on Windows with delayed template
+  // parsing.
   EXPECT_TRUE(matchesConditionally("template"
"T foo() { T a; return a; }"
"template"
"void bar() {"
"  foo();"
"}",
-   unresolvedLookupExpr(), true,
+   unresolvedLookupExpr(),
+   /*ExpectMatch=*/true,
"-fno-delayed-template-parsing"));
 }
 


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


Re: [PATCH] D20372: [include-fixer] Also look up prefixes of queries.

2016-05-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269956: [include-fixer] Also look up prefixes of queries. 
(authored by d0k).

Changed prior to commit:
  http://reviews.llvm.org/D20372?vs=57635=57642#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20372

Files:
  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
@@ -55,9 +55,6 @@
  {{SymbolInfo::ContextType::Namespace, "std"}}),
   SymbolInfo("sting", SymbolInfo::SymbolKind::Class, "\"sting\"", 1,
  {{SymbolInfo::ContextType::Namespace, "std"}}),
-  SymbolInfo("size_type", SymbolInfo::SymbolKind::Variable, "", 1,
- {{SymbolInfo::ContextType::Namespace, "string"},
-  {SymbolInfo::ContextType::Namespace, "std"}}),
   SymbolInfo("foo", SymbolInfo::SymbolKind::Class, "\"dir/otherdir/qux.h\"",
  1, {{SymbolInfo::ContextType::Namespace, "b"},
  {SymbolInfo::ContextType::Namespace, "a"}}),
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
@@ -24,53 +24,61 @@
   llvm::SmallVector Names;
   Identifier.split(Names, "::");
 
-  std::vector Symbols;
-  for (const auto  : SymbolIndices) {
-auto Res = DB->search(Names.back().str());
-Symbols.insert(Symbols.end(), Res.begin(), Res.end());
-  }
+  // As long as we don't find a result keep stripping name parts from the end.
+  // This is to support nested classes which aren't recorded in the database.
+  // Eventually we will either hit a class (namespaces aren't in the database
+  // either) and can report that result.
+  std::vector Results;
+  while (Results.empty() && !Names.empty()) {
+std::vector Symbols;
+for (const auto  : SymbolIndices) {
+  auto Res = DB->search(Names.back().str());
+  Symbols.insert(Symbols.end(), Res.begin(), Res.end());
+}
 
-  DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got "
- << Symbols.size() << " results...\n");
+DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got "
+   << Symbols.size() << " results...\n");
 
-  std::vector Results;
-  for (const auto  : Symbols) {
-// Match the identifier name without qualifier.
-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.
-  while (IdentiferContext != Names.rend() &&
- SymbolContext != Symbol.getContexts().end()) {
-if (SymbolContext->second == *IdentiferContext) {
-  ++IdentiferContext;
-  ++SymbolContext;
-} else if (SymbolContext->first ==
-   find_all_symbols::SymbolInfo::ContextType::EnumDecl) {
-  // Skip non-scoped enum context.
-  ++SymbolContext;
-} else {
-  IsMatched = false;
-  break;
+for (const auto  : Symbols) {
+  // Match the identifier name without qualifier.
+  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.
+while (IdentiferContext != Names.rend() &&
+   SymbolContext != Symbol.getContexts().end()) {
+  if (SymbolContext->second == *IdentiferContext) {
+++IdentiferContext;
+++SymbolContext;
+  } else if (SymbolContext->first ==
+ find_all_symbols::SymbolInfo::ContextType::EnumDecl) {
+// Skip non-scoped enum context.
+++SymbolContext;
+  } else {
+IsMatched = false;
+break;
+  }
 }
-  }
 
-  // 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.
-// FIXME: if the file path is a system header name, we want to use angle
-// brackets.
-

[clang-tools-extra] r269956 - [include-fixer] Also look up prefixes of queries.

2016-05-18 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed May 18 11:42:38 2016
New Revision: 269956

URL: http://llvm.org/viewvc/llvm-project?rev=269956=rev
Log:
[include-fixer] Also look up prefixes of queries.

This is used to find nested classes. For a nested name foo::bar::qux we
will first look up foo::bar::qux, then foo::bar, then foo unless we find
a result. This is used to support nested classes which are not part of
the index but can only be used if the header for the parent context is
included.

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

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

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=269956=269955=269956=diff
==
--- clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/SymbolIndexManager.cpp Wed May 18 
11:42:38 2016
@@ -24,53 +24,61 @@ SymbolIndexManager::search(llvm::StringR
   llvm::SmallVector Names;
   Identifier.split(Names, "::");
 
-  std::vector Symbols;
-  for (const auto  : SymbolIndices) {
-auto Res = DB->search(Names.back().str());
-Symbols.insert(Symbols.end(), Res.begin(), Res.end());
-  }
+  // As long as we don't find a result keep stripping name parts from the end.
+  // This is to support nested classes which aren't recorded in the database.
+  // Eventually we will either hit a class (namespaces aren't in the database
+  // either) and can report that result.
+  std::vector Results;
+  while (Results.empty() && !Names.empty()) {
+std::vector Symbols;
+for (const auto  : SymbolIndices) {
+  auto Res = DB->search(Names.back().str());
+  Symbols.insert(Symbols.end(), Res.begin(), Res.end());
+}
 
-  DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got "
- << Symbols.size() << " results...\n");
+DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got "
+   << Symbols.size() << " results...\n");
 
-  std::vector Results;
-  for (const auto  : Symbols) {
-// Match the identifier name without qualifier.
-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.
-  while (IdentiferContext != Names.rend() &&
- SymbolContext != Symbol.getContexts().end()) {
-if (SymbolContext->second == *IdentiferContext) {
-  ++IdentiferContext;
-  ++SymbolContext;
-} else if (SymbolContext->first ==
-   find_all_symbols::SymbolInfo::ContextType::EnumDecl) {
-  // Skip non-scoped enum context.
-  ++SymbolContext;
-} else {
-  IsMatched = false;
-  break;
+for (const auto  : Symbols) {
+  // Match the identifier name without qualifier.
+  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.
+while (IdentiferContext != Names.rend() &&
+   SymbolContext != Symbol.getContexts().end()) {
+  if (SymbolContext->second == *IdentiferContext) {
+++IdentiferContext;
+++SymbolContext;
+  } else if (SymbolContext->first ==
+ find_all_symbols::SymbolInfo::ContextType::EnumDecl) {
+// Skip non-scoped enum context.
+++SymbolContext;
+  } else {
+IsMatched = false;
+break;
+  }
 }
-  }
 
-  // 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.
-// FIXME: if the file path is a system header name, we want to use 
angle
-// brackets.
-std::string FilePath = Symbol.getFilePath().str();
-Results.push_back((FilePath[0] == '"' || FilePath[0] == '<')
-  ? FilePath
-  : "\"" + FilePath + "\"");
+// 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 

Re: [PATCH] D20372: [include-fixer] Also look up prefixes of queries.

2016-05-18 Thread Haojian Wu via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D20372



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


Re: r269765 - Revert "[X86] Add immediate range checks for many of the builtins."

2016-05-18 Thread Filipe Cabecinhas via cfe-commits
Indeed, my bad on two counts (I'm usually one of the people
complaining about commits like this, *and* I didn't notice the other
email was not sent to the list, so there was no record here).
Thanks Craig, for replying.

 Filipe

On Tue, May 17, 2016 at 11:09 PM, Sean Silva via cfe-commits
 wrote:
>
>
> On Tue, May 17, 2016 at 7:07 AM, Filipe Cabecinhas via cfe-commits
>  wrote:
>>
>> Author: filcab
>> Date: Tue May 17 09:07:43 2016
>> New Revision: 269765
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=269765=rev
>> Log:
>> Revert "[X86] Add immediate range checks for many of the builtins."
>>
>> This reverts commit r269619.
>
>
> In the future could you include the reason too?
>
> -- Sean Silva
>
>>
>>
>> Modified:
>> cfe/trunk/lib/Sema/SemaChecking.cpp
>> cfe/trunk/test/CodeGen/avx512vl-builtins.c
>>
>> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=269765=269764=269765=diff
>>
>> ==
>> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue May 17 09:07:43 2016
>> @@ -1323,52 +1323,23 @@ bool Sema::CheckX86BuiltinFunctionCall(u
>>  return SemaBuiltinCpuSupports(*this, TheCall);
>>case X86::BI__builtin_ms_va_start:
>>  return SemaBuiltinMSVAStart(TheCall);
>> -  case X86::BI__builtin_ia32_extractf64x4_mask:
>> -  case X86::BI__builtin_ia32_extracti64x4_mask:
>> -  case X86::BI__builtin_ia32_extractf32x8_mask:
>> -  case X86::BI__builtin_ia32_extracti32x8_mask:
>> -  case X86::BI__builtin_ia32_extractf64x2_256_mask:
>> -  case X86::BI__builtin_ia32_extracti64x2_256_mask:
>> -  case X86::BI__builtin_ia32_extractf32x4_256_mask:
>> -  case X86::BI__builtin_ia32_extracti32x4_256_mask:
>> -i = 1; l = 0; u = 1;
>> -break;
>>case X86::BI_mm_prefetch:
>> -  case X86::BI__builtin_ia32_extractf32x4_mask:
>> -  case X86::BI__builtin_ia32_extracti32x4_mask:
>> -  case X86::BI__builtin_ia32_vpermilpd_mask:
>> -  case X86::BI__builtin_ia32_vpermilps_mask:
>> -  case X86::BI__builtin_ia32_extractf64x2_512_mask:
>> -  case X86::BI__builtin_ia32_extracti64x2_512_mask:
>> -i = 1; l = 0; u = 3;
>> -break;
>> -  case X86::BI__builtin_ia32_insertf32x8_mask:
>> -  case X86::BI__builtin_ia32_inserti32x8_mask:
>> -  case X86::BI__builtin_ia32_insertf64x4_mask:
>> -  case X86::BI__builtin_ia32_inserti64x4_mask:
>> -  case X86::BI__builtin_ia32_insertf64x2_256_mask:
>> -  case X86::BI__builtin_ia32_inserti64x2_256_mask:
>> -  case X86::BI__builtin_ia32_insertf32x4_256_mask:
>> -  case X86::BI__builtin_ia32_inserti32x4_256_mask:
>> -i = 2; l = 0; u = 1;
>> +i = 1;
>> +l = 0;
>> +u = 3;
>>  break;
>>case X86::BI__builtin_ia32_sha1rnds4:
>> -  case X86::BI__builtin_ia32_shuf_f32x4_256_mask:
>> -  case X86::BI__builtin_ia32_shuf_f64x2_256_mask:
>> -  case X86::BI__builtin_ia32_shuf_i32x4_256_mask:
>> -  case X86::BI__builtin_ia32_shuf_i64x2_256_mask:
>> -  case X86::BI__builtin_ia32_shufpd128_mask:
>> -  case X86::BI__builtin_ia32_insertf64x2_512_mask:
>> -  case X86::BI__builtin_ia32_inserti64x2_512_mask:
>> -  case X86::BI__builtin_ia32_insertf32x4_mask:
>> -  case X86::BI__builtin_ia32_inserti32x4_mask:
>> -i = 2; l = 0; u = 3;
>> +i = 2;
>> +l = 0;
>> +u = 3;
>>  break;
>>case X86::BI__builtin_ia32_vpermil2pd:
>>case X86::BI__builtin_ia32_vpermil2pd256:
>>case X86::BI__builtin_ia32_vpermil2ps:
>>case X86::BI__builtin_ia32_vpermil2ps256:
>> -i = 3; l = 0; u = 3;
>> +i = 3;
>> +l = 0;
>> +u = 3;
>>  break;
>>case X86::BI__builtin_ia32_cmpb128_mask:
>>case X86::BI__builtin_ia32_cmpw128_mask:
>> @@ -1394,36 +1365,23 @@ bool Sema::CheckX86BuiltinFunctionCall(u
>>case X86::BI__builtin_ia32_ucmpw512_mask:
>>case X86::BI__builtin_ia32_ucmpd512_mask:
>>case X86::BI__builtin_ia32_ucmpq512_mask:
>> -  case X86::BI__builtin_ia32_vpcomub:
>> -  case X86::BI__builtin_ia32_vpcomuw:
>> -  case X86::BI__builtin_ia32_vpcomud:
>> -  case X86::BI__builtin_ia32_vpcomuq:
>> -  case X86::BI__builtin_ia32_vpcomb:
>> -  case X86::BI__builtin_ia32_vpcomw:
>> -  case X86::BI__builtin_ia32_vpcomd:
>> -  case X86::BI__builtin_ia32_vpcomq:
>> -i = 2; l = 0; u = 7;
>> +i = 2;
>> +l = 0;
>> +u = 7;
>>  break;
>>case X86::BI__builtin_ia32_roundps:
>>case X86::BI__builtin_ia32_roundpd:
>>case X86::BI__builtin_ia32_roundps256:
>>case X86::BI__builtin_ia32_roundpd256:
>> -  case X86::BI__builtin_ia32_vpermilpd256_mask:
>> -  case X86::BI__builtin_ia32_vpermilps256_mask:
>> -i = 1; l = 0; u = 15;
>> +i = 1;
>> +l = 0;
>> +u = 15;
>>  break;
>>case X86::BI__builtin_ia32_roundss:
>>case X86::BI__builtin_ia32_roundsd:
>> -  case X86::BI__builtin_ia32_rangepd128_mask:
>> -  case 

Re: [PATCH] D20168: [CodeGen] Handle structs directly in AMDGPUABIInfo

2016-05-18 Thread Matt Arsenault via cfe-commits
arsenm added a comment.

Some larger and smaller structs too. I think it would be good if single element 
structs are replaced with the element type


http://reviews.llvm.org/D20168



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


[clang-tools-extra] r269952 - clang-rename: handle non-inline ctor definitions when renaming classes

2016-05-18 Thread Miklos Vajna via cfe-commits
Author: vmiklos
Date: Wed May 18 11:12:48 2016
New Revision: 269952

URL: http://llvm.org/viewvc/llvm-project?rev=269952=rev
Log:
clang-rename: handle non-inline ctor definitions when renaming classes

The result of the test was C::D(), not D::D().

Reviewers: cfe-commits, klimek

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

Added:
clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
Modified:
clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp

Modified: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp?rev=269952=269951=269952=diff
==
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp Wed May 18 11:12:48 
2016
@@ -79,6 +79,11 @@ public:
 }
   }
 }
+
+if (getUSRForDecl(ConstructorDecl) == USR) {
+  // This takes care of the class name part of a non-inline ctor 
definition.
+  LocationsFound.push_back(ConstructorDecl->getLocStart());
+}
 return true;
   }
 

Added: clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp?rev=269952=auto
==
--- clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp (added)
+++ clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp Wed May 18 
11:12:48 2016
@@ -0,0 +1,15 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class C
+{
+public:
+C();
+};
+
+C::C() // CHECK: D::D()
+{
+}
+
+// Use grep -FUbo 'C'  to get the correct offset of foo when changing
+// this file.


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


Re: [PATCH] D20356: clang-rename: handle non-inline ctor definitions when renaming classes

2016-05-18 Thread Miklos Vajna via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269952: clang-rename: handle non-inline ctor definitions 
when renaming classes (authored by vmiklos).

Changed prior to commit:
  http://reviews.llvm.org/D20356?vs=57582=57641#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20356

Files:
  clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
  clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp

Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -79,6 +79,11 @@
 }
   }
 }
+
+if (getUSRForDecl(ConstructorDecl) == USR) {
+  // This takes care of the class name part of a non-inline ctor 
definition.
+  LocationsFound.push_back(ConstructorDecl->getLocStart());
+}
 return true;
   }
 
Index: clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
+++ clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
@@ -0,0 +1,15 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class C
+{
+public:
+C();
+};
+
+C::C() // CHECK: D::D()
+{
+}
+
+// Use grep -FUbo 'C'  to get the correct offset of foo when changing
+// this file.


Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -79,6 +79,11 @@
 }
   }
 }
+
+if (getUSRForDecl(ConstructorDecl) == USR) {
+  // This takes care of the class name part of a non-inline ctor definition.
+  LocationsFound.push_back(ConstructorDecl->getLocStart());
+}
 return true;
   }
 
Index: clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
+++ clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
@@ -0,0 +1,15 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class C
+{
+public:
+C();
+};
+
+C::C() // CHECK: D::D()
+{
+}
+
+// Use grep -FUbo 'C'  to get the correct offset of foo when changing
+// this file.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20168: [CodeGen] Handle structs directly in AMDGPUABIInfo

2016-05-18 Thread Matt Arsenault via cfe-commits
arsenm added a comment.

Can you add some tests that include arrays, struct within structs and arrays of 
structs?


http://reviews.llvm.org/D20168



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


Re: [PATCH] D20349: Fix a clang bug in lambda capture of 'this'

2016-05-18 Thread Faisal Vali via cfe-commits
faisalv added a comment.

That feedback would be greatly appreciated - thanks Taewook!
Faisal Vali


http://reviews.llvm.org/D20349



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


Re: [PATCH] D20198: clang-format: [JS] sort ES6 imports.

2016-05-18 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 57637.
mprobst marked an inline comment as done.
mprobst added a comment.

- address review comments
- - extract parseModuleReferences
- more review comments


http://reviews.llvm.org/D20198

Files:
  include/clang/Format/Format.h
  lib/Format/CMakeLists.txt
  lib/Format/Format.cpp
  lib/Format/FormatToken.h
  lib/Format/FormatTokenLexer.cpp
  lib/Format/FormatTokenLexer.h
  lib/Format/SortJavaScriptImports.cpp
  lib/Format/SortJavaScriptImports.h
  lib/Format/TokenAnalyzer.cpp
  lib/Format/TokenAnalyzer.h
  unittests/Format/CMakeLists.txt
  unittests/Format/SortImportsTestJS.cpp

Index: unittests/Format/SortImportsTestJS.cpp
===
--- /dev/null
+++ unittests/Format/SortImportsTestJS.cpp
@@ -0,0 +1,137 @@
+//===- unittest/Format/SortImportsTestJS.cpp - JS import sort unit tests --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "FormatTestUtils.h"
+#include "clang/Format/Format.h"
+#include "llvm/Support/Debug.h"
+#include "gtest/gtest.h"
+
+#define DEBUG_TYPE "format-test"
+
+namespace clang {
+namespace format {
+namespace {
+
+class SortImportsTestJS : public ::testing::Test {
+protected:
+  std::vector GetCodeRange(StringRef Code) {
+return std::vector(1, tooling::Range(0, Code.size()));
+  }
+
+  std::string sort(StringRef Code, StringRef FileName = "input.js") {
+auto Ranges = GetCodeRange(Code);
+std::string Sorted =
+applyAllReplacements(Code, sortIncludes(Style, Code, Ranges, FileName));
+return applyAllReplacements(Sorted,
+reformat(Style, Sorted, Ranges, FileName));
+  }
+
+  void verifySort(llvm::StringRef Expected, llvm::StringRef Code) {
+std::string Result = sort(Code);
+EXPECT_EQ(Expected.str(), Result) << "Formatted:\n" << Result;
+  }
+
+  FormatStyle Style = getGoogleStyle(FormatStyle::LK_JavaScript);
+};
+
+TEST_F(SortImportsTestJS, BasicSorting) {
+  verifySort("import {sym} from 'a';\n"
+ "import {sym} from 'b';\n"
+ "import {sym} from 'c';\n"
+ "\n"
+ "let x = 1;",
+ "import {sym} from 'a';\n"
+ "import {sym} from 'c';\n"
+ "import {sym} from 'b';\n"
+ "let x = 1;");
+}
+
+TEST_F(SortImportsTestJS, Comments) {
+  verifySort("/** @fileoverview This is a great file. */\n"
+ "// A very important import follows.\n"
+ "import {sym} from 'a'; /* more comments */\n"
+ "import {sym} from 'b'; // from //foo:bar\n",
+ "/** @fileoverview This is a great file. */\n"
+ "import {sym} from 'b'; // from //foo:bar\n"
+ "// A very important import follows.\n"
+ "import {sym} from 'a'; /* more comments */\n");
+}
+
+TEST_F(SortImportsTestJS, SortStar) {
+  verifySort("import * as foo from 'a';\n"
+ "import {sym} from 'a';\n"
+ "import * as bar from 'b';\n",
+ "import {sym} from 'a';\n"
+ "import * as foo from 'a';\n"
+ "import * as bar from 'b';\n");
+}
+
+TEST_F(SortImportsTestJS, AliasesSymbols) {
+  verifySort("import {sym1 as alias1} from 'b';\n"
+ "import {sym2 as alias2, sym3 as alias3} from 'c';\n",
+ "import {sym2 as alias2, sym3 as alias3} from 'c';\n"
+ "import {sym1 as alias1} from 'b';\n");
+}
+
+TEST_F(SortImportsTestJS, GroupImports) {
+  verifySort("import {a} from 'absolute';\n"
+ "\n"
+ "import {b} from '../parent';\n"
+ "import {b} from '../parent/nested';\n"
+ "\n"
+ "import {b} from './relative/path';\n"
+ "import {b} from './relative/path/nested';\n"
+ "\n"
+ "let x = 1;\n",
+ "import {b} from './relative/path/nested';\n"
+ "import {b} from './relative/path';\n"
+ "import {b} from '../parent/nested';\n"
+ "import {b} from '../parent';\n"
+ "import {a} from 'absolute';\n"
+ "let x = 1;\n");
+}
+
+TEST_F(SortImportsTestJS, Exports) {
+  verifySort("import {S} from 'bpath';\n"
+ "\n"
+ "import {T} from './cpath';\n"
+ "\n"
+ "export {A, B} from 'apath';\n"
+ "export {P} from '../parent';\n"
+ "export {R} from './relative';\n"
+ "export {S};\n"
+ "\n"
+ "let x = 1;\n"
+ "export y = 1;\n",
+ "export {R} from './relative';\n"
+ "import {T} from './cpath';\n"
+ "export {S};\n"
+ "export {A, B} from 'apath';\n"
+ "import {S} from 'bpath';\n"
+ "export {P} from 

Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: unittests/ASTMatchers/ASTMatchersNodeTest.cpp:187
@@ +186,3 @@
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));

thakis wrote:
> Doesn't referencing `bar()` after it's defined help too? If not, this is cool 
> too -- maybe add a `/*ExpectMatch=*/` in front of `true` so it's clear what 
> the true means.
Yes, please add an argument comment and a FIXME to the code that is known to be 
broken with delayed template parsing. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D20369



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


Re: [PATCH] D20198: clang-format: [JS] sort ES6 imports.

2016-05-18 Thread Martin Probst via cfe-commits
mprobst marked 4 inline comments as done.


Comment at: lib/Format/SortJavaScriptImports.cpp:216-217
@@ +215,4 @@
+break;
+  Current = Line->First;
+  LineEnd = Line->Last;
+  skipComments();

klimek wrote:
> Both of these are used only once, perhaps inline?
These are setting fields for the parse state (note: this is not a variable 
declaration).


http://reviews.llvm.org/D20198



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


Re: [PATCH] D20349: Fix a clang bug in lambda capture of 'this'

2016-05-18 Thread Taewook Oh via cfe-commits
twoh added a comment.

Thank you for your comments. @faisalv, it is great that you already submitted a 
patch. Let me see if your patch resolves the issue I have. Thanks!


http://reviews.llvm.org/D20349



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


[PATCH] D20373: PR27799: [OpenCL] Clang fails to compile libclc

2016-05-18 Thread Yaxun Liu via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: Anastasia.
yaxunl added subscribers: cfe-commits, tstellarAMD.

libclc fails to build due to some supported OpenCL extensions are not added to 
nvptx target.

http://reviews.llvm.org/D20373

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1840,6 +1840,12 @@
 
 return GPU != GK_NONE;
   }
+  void setSupportedOpenCLOpts() override {
+auto  = getSupportedOpenCLOpts();
+Opts.cl_clang_storage_class_specifiers = 1;
+Opts.cl_khr_byte_addressable_store = 1;
+Opts.cl_khr_fp64 = 1;
+ }
 };
 
 const Builtin::Info NVPTXTargetInfo::BuiltinInfo[] = {


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1840,6 +1840,12 @@
 
 return GPU != GK_NONE;
   }
+  void setSupportedOpenCLOpts() override {
+auto  = getSupportedOpenCLOpts();
+Opts.cl_clang_storage_class_specifiers = 1;
+Opts.cl_khr_byte_addressable_store = 1;
+Opts.cl_khr_fp64 = 1;
+ }
 };
 
 const Builtin::Info NVPTXTargetInfo::BuiltinInfo[] = {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20321: [Clang][AVX512][intrinsics] Fix vperm intrinsics.

2016-05-18 Thread michael zuckerman via cfe-commits
m_zuckerman added a comment.

Thanks, you are right !


Repository:
  rL LLVM

http://reviews.llvm.org/D20321



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


r269941 - [PS4] Clean up some test commentary. NFC

2016-05-18 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Wed May 18 10:35:58 2016
New Revision: 269941

URL: http://llvm.org/viewvc/llvm-project?rev=269941=rev
Log:
[PS4] Clean up some test commentary. NFC

Modified:
cfe/trunk/test/Driver/ps4-sdk-root.c

Modified: cfe/trunk/test/Driver/ps4-sdk-root.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-sdk-root.c?rev=269941=269940=269941=diff
==
--- cfe/trunk/test/Driver/ps4-sdk-root.c (original)
+++ cfe/trunk/test/Driver/ps4-sdk-root.c Wed May 18 10:35:58 2016
@@ -1,19 +1,19 @@
 // REQUIRES: x86-registered-target
 
-// Check that ps4-clang doesn't report a warning message when locating
+// Check that PS4 clang doesn't report a warning message when locating
 // system header files (either by looking at the value of SCE_ORBIS_SDK_DIR
 // or relative to the location of the compiler driver), if "-nostdinc",
 // "--sysroot" or "-isysroot" option is specified on the command line.
-// Otherwise, check that ps4-clang reports a warning.
+// Otherwise, check that PS4 clang reports a warning.
 
-// Check that clang doesn't report a warning message when locating
+// Check that PS4 clang doesn't report a warning message when locating
 // system libraries (either by looking at the value of SCE_ORBIS_SDK_DIR
 // or relative to the location of the compiler driver), if "-c", "-S", "-E",
 // "--sysroot", "-nostdlib" or "-nodefaultlibs" option is specified on
 // the command line.
-// Otherwise, check that ps4-clang reports a warning.
+// Otherwise, check that PS4 clang reports a warning.
 
-// setting up SCE_ORBIS_SDK_DIR to existing location, which is not a PS4 SDK.
+// Setting up SCE_ORBIS_SDK_DIR to existing location, which is not a PS4 SDK.
 // RUN: env SCE_ORBIS_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory 
-### -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS 
-check-prefix=WARN-SYS-LIBS -check-prefix=NO-WARN %s
 
 // RUN: env SCE_ORBIS_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory 
-### -c -target x86_64-scei-ps4 %s 2>&1 | FileCheck 
-check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s


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


[PATCH] D20372: [include-fixer] Also look up prefixes of queries.

2016-05-18 Thread Benjamin Kramer via cfe-commits
bkramer created this revision.
bkramer added reviewers: hokein, ioeric.
bkramer added a subscriber: cfe-commits.

This is used to find nested classes. For a nested name foo::bar::qux we
will first look up foo::bar::qux, then foo::bar, then foo unless we find
a result. This is used to support nested classes which are not part of
the index but can only be used if the header for the parent context is
included.

http://reviews.llvm.org/D20372

Files:
  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
@@ -55,9 +55,6 @@
  {{SymbolInfo::ContextType::Namespace, "std"}}),
   SymbolInfo("sting", SymbolInfo::SymbolKind::Class, "\"sting\"", 1,
  {{SymbolInfo::ContextType::Namespace, "std"}}),
-  SymbolInfo("size_type", SymbolInfo::SymbolKind::Variable, "", 1,
- {{SymbolInfo::ContextType::Namespace, "string"},
-  {SymbolInfo::ContextType::Namespace, "std"}}),
   SymbolInfo("foo", SymbolInfo::SymbolKind::Class, "\"dir/otherdir/qux.h\"",
  1, {{SymbolInfo::ContextType::Namespace, "b"},
  {SymbolInfo::ContextType::Namespace, "a"}}),
Index: include-fixer/SymbolIndexManager.cpp
===
--- include-fixer/SymbolIndexManager.cpp
+++ include-fixer/SymbolIndexManager.cpp
@@ -24,52 +24,59 @@
   llvm::SmallVector Names;
   Identifier.split(Names, "::");
 
-  std::vector Symbols;
-  for (const auto  : SymbolIndices) {
-auto Res = DB->search(Names.back().str());
-Symbols.insert(Symbols.end(), Res.begin(), Res.end());
-  }
+  // As long as we don't find a result keep stripping name parts from the end.
+  // This is to support nested classes which aren't recorded in the database.
+  // Eventually we will either hit a class (namespaces aren't in the database
+  // either) and can report that result.
+  std::vector Results;
+  while (Results.empty() && !Names.empty()) {
+std::vector Symbols;
+for (const auto  : SymbolIndices) {
+  auto Res = DB->search(Names.back().str());
+  Symbols.insert(Symbols.end(), Res.begin(), Res.end());
+}
 
-  DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got "
- << Symbols.size() << " results...\n");
+DEBUG(llvm::dbgs() << "Searching " << Names.back() << "... got "
+   << Symbols.size() << " results...\n");
 
-  std::vector Results;
-  for (const auto  : Symbols) {
-// Match the identifier name without qualifier.
-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.
-  while (IdentiferContext != Names.rend() &&
- SymbolContext != Symbol.getContexts().end()) {
-if (SymbolContext->second == *IdentiferContext) {
-  ++IdentiferContext;
-  ++SymbolContext;
-} else if (SymbolContext->first ==
-   find_all_symbols::SymbolInfo::ContextType::EnumDecl) {
-  // Skip non-scoped enum context.
-  ++SymbolContext;
-} else {
-  IsMatched = false;
-  break;
+for (const auto  : Symbols) {
+  // Match the identifier name without qualifier.
+  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.
+while (IdentiferContext != Names.rend() &&
+   SymbolContext != Symbol.getContexts().end()) {
+  if (SymbolContext->second == *IdentiferContext) {
+++IdentiferContext;
+++SymbolContext;
+  } else if (SymbolContext->first ==
+ find_all_symbols::SymbolInfo::ContextType::EnumDecl) {
+// Skip non-scoped enum context.
+++SymbolContext;
+  } else {
+IsMatched = false;
+break;
+  }
 }
-  }
 
-  // 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.
-// FIXME: if the file path is a system header name, we want to use angle
-// brackets.
-std::string FilePath = Symbol.getFilePath().str();
-

Re: [PATCH] D20366: [ASTMatcher] Make dump_ast_matchers.py executable.

2016-05-18 Thread Haojian Wu via cfe-commits
hokein added a comment.

In http://reviews.llvm.org/D20366#433123, @aaron.ballman wrote:

> What's the harm in leaving the props at 0644?


Just inconvenient . And I see the `dump_format_style.py` in the same directory 
is executable.


http://reviews.llvm.org/D20366



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


r269939 - [Clang][AVX512] completing missing intrinsics [pandnd].

2016-05-18 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Wed May 18 10:25:53 2016
New Revision: 269939

URL: http://llvm.org/viewvc/llvm-project?rev=269939=rev
Log:
[Clang][AVX512] completing missing intrinsics [pandnd].

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

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=269939=269938=269939=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Wed May 18 10:25:53 2016
@@ -418,6 +418,12 @@ _mm512_maskz_and_epi64(__mmask8 __k, __m
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_andnot_si512 (__m512i __A, __m512i __B)
+{
+  return (__m512i)(~(__A) & __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_andnot_epi32 (__m512i __A, __m512i __B)
 {
   return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A,

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=269939=269938=269939=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed May 18 10:25:53 2016
@@ -1451,6 +1451,17 @@ __m512i test_mm512_mask_andnot_epi32 (__
   return _mm512_mask_andnot_epi32(__src,__k,__A,__B);
 }
 
+__m512i test_mm512_andnot_si512(__m512i __A, __m512i __B)
+{
+  //CHECK-LABLE: @test_mm512_andnot_si512
+  //CHECK: load {{.*}}%__A.addr.i, align 64
+  //CHECK: %neg.i = xor{{.*}}, 
+  //CHECK: load {{.*}}%__B.addr.i, align 64
+  //CHECK: and <8 x i64> %neg.i,{{.*}}
+
+  return _mm512_andnot_si512(__A, __B);
+}
+
 __m512i test_mm512_andnot_epi32(__m512i __A, __m512i __B) {
   //CHECK-LABEL: @test_mm512_andnot_epi32
   //CHECK: @llvm.x86.avx512.mask.pandn.d.512


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


r269931 - [X86][SSE42] Sync with llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll

2016-05-18 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed May 18 09:29:55 2016
New Revision: 269931

URL: http://llvm.org/viewvc/llvm-project?rev=269931=rev
Log:
[X86][SSE42] Sync with llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll

Modified:
cfe/trunk/test/CodeGen/sse42-builtins.c

Modified: cfe/trunk/test/CodeGen/sse42-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse42-builtins.c?rev=269931=269930=269931=diff
==
--- cfe/trunk/test/CodeGen/sse42-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse42-builtins.c Wed May 18 09:29:55 2016
@@ -6,134 +6,118 @@
 
 #include 
 
-__m128i test_mm_cmpgt_epi8(__m128i A, __m128i B) {
-  // CHECK-LABEL: test_mm_cmpgt_epi8
-  // CHECK: icmp sgt <16 x i8>
-  return _mm_cmpgt_epi8(A, B);
-}
-
-__m128i test_mm_cmpgt_epi16(__m128i A, __m128i B) {
-  // CHECK-LABEL: test_mm_cmpgt_epi16
-  // CHECK: icmp sgt <8 x i16>
-  return _mm_cmpgt_epi16(A, B);
-}
-
-__m128i test_mm_cmpgt_epi32(__m128i A, __m128i B) {
-  // CHECK-LABEL: test_mm_cmpgt_epi32
-  // CHECK: icmp sgt <4 x i32>
-  return _mm_cmpgt_epi32(A, B);
-}
-
-__m128i test_mm_cmpgt_epi64(__m128i A, __m128i B) {
-  // CHECK-LABEL: test_mm_cmpgt_epi64
-  // CHECK: icmp sgt <2 x i64>
-  return _mm_cmpgt_epi64(A, B);
-}
+// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
 
 int test_mm_cmpestra(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestra
-  // CHECK: @llvm.x86.sse42.pcmpestria128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpestria128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestra(A, LA, B, LB, 7);
 }
 
 int test_mm_cmpestrc(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestrc
-  // CHECK: @llvm.x86.sse42.pcmpestric128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpestric128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestrc(A, LA, B, LB, 7);
 }
 
 int test_mm_cmpestri(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestri
-  // CHECK: @llvm.x86.sse42.pcmpestri128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpestri128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestri(A, LA, B, LB, 7);
 }
 
 __m128i test_mm_cmpestrm(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestrm
-  // CHECK: @llvm.x86.sse42.pcmpestrm128
+  // CHECK: call <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestrm(A, LA, B, LB, 7);
 }
 
 int test_mm_cmpestro(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestro
-  // CHECK: @llvm.x86.sse42.pcmpestrio128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestro(A, LA, B, LB, 7);
 }
 
 int test_mm_cmpestrs(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestrs
-  // CHECK: @llvm.x86.sse42.pcmpestris128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpestris128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestrs(A, LA, B, LB, 7);
 }
 
 int test_mm_cmpestrz(__m128i A, int LA, __m128i B, int LB) {
   // CHECK-LABEL: test_mm_cmpestrz
-  // CHECK: @llvm.x86.sse42.pcmpestriz128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8> %{{.*}}, i32 
%{{.*}}, <16 x i8> %{{.*}}, i32 %{{.*}}, i8 7)
   return _mm_cmpestrz(A, LA, B, LB, 7);
 }
 
+__m128i test_mm_cmpgt_epi64(__m128i A, __m128i B) {
+  // CHECK-LABEL: test_mm_cmpgt_epi64
+  // CHECK: icmp sgt <2 x i64>
+  return _mm_cmpgt_epi64(A, B);
+}
+
 int test_mm_cmpistra(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_cmpistra
-  // CHECK: @llvm.x86.sse42.pcmpistria128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpistria128(<16 x i8> %{{.*}}, <16 x 
i8> %{{.*}}, i8 7)
   return _mm_cmpistra(A, B, 7);
 }
 
 int test_mm_cmpistrc(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_cmpistrc
-  // CHECK: @llvm.x86.sse42.pcmpistric128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpistric128(<16 x i8> %{{.*}}, <16 x 
i8> %{{.*}}, i8 7)
   return _mm_cmpistrc(A, B, 7);
 }
 
 int test_mm_cmpistri(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_cmpistri
-  // CHECK: @llvm.x86.sse42.pcmpistri128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpistri128(<16 x i8> %{{.*}}, <16 x i8> 
%{{.*}}, i8 7)
   return _mm_cmpistri(A, B, 7);
 }
 
 __m128i test_mm_cmpistrm(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_cmpistrm
-  // CHECK: @llvm.x86.sse42.pcmpistrm128
+  // CHECK: call <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8> %{{.*}}, <16 
x i8> %{{.*}}, i8 7)
   return _mm_cmpistrm(A, B, 7);
 }
 
 int test_mm_cmpistro(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_cmpistro
-  // CHECK: @llvm.x86.sse42.pcmpistrio128
+  // CHECK: call i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8> %{{.*}}, <16 x 
i8> 

Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269936: [ASTMatcher] Fix a ASTMatcher test failure on 
Windows. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D20369?vs=57631=57633#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20369

Files:
  cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -178,13 +178,14 @@
 }
 
 TEST(Matcher, UnresolvedLookupExpr) {
-  EXPECT_TRUE(matches("template"
-  "T foo() { T a; return a; }"
-  "template"
-  "void bar() {"
-  "  foo();"
-  "}",
-  unresolvedLookupExpr()));
+  EXPECT_TRUE(matchesConditionally("template"
+   "T foo() { T a; return a; }"
+   "template"
+   "void bar() {"
+   "  foo();"
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));
 }
 
 TEST(Matcher, Call) {


Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -178,13 +178,14 @@
 }
 
 TEST(Matcher, UnresolvedLookupExpr) {
-  EXPECT_TRUE(matches("template"
-  "T foo() { T a; return a; }"
-  "template"
-  "void bar() {"
-  "  foo();"
-  "}",
-  unresolvedLookupExpr()));
+  EXPECT_TRUE(matchesConditionally("template"
+   "T foo() { T a; return a; }"
+   "template"
+   "void bar() {"
+   "  foo();"
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));
 }
 
 TEST(Matcher, Call) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269936 - [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed May 18 10:15:12 2016
New Revision: 269936

URL: http://llvm.org/viewvc/llvm-project?rev=269936=rev
Log:
[ASTMatcher] Fix a ASTMatcher test failure on Windows.

Reviewers: alexfh, aaron.ballman

Subscribers: thakis, cfe-commits, klimek

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

Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp?rev=269936=269935=269936=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp Wed May 18 10:15:12 
2016
@@ -178,13 +178,14 @@ TEST(EnumConstant, Matches) {
 }
 
 TEST(Matcher, UnresolvedLookupExpr) {
-  EXPECT_TRUE(matches("template"
-  "T foo() { T a; return a; }"
-  "template"
-  "void bar() {"
-  "  foo();"
-  "}",
-  unresolvedLookupExpr()));
+  EXPECT_TRUE(matchesConditionally("template"
+   "T foo() { T a; return a; }"
+   "template"
+   "void bar() {"
+   "  foo();"
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));
 }
 
 TEST(Matcher, Call) {


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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

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

Only use -fno-delayed-template-parsing in the testcase.


http://reviews.llvm.org/D20369

Files:
  unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -178,13 +178,14 @@
 }
 
 TEST(Matcher, UnresolvedLookupExpr) {
-  EXPECT_TRUE(matches("template"
-  "T foo() { T a; return a; }"
-  "template"
-  "void bar() {"
-  "  foo();"
-  "}",
-  unresolvedLookupExpr()));
+  EXPECT_TRUE(matchesConditionally("template"
+   "T foo() { T a; return a; }"
+   "template"
+   "void bar() {"
+   "  foo();"
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));
 }
 
 TEST(Matcher, Call) {


Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -178,13 +178,14 @@
 }
 
 TEST(Matcher, UnresolvedLookupExpr) {
-  EXPECT_TRUE(matches("template"
-  "T foo() { T a; return a; }"
-  "template"
-  "void bar() {"
-  "  foo();"
-  "}",
-  unresolvedLookupExpr()));
+  EXPECT_TRUE(matchesConditionally("template"
+   "T foo() { T a; return a; }"
+   "template"
+   "void bar() {"
+   "  foo();"
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));
 }
 
 TEST(Matcher, Call) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Nico Weber via cfe-commits
thakis added a comment.

(If so, maybe add a FIXME comment to make things work without delayed template 
parsing. In any case, getting the bot green is the most important thing, so 
landing this as is is definitely fine.)


http://reviews.llvm.org/D20369



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


r269935 - Teach Sema::MergeFunctionDecl to properly check for an out-of-line definition of a function that is declared as =default in its class definition.

2016-05-18 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Wed May 18 10:14:46 2016
New Revision: 269935

URL: http://llvm.org/viewvc/llvm-project?rev=269935=rev
Log:
Teach Sema::MergeFunctionDecl to properly check for an out-of-line definition 
of a function that is declared as =default in its class definition.

First part of PR27699.

Patch by Cristina Cristescu!

Reviewed by Richard Smith and me.

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=269935=269934=269935=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed May 18 10:14:46 2016
@@ -2993,7 +2993,7 @@ bool Sema::MergeFunctionDecl(FunctionDec
 << New << getSpecialMember(OldMethod);
   return true;
 }
-  } else if (OldMethod->isExplicitlyDefaulted() && !isFriend) {
+  } else if (OldMethod->getFirstDecl()->isExplicitlyDefaulted() && 
!isFriend) {
 Diag(NewMethod->getLocation(),
  diag::err_definition_of_explicitly_defaulted_member)
   << getSpecialMember(OldMethod);

Modified: cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp?rev=269935=269934=269935=diff
==
--- cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp Wed May 18 10:14:46 
2016
@@ -150,6 +150,14 @@ namespace PR13527 {
   Y::~Y() = default; // expected-error {{definition of explicitly defaulted}}
 }
 
+namespace PR27699 {
+  struct X {
+X();
+  };
+  X::X() = default; // expected-note {{here}}
+  X::X() = default; // expected-error {{redefinition of 'X'}}
+}
+
 namespace PR14577 {
   template
   struct Outer {


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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Nico Weber via cfe-commits
thakis added a comment.

Ah, you answered my question while I was writing it.

Doesn't that mean whatever feature this test is testing is broken on Windows?


http://reviews.llvm.org/D20369



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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Nico Weber via cfe-commits
thakis added inline comments.


Comment at: unittests/ASTMatchers/ASTMatchersNodeTest.cpp:187
@@ +186,3 @@
+   "}",
+   unresolvedLookupExpr(), true,
+   "-fno-delayed-template-parsing"));

Doesn't referencing `bar()` after it's defined help too? If not, this is cool 
too -- maybe add a `/*ExpectMatch=*/` in front of `true` so it's clear what the 
true means.


http://reviews.llvm.org/D20369



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


Re: [PATCH] D20321: [Clang][AVX512][intrinsics] Fix vperm intrinsics.

2016-05-18 Thread Craig Topper via cfe-commits
craig.topper added a subscriber: craig.topper.
craig.topper requested changes to this revision.
craig.topper added a reviewer: craig.topper.
craig.topper added a comment.
This revision now requires changes to proceed.

Don't the type casts need to be changed too? For example permutexvar_pd has the 
index as __v8df.


Repository:
  rL LLVM

http://reviews.llvm.org/D20321



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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Haojian Wu via cfe-commits
hokein added a comment.

In http://reviews.llvm.org/D20369#433141, @thakis wrote:

>   Maybe you could change Matcher.UnresolvedLookupExpr to call bar() from a 
> new function foo() so that it gets instantiated?


This will break the intention of the testcase. We don't want the function get 
instantiated here. Update the code now only restrict 
`-fno-delayed-template-parsing` in this test.


http://reviews.llvm.org/D20369



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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

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

I like this approach much better, thank you. LGTM!


http://reviews.llvm.org/D20369



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


Re: [PATCH] D20198: clang-format: [JS] sort ES6 imports.

2016-05-18 Thread Manuel Klimek via cfe-commits
klimek added a comment.

We're getting there. Couple of nits left.



Comment at: lib/Format/SortJavaScriptImports.cpp:94-97
@@ +93,6 @@
+// Side effect imports might be ordering sensitive. Consider them equal so
+// that they maintain their relative order in the stable sort below.
+// This retains transitivity because LHS.Category == RHS.Category here.
+return false;
+  // Empty URLs sort *last* (for export {...};).
+  if (LHS.URL.empty() != RHS.URL.empty())

Yea, completely missed that the != above.


Comment at: lib/Format/SortJavaScriptImports.cpp:128
@@ +127,3 @@
+SmallVector References;
+parseModuleReferences(Keywords, AnnotatedLines, References);
+

Return by value.


Comment at: lib/Format/SortJavaScriptImports.cpp:216-217
@@ +215,4 @@
+break;
+  Current = Line->First;
+  LineEnd = Line->Last;
+  skipComments();

Both of these are used only once, perhaps inline?


Comment at: lib/Format/SortJavaScriptImports.cpp:229
@@ +228,3 @@
+  Reference.Range.setBegin(Start);
+  Start = SourceLocation();
+  if (!parseModuleReference(Keywords, Reference))

I'd put that down after References.push_back so calculating the Reference is at 
least a single flow.


http://reviews.llvm.org/D20198



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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis.
thakis added a comment.

I agree with Aaron. Maybe you could change Matcher.UnresolvedLookupExpr to call 
bar() from a new function foo() so that it gets instantiated?


http://reviews.llvm.org/D20369



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


r269934 - [Hexagon] Recognize "q" and "v" in inline-asm as register constraints

2016-05-18 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Wed May 18 09:56:14 2016
New Revision: 269934

URL: http://llvm.org/viewvc/llvm-project?rev=269934=rev
Log:
[Hexagon] Recognize "q" and "v" in inline-asm as register constraints

Clang follow-up to r269933.

Added:
cfe/trunk/test/CodeGen/hexagon-inline-asm.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=269934=269933=269934=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed May 18 09:56:14 2016
@@ -6016,7 +6016,16 @@ public:
 
   bool validateAsmConstraint(const char *,
  TargetInfo::ConstraintInfo ) const override {
-return true;
+switch (*Name) {
+  case 'v':
+  case 'q':
+if (HasHVX) {
+  Info.setAllowsRegister();
+  return true;
+}
+break;
+}
+return false;
   }
 
   void getTargetDefines(const LangOptions ,

Added: cfe/trunk/test/CodeGen/hexagon-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/hexagon-inline-asm.c?rev=269934=auto
==
--- cfe/trunk/test/CodeGen/hexagon-inline-asm.c (added)
+++ cfe/trunk/test/CodeGen/hexagon-inline-asm.c Wed May 18 09:56:14 2016
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple hexagon-unknown-elf -target-feature +hvx -emit-llvm 
-o - %s | FileCheck %s
+
+typedef int v64 __attribute__((__vector_size__(64)))
+__attribute__((aligned(64)));
+
+void foo(v64 v0, v64 v1, v64 *p) {
+  v64 q0;
+  asm ("%0 = vgtw(%1.w,%2.w)" : "=q"(q0) : "v"(v0), "v"(v1));
+// CHECK: call <16 x i32> asm "$0 = vgtw($1.w,$2.w)", "=q,v,v"(<16 x 
i32>{{.*}}, <16 x i32>{{.*}})
+  *p = q0;
+}


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


Re: [PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Hrm, I kind of worry about this masking bugs when delayed template parsing is 
enabled (which it is by default on MSVC-built versions of clang).


http://reviews.llvm.org/D20369



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


Re: [PATCH] D20366: [ASTMatcher] Make dump_ast_matchers.py executable.

2016-05-18 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20366#433103, @hokein wrote:

> In http://reviews.llvm.org/D20366#433054, @aaron.ballman wrote:
>
> > Yeah, I'm not certain either (I've never used phab for reviewing this sort 
> > of thing). I would prefer this to be 0744 so that it is not group or world 
> > executable.
>
>
> No idea on this now. I tried `chmod 744` either in `git.core.filemode=true` 
> or in  `git.core.filemode=false`, the git always shows 755 in the commit :(.


It sounds like this may be a git thing and what you really want is 
svn:executable. However, the documentation doesn't specify *what* permissions 
that file winds up with 
(http://svnbook.red-bean.com/en/1.7/svn.advanced.props.file-portability.html#svn.advanced.props.special.executable).

What's the harm in leaving the props at 0644?


http://reviews.llvm.org/D20366



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


[PATCH] D20369: [ASTMatcher] Fix a ASTMatcher test failure on Windows.

2016-05-18 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added reviewers: alexfh, aaron.ballman.
hokein added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

http://reviews.llvm.org/D20369

Files:
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -79,6 +79,8 @@
   // Some tests need rtti/exceptions on
   Args.push_back("-frtti");
   Args.push_back("-fexceptions");
+  // Keep the same template handling behavior on Windows and Linux.
+  Args.push_back("-fno-delayed-template-parsing");
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {


Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -79,6 +79,8 @@
   // Some tests need rtti/exceptions on
   Args.push_back("-frtti");
   Args.push_back("-fexceptions");
+  // Keep the same template handling behavior on Windows and Linux.
+  Args.push_back("-fno-delayed-template-parsing");
   if (!runToolOnCodeWithArgs(
   Factory->create(), Code, Args, Filename, "clang-tool",
   std::make_shared(), VirtualMappedFiles)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >