[PATCH] D11757: Propagate SourceLocations through to get a Loc on float_cast_overflow

2015-08-05 Thread Filipe Cabecinhas
filcab created this revision.
filcab added reviewers: rsmith, ABataev, rjmccall.
filcab added a subscriber: cfe-commits.

float_cast_overflow is the only UBSan check without a source location attached.
This patch propagates SourceLocations where necessary to get them to the
EmitCheck() call.

http://reviews.llvm.org/D11757

Files:
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/catch-undef-behavior.c

Index: test/CodeGen/catch-undef-behavior.c
===
--- test/CodeGen/catch-undef-behavior.c
+++ test/CodeGen/catch-undef-behavior.c
@@ -19,6 +19,17 @@
 // CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i64 4, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
+// CHECK-UBSAN: @[[LINE_1000:.*]] = {{.*}}, i32 1000, i32 10 {{.*}} @{{.*}} }
+// CHECK-UBSAN: @[[FP16:.*]] = private unnamed_addr constant { i16, i16, [9 x i8] } { i16 1, i16 16, [9 x i8] c"'__fp16'\00" }
+// CHECK-UBSAN: @[[LINE_1100:.*]] = {{.*}}, i32 1100, i32 8 {{.*}} @{{.*}} }
+// CHECK-UBSAN: @[[LINE_1200:.*]] = {{.*}}, i32 1200, i32 10 {{.*}} @{{.*}} }
+// CHECK-UBSAN: @[[LINE_1300:.*]] = {{.*}}, i32 1300, i32 10 {{.*}} @{{.*}} }
+// CHECK-UBSAN: @[[LINE_1400:.*]] = {{.*}}, i32 1400, i32 10 {{.*}} @{{.*}} }
+// Make sure we check the fp16 type_mismatch data so we can easily match the signed char float_cast_overflow
+// CHECK-UBSAN: @[[LINE_1500:.*]] = {{.*}}, i32 1500, i32 10 {{.*}} @[[FP16]], {{.*}} }
+// CHECK-UBSAN: @[[SCHAR:.*]] = private unnamed_addr constant { i16, i16, [14 x i8] } { i16 0, i16 7, [14 x i8] c"'signed char'\00" }
+// CHECK-UBSAN: @[[LINE_1500:.*]] = {{.*}}, i32 1500, i32 10 {{.*}} @[[FP16]], {{.*}} }
+// CHECK-UBSAN: @[[LINE_1600:.*]] = {{.*}}, i32 1600, i32 10 {{.*}} @{{.*}} }
 
 // CHECK-NULL: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}}
 
@@ -209,10 +220,11 @@
   // CHECK-COMMON: %[[INBOUNDS:.*]] = icmp ule i128 %{{.*}}, -20282409603651670423947251286016
   // CHECK-COMMON-NEXT: br i1 %[[INBOUNDS]]
 
-  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(
+  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1000]] to i8*),
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW]]
   // CHECK-TRAP-NEXT: unreachable
+#line 1000
   return n;
 }
 
@@ -223,10 +235,11 @@
   // CHECK-COMMON: %[[INBOUNDS:.*]] = and i1 %[[GE]], %[[LE]]
   // CHECK-COMMON-NEXT: br i1 %[[INBOUNDS]]
 
-  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(
+  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1100]] to i8*),
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW]]
   // CHECK-TRAP-NEXT: unreachable
+#line 1100
   *p = n;
 }
 
@@ -239,10 +252,11 @@
 
   // CHECK-UBSAN: %[[CAST:.*]] = bitcast float %[[F]] to i32
   // CHECK-UBSAN: %[[ARG:.*]] = zext i32 %[[CAST]] to i64
-  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow({{.*}}, i64 %[[ARG]]
+  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1200]] to i8*), i64 %[[ARG]]
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW]]
   // CHECK-TRAP-NEXT: unreachable
+#line 1200
   return f;
 }
 
@@ -257,10 +271,11 @@
 
   // CHECK-UBSAN: store x86_fp80 %[[F]], x86_fp80* %[[ALLOCA:.*]], !nosanitize
   // CHECK-UBSAN: %[[ARG:.*]] = ptrtoint x86_fp80* %[[ALLOCA]] to i64
-  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow({{.*}}, i64 %[[ARG]]
+  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1300]] to i8*), i64 %[[ARG]]
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW]]
   // CHECK-TRAP-NEXT: unreachable
+#line 1300
   return ld;
 }
 
@@ -271,10 +286,11 @@
   // CHECK-COMMON: %[[INBOUNDS:.*]] = and i1 %[[GE]], %[[LE]]
   // CHECK-COMMON-NEXT: br i1 %[[INBOUNDS]]
 
-  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(
+  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1400]] to i8*),
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW]]
   // CHECK-TRAP-NEXT: unreachable
+#line 1400
   return f;
 }
 
@@ -285,10 +301,11 @@
   // CHECK-COMMON: %[[INBOUNDS:.*]] = and i1 %[[GE]], %[[LE]]
   // CHECK-COMMON-NEXT: br i1 %[[INBOUNDS]]
 
-  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(
+  // CHECK-UBSAN: call void @__ubsan_handle_float_cast_overflow(i8* bitcast ({{.*}} @[[LINE_1500]] to i8*),
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW]]
   // CHECK-TRAP-NEXT: unreachable
+#line 1500
   return *p;
 }
 
@@ -301,10 +318,11 @@
   // CHECK-COMMON: %[[INBOUNDS:.*]] = xor i1 %[[OUTOFBOUNDS]], true
   // CHECK-COMMON-NEXT: br i

Re: [PATCH] D11738: Add new llvm.loop.unroll.enable metadata which is now generated by "#pragma unroll" directive

2015-08-05 Thread Tyler Nowicki
tyler.nowicki added a subscriber: tyler.nowicki.
tyler.nowicki added a comment.

Hi Mark,

The patch LGTM!

Tyler


http://reviews.llvm.org/D11738



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


r244025 - [Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC.

2015-08-05 Thread Benjamin Kramer
Author: d0k
Date: Wed Aug  5 04:40:04 2015
New Revision: 244025

URL: http://llvm.org/viewvc/llvm-project?rev=244025&view=rev
Log:
[Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC.

Modified:
cfe/trunk/include/clang/AST/CommentSema.h

Modified: cfe/trunk/include/clang/AST/CommentSema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentSema.h?rev=244025&r1=244024&r2=244025&view=diff
==
--- cfe/trunk/include/clang/AST/CommentSema.h (original)
+++ cfe/trunk/include/clang/AST/CommentSema.h Wed Aug  5 04:40:04 2015
@@ -79,12 +79,8 @@ public:
   /// Returns a copy of array, owned by Sema's allocator.
   template
   ArrayRef copyArray(ArrayRef Source) {
-size_t Size = Source.size();
-if (Size != 0) {
-  T *Mem = Allocator.Allocate(Size);
-  std::uninitialized_copy(Source.begin(), Source.end(), Mem);
-  return llvm::makeArrayRef(Mem, Size);
-}
+if (!Source.empty())
+  return Source.copy(Allocator);
 return None;
   }
 


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


r244026 - [AST] ArrayRefize template argument packs. No functionality change intended.

2015-08-05 Thread Benjamin Kramer
Author: d0k
Date: Wed Aug  5 04:40:22 2015
New Revision: 244026

URL: http://llvm.org/viewvc/llvm-project?rev=244026&view=rev
Log:
[AST] ArrayRefize template argument packs. No functionality change intended.

Modified:
cfe/trunk/include/clang/AST/TemplateBase.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/TemplateBase.cpp
cfe/trunk/lib/AST/TemplateName.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/include/clang/AST/TemplateBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=244026&r1=244025&r2=244026&view=diff
==
--- cfe/trunk/include/clang/AST/TemplateBase.h (original)
+++ cfe/trunk/include/clang/AST/TemplateBase.h Wed Aug  5 04:40:22 2015
@@ -198,22 +198,19 @@ public:
   ///
   /// We assume that storage for the template arguments provided
   /// outlives the TemplateArgument itself.
-  TemplateArgument(const TemplateArgument *Args, unsigned NumArgs) {
+  explicit TemplateArgument(ArrayRef Args) {
 this->Args.Kind = Pack;
-this->Args.Args = Args;
-this->Args.NumArgs = NumArgs;
+this->Args.Args = Args.data();
+this->Args.NumArgs = Args.size();
   }
 
-  static TemplateArgument getEmptyPack() {
-return TemplateArgument((TemplateArgument*)nullptr, 0);
-  }
+  static TemplateArgument getEmptyPack() { return TemplateArgument(None); }
 
   /// \brief Create a new template argument pack by copying the given set of
   /// template arguments.
   static TemplateArgument CreatePackCopy(ASTContext &Context,
- const TemplateArgument *Args,
- unsigned NumArgs);
-  
+ ArrayRef Args);
+
   /// \brief Return the kind of stored template argument.
   ArgKind getKind() const { return (ArgKind)TypeOrValue.Kind; }
 

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=244026&r1=244025&r2=244026&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Aug  5 04:40:22 2015
@@ -4311,7 +4311,7 @@ ASTContext::getCanonicalTemplateArgument
A != AEnd; (void)++A, ++Idx)
 CanonArgs[Idx] = getCanonicalTemplateArgument(*A);
 
-  return TemplateArgument(CanonArgs, Arg.pack_size());
+  return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.pack_size()));
 }
   }
 

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=244026&r1=244025&r2=244026&view=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Aug  5 04:40:22 2015
@@ -2210,11 +2210,9 @@ ASTNodeImporter::ImportTemplateArgument(
 ToPack.reserve(From.pack_size());
 if (ImportTemplateArguments(From.pack_begin(), From.pack_size(), ToPack))
   return TemplateArgument();
-
-TemplateArgument *ToArgs 
-  = new (Importer.getToContext()) TemplateArgument[ToPack.size()];
-std::copy(ToPack.begin(), ToPack.end(), ToArgs);
-return TemplateArgument(ToArgs, ToPack.size());
+
+return TemplateArgument(
+llvm::makeArrayRef(ToPack).copy(Importer.getToContext()));
   }
   }
   

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=244026&r1=244025&r2=244026&view=diff
==
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Wed Aug  5 04:40:22 2015
@@ -240,8 +240,8 @@ static void GenerateInjectedTemplateArgs
 }
 
 if ((*Param)->isTemplateParameterPack())
-  Arg = TemplateArgument::CreatePackCopy(Context, &Arg, 1);
-
+  Arg = TemplateArgument::CreatePackCopy(Context, Arg);
+
 *Args++ = Arg;
   }
 }

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=244026&r1=244025&r2=244026&view=diff
==
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Wed Aug  5 04:40:22 2015
@@ -1443,7 +1443,7 @@ SubstNonTypeTemplateParmPackExpr(QualTyp
 NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) { }
 
 TemplateArgument SubstNonTypeTemplateParmPackExpr::getArgumentPack() const {
-  return TemplateArgument(Arguments, NumArguments);
+  return TemplateArgument(llvm:

r244024 - [Parse] ArrayRefize PragmaLoopHintInfo. No functionality change.

2015-08-05 Thread Benjamin Kramer
Author: d0k
Date: Wed Aug  5 04:39:57 2015
New Revision: 244024

URL: http://llvm.org/viewvc/llvm-project?rev=244024&view=rev
Log:
[Parse] ArrayRefize PragmaLoopHintInfo. No functionality change.

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

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=244024&r1=244023&r2=244024&view=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Wed Aug  5 04:39:57 2015
@@ -745,9 +745,7 @@ bool Parser::HandlePragmaMSInitSeg(Strin
 struct PragmaLoopHintInfo {
   Token PragmaName;
   Token Option;
-  Token *Toks;
-  size_t TokSize;
-  PragmaLoopHintInfo() : Toks(nullptr), TokSize(0) {}
+  ArrayRef Toks;
 };
 
 static std::string PragmaLoopHintString(Token PragmaName, Token Option) {
@@ -780,8 +778,8 @@ bool Parser::HandlePragmaLoopHint(LoopHi
   Hint.OptionLoc = IdentifierLoc::create(
   Actions.Context, Info->Option.getLocation(), OptionInfo);
 
-  Token *Toks = Info->Toks;
-  size_t TokSize = Info->TokSize;
+  const Token *Toks = Info->Toks.data();
+  size_t TokSize = Info->Toks.size();
 
   // Return a valid hint if pragma unroll or nounroll were specified
   // without an argument.
@@ -1928,11 +1926,7 @@ static bool ParseLoopHintValue(Preproces
   EOFTok.setLocation(Tok.getLocation());
   ValueList.push_back(EOFTok); // Terminates expression for parsing.
 
-  Token *TokenArray = (Token *)PP.getPreprocessorAllocator().Allocate(
-  ValueList.size() * sizeof(Token), llvm::alignOf());
-  std::copy(ValueList.begin(), ValueList.end(), TokenArray);
-  Info.Toks = TokenArray;
-  Info.TokSize = ValueList.size();
+  Info.Toks = 
llvm::makeArrayRef(ValueList).copy(PP.getPreprocessorAllocator());
 
   Info.PragmaName = PragmaName;
   Info.Option = Option;


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


r244027 - [AST] ArrayRefize BlockDecl::setCaptures. No functionality change intended.

2015-08-05 Thread Benjamin Kramer
Author: d0k
Date: Wed Aug  5 04:40:35 2015
New Revision: 244027

URL: http://llvm.org/viewvc/llvm-project?rev=244027&view=rev
Log:
[AST] ArrayRefize BlockDecl::setCaptures. No functionality change intended.

Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=244027&r1=244026&r2=244027&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Aug  5 04:40:35 2015
@@ -3491,7 +3491,7 @@ private:
   Stmt *Body;
   TypeSourceInfo *SignatureAsWritten;
 
-  Capture *Captures;
+  const Capture *Captures;
   unsigned NumCaptures;
 
   unsigned ManglingNumber;
@@ -3597,10 +3597,8 @@ public:
 
   bool capturesVariable(const VarDecl *var) const;
 
-  void setCaptures(ASTContext &Context,
-   const Capture *begin,
-   const Capture *end,
-   bool capturesCXXThis);
+  void setCaptures(ASTContext &Context, ArrayRef Captures,
+   bool CapturesCXXThis);
 
unsigned getBlockManglingNumber() const {
  return ManglingNumber;

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=244027&r1=244026&r2=244027&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Aug  5 04:40:35 2015
@@ -3757,26 +3757,17 @@ void BlockDecl::setParams(ArrayRef Captures,
+bool CapturesCXXThis) {
+  this->CapturesCXXThis = CapturesCXXThis;
+  this->NumCaptures = Captures.size();
 
-  if (begin == end) {
-NumCaptures = 0;
-Captures = nullptr;
+  if (Captures.empty()) {
+this->Captures = nullptr;
 return;
   }
 
-  NumCaptures = end - begin;
-
-  // Avoid new Capture[] because we don't want to provide a default
-  // constructor.
-  size_t allocationSize = NumCaptures * sizeof(Capture);
-  void *buffer = Context.Allocate(allocationSize, /*alignment*/sizeof(void*));
-  memcpy(buffer, begin, allocationSize);
-  Captures = static_cast(buffer);
+  this->Captures = Captures.copy(Context).data();
 }
 
 bool BlockDecl::capturesVariable(const VarDecl *variable) const {

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=244027&r1=244026&r2=244027&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Aug  5 04:40:35 2015
@@ -11397,8 +11397,7 @@ ExprResult Sema::ActOnBlockStmtExpr(Sour
   Cap.isNested(), Cap.getInitExpr());
 Captures.push_back(NewCap);
   }
-  BSI->TheDecl->setCaptures(Context, Captures.begin(), Captures.end(),
-BSI->CXXThisCaptureIndex != 0);
+  BSI->TheDecl->setCaptures(Context, Captures, BSI->CXXThisCaptureIndex != 0);
 
   // If the user wrote a function type in some form, try to use that.
   if (!BSI->FunctionType.isNull()) {

Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=244027&r1=244026&r2=244027&view=diff
==
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Wed Aug  5 04:40:35 2015
@@ -1700,8 +1700,7 @@ ExprResult Sema::BuildBlockForLambdaConv
 SC_None);
   BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,
  /*Nested=*/false, /*Copy=*/Init.get());
-  Block->setCaptures(Context, &Capture, &Capture + 1, 
- /*CapturesCXXThis=*/false);
+  Block->setCaptures(Context, Capture, /*CapturesCXXThis=*/false);
 
   // Add a fake function body to the block. IR generation is responsible
   // for filling in the actual body, which cannot be expressed as an AST.

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=244027&r1=244026&r2=244027&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Aug  5 04:40:35 2015
@@ -1304,8 +1304,7 @@ void ASTDeclReader::VisitBlockDecl(Block
 
 captures.push_back(BlockDecl::Capture(decl, byRef, nested, copyExpr));
   }
-  BD->setCaptures(Reader.getContext(), captures.begin(),
-  captures.end(), capturesCXXThis);
+  BD->setCaptures(Reader.getContext(), cap

r244028 - [AST] ArrayRefize template param list info setters. No functionality change intended.

2015-08-05 Thread Benjamin Kramer
Author: d0k
Date: Wed Aug  5 04:40:49 2015
New Revision: 244028

URL: http://llvm.org/viewvc/llvm-project?rev=244028&view=rev
Log:
[AST] ArrayRefize template param list info setters. No functionality change 
intended.

Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=244028&r1=244027&r2=244028&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Aug  5 04:40:49 2015
@@ -572,8 +572,7 @@ struct QualifierInfo {
   /// setTemplateParameterListsInfo - Sets info about "outer" template
   /// parameter lists.
   void setTemplateParameterListsInfo(ASTContext &Context,
- unsigned NumTPLists,
- TemplateParameterList **TPLists);
+ ArrayRef 
TPLists);
 
 private:
   // Copy constructor and copy assignment are disabled.
@@ -658,8 +657,8 @@ public:
 assert(index < getNumTemplateParameterLists());
 return getExtInfo()->TemplParamLists[index];
   }
-  void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists,
- TemplateParameterList **TPLists);
+  void setTemplateParameterListsInfo(ASTContext &Context,
+ ArrayRef 
TPLists);
 
   SourceLocation getTypeSpecStartLoc() const;
 
@@ -2983,8 +2982,8 @@ public:
 assert(i < getNumTemplateParameterLists());
 return getExtInfo()->TemplParamLists[i];
   }
-  void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists,
- TemplateParameterList **TPLists);
+  void setTemplateParameterListsInfo(ASTContext &Context,
+ ArrayRef 
TPLists);
 
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=244028&r1=244027&r2=244028&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Aug  5 04:40:49 2015
@@ -1653,11 +1653,9 @@ void DeclaratorDecl::setQualifierInfo(Ne
   }
 }
 
-void
-DeclaratorDecl::setTemplateParameterListsInfo(ASTContext &Context,
-  unsigned NumTPLists,
-  TemplateParameterList **TPLists) 
{
-  assert(NumTPLists > 0);
+void DeclaratorDecl::setTemplateParameterListsInfo(
+ASTContext &Context, ArrayRef TPLists) {
+  assert(!TPLists.empty());
   // Make sure the extended decl info is allocated.
   if (!hasExtInfo()) {
 // Save (non-extended) type source info pointer.
@@ -1668,7 +1666,7 @@ DeclaratorDecl::setTemplateParameterList
 getExtInfo()->TInfo = savedTInfo;
   }
   // Set the template parameter lists info.
-  getExtInfo()->setTemplateParameterListsInfo(Context, NumTPLists, TPLists);
+  getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);
 }
 
 SourceLocation DeclaratorDecl::getOuterLocStart() const {
@@ -1726,13 +1724,8 @@ SourceRange DeclaratorDecl::getSourceRan
   return SourceRange(getOuterLocStart(), RangeEnd);
 }
 
-void
-QualifierInfo::setTemplateParameterListsInfo(ASTContext &Context,
- unsigned NumTPLists,
- TemplateParameterList **TPLists) {
-  assert((NumTPLists == 0 || TPLists != nullptr) &&
- "Empty array of template parameters with positive size!");
-
+void QualifierInfo::setTemplateParameterListsInfo(
+ASTContext &Context, ArrayRef TPLists) {
   // Free previous template parameters (if any).
   if (NumTemplParamLists > 0) {
 Context.Deallocate(TemplParamLists);
@@ -1740,10 +1733,10 @@ QualifierInfo::setTemplateParameterLists
 NumTemplParamLists = 0;
   }
   // Set info on matched template parameter lists (if any).
-  if (NumTPLists > 0) {
-TemplParamLists = new (Context) TemplateParameterList*[NumTPLists];
-NumTemplParamLists = NumTPLists;
-std::copy(TPLists, TPLists + NumTPLists, TemplParamLists);
+  if (!TPLists.empty()) {
+TemplParamLists = new (Context) TemplateParameterList *[TPLists.size()];
+NumTemplParamLists = TPLists.size();
+std::copy(TPLists.begin(), TPLists.end(), TemplParamLists);
   }
 }
 
@@ -3482,16 +3475,15 @@ void TagDecl::setQualifierInfo(NestedNam
   }
 }
 
-void TagDecl::setTemplateParameterListsInfo(ASTContext &Context,
-unsigned NumTPLists,
-   

Re: [PATCH] D11476: Marked call instruction in thunk function with tail attribute when applicable

2015-08-05 Thread Amjad Aboud
aaboud retitled this revision from "Marked call instruction in thunk function 
with musttail attribute when applicable" to "Marked call instruction in thunk 
function with tail attribute when applicable".
aaboud updated the summary for this revision.
aaboud updated this revision to Diff 31341.

Repository:
  rL LLVM

http://reviews.llvm.org/D11476

Files:
  lib/CodeGen/CGVTables.cpp
  test/CodeGenCXX/microsoft-abi-structors.cpp

Index: lib/CodeGen/CGVTables.cpp
===
--- lib/CodeGen/CGVTables.cpp
+++ lib/CodeGen/CGVTables.cpp
@@ -312,6 +312,8 @@
   // Consider return adjustment if we have ThunkInfo.
   if (Thunk && !Thunk->Return.isEmpty())
 RV = PerformReturnAdjustment(*this, ResultType, RV, *Thunk);
+  else if (llvm::CallInst* Call = dyn_cast(CallOrInvoke))
+Call->setTailCallKind(llvm::CallInst::TCK_Tail);
 
   // Emit return.
   if (!ResultType->isVoidType() && Slot.isNull())
Index: test/CodeGenCXX/microsoft-abi-structors.cpp
===
--- test/CodeGenCXX/microsoft-abi-structors.cpp
+++ test/CodeGenCXX/microsoft-abi-structors.cpp
@@ -176,7 +176,7 @@
 //  Do an adjustment from B* to C*.
 // DTORS2:   getelementptr i8, i8* %{{.*}}, i32 -4
 // DTORS2:   bitcast i8* %{{.*}} to %"struct.dtor_in_second_nvbase::C"*
-// DTORS2:   %[[CALL:.*]] = call x86_thiscallcc i8* 
@"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z"
+// DTORS2:   %[[CALL:.*]] = tail call x86_thiscallcc i8* 
@"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z"
 // DTORS2:   ret i8* %[[CALL]]
 
 }


Index: lib/CodeGen/CGVTables.cpp
===
--- lib/CodeGen/CGVTables.cpp
+++ lib/CodeGen/CGVTables.cpp
@@ -312,6 +312,8 @@
   // Consider return adjustment if we have ThunkInfo.
   if (Thunk && !Thunk->Return.isEmpty())
 RV = PerformReturnAdjustment(*this, ResultType, RV, *Thunk);
+  else if (llvm::CallInst* Call = dyn_cast(CallOrInvoke))
+Call->setTailCallKind(llvm::CallInst::TCK_Tail);
 
   // Emit return.
   if (!ResultType->isVoidType() && Slot.isNull())
Index: test/CodeGenCXX/microsoft-abi-structors.cpp
===
--- test/CodeGenCXX/microsoft-abi-structors.cpp
+++ test/CodeGenCXX/microsoft-abi-structors.cpp
@@ -176,7 +176,7 @@
 //  Do an adjustment from B* to C*.
 // DTORS2:   getelementptr i8, i8* %{{.*}}, i32 -4
 // DTORS2:   bitcast i8* %{{.*}} to %"struct.dtor_in_second_nvbase::C"*
-// DTORS2:   %[[CALL:.*]] = call x86_thiscallcc i8* @"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z"
+// DTORS2:   %[[CALL:.*]] = tail call x86_thiscallcc i8* @"\01??_GC@dtor_in_second_nvbase@@UAEPAXI@Z"
 // DTORS2:   ret i8* %[[CALL]]
 
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244036 - Add AST matchers for narrowing constructors that are default, copy, or move constructors, as well as functionality to determine whether a ctor initializer is a base initializer.

2015-08-05 Thread Aaron Ballman
Author: aaronballman
Date: Wed Aug  5 07:11:30 2015
New Revision: 244036

URL: http://llvm.org/viewvc/llvm-project?rev=244036&view=rev
Log:
Add AST matchers for narrowing constructors that are default, copy, or move 
constructors, as well as functionality to determine whether a ctor initializer 
is a base initializer.

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

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=244036&r1=244035&r2=244036&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Wed Aug  5 07:11:30 2015
@@ -1460,6 +1460,58 @@ Example matches f(0, 0) (matcher = callE
 
 
 
+MatcherCXXConstructorDecl>isCopyConstructor
+Matches 
constructor declarations that are copy constructors.
+
+Example matches #2, but not #1 or #3 (matcher = 
constructorDecl(isCopyConstructor())
+  struct S {
+S(); // #1
+S(const S &); // #2
+S(S &&); // #3
+  };
+
+
+MatcherCXXConstructorDecl>isDefaultConstructor
+Matches 
constructor declarations that are default constructors.
+
+Example matches #1, but not #2 or #3 (matcher = 
constructorDecl(isDefaultConstructor())
+  struct S {
+S(); // #1
+S(const S &); // #2
+S(S &&); // #3
+  };
+
+
+
+MatcherCXXConstructorDecl>isMoveConstructor
+Matches 
constructor declarations that are move constructors.
+
+Example matches #3, but not #1 or #2 (matcher = 
constructorDecl(isMoveConstructor())
+  struct S {
+S(); // #1
+S(const S &); // #2
+S(S &&); // #3
+  };
+
+
+
+MatcherCXXCtorInitializer>isBaseInitializer
+Matches a 
constructor initializer if it is initializing a base, as opposed to a member.
+
+Given
+  struct B {};
+  struct D : B {
+int I;
+D(int i) : I(i) {}
+  };
+  struct E : B {
+E() : B() {}
+  };
+constructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
+  will match E(), but not match D(int).
+
+
+
 MatcherCXXCtorInitializer>isWritten
 Matches a constructor 
initializer if it is explicitly written in
 code (as opposed to implicitly added by the compiler).

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=244036&r1=244035&r2=244036&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Wed Aug  5 07:11:30 2015
@@ -2632,6 +2632,26 @@ AST_MATCHER(CXXCtorInitializer, isWritte
   return Node.isWritten();
 }
 
+/// \brief Matches a constructor initializer if it is initializing a base, as
+/// opposed to a member.
+///
+/// Given
+/// \code
+///   struct B {};
+///   struct D : B {
+/// int I;
+/// D(int i) : I(i) {}
+///   };
+///   struct E : B {
+/// E() : B() {}
+///   };
+/// \endcode
+/// constructorDecl(hasAnyConstructorInitializer(isBaseInitializer()))
+///   will match E(), but not match D(int).
+AST_MATCHER(CXXCtorInitializer, isBaseInitializer) {
+  return Node.isBaseInitializer();
+}
+
 /// \brief Matches any argument of a call expression or a constructor call
 /// expression.
 ///
@@ -4104,6 +4124,51 @@ AST_MATCHER_P(CXXConstructorDecl, forEac
   return Matched;
 }
 
+/// \brief Matches constructor declarations that are copy constructors.
+///
+/// Given
+/// \code
+///   struct S {
+/// S(); // #1
+/// S(const S &); // #2
+/// S(S &&); // #3
+///   };
+/// \endcode
+/// constructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
+AST_MATCHER(CXXConstructorDecl, isCopyConstructor) {
+  return Node.isCopyConstructor();
+}
+
+/// \brief Matches constructor declarations that are move constructors.
+///
+/// Given
+/// \code
+///   struct S {
+/// S(); // #1
+/// S(const S &); // #2
+/// S(S &&); // #3
+///   };
+/// \endcode
+/// constructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
+AST_MATCHER(CXXConstructorDecl, isMoveConstructor) {
+  return Node.isMoveConstructor();
+}
+
+/// \brief Matches constructor declarations that are default constructors.
+///
+/// Given
+/// \code
+///   struct S {
+/// S(); // #1
+/// S(const S &); // #2
+/// S(S &&); // #3
+///   };
+/// \endcode
+/// constructorDecl(isDefaultConstructor()) will

Re: [PATCH] AST matchers for constructors

2015-08-05 Thread Aaron Ballman
Thank you for correcting what my contacts list hadn't picked up on
yet. ;-) I've committed in r244036.

~Aaron

On Wed, Aug 5, 2015 at 8:04 AM, Manuel Klimek  wrote:
>
>
> On Wed, Aug 5, 2015 at 2:02 PM Manuel Klimek  wrote:
>>
>> LG
>>
>> On Wed, Aug 5, 2015 at 1:54 PM Aaron Ballman 
>> wrote:
>>>
>>> This patch adds AST matchers for narrowing constructors that are
>>> default, copy, or move constructors, as well as functionality to
>>> determine whether a ctor initializer is a base initializer. The patch
>>> also contains requisite tests and documentation changes.
>>>
>>> Thanks!
>>>
>>> ~Aaron
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D11761: [PATCH] clang-query quit command

2015-08-05 Thread Aaron Ballman
aaron.ballman created this revision.
aaron.ballman added reviewers: klimek, alexfh.
aaron.ballman added a subscriber: cfe-commits.

I would like to propose adding a clang-query command called 'quit' that 
terminates the clang-query interactive session. While Ctrl+C works well enough 
to terminate the application, it's not particularly discoverable, and it runs 
into an interesting conflict on Windows 10 where the terminal has received some 
love recently. Ctrl+C will perform a copy operation in the terminal now, 
depending on whether any text is selected or not. Muscle memory has made for 
some annoying mistakes recently for me.

I put together a patch that implements this functionality in terms of 
terminating the query session object.

Thanks!

http://reviews.llvm.org/D11761

Files:
  clang-query/Query.cpp
  clang-query/Query.h
  clang-query/QueryParser.cpp
  clang-query/QuerySession.h
  clang-query/tool/ClangQuery.cpp

Index: clang-query/tool/ClangQuery.cpp
===
--- clang-query/tool/ClangQuery.cpp
+++ clang-query/tool/ClangQuery.cpp
@@ -111,6 +111,8 @@
   QueryRef Q = QueryParser::parse(*Line, QS);
   Q->run(llvm::outs(), QS);
   llvm::outs().flush();
+  if (QS.Terminate)
+break;
 }
   }
 
Index: clang-query/QuerySession.h
===
--- clang-query/QuerySession.h
+++ clang-query/QuerySession.h
@@ -25,11 +25,12 @@
 class QuerySession {
 public:
   QuerySession(llvm::ArrayRef> ASTs)
-  : ASTs(ASTs), OutKind(OK_Diag), BindRoot(true) {}
+  : ASTs(ASTs), OutKind(OK_Diag), BindRoot(true), Terminate(false) {}
 
   llvm::ArrayRef> ASTs;
   OutputKind OutKind;
   bool BindRoot;
+  bool Terminate;
   llvm::StringMap NamedValues;
 };
 
Index: clang-query/QueryParser.cpp
===
--- clang-query/QueryParser.cpp
+++ clang-query/QueryParser.cpp
@@ -142,6 +142,7 @@
   PQK_Match,
   PQK_Set,
   PQK_Unlet,
+  PQK_Quit
 };
 
 enum ParsedQueryVariable {
@@ -181,6 +182,7 @@
   .Case("match", PQK_Match)
   .Case("set", PQK_Set)
   .Case("unlet", PQK_Unlet)
+  .Case("quit", PQK_Quit)
   .Default(PQK_Invalid);
 
   switch (QKind) {
@@ -190,6 +192,9 @@
   case PQK_Help:
 return endQuery(new HelpQuery);
 
+  case PQK_Quit:
+return endQuery(new QuitQuery);
+
   case PQK_Let: {
 StringRef Name = lexWord();
 
Index: clang-query/Query.h
===
--- clang-query/Query.h
+++ clang-query/Query.h
@@ -32,6 +32,7 @@
   QK_Match,
   QK_SetBool,
   QK_SetOutputKind,
+  QK_Quit
 };
 
 class QuerySession;
@@ -76,6 +77,14 @@
   static bool classof(const Query *Q) { return Q->Kind == QK_Help; }
 };
 
+/// Query for "quit".
+struct QuitQuery : Query {
+  QuitQuery() : Query(QK_Quit) {}
+  bool run(llvm::raw_ostream &OS, QuerySession &QS) const override;
+
+  static bool classof(const Query *Q) { return Q->Kind == QK_Quit; }
+};
+
 /// Query for "match MATCHER".
 struct MatchQuery : Query {
   MatchQuery(const ast_matchers::dynamic::DynTypedMatcher &Matcher)
Index: clang-query/Query.cpp
===
--- clang-query/Query.cpp
+++ clang-query/Query.cpp
@@ -44,10 +44,17 @@
 "  set output (diag|print|dump)  "
 "Set whether to print bindings as diagnostics,\n"
 ""
-"AST pretty prints or AST dumps.\n\n";
+"AST pretty prints or AST dumps.\n"
+"  quit  "
+"Terminates the query session.\n\n";
   return true;
 }
 
+bool QuitQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
+  QS.Terminate = true;
+  return true;
+}
+
 namespace {
 
 struct CollectBoundNodes : MatchFinder::MatchCallback {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11761: [PATCH] clang-query quit command

2015-08-05 Thread Manuel Klimek
klimek added a reviewer: pcc.
klimek added a comment.

+pcc for the opinion of the creator :)


http://reviews.llvm.org/D11761



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


Re: [PATCH] D11761: [PATCH] clang-query quit command

2015-08-05 Thread Manuel Klimek
klimek added a comment.

For what it's worth, I think this looks good, mainly curious whether pcc has 
any remarks code-wise.


http://reviews.llvm.org/D11761



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


Re: [PATCH] Fix crash in CheckObjCCircularContainer

2015-08-05 Thread AlexDenisov
Hi guys, any updates?
--
AlexDenisov
Software Engineer, http://lowlevelbits.org

> On 31 Jul 2015, at 22:55, AlexDenisov <1101.deb...@gmail.com> wrote:
> 
>> To clarify, are you saying that the warning may lead to false positives when 
>> used in subclasses ?
> 
> Seems I was wrong.
> Just checked the behaviour with backing storage - it also leads to a circular 
> container problem.
> 
> Also, you can find attachment with a ‘proper’ implementation, which also 
> covers subclassing.
> 
> P.S. I didn’t measure performance, but I think this implementation might have 
> negative impact on the speed.
> --
> AlexDenisov
> Software Engineer, http://lowlevelbits.org
> 
> 
>> On 30 Jul 2015, at 18:18, Argyrios Kyrtzidis  wrote:
>> 
>> 
>>> On Jul 30, 2015, at 1:05 AM, AlexDenisov <1101.deb...@gmail.com> wrote:
>>> 
>>> The patch is a simplest fix for crash when CheckObjCCircularContainer
>>> applies to a message to a ’super’, e.g.:
>>> 
>>> @implementation Foo : NSMutableArray
>>> - foo {
>>> [super addObject:nil];
>>> }
>>> @end
>>> 
>>> 
>>> This is, probably, not a proper fix for the problem,
>>> but initial patch wasn’t intended to apply checks to any kind
>>> of subclassing, because it, imho, over-complicates implementation:
>> 
>> To clarify, are you saying that the warning may lead to false positives when 
>> used in subclasses ?
>> If that’s the case could we just disable it inside collection subclasses, at 
>> least until the false positives can be addressed ?
>> 
>>> 
>>> This particular problem touches subclassing from a class-cluster,
>>> which means that the concrete subclass will have some backing storage, e.g.:
>>> 
>>> @implementation FootableArray : NSMutableArray
>>> {
>>> NSMutableArray *_backingStorage;
>>> }
>>> 
>>> - addObject:(id)object {
>>> [_backingStorage addObject:object];
>>> }
>>> 
>>> @end
>>> 
>>> In this case even adding `self` to `self` would not lead to a circular 
>>> container:
>>> 
>>> - foo {
>>> [self addObject:self]; // puts `self` into the `_backingStorage`
>>> }
>>> 
>>> I would apply this patch as is and postpone a ‘proper and bullet-proof 
>>> implementation’
>>> when I, or somebody who is also interested, will have more time.
>>> 
>>> If there are any questions/suggestions/objections - let’s discuss them.
>>> --
>>> AlexDenisov
>>> Software Engineer, http://lowlevelbits.org
>>> 
>>> 
>>> 
>> 
> 



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH][Solaris] Clang/Driver, stop hardcoding GCC paths in crt/ld.so lookup

2015-08-05 Thread Rafael Espíndola
Please git-clang-format this patch.

+  // /usr/gcc/./lib/gcc/../,

The code appends a triple after the "/lib/gcc". Is the comment missing it?

The inner loop has no version comparison. Are you depending on the
directory iteration order?

Can you add a testcase?

On 28 July 2015 at 12:35, Xan López  wrote:
> Here it is.
>
> On Tue, Jul 28, 2015 at 01:21:06PM +0200, Xan López wrote:
>> On Tue, Jul 28, 2015 at 01:55:23PM +0300, Yaron Keren wrote:
>> > +cfe-commits
>> >
>> > This is a very large Solaris special case in ScanLibDirForGCCTriple which
>> > shares almost no code with the function.
>> > How about splitting it out to a helper function or
>> > making ScanLibDirForGCCTriple virtual and overriding on Solaris?
>>
>> Yep, at least a helper function makes sense, you are right. I'll send
>> another patch with either of those suggestions later today.
>>
>>
>> Xan
>> ___
>> llvm-commits mailing list
>> llvm-comm...@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-comm...@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11582: Fix assertion failure in TransformOpaqueValueExpr

2015-08-05 Thread Rachel Craik
rcraik added a comment.

ping!


http://reviews.llvm.org/D11582



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


Re: [PATCH] D10933: Add new IdentifierNaming check

2015-08-05 Thread Alexander Kornienko
alexfh added a comment.

Some initial comments, mostly style-related. It takes some time to get used to 
the coding style used in LLVM/Clang. One notable thing: though we use `auto` 
sometimes, we don't use the almost-always-auto style. Please see the inline 
comments for specific cases.



Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:63
@@ +62,3 @@
+
+enum StyleConst {
+#define ENUMERATE(v) v,

I'd name this `StyleKind` as most other enums in the LLVM code.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:69
@@ +68,3 @@
+
+static StyleConst const StyleKeys[] = {
+#define ENUMERATE(v) v,

The only use of this array seems to be a simplification of a single loop (the 
other one can iterate over `StyleNames` as per the comment below). I'd remove 
it and instead added a "StyleKindCount" element in the enum and use a normal 
for loop.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:87
@@ +86,3 @@
+  auto const fromString = [](StringRef Str) {
+if (Str.equals("any") || Str.equals("aNy_CasE"))
+  return AnyCase;

This could be written nicer using llvm::StringSwitch.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:87
@@ +86,3 @@
+  auto const fromString = [](StringRef Str) {
+if (Str.equals("any") || Str.equals("aNy_CasE"))
+  return AnyCase;

alexfh wrote:
> This could be written nicer using llvm::StringSwitch.
Not sure why we would need alternative spellings of these options. That seems 
to just add complexity with no benefit.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:105
@@ +104,3 @@
+
+  for (const auto &Key : StyleKeys) {
+NamingStyles.push_back(NamingStyle(

Why not iterate over `StyleNames` here?


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:151
@@ +150,3 @@
+  if (const auto *DeclRef = Result.Nodes.getNodeAs("declref")) {
+auto It = NamingCheckFailures.find(cast(DeclRef->getDecl()));
+if (It == NamingCheckFailures.end())

No need to cast `ValueDecl` returned by `DeclRefExpr::getDecl()` to its base 
class.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:173
@@ +172,3 @@
+
+  auto KindName = "identifier";
+  auto Style = NamingStyle();

Please move the detection of the `KindName` and `Style` to a separate function. 
This method is too large.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:176
@@ +175,3 @@
+
+  if (Result.Nodes.getNodeAs("decl")) {
+if (NamingStyles[Typedef].isSet()) {

Please resolve the node only once (as it's done on line 168) and then just 
check it using `isa<...>(...)`.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:178
@@ +177,3 @@
+if (NamingStyles[Typedef].isSet()) {
+  KindName = "typedef";
+  Style = NamingStyles[Typedef];

Would it be better to have these in a single array next to `StyleNames`? Also, 
this code could return a `StyleKind` (now `StyleConst`), and you would need to 
get the corresponding `NamingStyle` and `KindName` once.

This code would suddenly become much leaner.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:190
@@ +189,3 @@
+  Style = NamingStyles[InlineNamespace];
+
+} else if (NamingStyles[Namespace].isSet()) {

Please remove empty lines before `}`.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:475
@@ +474,3 @@
+
+  auto matchesStyle = [](StringRef Name, NamingStyle Style) {
+static llvm::Regex Matchers[] = {

Please make this a function. This method is too large to define every utility 
function inside it.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:477
@@ +476,3 @@
+static llvm::Regex Matchers[] = {
+llvm::Regex(StringRef("^.*$")),
+llvm::Regex(StringRef("^[a-z][a-z0-9_]*$")),

No need to explicitly convert to `StringRef` here as well.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:505
@@ +504,3 @@
+
+auto fixupWithStyle = [](std::string Name, NamingStyle Style) {
+  static auto Splitter = llvm::Regex(StringRef(

Please make this a function. This method is too large to define every utility 
function inside it.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:505
@@ +504,3 @@
+
+auto fixupWithStyle = [](std::string Name, NamingStyle Style) {
+  static auto Splitter = llvm::Regex(StringRef(

alexfh wrote:
> Please make this a function. This method is too large to define every utility 
> function inside it.
Please make `Name` a StringRef.


Comment at: clang-tidy/readability/IdentifierNamingCh

Re: [PATCH] D10933: Add new IdentifierNaming check

2015-08-05 Thread Beren Minor
berenm added a comment.

Thanks for the review, I will fix the various style issues and come back with 
an updated version.



Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:87
@@ +86,3 @@
+  auto const fromString = [](StringRef Str) {
+if (Str.equals("any") || Str.equals("aNy_CasE"))
+  return AnyCase;

alexfh wrote:
> alexfh wrote:
> > This could be written nicer using llvm::StringSwitch.
> Not sure why we would need alternative spellings of these options. That seems 
> to just add complexity with no benefit.
The idea was to provide a way easier to type than the full names. This may not 
be very useful, and maybe a single simple name for each case scheme would be 
enough.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:178
@@ +177,3 @@
+if (NamingStyles[Typedef].isSet()) {
+  KindName = "typedef";
+  Style = NamingStyles[Typedef];

alexfh wrote:
> Would it be better to have these in a single array next to `StyleNames`? 
> Also, this code could return a `StyleKind` (now `StyleConst`), and you would 
> need to get the corresponding `NamingStyle` and `KindName` once.
> 
> This code would suddenly become much leaner.
The problem is that sometimes, the current code falls back to a more generic 
naming style, but the "kind name" is still trying to describe the original 
declaration.

For example, if no style is defined for methods, then it will try to use a more 
generic "function" style, but the warning will still be "invalid case style for 
method xxx".

Maybe this is superfluous and I can drop it. It don't see many cases anyway (my 
original code was covering more cases - too many - and it seemed sensible at 
that time).


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:512
@@ +511,3 @@
+  StringRef(Name).split(Substrs, "_", -1, false);
+  for (std::string Substr : Substrs) {
+while (!Substr.empty()) {

alexfh wrote:
> I think, this may be a `StringRef`.
I think I had some issues when trying to use StringRef around here, I will 
investigate a bit more.


http://reviews.llvm.org/D10933



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


[libcxx] r244047 - Update some links so that they don't point at the (private) WG21 Wiki

2015-08-05 Thread Marshall Clow
Author: marshall
Date: Wed Aug  5 09:36:42 2015
New Revision: 244047

URL: http://llvm.org/viewvc/llvm-project?rev=244047&view=rev
Log:
Update some links so that they don't point at the (private) WG21 Wiki

Modified:
libcxx/trunk/www/ts1z_status.html

Modified: libcxx/trunk/www/ts1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/ts1z_status.html?rev=244047&r1=244046&r2=244047&view=diff
==
--- libcxx/trunk/www/ts1z_status.html (original)
+++ libcxx/trunk/www/ts1z_status.html Wed Aug  5 09:36:42 2015
@@ -47,10 +47,10 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html";>3940Technical
 Specification - File SystemFile System

 
-   http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/n4273.txt";>4273Uniform
 Container Erasure.Library Fundamentals 2
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4273";>4273Uniform
 Container Erasure.Library Fundamentals 2
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4061";>4061Greatest
 Common Divisor and Least Common Multiple.Library Fundamentals 
2
-   http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/N4257.htm";>4257Delimited
 iterators.Library Fundamentals 2
-   http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/N4282.pdf";>4282The
 World's Dumbest Smart Pointer.Library Fundamentals 2
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4257";>4257Delimited
 iterators.Library Fundamentals 2
+   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4282";>4282The
 World's Dumbest Smart Pointer.Library Fundamentals 2

 
   


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


r244049 - Officially end my reign as owner of the driver.

2015-08-05 Thread Chad Rosier
Author: mcrosier
Date: Wed Aug  5 09:52:01 2015
New Revision: 244049

URL: http://llvm.org/viewvc/llvm-project?rev=244049&view=rev
Log:
Officially end my reign as owner of the driver.

Modified:
cfe/trunk/CODE_OWNERS.TXT

Modified: cfe/trunk/CODE_OWNERS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=244049&r1=244048&r2=244049&view=diff
==
--- cfe/trunk/CODE_OWNERS.TXT (original)
+++ cfe/trunk/CODE_OWNERS.TXT Wed Aug  5 09:52:01 2015
@@ -45,10 +45,6 @@ N: John McCall
 E: rjmcc...@apple.com
 D: Clang LLVM IR generation
 
-N: Chad Rosier
-E: mcros...@codeaurora.org
-D: Compiler driver
-
 N: Richard Smith
 E: rich...@metafoo.co.uk
 D: All parts of Clang not covered by someone else


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


Re: r244049 - Officially end my reign as owner of the driver.

2015-08-05 Thread Aaron Ballman
On Wed, Aug 5, 2015 at 10:52 AM, Chad Rosier  wrote:
> Author: mcrosier
> Date: Wed Aug  5 09:52:01 2015
> New Revision: 244049
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244049&view=rev
> Log:
> Officially end my reign as owner of the driver.

Thank you for all your work with it!

~Aaron

>
> Modified:
> cfe/trunk/CODE_OWNERS.TXT
>
> Modified: cfe/trunk/CODE_OWNERS.TXT
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=244049&r1=244048&r2=244049&view=diff
> ==
> --- cfe/trunk/CODE_OWNERS.TXT (original)
> +++ cfe/trunk/CODE_OWNERS.TXT Wed Aug  5 09:52:01 2015
> @@ -45,10 +45,6 @@ N: John McCall
>  E: rjmcc...@apple.com
>  D: Clang LLVM IR generation
>
> -N: Chad Rosier
> -E: mcros...@codeaurora.org
> -D: Compiler driver
> -
>  N: Richard Smith
>  E: rich...@metafoo.co.uk
>  D: All parts of Clang not covered by someone else
>
>
> ___
> 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


r244051 - Delete trailing whitespace

2015-08-05 Thread Douglas Katzman
Author: dougk
Date: Wed Aug  5 10:08:53 2015
New Revision: 244051

URL: http://llvm.org/viewvc/llvm-project?rev=244051&view=rev
Log:
Delete trailing whitespace

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=244051&r1=244050&r2=244051&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Aug  5 10:08:53 2015
@@ -53,7 +53,7 @@ CompilerInvocationBase::CompilerInvocati
 
 CompilerInvocationBase::CompilerInvocationBase(const CompilerInvocationBase &X)
   : RefCountedBase(),
-LangOpts(new LangOptions(*X.getLangOpts())), 
+LangOpts(new LangOptions(*X.getLangOpts())),
 TargetOpts(new TargetOptions(X.getTargetOpts())),
 DiagnosticOpts(new DiagnosticOptions(X.getDiagnosticOpts())),
 HeaderSearchOpts(new HeaderSearchOptions(X.getHeaderSearchOpts())),
@@ -1369,7 +1369,7 @@ static void ParseLangArgs(LangOptions &O
 .Case("CL1.2", LangStandard::lang_opencl12)
 .Case("CL2.0", LangStandard::lang_opencl20)
 .Default(LangStandard::lang_unspecified);
-
+
 if (OpenCLLangStd == LangStandard::lang_unspecified) {
   Diags.Report(diag::err_drv_invalid_value)
   << A->getAsString(Args) << A->getValue();
@@ -1377,7 +1377,7 @@ static void ParseLangArgs(LangOptions &O
 else
   LangStd = OpenCLLangStd;
   }
-  
+
   CompilerInvocation::setLangDefaults(Opts, IK, LangStd);
 
   // We abuse '-f[no-]gnu-keywords' to force overriding all GNU-extension
@@ -1425,12 +1425,12 @@ static void ParseLangArgs(LangOptions &O
 
 if (Args.hasArg(OPT_fno_objc_infer_related_result_type))
   Opts.ObjCInferRelatedResultType = 0;
-
+
 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
   Opts.ObjCSubscriptingLegacyRuntime =
 (Opts.ObjCRuntime.getKind() == ObjCRuntime::FragileMacOSX);
   }
-
+
   if (Args.hasArg(OPT_fgnu89_inline)) {
 if (Opts.CPlusPlus)
   Diags.Report(diag::err_drv_argument_not_allowed_with) << "-fgnu89-inline"
@@ -1583,7 +1583,7 @@ static void ParseLangArgs(LangOptions &O
   Opts.PIELevel = getLastArgIntValue(Args, OPT_pie_level, 0, Diags);
   Opts.Static = Args.hasArg(OPT_static_define);
   Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);
-  Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple 
+  Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple
 || Args.hasArg(OPT_fdump_record_layouts);
   Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
   Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking);
@@ -1627,7 +1627,7 @@ static void ParseLangArgs(LangOptions &O
   .Case("yes", LangOptions::ASMM_On)
   .Default(255)) {
 default:
-  Diags.Report(diag::err_drv_invalid_value) 
+  Diags.Report(diag::err_drv_invalid_value)
 << "-faddress-space-map-mangling=" << A->getValue();
   break;
 case LangOptions::ASMM_Target:
@@ -1912,7 +1912,7 @@ bool CompilerInvocation::CreateFromArgs(
   }
   // FIXME: ParsePreprocessorArgs uses the FileManager to read the contents of
   // PCH file and find the original header name. Remove the need to do that in
-  // ParsePreprocessorArgs and remove the FileManager 
+  // ParsePreprocessorArgs and remove the FileManager
   // parameters from the function and the "FileManager.h" #include.
   FileManager FileMgr(Res.getFileSystemOpts());
   ParsePreprocessorArgs(Res.getPreprocessorOpts(), Args, FileMgr, Diags);
@@ -1927,14 +1927,14 @@ namespace {
 SmallVector Data;
 unsigned CurBit;
 uint64_t CurValue;
-
+
   public:
 ModuleSignature() : CurBit(0), CurValue(0) { }
-
+
 void add(uint64_t Value, unsigned Bits);
 void add(StringRef Value);
 void flush();
-
+
 llvm::APInt getAsInteger() const;
   };
 }
@@ -1945,10 +1945,10 @@ void ModuleSignature::add(uint64_t Value
 CurBit += NumBits;
 return;
   }
-  
+
   // Add the current word.
   Data.push_back(CurValue);
-  
+
   if (CurBit)
 CurValue = Value >> (64-CurBit);
   else
@@ -1959,7 +1959,7 @@ void ModuleSignature::add(uint64_t Value
 void ModuleSignature::flush() {
   if (CurBit == 0)
 return;
-  
+
   Data.push_back(CurValue);
   CurBit = 0;
   CurValue = 0;
@@ -1997,7 +1997,7 @@ std::string CompilerInvocation::getModul
 
   for (StringRef Feature : LangOpts->ModuleFeatures)
 code = hash_combine(code, Feature);
-  
+
   // Extend the signature with the target options.
   code = hash_combine(code, TargetOpts->Triple, TargetOpts->CPU,
   TargetOpts->ABI);
@@ -2009,7 +2009,7 @@ std::string CompilerInvocation::getModul
   const HeaderSearchOptions &hsOpts = getHeaderSearchOpts();
   code = hash_combine(code, ppOpts.UsePredefines, ppOpts.DetailedRecord);
 
-  for (std::vector

r244052 - [SHAVE] uppercase the CHECK prefixes in 'lit' tests. NFC

2015-08-05 Thread Douglas Katzman
Author: dougk
Date: Wed Aug  5 10:08:54 2015
New Revision: 244052

URL: http://llvm.org/viewvc/llvm-project?rev=244052&view=rev
Log:
[SHAVE] uppercase the CHECK prefixes in 'lit' tests. NFC

Modified:
cfe/trunk/test/Driver/shave-toolchain.c

Modified: cfe/trunk/test/Driver/shave-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/shave-toolchain.c?rev=244052&r1=244051&r2=244052&view=diff
==
--- cfe/trunk/test/Driver/shave-toolchain.c (original)
+++ cfe/trunk/test/Driver/shave-toolchain.c Wed Aug  5 10:08:54 2015
@@ -9,17 +9,17 @@
 // The same goes for "moviAsm".
 
 // RUN: %clang -target shave -c -### %s -Icommon 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=movicompile
-// movicompile: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-I" "common"
-// movicompile: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" 
"-a" "-i:common" "-elf"
+// RUN:   | FileCheck %s -check-prefix=MOVICOMPILE
+// MOVICOMPILE: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-I" "common"
+// MOVICOMPILE: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" 
"-a" "-i:common" "-elf"
 
 // RUN: %clang -target shave -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=defines
-// defines: "-D" "EFINE_ME" "-U" "NDEFINE_ME"
+// RUN:   | FileCheck %s -check-prefix=DEFINES
+// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME"
 
 // RUN: %clang -target shave -c -### %s -Icommon -iquote quotepath -isystem 
syspath 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=includes
-// includes: "-iquote" "quotepath" "-isystem" "syspath"
+// RUN:   | FileCheck %s -check-prefix=INCLUDES
+// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath"
 
 // RUN: %clang -target shave -c -### %s -g -fno-inline-functions \
 // RUN: -fno-inline-functions-called-once -Os -Wall \


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


RE: r244049 - Officially end my reign as owner of the driver.

2015-08-05 Thread Chad Rosier
Thanks, Aaron.  I'm fairly proud of the crash diagnostics and script 
generation.  Sadly, there's still much, much more to be done.

-Original Message-
From: aaron.ball...@gmail.com [mailto:aaron.ball...@gmail.com] On Behalf Of 
Aaron Ballman
Sent: Wednesday, August 05, 2015 10:53 AM
To: Chad Rosier
Cc: cfe-commits
Subject: Re: r244049 - Officially end my reign as owner of the driver.

On Wed, Aug 5, 2015 at 10:52 AM, Chad Rosier  wrote:
> Author: mcrosier
> Date: Wed Aug  5 09:52:01 2015
> New Revision: 244049
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244049&view=rev
> Log:
> Officially end my reign as owner of the driver.

Thank you for all your work with it!

~Aaron

>
> Modified:
> cfe/trunk/CODE_OWNERS.TXT
>
> Modified: cfe/trunk/CODE_OWNERS.TXT
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=2440
> 49&r1=244048&r2=244049&view=diff 
> ==
> 
> --- cfe/trunk/CODE_OWNERS.TXT (original)
> +++ cfe/trunk/CODE_OWNERS.TXT Wed Aug  5 09:52:01 2015
> @@ -45,10 +45,6 @@ N: John McCall
>  E: rjmcc...@apple.com
>  D: Clang LLVM IR generation
>
> -N: Chad Rosier
> -E: mcros...@codeaurora.org
> -D: Compiler driver
> -
>  N: Richard Smith
>  E: rich...@metafoo.co.uk
>  D: All parts of Clang not covered by someone else
>
>
> ___
> 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] D10933: Add new IdentifierNaming check

2015-08-05 Thread Alexander Kornienko
alexfh added inline comments.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:87
@@ +86,3 @@
+  auto const fromString = [](StringRef Str) {
+if (Str.equals("any") || Str.equals("aNy_CasE"))
+  return AnyCase;

berenm wrote:
> alexfh wrote:
> > alexfh wrote:
> > > This could be written nicer using llvm::StringSwitch.
> > Not sure why we would need alternative spellings of these options. That 
> > seems to just add complexity with no benefit.
> The idea was to provide a way easier to type than the full names. This may 
> not be very useful, and maybe a single simple name for each case scheme would 
> be enough.
Clang-tidy options are usually read from a file, so minimizing typing is not 
really important.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:178
@@ +177,3 @@
+if (NamingStyles[Typedef].isSet()) {
+  KindName = "typedef";
+  Style = NamingStyles[Typedef];

berenm wrote:
> alexfh wrote:
> > Would it be better to have these in a single array next to `StyleNames`? 
> > Also, this code could return a `StyleKind` (now `StyleConst`), and you 
> > would need to get the corresponding `NamingStyle` and `KindName` once.
> > 
> > This code would suddenly become much leaner.
> The problem is that sometimes, the current code falls back to a more generic 
> naming style, but the "kind name" is still trying to describe the original 
> declaration.
> 
> For example, if no style is defined for methods, then it will try to use a 
> more generic "function" style, but the warning will still be "invalid case 
> style for method xxx".
> 
> Maybe this is superfluous and I can drop it. It don't see many cases anyway 
> (my original code was covering more cases - too many - and it seemed sensible 
> at that time).
> The problem is that sometimes, the current code falls back to a more 
> generic naming style, but the "kind name" is still trying to describe the 
> original declaration.

I see. It might be possible to split the mapping of types to style kinds and 
handling missing styles. E.g. a function can return "Method" (which should be 
SK_Method according to [1], btw) and then a caller would check whether the 
corresponding `NamingStyle` is configured, and if needed fall back to a more 
generic category. WDYT?


[1] 
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly


http://reviews.llvm.org/D10933



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


Re: [PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-05 Thread Ben Langmuir
benlangmuir updated this revision to Diff 31354.
benlangmuir added a comment.

Sorry for the slow response, I somehow missed your original comment.

Add a more cohesive comment.  I don't think we can usefully specify the SDK 
range it affects until a fixed SDK is available (currently it's every SDK that 
has module maps at all).  I'd love to update the comment then.  Ideally at that 
point we could also check the SDK version before applying the hack, but I'm not 
sure it's worth reading the SDK version plist file from disk just for that.  We 
already read this file when creating the module cache hash, but I'd like to 
remove that at some point.


Repository:
  rL LLVM

http://reviews.llvm.org/D11403

Files:
  include/clang/Basic/Module.h
  lib/Basic/Module.cpp
  lib/Lex/ModuleMap.cpp
  test/Modules/Inputs/System/usr/include/assert.h
  test/Modules/Inputs/System/usr/include/module.map
  test/Modules/Inputs/System/usr/include/tcl-private/header.h
  test/Modules/darwin_specific_modulemap_hacks.m

Index: test/Modules/darwin_specific_modulemap_hacks.m
===
--- /dev/null
+++ test/Modules/darwin_specific_modulemap_hacks.m
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -isystem %S/Inputs/System/usr/include -triple x86_64-apple-darwin10 %s -verify -fsyntax-only
+// expected-no-diagnostics
+
+@import Darwin.C.excluded; // no error, header is implicitly 'textual'
+@import Tcl.Private;   // no error, header is implicitly 'textual'
+@import IOKit.avc; // no error, cplusplus requirement removed
+
+#if defined(DARWIN_C_EXCLUDED)
+#error assert.h should be textual
+#elif defined(TCL_PRIVATE)
+#error tcl-private/header.h should be textual
+#endif
+
+#import 
+#import 
+
+#if !defined(DARWIN_C_EXCLUDED)
+#error assert.h missing
+#elif !defined(TCL_PRIVATE)
+#error tcl-private/header.h missing
+#endif
Index: test/Modules/Inputs/System/usr/include/tcl-private/header.h
===
--- /dev/null
+++ test/Modules/Inputs/System/usr/include/tcl-private/header.h
@@ -0,0 +1,2 @@
+// tcl-private/header.h
+#define TCL_PRIVATE 1
Index: test/Modules/Inputs/System/usr/include/module.map
===
--- test/Modules/Inputs/System/usr/include/module.map
+++ test/Modules/Inputs/System/usr/include/module.map
@@ -30,3 +30,25 @@
   header "uses_other_constants.h"
   export *
 }
+
+module Darwin {
+  module C {
+module excluded {
+  requires excluded
+  header "assert.h"
+}
+  }
+}
+
+module Tcl {
+  module Private {
+requires excluded
+umbrella ""
+  }
+}
+
+module IOKit {
+  module avc {
+requires cplusplus
+  }
+}
Index: test/Modules/Inputs/System/usr/include/assert.h
===
--- /dev/null
+++ test/Modules/Inputs/System/usr/include/assert.h
@@ -0,0 +1,2 @@
+// assert.h
+#define DARWIN_C_EXCLUDED 1
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1570,6 +1570,41 @@
 : File->getDir(), ExternLoc);
 }
 
+/// Whether to add the requirement \p Feature to the module \p M.
+///
+/// This preserves backwards compatibility for two hacks in the Darwin system
+/// module map files:
+///
+/// 1. The use of 'requires excluded' to make headers non-modular, which
+///should really be mapped to 'textual' now that we have this feature.  We
+///drop the 'excluded' requirement, and set \p IsRequiresExcludedHack to
+///true.  Later, this bit will be used to map all the headers inside this
+///module to 'textual'.
+///
+///This affects Darwin.C.excluded (for assert.h) and Tcl.Private.
+///
+/// 2. Removes a bogus cplusplus requirement from IOKit.avc.  This requirement
+///was never correct and causes issues now that we check it, so drop it.
+static bool shouldAddRequirement(Module *M, StringRef Feature,
+ bool &IsRequiresExcludedHack) {
+  if (Feature == "excluded" || Feature == "cplusplus") {
+std::string FullName = M->getFullModuleName();
+if (FullName == "Darwin.C.excluded" || FullName == "Tcl.Private") {
+  // We will mark the module contents non-modular. See doc comment for
+  // Module::UsesRequiresExcludedHack.
+  IsRequiresExcludedHack = true;
+  return false;
+} else if (FullName == "IOKit.avc") {
+  // This module was mistakenly marked 'requires cplusplus' in older Darwin
+  // SDK versions. As a backwards compatibility hack, don't add the
+  // requirement.
+  return false;
+}
+  }
+
+  return true;
+}
+
 /// \brief Parse a requires declaration.
 ///
 ///   requires-declaration:
@@ -1605,9 +1640,16 @@
 std::string Feature = Tok.getString();
 consumeToken();
 
-// Add this feature.
-Acti

[PATCH] D11765: [sanitizer] Enable tsan for aarch64

2015-08-05 Thread Adhemerval Zanella
zatrazz created this revision.
zatrazz added reviewers: rengolin, t.p.northover, aemerson, pcc.
zatrazz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

This patch enables the -fsanitizer=thread option for Linux/aarch64.

http://reviews.llvm.org/D11765

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3626,10 +3626,10 @@
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64) {
+  if (IsX86_64 || IsMIPS64)
 Res |= SanitizerKind::Leak;
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  }
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3626,10 +3626,10 @@
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64) {
+  if (IsX86_64 || IsMIPS64)
 Res |= SanitizerKind::Leak;
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  }
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11742: Add -gcodeview and -gdwarf to control which type Clang emits

2015-08-05 Thread Reid Kleckner
rnk marked 2 inline comments as done.


Comment at: test/CodeGen/dwarf-version.c:11
@@ -7,3 +10,3 @@
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
 // RUN: %clang -target i386-pc-solaris -g -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=VER2
 int main (void) {

hans wrote:
> Maybe add %clang_cl invocations here?
I'd rather keep the %clang_cl tests in test/Driver, though.


http://reviews.llvm.org/D11742



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


Re: [PATCH] D11476: Marked call instruction in thunk function with tail attribute when applicable

2015-08-05 Thread Reid Kleckner
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

The patch seems right, but I'm surprised there isn't more test fallout.


Repository:
  rL LLVM

http://reviews.llvm.org/D11476



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


Re: [PATCH] D11743: [CMake] First pass at adding support for clang bootstrap builds to CMake

2015-08-05 Thread Chris Bieneman
beanz updated this revision to Diff 31359.
beanz added a comment.

- Fixed a dependency tracking issue with figuring out when to clear out the 
bootstrap build
- Removed 'bootstrap-install' from the 'bootstrap' target
- Added 'bootstrap-check' and 'bootstrap-check-all' targets


http://reviews.llvm.org/D11743

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -96,6 +96,7 @@
 
   option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
 "Set to ON to force using an old, unsupported host toolchain." OFF)
+  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
 
   include(AddLLVM)
   include(TableGen)
@@ -551,3 +552,76 @@
 ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
 COPYONLY)
 endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+  include(ExternalProject)
+
+  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
+set(cmake_3_4_USES_TERMINAL_OPTIONS)
+  else()
+set(cmake_3_4_USES_TERMINAL_OPTIONS
+  USES_TERMINAL_CONFIGURE 1
+  USES_TERMINAL_BUILD 1
+  USES_TERMINAL_INSTALL 1
+  )
+  endif()
+  
+  set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
+  set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-bins/)
+
+  add_custom_target(bootstrap-clear
+DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+)
+  add_custom_command(
+OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+DEPENDS clang
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E touch 
${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+COMMENT "Clobberring bootstrap build and stamp directories"
+)
+
+  ExternalProject_Add(bootstrap
+DEPENDS clang
+PREFIX bootstrap
+SOURCE_DIR ${CMAKE_SOURCE_DIR}
+STAMP_DIR ${STAMP_DIR}
+BINARY_DIR ${BINARY_DIR}
+CMAKE_ARGS
+# We shouldn't need to set this here, but INSTALL_DIR doesn't
+# seem to work, so instead I'm passing this through
+-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+${CLANG_BOOTSTRAP_CMAKE_ARGS}
+-DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++
+-DCMAKE_C_COMPILER=${CMAKE_BINARY_DIR}/bin/clang
+INSTALL_COMMAND ""
+STEP_TARGETS configure build
+${cmake_3_4_USES_TERMINAL_OPTIONS}
+)
+
+  # exclude really-install from main target
+  set_target_properties(bootstrap PROPERTIES 
_EP_really-install_EXCLUDE_FROM_MAIN On)
+  ExternalProject_Add_Step(bootstrap really-install
+COMMAND ${CMAKE_COMMAND} --build  --target install
+COMMENT "Performing install step for 'bootstrap'"
+DEPENDEES build
+  )
+  ExternalProject_Add_StepTargets(bootstrap really-install)
+  add_custom_target(bootstrap-install DEPENDS bootstrap-really-install)
+
+
+  set(ADDITIONAL_TARGETS_TO_ADD check check-all)
+  foreach(target ${ADDITIONAL_TARGETS_TO_ADD})
+# exclude from main target
+set_target_properties(bootstrap PROPERTIES _EP_${target}_EXCLUDE_FROM_MAIN 
On)
+
+ExternalProject_Add_Step(bootstrap ${target}
+  COMMAND ${CMAKE_COMMAND} --build  --target ${target}
+  COMMENT "Performing ${target} for 'bootstrap'"
+  DEPENDEES configure
+)
+ExternalProject_Add_StepTargets(bootstrap ${target})
+  endforeach()
+endif()


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -96,6 +96,7 @@
 
   option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
 "Set to ON to force using an old, unsupported host toolchain." OFF)
+  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
 
   include(AddLLVM)
   include(TableGen)
@@ -551,3 +552,76 @@
 ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
 COPYONLY)
 endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+  include(ExternalProject)
+
+  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
+set(cmake_3_4_USES_TERMINAL_OPTIONS)
+  else()
+set(cmake_3_4_USES_TERMINAL_OPTIONS
+  USES_TERMINAL_CONFIGURE 1
+  USES_TERMINAL_BUILD 1
+  USES_TERMINAL_INSTALL 1
+  )
+  endif()
+  
+  set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
+  set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-bins/)
+
+  add_custom_target(bootstrap-clear
+DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+)
+  add_custom_command(
+OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+DEPENDS clang
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/bootst

Re: [PATCH] D11360: Proposed patch to prevent the creation of empty (forwarding) blocks resulting from nested ifs.

2015-08-05 Thread Wolfgang Pieb
wolfgangp added a comment.

Ping...


http://reviews.llvm.org/D11360



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


Re: r244049 - Officially end my reign as owner of the driver.

2015-08-05 Thread Ted kremenek
Thanks for all your work on it, Chad.



> On Aug 5, 2015, at 7:52 AM, Chad Rosier  wrote:
> 
> Author: mcrosier
> Date: Wed Aug  5 09:52:01 2015
> New Revision: 244049
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=244049&view=rev
> Log:
> Officially end my reign as owner of the driver.
> 
> Modified:
>cfe/trunk/CODE_OWNERS.TXT
> 
> Modified: cfe/trunk/CODE_OWNERS.TXT
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=244049&r1=244048&r2=244049&view=diff
> ==
> --- cfe/trunk/CODE_OWNERS.TXT (original)
> +++ cfe/trunk/CODE_OWNERS.TXT Wed Aug  5 09:52:01 2015
> @@ -45,10 +45,6 @@ N: John McCall
> E: rjmcc...@apple.com
> D: Clang LLVM IR generation
> 
> -N: Chad Rosier
> -E: mcros...@codeaurora.org
> -D: Compiler driver
> -
> N: Richard Smith
> E: rich...@metafoo.co.uk
> D: All parts of Clang not covered by someone else
> 
> 
> ___
> 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: r244049 - Officially end my reign as owner of the driver.

2015-08-05 Thread Chad Rosier
Thanks, Ted!!

-Original Message-
From: Ted kremenek [mailto:kreme...@apple.com] 
Sent: Wednesday, August 05, 2015 12:40 PM
To: Chad Rosier
Cc: cfe-commits@lists.llvm.org
Subject: Re: r244049 - Officially end my reign as owner of the driver.

Thanks for all your work on it, Chad.



> On Aug 5, 2015, at 7:52 AM, Chad Rosier  wrote:
> 
> Author: mcrosier
> Date: Wed Aug  5 09:52:01 2015
> New Revision: 244049
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=244049&view=rev
> Log:
> Officially end my reign as owner of the driver.
> 
> Modified:
>cfe/trunk/CODE_OWNERS.TXT
> 
> Modified: cfe/trunk/CODE_OWNERS.TXT
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CODE_OWNERS.TXT?rev=2440
> 49&r1=244048&r2=244049&view=diff 
> ==
> 
> --- cfe/trunk/CODE_OWNERS.TXT (original)
> +++ cfe/trunk/CODE_OWNERS.TXT Wed Aug  5 09:52:01 2015
> @@ -45,10 +45,6 @@ N: John McCall
> E: rjmcc...@apple.com
> D: Clang LLVM IR generation
> 
> -N: Chad Rosier
> -E: mcros...@codeaurora.org
> -D: Compiler driver
> -
> N: Richard Smith
> E: rich...@metafoo.co.uk
> D: All parts of Clang not covered by someone else
> 
> 
> ___
> 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] D10933: Add new IdentifierNaming check

2015-08-05 Thread Beren Minor
berenm added inline comments.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:178
@@ +177,3 @@
+if (NamingStyles[Typedef].isSet()) {
+  KindName = "typedef";
+  Style = NamingStyles[Typedef];

alexfh wrote:
> berenm wrote:
> > alexfh wrote:
> > > Would it be better to have these in a single array next to `StyleNames`? 
> > > Also, this code could return a `StyleKind` (now `StyleConst`), and you 
> > > would need to get the corresponding `NamingStyle` and `KindName` once.
> > > 
> > > This code would suddenly become much leaner.
> > The problem is that sometimes, the current code falls back to a more 
> > generic naming style, but the "kind name" is still trying to describe the 
> > original declaration.
> > 
> > For example, if no style is defined for methods, then it will try to use a 
> > more generic "function" style, but the warning will still be "invalid case 
> > style for method xxx".
> > 
> > Maybe this is superfluous and I can drop it. It don't see many cases anyway 
> > (my original code was covering more cases - too many - and it seemed 
> > sensible at that time).
> > The problem is that sometimes, the current code falls back to a more 
> > generic naming style, but the "kind name" is still trying to describe the 
> > original declaration.
> 
> I see. It might be possible to split the mapping of types to style kinds and 
> handling missing styles. E.g. a function can return "Method" (which should be 
> SK_Method according to [1], btw) and then a caller would check whether the 
> corresponding `NamingStyle` is configured, and if needed fall back to a more 
> generic category. WDYT?
> 
> 
> [1] 
> http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
I think it would be difficult to map the declaration types to style kinds 
without checking the styles that have been provided and falling back to another 
style at the same time.

For example, a constexpr method is currently selecting the styles in this 
preferred order :
constexpr method > [public/protected/private] method > method > function.

The order is debatable, but we cannot have the //constexpr method// to 
//public/protected/private method// fallback, if there is no style for 
constexpr methods, without reading again the method declaration.

It might be OK that the warning message do not use the exact identifier kind 
name, and one can even think it is better to have a warning message that tells 
the user which style it used instead of which kind of identifier was checked.


http://reviews.llvm.org/D10933



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


r244063 - Add missing atomic libcall support.

2015-08-05 Thread James Y Knight
Author: jyknight
Date: Wed Aug  5 11:57:36 2015
New Revision: 244063

URL: http://llvm.org/viewvc/llvm-project?rev=244063&view=rev
Log:
Add missing atomic libcall support.

Support for emitting libcalls for __atomic_fetch_nand and
__atomic_{add,sub,and,or,xor,nand}_fetch was missing; add it, and some
test cases.

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

Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/lib/CodeGen/CGAtomic.cpp
cfe/trunk/test/CodeGen/atomic-ops-libcall.c

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=244063&r1=244062&r2=244063&view=diff
==
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Wed Aug  5 11:57:36 2015
@@ -1715,6 +1715,9 @@ The macros ``__ATOMIC_RELAXED``, ``__ATO
 provided, with values corresponding to the enumerators of C11's
 ``memory_order`` enumeration.
 
+(Note that Clang additionally provides GCC-compatible ``__atomic_*``
+builtins)
+
 Low-level ARM exclusive memory builtins
 ---
 

Modified: cfe/trunk/lib/CodeGen/CGAtomic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGAtomic.cpp?rev=244063&r1=244062&r2=244063&view=diff
==
--- cfe/trunk/lib/CodeGen/CGAtomic.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGAtomic.cpp Wed Aug  5 11:57:36 2015
@@ -699,7 +699,7 @@ RValue CodeGenFunction::EmitAtomicExpr(A
 
   switch (E->getOp()) {
   case AtomicExpr::AO__c11_atomic_init:
-llvm_unreachable("Already handled!");
+llvm_unreachable("Already handled above with EmitAtomicInit!");
 
   case AtomicExpr::AO__c11_atomic_load:
   case AtomicExpr::AO__atomic_load_n:
@@ -785,20 +785,43 @@ RValue CodeGenFunction::EmitAtomicExpr(A
   if (UseLibcall) {
 bool UseOptimizedLibcall = false;
 switch (E->getOp()) {
+case AtomicExpr::AO__c11_atomic_init:
+  llvm_unreachable("Already handled above with EmitAtomicInit!");
+
 case AtomicExpr::AO__c11_atomic_fetch_add:
 case AtomicExpr::AO__atomic_fetch_add:
 case AtomicExpr::AO__c11_atomic_fetch_and:
 case AtomicExpr::AO__atomic_fetch_and:
 case AtomicExpr::AO__c11_atomic_fetch_or:
 case AtomicExpr::AO__atomic_fetch_or:
+case AtomicExpr::AO__atomic_fetch_nand:
 case AtomicExpr::AO__c11_atomic_fetch_sub:
 case AtomicExpr::AO__atomic_fetch_sub:
 case AtomicExpr::AO__c11_atomic_fetch_xor:
 case AtomicExpr::AO__atomic_fetch_xor:
+case AtomicExpr::AO__atomic_add_fetch:
+case AtomicExpr::AO__atomic_and_fetch:
+case AtomicExpr::AO__atomic_nand_fetch:
+case AtomicExpr::AO__atomic_or_fetch:
+case AtomicExpr::AO__atomic_sub_fetch:
+case AtomicExpr::AO__atomic_xor_fetch:
   // For these, only library calls for certain sizes exist.
   UseOptimizedLibcall = true;
   break;
-default:
+
+case AtomicExpr::AO__c11_atomic_load:
+case AtomicExpr::AO__c11_atomic_store:
+case AtomicExpr::AO__c11_atomic_exchange:
+case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
+case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
+case AtomicExpr::AO__atomic_load_n:
+case AtomicExpr::AO__atomic_load:
+case AtomicExpr::AO__atomic_store_n:
+case AtomicExpr::AO__atomic_store:
+case AtomicExpr::AO__atomic_exchange_n:
+case AtomicExpr::AO__atomic_exchange:
+case AtomicExpr::AO__atomic_compare_exchange_n:
+case AtomicExpr::AO__atomic_compare_exchange:
   // Only use optimized library calls for sizes for which they exist.
   if (Size == 1 || Size == 2 || Size == 4 || Size == 8)
 UseOptimizedLibcall = true;
@@ -820,6 +843,9 @@ RValue CodeGenFunction::EmitAtomicExpr(A
 QualType RetTy;
 bool HaveRetTy = false;
 switch (E->getOp()) {
+case AtomicExpr::AO__c11_atomic_init:
+  llvm_unreachable("Already handled!");
+
 // There is only one libcall for compare an exchange, because there is no
 // optimisation benefit possible from a libcall version of a weak compare
 // and exchange.
@@ -903,7 +929,49 @@ RValue CodeGenFunction::EmitAtomicExpr(A
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy,
 E->getExprLoc(), sizeChars);
   break;
-default: return EmitUnsupportedRValue(E, "atomic library call");
+// T __atomic_fetch_nand_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_fetch_nand:
+  LibCallName = "__atomic_fetch_nand";
+  AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1, MemTy,
+E->getExprLoc(), sizeChars);
+  break;
+
+// T __atomic_add_fetch_N(T *mem, T val, int order)
+case AtomicExpr::AO__atomic_add_fetch:
+  LibCallName = "__atomic_add_fetch";
+  AddDirectArgument(*this, Args, UseOptimizedLibc

Re: [PATCH] D11743: [CMake] First pass at adding support for clang bootstrap builds to CMake

2015-08-05 Thread Chandler Carruth
chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

Totally awesome man, ship it. I've left a nit-pick below, but this is 
definitely the right starting place.



Comment at: CMakeLists.txt:615
@@ +614,3 @@
+
+  set(ADDITIONAL_TARGETS_TO_ADD check check-all)
+  foreach(target ${ADDITIONAL_TARGETS_TO_ADD})

nit pick: I'd call it 'check-llvm', 'check-clang', and 'check-all'. I'm OK if 
we have to hard code the list though, that seems a minor inconvenience.


http://reviews.llvm.org/D11743



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


Re: [PATCH] D11298: Convert a few classes over to use the new TrailingObjects helper.

2015-08-05 Thread James Y Knight
jyknight marked an inline comment as done.


Comment at: include/clang/AST/Decl.h:3620
@@ +3619,3 @@
+  public DeclContext,
+  llvm::TrailingObjects {
+protected:

rsmith wrote:
> I would prefer to see an explicit `private` access specifier here.
Done here and everywhere.


Comment at: include/clang/AST/Decl.h:3702
@@ -3691,2 +3701,3 @@
   friend class ASTDeclWriter;
+  friend class TrailingObjects;
 };

rsmith wrote:
> I predict one of our supported host compilers will choke on this.
> 
> *experiments*
> 
> That compiler is MSVC. It appears all our supported compilers provide enough 
> C++11 to allow
> 
>   friend TrailingObjects;
Done here and everywhere


Comment at: include/clang/AST/DeclTemplate.h:47
@@ -45,2 +46,3 @@
 /// derived classes.
-class LLVM_ALIGNAS(/*alignof(void*)*/ LLVM_PTR_SIZE) TemplateParameterList {
+class LLVM_ALIGNAS(/*alignof(void*)*/ LLVM_PTR_SIZE) TemplateParameterList 
final
+: llvm::TrailingObjects {

rsmith wrote:
> Can you remove the LLVM_ALIGNAS?
Nope, still needs to be provded manually. The TrailingObjects class does not 
currently adjust the alignment for you, but rather, just static_asserts that 
you've gotten it right. I'd like it to, but right now, the argument to 
LLVM_ALIGNAS apparently needs to be a literal integer for MSVC.

...although...actually, now that I think about it more, it may actually be 
possible to make it work even on VC. I don't have a way to test it, but I think 
something like the following might do the trick.

I'd like to avoid trying to add this feature to the llvm TrailingObjects class 
right now, though, and try it in a follow-up later on, OK?

```
template class AlignmentHelper {};

template<> class LLVM_ALIGNAS(1) AlignmentHelper<1> {};
template<> class LLVM_ALIGNAS(2) AlignmentHelper<2> {};
template<> class LLVM_ALIGNAS(4) AlignmentHelper<4> {};
template<> class LLVM_ALIGNAS(8) AlignmentHelper<8> {};
template<> class LLVM_ALIGNAS(16) AlignmentHelper<16> {};
template<> class LLVM_ALIGNAS(32) AlignmentHelper<32> {};

class OtherThing {
  double x;
};

class SomeThing : AlignmentHelper::Alignment> {
  char x;
};

int main() {
  static_assert(AlignOf::Alignment == 
AlignOf::Alignment, "");
}

```


Comment at: include/clang/AST/DeclTemplate.h:145
@@ -136,4 +144,3 @@
 /// derived classes. Suitable for creating on the stack.
-template
-class FixedSizeTemplateParameterList : public TemplateParameterList {
-  NamedDecl *Params[N];
+template  class FixedSizeTemplateParameterListStorage {
+  char Mem[TemplateParameterList::totalSizeToAlloc(N)];

rsmith wrote:
> This type is now underaligned.
Indeed! stupid oversight from adjusting the code at the last minute for the 
required "final". Should've inserted an alignment here too. But because of the 
constexpr issue, this goes away anyways...


Comment at: include/clang/AST/DeclTemplate.h:146
@@ -140,1 +145,3 @@
+template  class FixedSizeTemplateParameterListStorage {
+  char Mem[TemplateParameterList::totalSizeToAlloc(N)];
 

rnk wrote:
> rsmith wrote:
> > Do all of our supported compilers provide enough `constexpr` support for 
> > this to actually work? How would you feel about:
> > 
> >   TemplateParameterList List;
> >   NamedDecl *Params[N];
> > 
> > (Yeah, I don't like this either.)
> Won't this reduce the alignment of this structure to 1?
Yeah, right, no constexpr in VS2013. So, I guess that'll have to do...yuck but 
oh well.

I stuck in some asserts for the layout being as expected to assuage my 
conscience.


Comment at: include/clang/AST/DeclTemplate.h:165
@@ -151,6 +164,3 @@
   /// \brief The template argument list.
-  ///
-  /// The integer value will be non-zero to indicate that this
-  /// template argument list does own the pointer.
-  llvm::PointerIntPair Arguments;
+  const TemplateArgument *Arguments;
 

rsmith wrote:
> Please check in the removal of the `Owned` flag separately.
Acknowledged. [but still in this change as of right now]


Comment at: include/clang/AST/DeclTemplate.h:1290-1302
@@ -1262,15 +1289,15 @@
   /// pack.
   QualType getExpansionType(unsigned I) const {
 assert(I < NumExpandedTypes && "Out-of-range expansion type index");
-void * const *TypesAndInfos = reinterpret_cast(this + 1);
+void *const *TypesAndInfos = getTrailingObjects();
 return QualType::getFromOpaquePtr(TypesAndInfos[2*I]);
   }
 
   /// \brief Retrieve a particular expansion type source info within an
   /// expanded parameter pack.
   TypeSourceInfo *getExpansionTypeSourceInfo(unsigned I) const {
 assert(I < NumExpandedTypes && "Out-of-range expansion type index");
-void * const *TypesAndInfos = reinterpret_cast(this + 1);
+void *const *TypesAndInfos = getTrailingObjects();
 return static_cast(TypesAndInfos[2*I+1]);
   }
 

rsmith wrote:
> 

r244065 - Fix a tiny bug in -no-canonical-prefixes that somehow we have never

2015-08-05 Thread Chandler Carruth
Author: chandlerc
Date: Wed Aug  5 12:07:33 2015
New Revision: 244065

URL: http://llvm.org/viewvc/llvm-project?rev=244065&view=rev
Log:
Fix a tiny bug in -no-canonical-prefixes that somehow we have never
noticed until now.

The code for setting up the driver's InstalledDir didn't respect
-no-canonical-prefixes. Because of this, there are a few places in the
driver where we would unexpectedly form absolute paths, notably when
searching for and finding GCC installations to use, etc. The fix is
straightforward, and I've added this path to '-v' both so we can test it
sanely and so that it will be substantially more obvious the next time
someone has to debug something here.

Note that there is another bug that we don't actually *canonicalize* the
installed directory! I don't really want to fix that because I don't
have a realistic way to test the usage of this mode. I suspect that
folks using the shared module cache would care about getting this right
though, and so they might want to address it. I've left the appropriate
FIXMEs so that it is clear what to change, and I've updated the test
code to make it clear what is happening here.

Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/no-canonical-prefixes.c
cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=244065&r1=244064&r2=244065&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Aug  5 12:07:33 2015
@@ -762,6 +762,9 @@ void Driver::PrintVersion(const Compilat
   } else
 OS << "Thread model: " << TC.getThreadModel();
   OS << '\n';
+
+  // Print out the install directory.
+  OS << "InstalledDir: " << InstalledDir << '\n';
 }
 
 /// PrintDiagnosticCategories - Implement the --print-diagnostic-categories

Modified: cfe/trunk/test/Driver/no-canonical-prefixes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/no-canonical-prefixes.c?rev=244065&r1=244064&r2=244065&view=diff
==
--- cfe/trunk/test/Driver/no-canonical-prefixes.c (original)
+++ cfe/trunk/test/Driver/no-canonical-prefixes.c Wed Aug  5 12:07:33 2015
@@ -1,11 +1,17 @@
 // Due to ln -sf:
 // REQUIRES: shell
-// RUN: mkdir -p %t
-// RUN: cd %t
+// RUN: mkdir -p %t.real
+// RUN: cd %t.real
 // RUN: ln -sf %clang test-clang
-// RUN: ./test-clang -v -S %s 2>&1 | FileCheck %s
-// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck 
--check-prefix=NCP %s
-
-
-// CHECK: /clang{{.*}}" -cc1
-// NCP: test-clang" -cc1
+// RUN: cd ..
+// RUN: ln -sf %t.real %t.fake
+// RUN: cd %t.fake
+// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
+// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck 
--check-prefix=NON-CANONICAL %s
+//
+// FIXME: This should really be '.real'.
+// CANONICAL: InstalledDir: {{.*}}.fake
+// CANONICAL: {{[/|\\]*}}clang{{.*}}" -cc1
+//
+// NON-CANONICAL: InstalledDir: .{{$}}
+// NON-CANONICAL: test-clang" -cc1

Modified: cfe/trunk/tools/driver/driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=244065&r1=244064&r2=244065&view=diff
==
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Wed Aug  5 12:07:33 2015
@@ -344,7 +344,7 @@ CreateAndPopulateDiagOpts(ArrayRef &argv,
-  Driver &TheDriver) {
+  Driver &TheDriver, bool CanonicalPrefixes) {
   // Attempt to find the original path used to invoke the driver, to determine
   // the installed path. We do this manually, because we want to support that
   // path being a symlink.
@@ -355,7 +355,11 @@ static void SetInstallDir(SmallVectorImp
 if (llvm::ErrorOr Tmp = llvm::sys::findProgramByName(
 llvm::sys::path::filename(InstalledPath.str(
   InstalledPath = *Tmp;
-  llvm::sys::fs::make_absolute(InstalledPath);
+
+  // FIXME: We don't actually canonicalize this, we just make it absolute.
+  if (CanonicalPrefixes)
+llvm::sys::fs::make_absolute(InstalledPath);
+
   InstalledPath = llvm::sys::path::parent_path(InstalledPath);
   if (llvm::sys::fs::exists(InstalledPath.c_str()))
 TheDriver.setInstalledDir(InstalledPath);
@@ -473,7 +477,7 @@ int main(int argc_, const char **argv_)
   ProcessWarningOptions(Diags, *DiagOpts, /*ReportDiags=*/false);
 
   Driver TheDriver(Path, llvm::sys::getDefaultTargetTriple(), Diags);
-  SetInstallDir(argv, TheDriver);
+  SetInstallDir(argv, TheDriver, CanonicalPrefixes);
 
   llvm::InitializeAllTargets();
   insertArgsFromProgramName(ProgName, DS, argv, SavedStrings);


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

r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Argyrios Kyrtzidis
Author: akirtzidis
Date: Wed Aug  5 12:23:59 2015
New Revision: 244066

URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev
Log:
[test/Index] Update libclang tests to use libclang for creating PCH files.

This is consistent and tests the primary configuration we want to test, libclang
creating and consuming PCH files.

Modified:
cfe/trunk/test/Index/TestClassForwardDecl.m
cfe/trunk/test/Index/annotate-comments-objc.m
cfe/trunk/test/Index/annotate-comments.cpp
cfe/trunk/test/Index/c-index-api-loadTU-test.m
cfe/trunk/test/Index/c-index-getCursor-test.m
cfe/trunk/test/Index/c-index-pch.c
cfe/trunk/test/Index/c-index-redecls.c
cfe/trunk/test/Index/cindex-from-source.m
cfe/trunk/test/Index/comment-custom-block-command.cpp
cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
cfe/trunk/test/Index/complete-pch.m
cfe/trunk/test/Index/parse-all-comments.c
cfe/trunk/test/Index/print-mangled-name.cpp

Modified: cfe/trunk/test/Index/TestClassForwardDecl.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/TestClassForwardDecl.m?rev=244066&r1=244065&r2=244066&view=diff
==
--- cfe/trunk/test/Index/TestClassForwardDecl.m (original)
+++ cfe/trunk/test/Index/TestClassForwardDecl.m Wed Aug  5 12:23:59 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x 
objective-c %s -o %t.ast
+// RUN: c-index-test -write-pch %t.ast -Xclang -triple -Xclang 
x86_64-apple-darwin10 -fblocks -x objective-c %s
 // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck 
-check-prefix=CHECK-scan %s
 // RUN: c-index-test -test-load-tu %t.ast local | FileCheck 
-check-prefix=CHECK-load %s
 // REQUIRES: x86-registered-target

Modified: cfe/trunk/test/Index/annotate-comments-objc.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-comments-objc.m?rev=244066&r1=244065&r2=244066&view=diff
==
--- cfe/trunk/test/Index/annotate-comments-objc.m (original)
+++ cfe/trunk/test/Index/annotate-comments-objc.m Wed Aug  5 12:23:59 2015
@@ -69,6 +69,7 @@ typedef struct Struct_notdoxy *typedef_i
 // RUN: %clang_cc1 -emit-pch -o %t/out.pch -F %S/Inputs/Frameworks %s
 // RUN: %clang_cc1 -include-pch %t/out.pch -F %S/Inputs/Frameworks 
-fsyntax-only %s
 
+// RUN: c-index-test -write-pch %t/out.pch -F %S/Inputs/Frameworks %s
 // RUN: c-index-test -test-load-source all 
-comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F 
%S/Inputs/Frameworks > %t/out.c-index-direct
 // RUN: c-index-test -test-load-source all 
-comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F 
%S/Inputs/Frameworks -fmodules -fmodules-cache-path=%t/module-cache > 
%t/out.c-index-modules
 // RUN: c-index-test -test-load-tu %t/out.pch all -F %S/Inputs/Frameworks > 
%t/out.c-index-pch

Modified: cfe/trunk/test/Index/annotate-comments.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-comments.cpp?rev=244066&r1=244065&r2=244066&view=diff
==
--- cfe/trunk/test/Index/annotate-comments.cpp (original)
+++ cfe/trunk/test/Index/annotate-comments.cpp Wed Aug  5 12:23:59 2015
@@ -263,6 +263,7 @@ void isdoxy54(int);
 // RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t/out.pch %s
 // RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t/out.pch -fsyntax-only %s
 
+// RUN: c-index-test -write-pch %t/out.pch -x c++ -std=c++11 %s
 // RUN: c-index-test -test-load-source all 
-comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 
> %t/out.c-index-direct
 // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch
 

Modified: cfe/trunk/test/Index/c-index-api-loadTU-test.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/c-index-api-loadTU-test.m?rev=244066&r1=244065&r2=244066&view=diff
==
--- cfe/trunk/test/Index/c-index-api-loadTU-test.m (original)
+++ cfe/trunk/test/Index/c-index-api-loadTU-test.m Wed Aug  5 12:23:59 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x 
objective-c %s -o %t.ast
+// RUN: c-index-test -write-pch %t.ast -Xclang -triple -Xclang 
x86_64-apple-darwin10 -fblocks -x objective-c %s
 // RUN: c-index-test -test-load-tu %t.ast all > %t 2>&1 && FileCheck 
--input-file=%t %s
 // REQUIRES: x86-registered-target
 @interface Foo 

Modified: cfe/trunk/test/Index/c-index-getCursor-test.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/c-index-getCursor-test.m?rev=244066&r1=244065&r2=244066&view=diff
==
--- cfe/trunk/test/Index/c-index-getCursor-test.m (original)
+++ cfe/trunk/test/Index/c-index-getCursor-test.m Wed Aug  5 12:23:59

Re: [PATCH] D11766: "Claim" the arguments belonging to 'clang_ignored_gcc_optimization_f_Group'

2015-08-05 Thread Chad Rosier
mcrosier added a subscriber: mcrosier.
mcrosier accepted this revision.
mcrosier added a reviewer: mcrosier.
mcrosier added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D11766



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


r244070 - [CMake] First pass at adding support for clang bootstrap builds to CMake

2015-08-05 Thread Chris Bieneman
Author: cbieneman
Date: Wed Aug  5 12:38:12 2015
New Revision: 244070

URL: http://llvm.org/viewvc/llvm-project?rev=244070&view=rev
Log:
[CMake] First pass at adding support for clang bootstrap builds to CMake

Summary:
This patch adds a new CLANG_ENABLE_BOOTSTRAP option to CMake which adds targets 
for building a stage2 bootstrap compiler. The targets are:

bootstrap-configure
bootstrap-build
bootstrap (same as bootstrap-configure and bootstrap-build)
bootstrap-install
bootstrap-check-llvm
bootstrap-check-clang
bootstrap-check-all

If you are using 3.3.20150708 or greater it utilizes the ninja USES_TERMINAL_* 
settings on the external project so that the output is properly buffered.

Reviewers: bogner, chandlerc

Subscribers: filcab, cfe-commits

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

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=244070&r1=244069&r2=244070&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Wed Aug  5 12:38:12 2015
@@ -96,6 +96,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 
   option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
 "Set to ON to force using an old, unsupported host toolchain." OFF)
+  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
 
   include(AddLLVM)
   include(TableGen)
@@ -551,3 +552,76 @@ if (CLANG_BUILT_STANDALONE)
 ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
 COPYONLY)
 endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+  include(ExternalProject)
+
+  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
+set(cmake_3_4_USES_TERMINAL_OPTIONS)
+  else()
+set(cmake_3_4_USES_TERMINAL_OPTIONS
+  USES_TERMINAL_CONFIGURE 1
+  USES_TERMINAL_BUILD 1
+  USES_TERMINAL_INSTALL 1
+  )
+  endif()
+  
+  set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
+  set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-bins/)
+
+  add_custom_target(bootstrap-clear
+DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+)
+  add_custom_command(
+OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+DEPENDS clang
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E touch 
${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+COMMENT "Clobberring bootstrap build and stamp directories"
+)
+
+  ExternalProject_Add(bootstrap
+DEPENDS clang
+PREFIX bootstrap
+SOURCE_DIR ${CMAKE_SOURCE_DIR}
+STAMP_DIR ${STAMP_DIR}
+BINARY_DIR ${BINARY_DIR}
+CMAKE_ARGS
+# We shouldn't need to set this here, but INSTALL_DIR doesn't
+# seem to work, so instead I'm passing this through
+-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+${CLANG_BOOTSTRAP_CMAKE_ARGS}
+-DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++
+-DCMAKE_C_COMPILER=${CMAKE_BINARY_DIR}/bin/clang
+INSTALL_COMMAND ""
+STEP_TARGETS configure build
+${cmake_3_4_USES_TERMINAL_OPTIONS}
+)
+
+  # exclude really-install from main target
+  set_target_properties(bootstrap PROPERTIES 
_EP_really-install_EXCLUDE_FROM_MAIN On)
+  ExternalProject_Add_Step(bootstrap really-install
+COMMAND ${CMAKE_COMMAND} --build  --target install
+COMMENT "Performing install step for 'bootstrap'"
+DEPENDEES build
+  )
+  ExternalProject_Add_StepTargets(bootstrap really-install)
+  add_custom_target(bootstrap-install DEPENDS bootstrap-really-install)
+
+
+  set(ADDITIONAL_TARGETS_TO_ADD check-llvm check-clang check-all)
+  foreach(target ${ADDITIONAL_TARGETS_TO_ADD})
+# exclude from main target
+set_target_properties(bootstrap PROPERTIES _EP_${target}_EXCLUDE_FROM_MAIN 
On)
+
+ExternalProject_Add_Step(bootstrap ${target}
+  COMMAND ${CMAKE_COMMAND} --build  --target ${target}
+  COMMENT "Performing ${target} for 'bootstrap'"
+  DEPENDEES configure
+)
+ExternalProject_Add_StepTargets(bootstrap ${target})
+  endforeach()
+endif()


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


Re: [PATCH] D11743: [CMake] First pass at adding support for clang bootstrap builds to CMake

2015-08-05 Thread Phabricator
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244070: [CMake] First pass at adding support for clang 
bootstrap builds to CMake (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D11743?vs=31359&id=31371#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11743

Files:
  cfe/trunk/CMakeLists.txt

Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/CMakeLists.txt
@@ -96,6 +96,7 @@
 
   option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
 "Set to ON to force using an old, unsupported host toolchain." OFF)
+  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
 
   include(AddLLVM)
   include(TableGen)
@@ -551,3 +552,76 @@
 ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
 COPYONLY)
 endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+  include(ExternalProject)
+
+  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
+set(cmake_3_4_USES_TERMINAL_OPTIONS)
+  else()
+set(cmake_3_4_USES_TERMINAL_OPTIONS
+  USES_TERMINAL_CONFIGURE 1
+  USES_TERMINAL_BUILD 1
+  USES_TERMINAL_INSTALL 1
+  )
+  endif()
+  
+  set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
+  set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-bins/)
+
+  add_custom_target(bootstrap-clear
+DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+)
+  add_custom_command(
+OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+DEPENDS clang
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${STAMP_DIR}
+COMMAND ${CMAKE_COMMAND} -E touch 
${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+COMMENT "Clobberring bootstrap build and stamp directories"
+)
+
+  ExternalProject_Add(bootstrap
+DEPENDS clang
+PREFIX bootstrap
+SOURCE_DIR ${CMAKE_SOURCE_DIR}
+STAMP_DIR ${STAMP_DIR}
+BINARY_DIR ${BINARY_DIR}
+CMAKE_ARGS
+# We shouldn't need to set this here, but INSTALL_DIR doesn't
+# seem to work, so instead I'm passing this through
+-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+${CLANG_BOOTSTRAP_CMAKE_ARGS}
+-DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++
+-DCMAKE_C_COMPILER=${CMAKE_BINARY_DIR}/bin/clang
+INSTALL_COMMAND ""
+STEP_TARGETS configure build
+${cmake_3_4_USES_TERMINAL_OPTIONS}
+)
+
+  # exclude really-install from main target
+  set_target_properties(bootstrap PROPERTIES 
_EP_really-install_EXCLUDE_FROM_MAIN On)
+  ExternalProject_Add_Step(bootstrap really-install
+COMMAND ${CMAKE_COMMAND} --build  --target install
+COMMENT "Performing install step for 'bootstrap'"
+DEPENDEES build
+  )
+  ExternalProject_Add_StepTargets(bootstrap really-install)
+  add_custom_target(bootstrap-install DEPENDS bootstrap-really-install)
+
+
+  set(ADDITIONAL_TARGETS_TO_ADD check-llvm check-clang check-all)
+  foreach(target ${ADDITIONAL_TARGETS_TO_ADD})
+# exclude from main target
+set_target_properties(bootstrap PROPERTIES _EP_${target}_EXCLUDE_FROM_MAIN 
On)
+
+ExternalProject_Add_Step(bootstrap ${target}
+  COMMAND ${CMAKE_COMMAND} --build  --target ${target}
+  COMMENT "Performing ${target} for 'bootstrap'"
+  DEPENDEES configure
+)
+ExternalProject_Add_StepTargets(bootstrap ${target})
+  endforeach()
+endif()


Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/CMakeLists.txt
@@ -96,6 +96,7 @@
 
   option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
 "Set to ON to force using an old, unsupported host toolchain." OFF)
+  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
 
   include(AddLLVM)
   include(TableGen)
@@ -551,3 +552,76 @@
 ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
 COPYONLY)
 endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+  include(ExternalProject)
+
+  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
+set(cmake_3_4_USES_TERMINAL_OPTIONS)
+  else()
+set(cmake_3_4_USES_TERMINAL_OPTIONS
+  USES_TERMINAL_CONFIGURE 1
+  USES_TERMINAL_BUILD 1
+  USES_TERMINAL_INSTALL 1
+  )
+  endif()
+  
+  set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
+  set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-bins/)
+
+  add_custom_target(bootstrap-clear
+DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+)
+  add_custom_command(
+OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
+DEPENDS clang
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
+COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
+COMMAND ${CMAKE_C

r244076 - [test] Attempt a change to see if it fixes the test for the windows bot.

2015-08-05 Thread Argyrios Kyrtzidis
Author: akirtzidis
Date: Wed Aug  5 12:52:57 2015
New Revision: 244076

URL: http://llvm.org/viewvc/llvm-project?rev=244076&view=rev
Log:
[test] Attempt a change to see if it fixes the test for the windows bot.

Modified:
cfe/trunk/test/Index/TestClassForwardDecl.m

Modified: cfe/trunk/test/Index/TestClassForwardDecl.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/TestClassForwardDecl.m?rev=244076&r1=244075&r2=244076&view=diff
==
--- cfe/trunk/test/Index/TestClassForwardDecl.m (original)
+++ cfe/trunk/test/Index/TestClassForwardDecl.m Wed Aug  5 12:52:57 2015
@@ -1,4 +1,4 @@
-// RUN: c-index-test -write-pch %t.ast -Xclang -triple -Xclang 
x86_64-apple-darwin10 -fblocks -x objective-c %s
+// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 
%s
 // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck 
-check-prefix=CHECK-scan %s
 // RUN: c-index-test -test-load-tu %t.ast local | FileCheck 
-check-prefix=CHECK-load %s
 // REQUIRES: x86-registered-target


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


Re: [PATCH] D2916: Add test for Python binding Index read.

2015-08-05 Thread Brian Gesiak
modocache updated this revision to Diff 31376.
modocache added a comment.

Rebase onto master.


http://reviews.llvm.org/D2916

Files:
  bindings/python/tests/cindex/test_index.py
  bindings/python/tests/cindex/test_translation_unit.py
  bindings/python/tests/cindex/util.py

Index: bindings/python/tests/cindex/util.py
===
--- bindings/python/tests/cindex/util.py
+++ bindings/python/tests/cindex/util.py
@@ -1,5 +1,7 @@
 # This file provides common utility functions for the test suite.
 
+import tempfile
+
 from clang.cindex import Cursor
 from clang.cindex import TranslationUnit
 
@@ -30,6 +32,16 @@
 return TranslationUnit.from_source(name, args, unsaved_files=[(name,
source)])
 
+def save_tu(tu):
+"""Convenience API to save a TranslationUnit to a file.
+
+Returns the filename it was saved to.
+"""
+_, path = tempfile.mkstemp()
+tu.save(path)
+
+return path
+
 def get_cursor(source, spelling):
 """Obtain a cursor from a source object.
 
Index: bindings/python/tests/cindex/test_translation_unit.py
===
--- bindings/python/tests/cindex/test_translation_unit.py
+++ bindings/python/tests/cindex/test_translation_unit.py
@@ -1,6 +1,5 @@
 import gc
 import os
-import tempfile
 
 from clang.cindex import CursorKind
 from clang.cindex import Cursor
@@ -13,6 +12,7 @@
 from clang.cindex import TranslationUnit
 from .util import get_cursor
 from .util import get_tu
+from .util import save_tu
 
 kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
 
@@ -89,16 +89,6 @@
 for i in zip(inc, tu.get_includes()):
 assert eq(i[0], i[1])
 
-def save_tu(tu):
-"""Convenience API to save a TranslationUnit to a file.
-
-Returns the filename it was saved to.
-"""
-_, path = tempfile.mkstemp()
-tu.save(path)
-
-return path
-
 def test_save():
 """Ensure TranslationUnit.save() works."""
 
Index: bindings/python/tests/cindex/test_index.py
===
--- bindings/python/tests/cindex/test_index.py
+++ bindings/python/tests/cindex/test_index.py
@@ -1,12 +1,26 @@
-from clang.cindex import *
 import os
 
+from clang.cindex import Index
+from clang.cindex import TranslationUnit
+from .util import get_cursor
+from .util import get_tu
+from .util import save_tu
+
 kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
 
 def test_create():
 index = Index.create()
 
-# FIXME: test Index.read
+def test_read():
+translation_unit = get_tu('int foo();')
+path = save_tu(translation_unit)
+
+index = Index.create()
+read_unit = index.read(path)
+assert len(read_unit.diagnostics) == 0
+
+cursor = get_cursor(read_unit, 'foo')
+assert cursor is not None
 
 def test_parse():
 index = Index.create()


Index: bindings/python/tests/cindex/util.py
===
--- bindings/python/tests/cindex/util.py
+++ bindings/python/tests/cindex/util.py
@@ -1,5 +1,7 @@
 # This file provides common utility functions for the test suite.
 
+import tempfile
+
 from clang.cindex import Cursor
 from clang.cindex import TranslationUnit
 
@@ -30,6 +32,16 @@
 return TranslationUnit.from_source(name, args, unsaved_files=[(name,
source)])
 
+def save_tu(tu):
+"""Convenience API to save a TranslationUnit to a file.
+
+Returns the filename it was saved to.
+"""
+_, path = tempfile.mkstemp()
+tu.save(path)
+
+return path
+
 def get_cursor(source, spelling):
 """Obtain a cursor from a source object.
 
Index: bindings/python/tests/cindex/test_translation_unit.py
===
--- bindings/python/tests/cindex/test_translation_unit.py
+++ bindings/python/tests/cindex/test_translation_unit.py
@@ -1,6 +1,5 @@
 import gc
 import os
-import tempfile
 
 from clang.cindex import CursorKind
 from clang.cindex import Cursor
@@ -13,6 +12,7 @@
 from clang.cindex import TranslationUnit
 from .util import get_cursor
 from .util import get_tu
+from .util import save_tu
 
 kInputsDir = os.path.join(os.path.dirname(__file__), 'INPUTS')
 
@@ -89,16 +89,6 @@
 for i in zip(inc, tu.get_includes()):
 assert eq(i[0], i[1])
 
-def save_tu(tu):
-"""Convenience API to save a TranslationUnit to a file.
-
-Returns the filename it was saved to.
-"""
-_, path = tempfile.mkstemp()
-tu.save(path)
-
-return path
-
 def test_save():
 """Ensure TranslationUnit.save() works."""
 
Index: bindings/python/tests/cindex/test_index.py
===
--- bindings/python/tests/cindex/test_index.py
+++ bindings/python/tests/cindex/test_index.py
@@ -1,12 +1,26 @@
-from clang.cindex import *
 import os
 
+from clang.cindex

Re: [PATCH] D11740: ABI versioning macros for libc++

2015-08-05 Thread Evgeniy Stepanov
eugenis added a comment.

I'm trying to follow this proposal (which people seem to agree with in the 
general):
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-December/040587.html

Renaming _LIBCPP_ALTERNATE_STRING_LAYOUT is to give a unified naming scheme for 
all ABI-changing features, as proposed in the initial message in the above mail 
discussion.


Repository:
  rL LLVM

http://reviews.llvm.org/D11740



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


r244079 - Claim arguments that belong to 'clang_ignored_gcc_optimization_f_Group'

2015-08-05 Thread Douglas Katzman
Author: dougk
Date: Wed Aug  5 13:03:47 2015
New Revision: 244079

URL: http://llvm.org/viewvc/llvm-project?rev=244079&view=rev
Log:
Claim arguments that belong to 'clang_ignored_gcc_optimization_f_Group'

This seems preferable to printing two warnings per unsupported option-
one warning about not supporting it, and one about not using it.
It also makes the '-Wno-' option do what you mean.

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

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=244079&r1=244078&r2=244079&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug  5 13:03:47 2015
@@ -3848,6 +3848,7 @@ void Clang::ConstructJob(Compilation &C,
   for (const Arg *A :
Args.filtered(options::OPT_clang_ignored_gcc_optimization_f_Group)) {
 D.Diag(diag::warn_ignored_gcc_optimization) << A->getAsString(Args);
+A->claim();
   }
 
   claimNoWarnArgs(Args);

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=244079&r1=244078&r2=244079&view=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Wed Aug  5 13:03:47 2015
@@ -412,6 +412,19 @@
 // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not 
supported
 // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported
 
+// Test that an ignored optimization argument only prints 1 warning,
+// not both a warning about not claiming the arg, *and* about not supporting
+// the arg; and that adding -Wno-ignored-optimization silences the warning.
+//
+// RUN: %clang -### -fprofile-correction %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-WARNING3 %s
+// CHECK-NO-WARNING3: optimization flag '-fprofile-correction' is not supported
+// CHECK-NO-WARNING3-NOT: argument unused
+// RUN: %clang -### -fprofile-correction -Wno-ignored-optimization-argument %s 
2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-WARNING4 %s
+// CHECK-NO-WARNING4-NOT: not supported
+// CHECK-NO-WARNING4-NOT: argument unused
+
 // RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck 
-check-prefix=CHAR-SIGN1 %s
 // CHAR-SIGN1-NOT: -fno-signed-char
 


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


Re: [PATCH] D11742: Add -gcodeview and -gdwarf to control which type Clang emits

2015-08-05 Thread Hans Wennborg
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D11742



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


Re: [PATCH] D11753: [X86] Add support for _MM_ALIGN16

2015-08-05 Thread Eric Christopher
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Couple of inline comments, otherwise LGTM.

-eric



Comment at: test/CodeGen/ms-mm-align.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: -triple i686--windows -Oz -emit-llvm %s -o - \

Any chance of putting thi with the rest of the Intrin.h checks?


Comment at: test/CodeGen/ms-mm-align.c:2
@@ +1,3 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
+// RUN: | FileCheck %s -check-prefix CHECK

Shouldn't need -Oz.


http://reviews.llvm.org/D11753



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


Re: r243964 - [OPENMP] Fix compiler crash during data-sharing attributes analysis.

2015-08-05 Thread Hans Wennborg
Sorry for the delay. Merged in r244090.

Cheers,
Hans

On Tue, Aug 4, 2015 at 3:05 AM, Bataev, Alexey  wrote:
> Hans,
> This patch fixes crash in clang. Could you backport it to 3.7 branch?
>
> Best regards,
> Alexey Bataev
> =
> Software Engineer
> Intel Compiler Team
>
>
> 04.08.2015 11:10, Alexey Bataev пишет:
>
>> Author: abataev
>> Date: Tue Aug  4 03:10:48 2015
>> New Revision: 243964
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=243964&view=rev
>> Log:
>> [OPENMP] Fix compiler crash during data-sharing attributes analysis.
>>
>> If a global variable is marked as private in OpenMP construct and then is
>> used in of the private clauses of the same construct, it might cause
>> compiler crash because of incorrect capturing.
>>
>> Modified:
>>  cfe/trunk/lib/Sema/SemaOpenMP.cpp
>>  cfe/trunk/test/OpenMP/simd_linear_messages.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=243964&r1=243963&r2=243964&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Aug  4 03:10:48 2015
>> @@ -657,7 +657,9 @@ void Sema::InitDataSharingAttributesStac
>>   bool Sema::IsOpenMPCapturedVar(VarDecl *VD) {
>> assert(LangOpts.OpenMP && "OpenMP is not allowed");
>> VD = VD->getCanonicalDecl();
>> -  if (DSAStack->getCurrentDirective() != OMPD_unknown) {
>> +  if (DSAStack->getCurrentDirective() != OMPD_unknown &&
>> +  (!DSAStack->isClauseParsingMode() ||
>> +   DSAStack->getParentDirective() != OMPD_unknown)) {
>>   if (DSAStack->isLoopControlVariable(VD) ||
>>   (VD->hasLocalStorage() &&
>>isParallelOrTaskRegion(DSAStack->getCurrentDirective())) ||
>>
>> Modified: cfe/trunk/test/OpenMP/simd_linear_messages.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_linear_messages.cpp?rev=243964&r1=243963&r2=243964&view=diff
>>
>> ==
>> --- cfe/trunk/test/OpenMP/simd_linear_messages.cpp (original)
>> +++ cfe/trunk/test/OpenMP/simd_linear_messages.cpp Tue Aug  4 03:10:48
>> 2015
>> @@ -156,6 +156,7 @@ namespace C {
>>   using A::x;
>>   }
>>   +int f;
>>   int main(int argc, char **argv) {
>> double darr[100];
>> // expected-note@+1 {{in instantiation of function template
>> specialization 'test_template<-4, double, int>' requested here}}
>> @@ -167,6 +168,8 @@ int main(int argc, char **argv) {
>> S5 g(5); // expected-note {{'g' defined here}}
>> int i;
>> int &j = i; // expected-note {{'j' defined here}}
>> +  #pragma omp simd linear(f) linear(f) // expected-error {{linear
>> variable cannot be linear}} expected-note {{defined as linear}}
>> +  for (int k = 0; k < argc; ++k) ++k;
>> #pragma omp simd linear // expected-error {{expected '(' after
>> 'linear'}}
>> for (int k = 0; k < argc; ++k) ++k;
>> #pragma omp simd linear ( // expected-error {{expected expression}}
>> expected-error {{expected ')'}} expected-note {{to match this '('}}
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244091 - [AArch64] Enable thread sanitizer on clang

2015-08-05 Thread Renato Golin
Author: rengolin
Date: Wed Aug  5 13:42:41 2015
New Revision: 244091

URL: http://llvm.org/viewvc/llvm-project?rev=244091&view=rev
Log:
[AArch64] Enable thread sanitizer on clang

With this option, clang can use -fsanitize=thread on AArch64.

Patch by Adhemerval Zanella.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=244091&r1=244090&r2=244091&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Aug  5 13:42:41 2015
@@ -3626,10 +3626,10 @@ SanitizerMask Linux::getSupportedSanitiz
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64) {
+  if (IsX86_64 || IsMIPS64)
 Res |= SanitizerKind::Leak;
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  }
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {


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


Re: [PATCH] D11765: [sanitizer] Enable tsan for aarch64

2015-08-05 Thread Renato Golin
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

This patch is necessary for the RT tests to compile on AArch64.


http://reviews.llvm.org/D11765



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


Re: [PATCH] D11765: [sanitizer] Enable tsan for aarch64

2015-08-05 Thread Renato Golin
rengolin closed this revision.
rengolin added a comment.

r244091


http://reviews.llvm.org/D11765



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


r244097 - Add -gcodeview and -gdwarf to control which type Clang emits

2015-08-05 Thread Reid Kleckner
Author: rnk
Date: Wed Aug  5 13:51:13 2015
New Revision: 244097

URL: http://llvm.org/viewvc/llvm-project?rev=244097&view=rev
Log:
Add -gcodeview and -gdwarf to control which type Clang emits

Summary:
By default, 'clang' emits dwarf and 'clang-cl' emits codeview.  You can
force emission of one or both by passing -gcodeview and -gdwarf to
either driver.

Reviewers: dblaikie, hans

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/dwarf-version.c
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=244097&r1=244096&r2=244097&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Wed Aug  5 13:51:13 2015
@@ -157,9 +157,10 @@ def _SLASH_Zc_trigraphs : CLFlag<"Zc:tri
   HelpText<"Enable trigraphs">, Alias;
 def _SLASH_Zc_trigraphs_off : CLFlag<"Zc:trigraphs-">,
   HelpText<"Disable trigraphs (default)">, Alias;
-def _SLASH_Z7 : CLFlag<"Z7">, Alias;
-def _SLASH_Zi : CLFlag<"Zi">, HelpText<"Enable debug information">,
-  Alias;
+def _SLASH_Z7 : CLFlag<"Z7">,
+  HelpText<"Enable CodeView debug information in object files">;
+def _SLASH_Zi : CLFlag<"Zi">, Alias<_SLASH_Z7>,
+  HelpText<"Alias for /Z7. Does not produce PDBs.">;
 def _SLASH_Zp : CLJoined<"Zp">,
   HelpText<"Specify the default maximum struct packing alignment">,
   Alias;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=244097&r1=244096&r2=244097&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Aug  5 13:51:13 2015
@@ -1096,6 +1096,13 @@ def gdwarf_3 : Flag<["-"], "gdwarf-3">,
   HelpText<"Generate source-level debug information with dwarf version 3">, 
Flags<[CC1Option,CC1AsOption]>;
 def gdwarf_4 : Flag<["-"], "gdwarf-4">, Group,
   HelpText<"Generate source-level debug information with dwarf version 4">, 
Flags<[CC1Option,CC1AsOption]>;
+def gcodeview : Flag<["-"], "gcodeview">,
+  HelpText<"Generate CodeView debug information">,
+  Flags<[CC1Option, CC1AsOption, CoreOption]>;
+// Equivalent to our default dwarf version. Forces usual dwarf emission when
+// CodeView is enabled.
+def gdwarf : Flag<["-"], "gdwarf">, Alias, Flags<[CoreOption]>;
+
 def gfull : Flag<["-"], "gfull">, Group;
 def gused : Flag<["-"], "gused">, Group;
 def gstabs : Joined<["-"], "gstabs">, Group, Flags<[Unsupported]>;

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=244097&r1=244096&r2=244097&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Wed Aug  5 13:51:13 2015
@@ -173,9 +173,14 @@ VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
 /// The kind of generated debug info.
 ENUM_CODEGENOPT(DebugInfo, DebugInfoKind, 3, NoDebugInfo)
 
-/// Dwarf version.
+/// Dwarf version. Version zero indicates to LLVM that no DWARF should be
+/// emitted.
 VALUE_CODEGENOPT(DwarfVersion, 3, 0)
 
+/// Whether we should emit CodeView debug information. It's possible to emit
+/// CodeView and DWARF into the same object.
+CODEGENOPT(EmitCodeView, 1, 0)
+
 /// The kind of inlining to perform.
 ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NoInlining)
 

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=244097&r1=244096&r2=244097&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Aug  5 13:51:13 2015
@@ -369,11 +369,16 @@ void CodeGenModule::Release() {
   (Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) {
 EmitModuleLinkOptions();
   }
-  if (CodeGenOpts.DwarfVersion)
+  if (CodeGenOpts.DwarfVersion) {
 // We actually want the latest version when there are conflicts.
 // We can change from Warning to Latest if such mode is supported.
 getModule().addModuleFlag(llvm::Module::Warning, "Dwarf Version",
   CodeGenOpts.DwarfVersion);
+  }
+  if (CodeGenOpts.EmitCodeView) {
+// In

Re: r243945 - [UB] Fix two cases of UB in copy/pasted code from SmallVector.

2015-08-05 Thread Hans Wennborg
Richard, Chandler asked me about merging this and the other memcpy-ub
patches to 3.7. I'd like to hear what you think.

On the one hand, this doesn't fix a regression from previous releases
and the issue it addresses is probably fairly benign at the moment. On
the other hand, the patches do fix undefined behaviour and look pretty
straight-forward. What do you think?

Thanks,
Hans

On Mon, Aug 3, 2015 at 8:52 PM, Chandler Carruth  wrote:
> Author: chandlerc
> Date: Mon Aug  3 22:52:52 2015
> New Revision: 243945
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243945&view=rev
> Log:
> [UB] Fix two cases of UB in copy/pasted code from SmallVector.
>
> We should really stop copying and pasting code around. =/
>
> Found by UBSan.
>
> Modified:
> cfe/trunk/include/clang/AST/ASTVector.h
> cfe/trunk/include/clang/Analysis/Support/BumpVector.h
>
> Modified: cfe/trunk/include/clang/AST/ASTVector.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTVector.h?rev=243945&r1=243944&r2=243945&view=diff
> ==
> --- cfe/trunk/include/clang/AST/ASTVector.h (original)
> +++ cfe/trunk/include/clang/AST/ASTVector.h Mon Aug  3 22:52:52 2015
> @@ -384,14 +384,15 @@ void ASTVector::grow(const ASTContext
>T *NewElts = new (C, llvm::alignOf()) T[NewCapacity];
>
>// Copy the elements over.
> -  if (std::is_class::value) {
> -std::uninitialized_copy(Begin, End, NewElts);
> -// Destroy the original elements.
> -destroy_range(Begin, End);
> -  }
> -  else {
> -// Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
> -memcpy(NewElts, Begin, CurSize * sizeof(T));
> +  if (Begin != End) {
> +if (std::is_class::value) {
> +  std::uninitialized_copy(Begin, End, NewElts);
> +  // Destroy the original elements.
> +  destroy_range(Begin, End);
> +} else {
> +  // Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
> +  memcpy(NewElts, Begin, CurSize * sizeof(T));
> +}
>}
>
>// ASTContext never frees any memory.
>
> Modified: cfe/trunk/include/clang/Analysis/Support/BumpVector.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Support/BumpVector.h?rev=243945&r1=243944&r2=243945&view=diff
> ==
> --- cfe/trunk/include/clang/Analysis/Support/BumpVector.h (original)
> +++ cfe/trunk/include/clang/Analysis/Support/BumpVector.h Mon Aug  3 22:52:52 
> 2015
> @@ -223,14 +223,15 @@ void BumpVector::grow(BumpVectorConte
>T *NewElts = C.getAllocator().template Allocate(NewCapacity);
>
>// Copy the elements over.
> -  if (std::is_class::value) {
> -std::uninitialized_copy(Begin, End, NewElts);
> -// Destroy the original elements.
> -destroy_range(Begin, End);
> -  }
> -  else {
> -// Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
> -memcpy(NewElts, Begin, CurSize * sizeof(T));
> +  if (Begin != End) {
> +if (std::is_class::value) {
> +  std::uninitialized_copy(Begin, End, NewElts);
> +  // Destroy the original elements.
> +  destroy_range(Begin, End);
> +} else {
> +  // Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
> +  memcpy(NewElts, Begin, CurSize * sizeof(T));
> +}
>}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11761: [PATCH] clang-query quit command

2015-08-05 Thread Peter Collingbourne
pcc added a comment.

I normally quit clang-query, or pretty much any other interactive command line 
program, by typing end-of-file (Ctrl-D on Unix, Ctrl-Z  on Windows). If 
this works on Windows 10 I'd rather users do it that way. We can make this more 
discoverable through documentation.


http://reviews.llvm.org/D11761



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


Re: [PATCH] D11753: [X86] Add support for _MM_ALIGN16

2015-08-05 Thread Michael Kuperstein
mkuper added a comment.

Thanks, Eric!



Comment at: test/CodeGen/ms-mm-align.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: -triple i686--windows -Oz -emit-llvm %s -o - \

echristo wrote:
> Any chance of putting thi with the rest of the Intrin.h checks?
I've originally wanted to put it in ms-intinsics.c, but it fails for the 
"-triple thumbv7--windows" test (as it should - this is an x86-only macro).
If you have a different test in mind, I'll move it there.


Comment at: test/CodeGen/ms-mm-align.c:2
@@ +1,3 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
+// RUN: | FileCheck %s -check-prefix CHECK

echristo wrote:
> Shouldn't need -Oz.
Copied that from ms-intrinsics.c as well. Will remove.


http://reviews.llvm.org/D11753



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


Re: [PATCH] D11761: [PATCH] clang-query quit command

2015-08-05 Thread Aaron Ballman
aaron.ballman added a comment.

In http://reviews.llvm.org/D11761#218141, @pcc wrote:

> I normally quit clang-query, or pretty much any other interactive command 
> line program, by typing end-of-file (Ctrl-D on Unix, Ctrl-Z  on 
> Windows). If this works on Windows 10 I'd rather users do it that way. We can 
> make this more discoverable through documentation.


While Ctrl+Z  does terminate clang-query on Windows, it's an incredibly 
obtuse way to terminate an interactive application on Windows. (Having used 
Windows for 20 years, I had to go look up what Ctrl+Z does!) Saying "but we can 
document it" doesn't really change that fact; users can already look at the 
documentation on MSDN to learn that Ctrl+Break or Ctrl+C will send a SIGINT 
(Ctrl+Z sets the EOF indicator, which is even more obtuse).

I'm not certain that control codes to terminate interactive shell programs on 
Windows is as normal as it is on Unix-like systems.

~Aaron


http://reviews.llvm.org/D11761



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


Re: [PATCH] D11757: Propagate SourceLocations through to get a Loc on float_cast_overflow

2015-08-05 Thread Alexey Samsonov
samsonov added a comment.

Thank you for working on this! This change looks good to me, but I'll let 
Richard say a final word.

Note that you would need to make a corresponding change in UBSan compiler-rt 
runtime. Also, this is an ABI-breaking change - e.g. shared objects built with 
older Clang will not work properly with new runtime. I would recommend you to 
add *some* diagnostic to ubsan runtime - e.g. if it tries to read 
SourceLocation from FloatCastOverflowData passed to handler, but it looks more 
like TypeDescriptor, than it would crash with a verbose message.


http://reviews.llvm.org/D11757



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


r244104 - Documentation: fix a typo, "This flag is determines" -> "This flag determines".

2015-08-05 Thread James Dennett
Author: jdennett
Date: Wed Aug  5 14:44:47 2015
New Revision: 244104

URL: http://llvm.org/viewvc/llvm-project?rev=244104&view=rev
Log:
Documentation: fix a typo, "This flag is determines" -> "This flag determines".

No functional change.

Modified:
cfe/trunk/include/clang/AST/PrettyPrinter.h

Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=244104&r1=244103&r2=244104&view=diff
==
--- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed Aug  5 14:44:47 2015
@@ -109,7 +109,7 @@ struct PrintingPolicy {
   /// \brief Whether we should print the sizes of constant array expressions
   /// as written in the sources.
   ///
-  /// This flag is determines whether arrays types declared as
+  /// This flag determines whether arrays types declared as
   ///
   /// \code
   /// int a[4+10*10];


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


Re: [PATCH] D11761: [PATCH] clang-query quit command

2015-08-05 Thread Manuel Klimek
klimek added a comment.

Peter, any particular reason?

In http://reviews.llvm.org/D11761#218151, @aaron.ballman wrote:

> In http://reviews.llvm.org/D11761#218141, @pcc wrote:
>
> > I normally quit clang-query, or pretty much any other interactive command 
> > line program, by typing end-of-file (Ctrl-D on Unix, Ctrl-Z  on 
> > Windows). If this works on Windows 10 I'd rather users do it that way. We 
> > can make this more discoverable through documentation.
>
>
> While Ctrl+Z  does terminate clang-query on Windows, it's an 
> incredibly obtuse way to terminate an interactive application on Windows. 
> (Having used Windows for 20 years, I had to go look up what Ctrl+Z does!) 
> Saying "but we can document it" doesn't really change that fact; users can 
> already look at the documentation on MSDN to learn that Ctrl+Break or Ctrl+C 
> will send a SIGINT (Ctrl+Z sets the EOF indicator, which is even more obtuse).
>
> I'm not certain that control codes to terminate interactive shell programs on 
> Windows is as normal as it is on Unix-like systems.
>
> ~Aaron


+1 to that; I do think we want this to work well for windows users, and the 
expected knowledge is different


http://reviews.llvm.org/D11761



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


r244110 - Remove unnecessary ClangLibdirSuffix variable.

2015-08-05 Thread Yaron Keren
Author: yrnkrn
Date: Wed Aug  5 15:06:56 2015
New Revision: 244110

URL: http://llvm.org/viewvc/llvm-project?rev=244110&view=rev
Log:
Remove unnecessary ClangLibdirSuffix variable. 
Twine + const char * is supported.


Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=244110&r1=244109&r2=244110&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Aug  5 15:06:56 2015
@@ -1085,13 +1085,11 @@ std::string CompilerInvocation::GetResou
   // Compute the path to the resource directory.
   StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
   SmallString<128> P(Dir);
-  if (ClangResourceDir != "") {
+  if (ClangResourceDir != "")
 llvm::sys::path::append(P, ClangResourceDir);
-  } else {
-StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
-llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
-CLANG_VERSION_STRING);
-  }
+  else
+llvm::sys::path::append(P, "..", Twine("lib") + CLANG_LIBDIR_SUFFIX,
+"clang", CLANG_VERSION_STRING);
 
   return P.str();
 }


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


Re: [PATCH] Fix crash in CheckObjCCircularContainer

2015-08-05 Thread AlexDenisov
> Why not get the IdentifierInfo pointer for the class name from the NSAPI 
> object and compare that ?
There are more than one way to do things, it’s just lack of knowledge about the 
code base.

> Also there is code duplication, since the same code pattern is used in 3 
> places, could you refactor into a function ?

Fixed this as well. Also, I got rid of `NSCountedSet` since it’s a subclass of 
`NSMutableSet` and will be caught by `isSubclassOfNSClass`.

The new version of the patch attached.
--
AlexDenisov
Software Engineer, http://lowlevelbits.org



proper_fix_for_circular_containers_v2.patch
Description: Binary data

> On 05 Aug 2015, at 19:22, Argyrios Kyrtzidis  wrote:
> 
>> 
>> -  if (S.NSMutableArrayPointer != Message->getReceiverType()) {
>> +  ObjCInterfaceDecl *Receiver = Message->getReceiverInterface();
>> +  if (!Receiver) {
>> +return None;
>> +  }
>> +
>> +  bool IsMutableArray = false;
>> +  do {
>> +QualType QT = S.Context.getObjCInterfaceType(Receiver);
>> +QualType ReceiverType = S.Context.getObjCObjectPointerType(QT);
>> +
>> +IsMutableArray = !S.NSMutableArrayPointer.isNull() &&
>> +  ReceiverType == S.NSMutableArrayPointer;
>> +
>> +if (IsMutableArray) {
>> +  break;
>> +}
>> +  } while ((Receiver = Receiver->getSuperClass()));
>> +
>> +  if (!IsMutableArray) {
>> return None;
>>   }
>> 
> 
> Why not get the IdentifierInfo pointer for the class name from the NSAPI 
> object and compare that ? It seems unnecessary to be doing the type lookups 
> for this.
> 
> Also there is code duplication, since the same code pattern is used in 3 
> places, could you refactor into a function ?
> 
> 
> 
>> On Jul 31, 2015, at 1:55 PM, AlexDenisov <1101.deb...@gmail.com> wrote:
>> 
>>> To clarify, are you saying that the warning may lead to false positives 
>>> when used in subclasses ?
>> 
>> Seems I was wrong.
>> Just checked the behaviour with backing storage - it also leads to a 
>> circular container problem.
>> 
>> Also, you can find attachment with a ‘proper’ implementation, which also 
>> covers subclassing.
>> 
>> P.S. I didn’t measure performance, but I think this implementation might 
>> have negative impact on the speed.
>> --
>> AlexDenisov
>> Software Engineer, http://lowlevelbits.org
>> 
>> 
>>> On 30 Jul 2015, at 18:18, Argyrios Kyrtzidis  wrote:
>>> 
>>> 
 On Jul 30, 2015, at 1:05 AM, AlexDenisov <1101.deb...@gmail.com> wrote:
 
 The patch is a simplest fix for crash when CheckObjCCircularContainer
 applies to a message to a ’super’, e.g.:
 
 @implementation Foo : NSMutableArray
 - foo {
 [super addObject:nil];
 }
 @end
 
 
 This is, probably, not a proper fix for the problem,
 but initial patch wasn’t intended to apply checks to any kind
 of subclassing, because it, imho, over-complicates implementation:
>>> 
>>> To clarify, are you saying that the warning may lead to false positives 
>>> when used in subclasses ?
>>> If that’s the case could we just disable it inside collection subclasses, 
>>> at least until the false positives can be addressed ?
>>> 
 
 This particular problem touches subclassing from a class-cluster,
 which means that the concrete subclass will have some backing storage, 
 e.g.:
 
 @implementation FootableArray : NSMutableArray
 {
 NSMutableArray *_backingStorage;
 }
 
 - addObject:(id)object {
 [_backingStorage addObject:object];
 }
 
 @end
 
 In this case even adding `self` to `self` would not lead to a circular 
 container:
 
 - foo {
 [self addObject:self]; // puts `self` into the `_backingStorage`
 }
 
 I would apply this patch as is and postpone a ‘proper and bullet-proof 
 implementation’
 when I, or somebody who is also interested, will have more time.
 
 If there are any questions/suggestions/objections - let’s discuss them.
 --
 AlexDenisov
 Software Engineer, http://lowlevelbits.org
 
 
 
>>> 
>> 
> 



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244111 - Remove unused comparison operators from the Builtin Info struct.

2015-08-05 Thread Eric Christopher
Author: echristo
Date: Wed Aug  5 15:11:04 2015
New Revision: 244111

URL: http://llvm.org/viewvc/llvm-project?rev=244111&view=rev
Log:
Remove unused comparison operators from the Builtin Info struct.

Modified:
cfe/trunk/include/clang/Basic/Builtins.h

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=244111&r1=244110&r2=244111&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Wed Aug  5 15:11:04 2015
@@ -52,13 +52,6 @@ enum ID {
 struct Info {
   const char *Name, *Type, *Attributes, *HeaderName;
   LanguageID builtin_lang;
-
-  bool operator==(const Info &RHS) const {
-return !strcmp(Name, RHS.Name) &&
-   !strcmp(Type, RHS.Type) &&
-   !strcmp(Attributes, RHS.Attributes);
-  }
-  bool operator!=(const Info &RHS) const { return !(*this == RHS); }
 };
 
 /// \brief Holds information about both target-independent and


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


Re: r243085 - Fix the cc1as crash when it outputs assembly

2015-08-05 Thread Hans Wennborg
Ping?

On Thu, Jul 30, 2015 at 10:20 AM, Hans Wennborg  wrote:
> Rafael: ping?
>
> This is probably not terribly important, but I would like to get it off my 
> list.
>
> On Wed, Jul 29, 2015 at 10:16 AM, Hans Wennborg  wrote:
>> Ping?
>>
>> On Mon, Jul 27, 2015 at 1:29 PM, Hans Wennborg  wrote:
>>> Rafael, I don't know who's the owner here but you're probably in the
>>> best position to comment on whether this is ok for merging to 3.7.
>>> What do you think?
>>>
>>> On Fri, Jul 24, 2015 at 10:53 AM, Hans Wennborg  wrote:
 Is this something we should merge to 3.7?

 On Thu, Jul 23, 2015 at 7:12 PM, Steven Wu  wrote:
> Author: steven_wu
> Date: Thu Jul 23 21:12:43 2015
> New Revision: 243085
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243085&view=rev
> Log:
> Fix the cc1as crash when it outputs assembly
>
> In clang cc1as_main, when the output file type is “asm”, AsmStreamer
> owns a formatted_raw_ostream which has a reference to FDOS
> (raw_ostream), so AsmStreamer must be closed before FDOS is closed.
>
> Added:
> cfe/trunk/test/Misc/cc1as-asm.s
> Modified:
> cfe/trunk/tools/driver/cc1as_main.cpp
>
> Added: cfe/trunk/test/Misc/cc1as-asm.s
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/cc1as-asm.s?rev=243085&view=auto
> ==
> --- cfe/trunk/test/Misc/cc1as-asm.s (added)
> +++ cfe/trunk/test/Misc/cc1as-asm.s Thu Jul 23 21:12:43 2015
> @@ -0,0 +1,3 @@
> +// Run cc1as asm output path just to make sure it works
> +// REQUIRES: x86-registered-target
> +// RUN: %clang -cc1as -triple x86_64-apple-macosx10.10.0 -filetype asm 
> %s -o /dev/null
>
> Modified: cfe/trunk/tools/driver/cc1as_main.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=243085&r1=243084&r2=243085&view=diff
> ==
> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)
> +++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Jul 23 21:12:43 2015
> @@ -406,6 +406,9 @@ static bool ExecuteAssembler(AssemblerIn
>  Failed = Parser->Run(Opts.NoInitialTextSection);
>}
>
> +  // Close Streamer first.
> +  // It might have a reference to the output stream.
> +  Str.reset();
>// Close the output stream early.
>BOS.reset();
>FDOS.reset();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Fix crash in CheckObjCCircularContainer

2015-08-05 Thread Argyrios Kyrtzidis
> +IdentifierInfo *II = &S.Context.Idents.get(InterfaceDecl->getName());


You can just do “InterfaceDecl->getIdentifier()”, no need to lookup by string. 
Also this will eliminate the need to pass Sema as parameter.
And ‘isSubclassOfNSClass()’ seems generally useful, how about you make it a 
function of NSAPI ?

Otherwise LGTM.


> On Aug 5, 2015, at 1:11 PM, AlexDenisov <1101.deb...@gmail.com> wrote:
> 
>> Why not get the IdentifierInfo pointer for the class name from the NSAPI 
>> object and compare that ?
> There are more than one way to do things, it’s just lack of knowledge about 
> the code base.
> 
>> Also there is code duplication, since the same code pattern is used in 3 
>> places, could you refactor into a function ?
> 
> Fixed this as well. Also, I got rid of `NSCountedSet` since it’s a subclass 
> of `NSMutableSet` and will be caught by `isSubclassOfNSClass`.
> 
> The new version of the patch attached.
> --
> AlexDenisov
> Software Engineer, http://lowlevelbits.org
> 
> 
>> On 05 Aug 2015, at 19:22, Argyrios Kyrtzidis  wrote:
>> 
>>> 
>>> -  if (S.NSMutableArrayPointer != Message->getReceiverType()) {
>>> +  ObjCInterfaceDecl *Receiver = Message->getReceiverInterface();
>>> +  if (!Receiver) {
>>> +return None;
>>> +  }
>>> +
>>> +  bool IsMutableArray = false;
>>> +  do {
>>> +QualType QT = S.Context.getObjCInterfaceType(Receiver);
>>> +QualType ReceiverType = S.Context.getObjCObjectPointerType(QT);
>>> +
>>> +IsMutableArray = !S.NSMutableArrayPointer.isNull() &&
>>> +  ReceiverType == S.NSMutableArrayPointer;
>>> +
>>> +if (IsMutableArray) {
>>> +  break;
>>> +}
>>> +  } while ((Receiver = Receiver->getSuperClass()));
>>> +
>>> +  if (!IsMutableArray) {
>>>return None;
>>>  }
>>> 
>> 
>> Why not get the IdentifierInfo pointer for the class name from the NSAPI 
>> object and compare that ? It seems unnecessary to be doing the type lookups 
>> for this.
>> 
>> Also there is code duplication, since the same code pattern is used in 3 
>> places, could you refactor into a function ?
>> 
>> 
>> 
>>> On Jul 31, 2015, at 1:55 PM, AlexDenisov <1101.deb...@gmail.com> wrote:
>>> 
 To clarify, are you saying that the warning may lead to false positives 
 when used in subclasses ?
>>> 
>>> Seems I was wrong.
>>> Just checked the behaviour with backing storage - it also leads to a 
>>> circular container problem.
>>> 
>>> Also, you can find attachment with a ‘proper’ implementation, which also 
>>> covers subclassing.
>>> 
>>> P.S. I didn’t measure performance, but I think this implementation might 
>>> have negative impact on the speed.
>>> --
>>> AlexDenisov
>>> Software Engineer, http://lowlevelbits.org
>>> 
>>> 
 On 30 Jul 2015, at 18:18, Argyrios Kyrtzidis  wrote:
 
 
> On Jul 30, 2015, at 1:05 AM, AlexDenisov <1101.deb...@gmail.com> wrote:
> 
> The patch is a simplest fix for crash when CheckObjCCircularContainer
> applies to a message to a ’super’, e.g.:
> 
> @implementation Foo : NSMutableArray
> - foo {
> [super addObject:nil];
> }
> @end
> 
> 
> This is, probably, not a proper fix for the problem,
> but initial patch wasn’t intended to apply checks to any kind
> of subclassing, because it, imho, over-complicates implementation:
 
 To clarify, are you saying that the warning may lead to false positives 
 when used in subclasses ?
 If that’s the case could we just disable it inside collection subclasses, 
 at least until the false positives can be addressed ?
 
> 
> This particular problem touches subclassing from a class-cluster,
> which means that the concrete subclass will have some backing storage, 
> e.g.:
> 
> @implementation FootableArray : NSMutableArray
> {
> NSMutableArray *_backingStorage;
> }
> 
> - addObject:(id)object {
> [_backingStorage addObject:object];
> }
> 
> @end
> 
> In this case even adding `self` to `self` would not lead to a circular 
> container:
> 
> - foo {
> [self addObject:self]; // puts `self` into the `_backingStorage`
> }
> 
> I would apply this patch as is and postpone a ‘proper and bullet-proof 
> implementation’
> when I, or somebody who is also interested, will have more time.
> 
> If there are any questions/suggestions/objections - let’s discuss them.
> --
> AlexDenisov
> Software Engineer, http://lowlevelbits.org
> 
> 
> 
 
>>> 
>> 
> 

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


Re: r243085 - Fix the cc1as crash when it outputs assembly

2015-08-05 Thread Hans Wennborg
Thanks! r244116.

 - Hans

On Wed, Aug 5, 2015 at 1:23 PM, Rafael Espíndola
 wrote:
> It is probably very safe, so fine by me.
>
> On 5 August 2015 at 16:19, Hans Wennborg  wrote:
>> Ping?
>>
>> On Thu, Jul 30, 2015 at 10:20 AM, Hans Wennborg  wrote:
>>> Rafael: ping?
>>>
>>> This is probably not terribly important, but I would like to get it off my 
>>> list.
>>>
>>> On Wed, Jul 29, 2015 at 10:16 AM, Hans Wennborg  wrote:
 Ping?

 On Mon, Jul 27, 2015 at 1:29 PM, Hans Wennborg  wrote:
> Rafael, I don't know who's the owner here but you're probably in the
> best position to comment on whether this is ok for merging to 3.7.
> What do you think?
>
> On Fri, Jul 24, 2015 at 10:53 AM, Hans Wennborg  wrote:
>> Is this something we should merge to 3.7?
>>
>> On Thu, Jul 23, 2015 at 7:12 PM, Steven Wu  wrote:
>>> Author: steven_wu
>>> Date: Thu Jul 23 21:12:43 2015
>>> New Revision: 243085
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=243085&view=rev
>>> Log:
>>> Fix the cc1as crash when it outputs assembly
>>>
>>> In clang cc1as_main, when the output file type is “asm”, AsmStreamer
>>> owns a formatted_raw_ostream which has a reference to FDOS
>>> (raw_ostream), so AsmStreamer must be closed before FDOS is closed.
>>>
>>> Added:
>>> cfe/trunk/test/Misc/cc1as-asm.s
>>> Modified:
>>> cfe/trunk/tools/driver/cc1as_main.cpp
>>>
>>> Added: cfe/trunk/test/Misc/cc1as-asm.s
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/cc1as-asm.s?rev=243085&view=auto
>>> ==
>>> --- cfe/trunk/test/Misc/cc1as-asm.s (added)
>>> +++ cfe/trunk/test/Misc/cc1as-asm.s Thu Jul 23 21:12:43 2015
>>> @@ -0,0 +1,3 @@
>>> +// Run cc1as asm output path just to make sure it works
>>> +// REQUIRES: x86-registered-target
>>> +// RUN: %clang -cc1as -triple x86_64-apple-macosx10.10.0 -filetype asm 
>>> %s -o /dev/null
>>>
>>> Modified: cfe/trunk/tools/driver/cc1as_main.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=243085&r1=243084&r2=243085&view=diff
>>> ==
>>> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)
>>> +++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Jul 23 21:12:43 2015
>>> @@ -406,6 +406,9 @@ static bool ExecuteAssembler(AssemblerIn
>>>  Failed = Parser->Run(Opts.NoInitialTextSection);
>>>}
>>>
>>> +  // Close Streamer first.
>>> +  // It might have a reference to the output stream.
>>> +  Str.reset();
>>>// Close the output stream early.
>>>BOS.reset();
>>>FDOS.reset();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244119 - [CMake] Add USES_TERMINAL 1 to ExternalProject_Add_Step calls on 3.3.20150708 and later.

2015-08-05 Thread Chris Bieneman
Author: cbieneman
Date: Wed Aug  5 15:46:39 2015
New Revision: 244119

URL: http://llvm.org/viewvc/llvm-project?rev=244119&view=rev
Log:
[CMake] Add USES_TERMINAL 1 to ExternalProject_Add_Step calls on 3.3.20150708 
and later.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=244119&r1=244118&r2=244119&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Wed Aug  5 15:46:39 2015
@@ -558,12 +558,14 @@ if (CLANG_ENABLE_BOOTSTRAP)
 
   if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
 set(cmake_3_4_USES_TERMINAL_OPTIONS)
+set(cmake_3_4_USES_TERMINAL)
   else()
 set(cmake_3_4_USES_TERMINAL_OPTIONS
   USES_TERMINAL_CONFIGURE 1
   USES_TERMINAL_BUILD 1
   USES_TERMINAL_INSTALL 1
   )
+set(cmake_3_4_USES_TERMINAL USES_TERMINAL 1)
   endif()
   
   set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
@@ -607,6 +609,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
 COMMAND ${CMAKE_COMMAND} --build  --target install
 COMMENT "Performing install step for 'bootstrap'"
 DEPENDEES build
+${cmake_3_4_USES_TERMINAL}
   )
   ExternalProject_Add_StepTargets(bootstrap really-install)
   add_custom_target(bootstrap-install DEPENDS bootstrap-really-install)
@@ -621,6 +624,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
   COMMAND ${CMAKE_COMMAND} --build  --target ${target}
   COMMENT "Performing ${target} for 'bootstrap'"
   DEPENDEES configure
+  ${cmake_3_4_USES_TERMINAL}
 )
 ExternalProject_Add_StepTargets(bootstrap ${target})
   endforeach()


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


Re: [Patch][LoopVectorize]Late evaluation of vectorization requirements

2015-08-05 Thread Tyler Nowicki
Hi,

Could I get a review of these patches?

Thanks,

Tyler


> On Jul 27, 2015, at 4:45 PM, Tyler Nowicki  wrote:
> 
> Please ignore the debug line in the LLVM late-evaluation patch. It won’t be 
> part of the commit.
> 
> +  DEBUG(dbgs() << "LV: Emitting analysis message.\n”);
> 
> Tyler
> 
>> On Jul 27, 2015, at 3:23 PM, Tyler Nowicki > > wrote:
>> 
>> Hi Hal,
>> 
>> Thanks for the review! No worries about the delay.
>> 
 Could I get a review of these patches for cfe and llvm?
>>> 
>>> Hi Tyler,
>>> 
>>> I'm apologize for the delay. I think this generally looks good, but I don't 
>>> understand the motivation for introducing the additional FrontendOptions 
>>> member. Why not just make a subclass of 
>>> DiagnosticInfoOptimizationRemarkAnalysis that the frontend can handle 
>>> specially (and detect using the normal isa/dyn_cast mechanism?\
>> 
>> The diagnostic handling code doesn’t use isa or dyn_cast, rather it uses 
>> switches to select between different types. I modified the patch to use a 
>> subclass rather than a member variable. Let me know what patch you think 
>> would work out better?
>> 
>> 
 I should have also said in my previous email that I am not thrilled
 by the need to use O3 in the clang-side test.
>>> 
>>> So using -O2 or using -fvectorize does not help?
>> 
>> Using -O1 with -fvectorize seems to work, at least it is a smaller set of 
>> passes than O3.
>> 
>> I attached the updated patches. I also noticed that 
>> DiagnosticInfoOptimizationBase::classof() was incorrectly implemented. It 
>> would need its own diagnostic kind, but that doesn’t make sense because you 
>> would never instantiate the base class. I thought it was best just to remove 
>> it. See the third patch.
>> 
>> Tyler
>> 
>> 
>> 
>> 
> 
> ___
> cfe-commits mailing list
> cfe-comm...@cs.uiuc.edu 
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits 
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244124 - Documentation: fix another typo, "arrays types" -> "array types".

2015-08-05 Thread James Dennett
Author: jdennett
Date: Wed Aug  5 15:58:23 2015
New Revision: 244124

URL: http://llvm.org/viewvc/llvm-project?rev=244124&view=rev
Log:
Documentation: fix another typo, "arrays types" -> "array types".

Thanks to Kim Gräsman  for pointing this out.

Modified:
cfe/trunk/include/clang/AST/PrettyPrinter.h

Modified: cfe/trunk/include/clang/AST/PrettyPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/PrettyPrinter.h?rev=244124&r1=244123&r2=244124&view=diff
==
--- cfe/trunk/include/clang/AST/PrettyPrinter.h (original)
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h Wed Aug  5 15:58:23 2015
@@ -109,7 +109,7 @@ struct PrintingPolicy {
   /// \brief Whether we should print the sizes of constant array expressions
   /// as written in the sources.
   ///
-  /// This flag determines whether arrays types declared as
+  /// This flag determines whether array types declared as
   ///
   /// \code
   /// int a[4+10*10];


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


Re: Add flags to disable profile generation.

2015-08-05 Thread Justin Bogner
Diego Novillo  writes:
> This patch adds flags -fno-profile-instr-generate and
> -fno-profile-instr-use, and the GCC aliases -fno-profile-generate and
> -fno-profile-use.
>
> These flags are used in situations where users need to disable profile
> generation or use for specific files in a build, without affecting other
> files.
>
> OK to commit?

Sure, but we should probably add a -fno-coverage-mapping as well, since
`-fprofile-generate -fcoverage-mapping -fno-profile-generate` will error
with this change. Do you mind adding that in a followup?

> Thanks.  Diego.
>
> From 016d91cdf4540497f338a3ad4e2da612e29c7502 Mon Sep 17 00:00:00 2001
> From: Diego Novillo 
> Date: Wed, 5 Aug 2015 15:02:16 -0400
> Subject: [PATCH] Add flags to disable profile generation.
>
> This patch adds flags -fno-profile-instr-generate and
> -fno-profile-instr-use, and the GCC aliases -fno-profile-generate and
> -fno-profile-use.
>
> These flags are used in situations where users need to disable profile
> generation or use for specific files in a build, without affecting other
> files.
> ---
>  docs/UsersManual.rst| 13 
>  include/clang/Driver/Options.td | 10 ++
>  lib/Driver/Tools.cpp| 67 
> -
>  test/Driver/clang_f_opts.c  | 10 ++
>  4 files changed, 72 insertions(+), 28 deletions(-)
>
> diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst
> index 842538c..9a70d63 100644
> --- a/docs/UsersManual.rst
> +++ b/docs/UsersManual.rst
> @@ -1534,6 +1534,19 @@ with respect to profile creation and use.
>profile file, it reads from that file. If ``pathname`` is a directory name,
>it reads from ``pathname/default.profdata``.
>  
> +Disabling Instrumentation
> +^
> +
> +In certain situations, it may be useful to disable profile generation or use
> +for specific files in a build, without affecting the main compilation flags
> +used for the other files in the project.
> +
> +In these cases, you can use the flag ``-fno-profile-instr-generate`` (or
> +``-fno-profile-generate``) to disable profile generation, and
> +``-fno-profile-instr-use`` (or ``-fno-profile-use``) to disable profile use.
> +
> +Note that these flags should appear after the corresponding profile
> +flags to have an effect.
>  
>  Controlling Size of Debug Information
>  -
> diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
> index 63e880d..d84e03e 100644
> --- a/include/clang/Driver/Options.td
> +++ b/include/clang/Driver/Options.td
> @@ -446,6 +446,16 @@ def fprofile_use : Flag<["-"], "fprofile-use">, 
> Group,
>  def fprofile_use_EQ : Joined<["-"], "fprofile-use=">,
>  Group, Flags<[DriverOption]>, MetaVarName<"">,
>  HelpText<"Use instrumentation data for profile-guided optimization. If 
> pathname is a directory, it reads from /default.profdata. 
> Otherwise, it reads from file .">;
> +def fno_profile_instr_generate : Flag<["-"], "fno-profile-instr-generate">,
> +Group, Flags<[DriverOption]>,
> +HelpText<"Disable generation of profile instrumentation.">;
> +def fno_profile_generate : Flag<["-"], "fno-profile-generate">,
> +Alias;
> +def fno_profile_instr_use : Flag<["-"], "fno-profile-instr-use">,
> +Group, Flags<[DriverOption]>,
> +HelpText<"Disable using instrumentation data for profile-guided 
> optimization">;
> +def fno_profile_use : Flag<["-"], "fno-profile-use">,
> +Alias;
>  
>  def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CC1Option]>,
>HelpText<"Enable the 'blocks' language feature">;
> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
> index 2135b77..22863dc 100644
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -2848,42 +2848,53 @@ static void addPGOAndCoverageFlags(Compilation &C, 
> const Driver &D,
>auto *ProfileGenerateArg = Args.getLastArg(
>options::OPT_fprofile_instr_generate,
>options::OPT_fprofile_instr_generate_EQ, 
> options::OPT_fprofile_generate,
> -  options::OPT_fprofile_generate_EQ);
> +  options::OPT_fprofile_generate_EQ,
> +  options::OPT_fno_profile_instr_generate);
> +  if (ProfileGenerateArg &&
> +  ProfileGenerateArg->getOption().matches(
> +  options::OPT_fno_profile_instr_generate))
> +ProfileGenerateArg = nullptr;
>  
>auto *ProfileUseArg = Args.getLastArg(
>options::OPT_fprofile_instr_use, options::OPT_fprofile_instr_use_EQ,
> -  options::OPT_fprofile_use, options::OPT_fprofile_use_EQ);
> +  options::OPT_fprofile_use, options::OPT_fprofile_use_EQ,
> +  options::OPT_fno_profile_instr_use);
> +  if (ProfileUseArg &&
> +  ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use))
> +ProfileUseArg = nullptr;
>  
>if (ProfileGenerateArg && ProfileUseArg)
>  D.Diag(diag::err_drv_argument_not_allowed_with)
>  << ProfileGenerateArg->getSpelling() << ProfileUseArg->getSpelling();
>  
> -  if (

r244125 - Remove unused function GetBuiltinNames.

2015-08-05 Thread Eric Christopher
Author: echristo
Date: Wed Aug  5 16:04:24 2015
New Revision: 244125

URL: http://llvm.org/viewvc/llvm-project?rev=244125&view=rev
Log:
Remove unused function GetBuiltinNames.

Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/lib/Basic/Builtins.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=244125&r1=244124&r2=244125&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Wed Aug  5 16:04:24 2015
@@ -70,9 +70,6 @@ public:
   /// such.
   void InitializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts);
 
-  /// \brief Populate the vector with the names of all of the builtins.
-  void GetBuiltinNames(SmallVectorImpl &Names);
-
   /// \brief Return the identifier name for the specified builtin,
   /// e.g. "__builtin_abs".
   const char *GetName(unsigned ID) const {

Modified: cfe/trunk/lib/Basic/Builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Builtins.cpp?rev=244125&r1=244124&r2=244125&view=diff
==
--- cfe/trunk/lib/Basic/Builtins.cpp (original)
+++ cfe/trunk/lib/Basic/Builtins.cpp Wed Aug  5 16:04:24 2015
@@ -80,19 +80,6 @@ void Builtin::Context::InitializeBuiltin
   Table.get(TSRecords[i].Name).setBuiltinID(i+Builtin::FirstTSBuiltin);
 }
 
-void
-Builtin::Context::GetBuiltinNames(SmallVectorImpl &Names) {
-  // Final all target-independent names
-  for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
-if (!strchr(BuiltinInfo[i].Attributes, 'f'))
-  Names.push_back(BuiltinInfo[i].Name);
-
-  // Find target-specific names.
-  for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
-if (!strchr(TSRecords[i].Attributes, 'f'))
-  Names.push_back(TSRecords[i].Name);
-}
-
 void Builtin::Context::ForgetBuiltin(unsigned ID, IdentifierTable &Table) {
   Table.get(GetRecord(ID).Name).setBuiltinID(0);
 }


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


r244126 - Rename builtin_lang -> Langs to match the rest of the code a bit better.

2015-08-05 Thread Eric Christopher
Author: echristo
Date: Wed Aug  5 16:04:28 2015
New Revision: 244126

URL: http://llvm.org/viewvc/llvm-project?rev=244126&view=rev
Log:
Rename builtin_lang -> Langs to match the rest of the code a bit better.

Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/lib/Basic/Builtins.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=244126&r1=244125&r2=244126&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Wed Aug  5 16:04:28 2015
@@ -51,7 +51,7 @@ enum ID {
 
 struct Info {
   const char *Name, *Type, *Attributes, *HeaderName;
-  LanguageID builtin_lang;
+  LanguageID Langs;
 };
 
 /// \brief Holds information about both target-independent and

Modified: cfe/trunk/lib/Basic/Builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Builtins.cpp?rev=244126&r1=244125&r2=244126&view=diff
==
--- cfe/trunk/lib/Basic/Builtins.cpp (original)
+++ cfe/trunk/lib/Basic/Builtins.cpp Wed Aug  5 16:04:28 2015
@@ -22,9 +22,12 @@ using namespace clang;
 static const Builtin::Info BuiltinInfo[] = {
   { "not a builtin function", nullptr, nullptr, nullptr, ALL_LANGUAGES},
 #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES },
-#define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) { #ID, TYPE, ATTRS, 0, 
BUILTIN_LANG },
-#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) { #ID, TYPE, ATTRS, 
HEADER,\
-BUILTIN_LANG },
+#define LANGBUILTIN(ID, TYPE, ATTRS, LANGS)
\
+  { #ID, TYPE, ATTRS, 0, LANGS }   
\
+  ,
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) 
\
+  { #ID, TYPE, ATTRS, HEADER, LANGS }  
\
+  ,
 #include "clang/Basic/Builtins.def"
 };
 
@@ -53,12 +56,10 @@ bool Builtin::Context::BuiltinIsSupporte
   bool MathBuiltinsUnsupported =
 LangOpts.NoMathBuiltin && BuiltinInfo.HeaderName &&  
 llvm::StringRef(BuiltinInfo.HeaderName).equals("math.h");
-  bool GnuModeUnsupported = !LangOpts.GNUMode &&
-(BuiltinInfo.builtin_lang & GNU_LANG);
-  bool MSModeUnsupported = !LangOpts.MicrosoftExt &&
-   (BuiltinInfo.builtin_lang & MS_LANG);
-  bool ObjCUnsupported = !LangOpts.ObjC1 &&
- BuiltinInfo.builtin_lang == OBJC_LANG;
+  bool GnuModeUnsupported = !LangOpts.GNUMode && (BuiltinInfo.Langs & 
GNU_LANG);
+  bool MSModeUnsupported =
+  !LangOpts.MicrosoftExt && (BuiltinInfo.Langs & MS_LANG);
+  bool ObjCUnsupported = !LangOpts.ObjC1 && BuiltinInfo.Langs == OBJC_LANG;
   return !BuiltinsUnsupported && !MathBuiltinsUnsupported &&
  !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported;
 }


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


Re: [PATCH] D11757: Propagate SourceLocations through to get a Loc on float_cast_overflow

2015-08-05 Thread Filipe Cabecinhas
filcab added a comment.

In http://reviews.llvm.org/D11757#218153, @samsonov wrote:

> Note that you would need to make a corresponding change in UBSan compiler-rt 
> runtime.


I finished this late last night, so I figured I'd upload the bigger patch and 
start getting comments. :-)

> Also, this is an ABI-breaking change - e.g. shared objects built with older 
> Clang will not work properly with new runtime. I would recommend you to add 
> *some* diagnostic to ubsan runtime - e.g. if it tries to read SourceLocation 
> from FloatCastOverflowData passed to handler, but it looks more like 
> TypeDescriptor, than it would crash with a verbose message.


I've made the simple UBSan patch and am only missing changing tests (on my 
machine we do get file names and lines for those source locations, from debug 
info, but I'll figure out a way to differentiate those).
I'll add a small check for v1/v2 of FloatCastOverflowData.

I will only commit after both patches are accepted, too.


http://reviews.llvm.org/D11757



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


Re: [PATCH] D11298: Convert a few classes over to use the new TrailingObjects helper.

2015-08-05 Thread Richard Smith
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Looks like a really nice cleanup, thanks!



Comment at: include/clang/AST/DeclTemplate.h:47-49
@@ -45,3 +46,5 @@
 /// derived classes.
-class LLVM_ALIGNAS(/*alignof(void*)*/ LLVM_PTR_SIZE) TemplateParameterList {
+class LLVM_ALIGNAS(/*alignof(void*)*/ LLVM_PTR_SIZE) TemplateParameterList 
final
+: private llvm::TrailingObjects {
+
   /// The location of the 'template' keyword.

I've used that trick in the past to work around the same bug in older versions 
of GCC; I think it should work OK (but we're getting into known-weird corners 
of MSVC record layout). Doing that in a follow-up change seems fine to me.


Comment at: lib/AST/Decl.cpp:3122
@@ +3121,3 @@
+  void *Buffer = Context.Allocate(
+  totalSizeToAlloc(
+  TArgs.size(), Ts.size()));

OK, I guessed that might be the reason. Seems like a reasonable safety measure. 
(Do you get an error if you specify the wrong types?)


Comment at: lib/AST/DeclTemplate.cpp:554-557
@@ -556,5 +553,6 @@
+getTrailingObjects>();
 for (unsigned I = 0; I != NumExpandedTypes; ++I) {
-  TypesAndInfos[2*I] = ExpandedTypes[I].getAsOpaquePtr();
-  TypesAndInfos[2*I + 1] = ExpandedTInfos[I];
+  TypesAndInfos[I].first = ExpandedTypes[I];
+  TypesAndInfos[I].second = ExpandedTInfos[I];
 }
   }

I'd prefer a placement new expression here rather than calling the assignment 
operator on an uninitialized `QualType` object.


http://reviews.llvm.org/D11298



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


Re: [PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-05 Thread Richard Smith
rsmith added inline comments.


Comment at: include/clang/Basic/Module.h:203-211
@@ -202,1 +202,11 @@
 
+  /// \brief Whether this module uses the 'requires excluded' hack to mark its
+  /// contents as 'textual'.
+  ///
+  /// On older Darwin SDK versions, 'requires excluded' is used to mark the
+  /// contents of the Darwin.C.excluded (assert.h) and Tcl.Private modules as
+  /// non-modular headers.  For backwards compatibility, we continue to support
+  /// this idiom for just these modules, and map the headers to 'textual' to
+  /// match the original intent.
+  unsigned UsesRequiresExcludedHack : 1;
+

Do we really need to write this into the `Module` object? Could we instead just 
track this while we're parsing the module map?


Comment at: lib/Lex/ModuleMap.cpp:1590-1603
@@ +1589,16 @@
+ bool &IsRequiresExcludedHack) {
+  if (Feature == "excluded" || Feature == "cplusplus") {
+std::string FullName = M->getFullModuleName();
+if (FullName == "Darwin.C.excluded" || FullName == "Tcl.Private") {
+  // We will mark the module contents non-modular. See doc comment for
+  // Module::UsesRequiresExcludedHack.
+  IsRequiresExcludedHack = true;
+  return false;
+} else if (FullName == "IOKit.avc") {
+  // This module was mistakenly marked 'requires cplusplus' in older Darwin
+  // SDK versions. As a backwards compatibility hack, don't add the
+  // requirement.
+  return false;
+}
+  }
+

Please handle the `excluded` and `cplusplus` cases separately, to keep this 
special case as narrow as possible.


Comment at: lib/Lex/ModuleMap.cpp:1591
@@ +1590,3 @@
+  if (Feature == "excluded" || Feature == "cplusplus") {
+std::string FullName = M->getFullModuleName();
+if (FullName == "Darwin.C.excluded" || FullName == "Tcl.Private") {

Seems like overkill to compute the full module name for every module that 
`requires cplusplus`. Instead, how about walking the module path a component at 
a time and checking you get the expected sequence of components?


Comment at: lib/Lex/ModuleMap.cpp:1891-1908
@@ +1890,20 @@
+
+  if (ActiveModule->UsesRequiresExcludedHack) {
+// Mark this header 'textual' (see doc comment for
+// Module::UsesRequiresExcludedHack). Although iterating over the directory
+// is relatively expensive, in practice this only applies to the uncommonly
+// used Tcl module on Darwin platforms.
+std::error_code EC;
+for (llvm::sys::fs::recursive_directory_iterator I(Dir->getName(), EC), E;
+ I != E && !EC; I.increment(EC)) {
+  if (const FileEntry *FE = SourceMgr.getFileManager().getFile(I->path())) 
{
+// FIXME: Taking the name from the FileEntry is unstable and can give
+// different results depending on how we've previously named that file
+// in this build.
+Module::Header Header = {FE->getName(), FE};
+Map.addHeader(ActiveModule, Header, ModuleMap::TextualHeader);
+  }
+}
+return;
+  }
+

Is there a better way of handling this? If the parent directory isn't itself an 
umbrella directory of some module, maybe you could just ignore the umbrella 
directory declaration for this module entirely?


Repository:
  rL LLVM

http://reviews.llvm.org/D11403



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


Re: [PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-05 Thread Ben Langmuir
benlangmuir added inline comments.


Comment at: include/clang/Basic/Module.h:203-211
@@ -202,1 +202,11 @@
 
+  /// \brief Whether this module uses the 'requires excluded' hack to mark its
+  /// contents as 'textual'.
+  ///
+  /// On older Darwin SDK versions, 'requires excluded' is used to mark the
+  /// contents of the Darwin.C.excluded (assert.h) and Tcl.Private modules as
+  /// non-modular headers.  For backwards compatibility, we continue to support
+  /// this idiom for just these modules, and map the headers to 'textual' to
+  /// match the original intent.
+  unsigned UsesRequiresExcludedHack : 1;
+

rsmith wrote:
> Do we really need to write this into the `Module` object? Could we instead 
> just track this while we're parsing the module map?
Will do.


Comment at: lib/Lex/ModuleMap.cpp:1590-1603
@@ +1589,16 @@
+ bool &IsRequiresExcludedHack) {
+  if (Feature == "excluded" || Feature == "cplusplus") {
+std::string FullName = M->getFullModuleName();
+if (FullName == "Darwin.C.excluded" || FullName == "Tcl.Private") {
+  // We will mark the module contents non-modular. See doc comment for
+  // Module::UsesRequiresExcludedHack.
+  IsRequiresExcludedHack = true;
+  return false;
+} else if (FullName == "IOKit.avc") {
+  // This module was mistakenly marked 'requires cplusplus' in older Darwin
+  // SDK versions. As a backwards compatibility hack, don't add the
+  // requirement.
+  return false;
+}
+  }
+

rsmith wrote:
> Please handle the `excluded` and `cplusplus` cases separately, to keep this 
> special case as narrow as possible.
Will do.  Not sure why I ever combined them like that...


Comment at: lib/Lex/ModuleMap.cpp:1591
@@ +1590,3 @@
+  if (Feature == "excluded" || Feature == "cplusplus") {
+std::string FullName = M->getFullModuleName();
+if (FullName == "Darwin.C.excluded" || FullName == "Tcl.Private") {

rsmith wrote:
> Seems like overkill to compute the full module name for every module that 
> `requires cplusplus`. Instead, how about walking the module path a component 
> at a time and checking you get the expected sequence of components?
Makes sense, will do.


Comment at: lib/Lex/ModuleMap.cpp:1891-1908
@@ +1890,20 @@
+
+  if (ActiveModule->UsesRequiresExcludedHack) {
+// Mark this header 'textual' (see doc comment for
+// Module::UsesRequiresExcludedHack). Although iterating over the directory
+// is relatively expensive, in practice this only applies to the uncommonly
+// used Tcl module on Darwin platforms.
+std::error_code EC;
+for (llvm::sys::fs::recursive_directory_iterator I(Dir->getName(), EC), E;
+ I != E && !EC; I.increment(EC)) {
+  if (const FileEntry *FE = SourceMgr.getFileManager().getFile(I->path())) 
{
+// FIXME: Taking the name from the FileEntry is unstable and can give
+// different results depending on how we've previously named that file
+// in this build.
+Module::Header Header = {FE->getName(), FE};
+Map.addHeader(ActiveModule, Header, ModuleMap::TextualHeader);
+  }
+}
+return;
+  }
+

rsmith wrote:
> Is there a better way of handling this? If the parent directory isn't itself 
> an umbrella directory of some module, maybe you could just ignore the 
> umbrella directory declaration for this module entirely?
This only affects Tcl.Private, and Tcl has an umbrella header so I don't think 
that will work.  The only other way I can think of making this work is to have 
a notion of a *directory* that is exempt from its containing umbrella, but I'm 
not sure that's a generally good feature and it seems like a lot more work.  
Let me know if you have any suggestions though.


Repository:
  rL LLVM

http://reviews.llvm.org/D11403



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


Re: [PATCH] D11757: Propagate SourceLocations through to get a Loc on float_cast_overflow

2015-08-05 Thread Richard Smith
rsmith added a comment.

Looks good to me too (though please hold off on this until you and samsonov 
have agreed on what to do about the ubsan ABI change).



Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:1288
@@ -1287,3 +1287,3 @@
OpenMPDirectiveKind Kind,
-   const RegionCodeGenTy &BodyOpGen) {
+   const RegionCodeGenTy &BodyOpGen, SourceLocation Loc) {
   llvm::Value *CallBool = CGF.EmitScalarConversion(

Please reorder the parameters to put the source location before the body, so 
that the expected lambda parameter is last (see 
http://llvm.org/docs/CodingStandards.html#format-lambdas-like-blocks-of-code).


http://reviews.llvm.org/D11757



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


Re: [PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-05 Thread Richard Smith
rsmith added inline comments.


Comment at: lib/Lex/ModuleMap.cpp:1891-1908
@@ +1890,20 @@
+
+  if (ActiveModule->UsesRequiresExcludedHack) {
+// Mark this header 'textual' (see doc comment for
+// Module::UsesRequiresExcludedHack). Although iterating over the directory
+// is relatively expensive, in practice this only applies to the uncommonly
+// used Tcl module on Darwin platforms.
+std::error_code EC;
+for (llvm::sys::fs::recursive_directory_iterator I(Dir->getName(), EC), E;
+ I != E && !EC; I.increment(EC)) {
+  if (const FileEntry *FE = SourceMgr.getFileManager().getFile(I->path())) 
{
+// FIXME: Taking the name from the FileEntry is unstable and can give
+// different results depending on how we've previously named that file
+// in this build.
+Module::Header Header = {FE->getName(), FE};
+Map.addHeader(ActiveModule, Header, ModuleMap::TextualHeader);
+  }
+}
+return;
+  }
+

benlangmuir wrote:
> rsmith wrote:
> > Is there a better way of handling this? If the parent directory isn't 
> > itself an umbrella directory of some module, maybe you could just ignore 
> > the umbrella directory declaration for this module entirely?
> This only affects Tcl.Private, and Tcl has an umbrella header so I don't 
> think that will work.  The only other way I can think of making this work is 
> to have a notion of a *directory* that is exempt from its containing 
> umbrella, but I'm not sure that's a generally good feature and it seems like 
> a lot more work.  Let me know if you have any suggestions though.
Ugh, OK. In that case:

 * maybe take the file name from `I->path()` rather than `FE->getName()` (we 
want to imagine the files were named within the umbrella directory rather than 
some other way)
 * sort the paths before you add them so that the serialized pcm doesn't depend 
on file system traversal order

Also, you'll be paying this file system traversal cost whenever the relevant 
module map is parsed, not only when the Tcl module is used -- and if it's the 
/usr/include module map, you'll walk this umbrella directory on every build. 
Just wanted to confirm you're OK with that.


Repository:
  rL LLVM

http://reviews.llvm.org/D11403



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


Re: Add flags to disable profile generation.

2015-08-05 Thread Diego Novillo
On Wed, Aug 5, 2015 at 4:04 PM, Justin Bogner 
wrote:

> Diego Novillo  writes:
> > This patch adds flags -fno-profile-instr-generate and
> > -fno-profile-instr-use, and the GCC aliases -fno-profile-generate and
> > -fno-profile-use.
> >
> > These flags are used in situations where users need to disable profile
> > generation or use for specific files in a build, without affecting other
> > files.
> >
> > OK to commit?
>
> Sure, but we should probably add a -fno-coverage-mapping as well, since
> `-fprofile-generate -fcoverage-mapping -fno-profile-generate` will error
> with this change. Do you mind adding that in a followup?
>

No problem.  Patch coming up.


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


r244153 - Add flags to disable profile generation.

2015-08-05 Thread Diego Novillo
Author: dnovillo
Date: Wed Aug  5 16:49:51 2015
New Revision: 244153

URL: http://llvm.org/viewvc/llvm-project?rev=244153&view=rev
Log:
Add flags to disable profile generation.

This patch adds flags -fno-profile-instr-generate and
-fno-profile-instr-use, and the GCC aliases -fno-profile-generate and
-fno-profile-use.

These flags are used in situations where users need to disable profile
generation or use for specific files in a build, without affecting other
files.

Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=244153&r1=244152&r2=244153&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Wed Aug  5 16:49:51 2015
@@ -1534,6 +1534,19 @@ with respect to profile creation and use
   profile file, it reads from that file. If ``pathname`` is a directory name,
   it reads from ``pathname/default.profdata``.
 
+Disabling Instrumentation
+^
+
+In certain situations, it may be useful to disable profile generation or use
+for specific files in a build, without affecting the main compilation flags
+used for the other files in the project.
+
+In these cases, you can use the flag ``-fno-profile-instr-generate`` (or
+``-fno-profile-generate``) to disable profile generation, and
+``-fno-profile-instr-use`` (or ``-fno-profile-use``) to disable profile use.
+
+Note that these flags should appear after the corresponding profile
+flags to have an effect.
 
 Controlling Size of Debug Information
 -

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=244153&r1=244152&r2=244153&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Aug  5 16:49:51 2015
@@ -446,6 +446,16 @@ def fprofile_use : Flag<["-"], "fprofile
 def fprofile_use_EQ : Joined<["-"], "fprofile-use=">,
 Group, Flags<[DriverOption]>, MetaVarName<"">,
 HelpText<"Use instrumentation data for profile-guided optimization. If 
pathname is a directory, it reads from /default.profdata. Otherwise, 
it reads from file .">;
+def fno_profile_instr_generate : Flag<["-"], "fno-profile-instr-generate">,
+Group, Flags<[DriverOption]>,
+HelpText<"Disable generation of profile instrumentation.">;
+def fno_profile_generate : Flag<["-"], "fno-profile-generate">,
+Alias;
+def fno_profile_instr_use : Flag<["-"], "fno-profile-instr-use">,
+Group, Flags<[DriverOption]>,
+HelpText<"Disable using instrumentation data for profile-guided 
optimization">;
+def fno_profile_use : Flag<["-"], "fno-profile-use">,
+Alias;
 
 def fblocks : Flag<["-"], "fblocks">, Group, Flags<[CC1Option]>,
   HelpText<"Enable the 'blocks' language feature">;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=244153&r1=244152&r2=244153&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug  5 16:49:51 2015
@@ -2848,42 +2848,53 @@ static void addPGOAndCoverageFlags(Compi
   auto *ProfileGenerateArg = Args.getLastArg(
   options::OPT_fprofile_instr_generate,
   options::OPT_fprofile_instr_generate_EQ, options::OPT_fprofile_generate,
-  options::OPT_fprofile_generate_EQ);
+  options::OPT_fprofile_generate_EQ,
+  options::OPT_fno_profile_instr_generate);
+  if (ProfileGenerateArg &&
+  ProfileGenerateArg->getOption().matches(
+  options::OPT_fno_profile_instr_generate))
+ProfileGenerateArg = nullptr;
 
   auto *ProfileUseArg = Args.getLastArg(
   options::OPT_fprofile_instr_use, options::OPT_fprofile_instr_use_EQ,
-  options::OPT_fprofile_use, options::OPT_fprofile_use_EQ);
+  options::OPT_fprofile_use, options::OPT_fprofile_use_EQ,
+  options::OPT_fno_profile_instr_use);
+  if (ProfileUseArg &&
+  ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use))
+ProfileUseArg = nullptr;
 
   if (ProfileGenerateArg && ProfileUseArg)
 D.Diag(diag::err_drv_argument_not_allowed_with)
 << ProfileGenerateArg->getSpelling() << ProfileUseArg->getSpelling();
 
-  if (ProfileGenerateArg &&
-  ProfileGenerateArg->getOption().matches(
-  options::OPT_fprofile_instr_generate_EQ))
-ProfileGenerateArg->render(Args, CmdArgs);
-  else if (ProfileGenerateArg &&
-   ProfileGenerateArg->getOption().matches(
-   options::OPT_fprofile_generate_EQ)) {
-SmallString<128>

Re: [PATCH] D11778: Improvements on Diagnostic in Macro Expansions

2015-08-05 Thread Richard Trieu
rtrieu added a comment.

Some questions about your tests.



Comment at: test/Misc/reduced-diags-macros-backtrace.cpp:27
@@ +26,3 @@
+// ALL-NEXT: {{.*}}:7:23: note: expanded from macro 'LEVEL4'
+// ALL-NEXT: #define LEVEL4(x) ADD(p,x)
+// ALL-NEXT:   ^

Why are macro notes printed after this one?  Clang found 'p' so it does not 
need to give any more information.


Comment at: test/Misc/reduced-diags-macros-backtrace.cpp:36
@@ +35,3 @@
+// ALL-NEXT: {{.*}}:12:16: error: use of undeclared identifier 'b'
+// ALL-NEXT: int a = LEVEL1(b);
+// ALL-NEXT:^

Same question, why are notes still printed after this one?


Comment at: test/Misc/reduced-diags-macros-backtrace.cpp:53-78
@@ +52,27 @@
+// SKIP: {{.*}}:12:9: error: use of undeclared identifier 'p'
+// SKIP-ALL: int a = LEVEL1(b);
+// SKIP-ALL: ^
+// SKIP-ALL: {{.*}}:10:19: note: expanded from macro 'LEVEL1'
+// SKIP-ALL: #define LEVEL1(x) LEVEL2(x)
+// SKIP-ALL:   ^
+// SKIP-ALL: note: (skipping 3 expansions in backtrace; use 
-fmacro-backtrace-limit=0 to see all)
+// SKIP-ALL: {{.*}}:6:20: note: expanded from macro 'ADD'
+// SKIP-ALL: #define ADD(x,y) G(x) + y
+// SKIP-ALL:^
+// SKIP-ALL: {{.*}}:5:16: note: expanded from macro 'G'
+// SKIP-ALL: #define G(x) F(x) + 2
+// SKIP-ALL:^
+// SKIP-ALL: {{.*}}:12:16: error: use of undeclared identifier 'b'
+// SKIP-ALL: int a = LEVEL1(b);
+// SKIP-ALL:^
+// SKIP-ALL: {{.*}}:10:26: note: expanded from macro 'LEVEL1'
+// SKIP-ALL: #define LEVEL1(x) LEVEL2(x)
+// SKIP-ALL:  ^
+// SKIP-ALL: note: (skipping 1 expansions in backtrace; use 
-fmacro-backtrace-limit=0 to see all)
+// SKIP-ALL: {{.*}}:8:26: note: expanded from macro 'LEVEL3'
+// SKIP-ALL: #define LEVEL3(x) LEVEL4(x)
+// SKIP-ALL:  ^
+// SKIP-ALL: {{.*}}:7:25: note: expanded from macro 'LEVEL4'
+// SKIP-ALL: #define LEVEL4(x) ADD(p,x)
+// SKIP-ALL: ^
+// SKIP-ALL: 2 errors generated.

Did you mean "SKIP-NEXT"?


Comment at: test/Misc/reduced-diags-macros.cpp:13-14
@@ +12,4 @@
+// CHECK-NEXT: {{.*}}:3:34: note: expanded from macro 'NO_INITIATION'
+// CHECK-NEXT: #define NO_INITIATION(x) int a = x * 2
+// CHECK-NEXT:  ^
+

If this had one more macro expansion, would it be printed or not?


Comment at: test/Misc/reduced-diags-macros.cpp:27-29
@@ +26,5 @@
+
+// CHECK: {{.*}}:25:23: error: use of undeclared identifier 'x'
+// CHECK-NEXT: int  p = SWAP_ARGU(3, x);
+// CHECK-NEXT:   ^
+// CHECK-NEXT: {{.*}}:23:28: note: expanded from macro 'SWAP_ARGU'

How is this different than the test for 'b' above?  Specifically, why does the 
error for 'b' print no macros notes while the error for 'x' prints two notes?


http://reviews.llvm.org/D11778



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


Re: [PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-05 Thread Ben Langmuir
benlangmuir added inline comments.


Comment at: lib/Lex/ModuleMap.cpp:1891-1908
@@ +1890,20 @@
+
+  if (ActiveModule->UsesRequiresExcludedHack) {
+// Mark this header 'textual' (see doc comment for
+// Module::UsesRequiresExcludedHack). Although iterating over the directory
+// is relatively expensive, in practice this only applies to the uncommonly
+// used Tcl module on Darwin platforms.
+std::error_code EC;
+for (llvm::sys::fs::recursive_directory_iterator I(Dir->getName(), EC), E;
+ I != E && !EC; I.increment(EC)) {
+  if (const FileEntry *FE = SourceMgr.getFileManager().getFile(I->path())) 
{
+// FIXME: Taking the name from the FileEntry is unstable and can give
+// different results depending on how we've previously named that file
+// in this build.
+Module::Header Header = {FE->getName(), FE};
+Map.addHeader(ActiveModule, Header, ModuleMap::TextualHeader);
+  }
+}
+return;
+  }
+

rsmith wrote:
> benlangmuir wrote:
> > rsmith wrote:
> > > Is there a better way of handling this? If the parent directory isn't 
> > > itself an umbrella directory of some module, maybe you could just ignore 
> > > the umbrella directory declaration for this module entirely?
> > This only affects Tcl.Private, and Tcl has an umbrella header so I don't 
> > think that will work.  The only other way I can think of making this work 
> > is to have a notion of a *directory* that is exempt from its containing 
> > umbrella, but I'm not sure that's a generally good feature and it seems 
> > like a lot more work.  Let me know if you have any suggestions though.
> Ugh, OK. In that case:
> 
>  * maybe take the file name from `I->path()` rather than `FE->getName()` (we 
> want to imagine the files were named within the umbrella directory rather 
> than some other way)
>  * sort the paths before you add them so that the serialized pcm doesn't 
> depend on file system traversal order
> 
> Also, you'll be paying this file system traversal cost whenever the relevant 
> module map is parsed, not only when the Tcl module is used -- and if it's the 
> /usr/include module map, you'll walk this umbrella directory on every build. 
> Just wanted to confirm you're OK with that.
> * maybe take the file name from I->path() rather than FE->getName()
> * sort the paths
Ah, good catches!

> Also, you'll be paying this file system traversal cost whenever the relevant 
> module map is parsed,

Tcl is a framework so not affected by looking at usr/include.  But your comment 
made me double check where else we might parse this.  I think the answer is:

1. When Tcl is named in an import or header include.  This seems fine.
2. When we call collectAllModules()...

I'm not happy about (2) since it can happen during code completion of imports.  
I suppose we're already iterating directories and parsing a tonne of other 
module map files here.  I'll benchmark this and see how awful it is... 


Repository:
  rL LLVM

http://reviews.llvm.org/D11403



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


Re: r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Renato Golin
On 5 August 2015 at 18:23, Argyrios Kyrtzidis  wrote:
> Author: akirtzidis
> Date: Wed Aug  5 12:23:59 2015
> New Revision: 244066
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev
> Log:
> [test/Index] Update libclang tests to use libclang for creating PCH files.

Hi,

This also broke our bots:

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6914

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1882

and 244076 didn't fix it.

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


Re: r244070 - [CMake] First pass at adding support for clang bootstrap builds to CMake

2015-08-05 Thread Justin Bogner
Chris Bieneman  writes:
> Author: cbieneman
> Date: Wed Aug  5 12:38:12 2015
> New Revision: 244070
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244070&view=rev
> Log:
> [CMake] First pass at adding support for clang bootstrap builds to CMake
>
> Summary:
> This patch adds a new CLANG_ENABLE_BOOTSTRAP option to CMake which
> adds targets for building a stage2 bootstrap compiler. The targets
> are:

This is great! Thanks for working on it.

Would it be crazy to make this pass along the tablegen from the stage1
build to the stage2 build, so that it doesn't need to rebuild it?

> bootstrap-configure
> bootstrap-build
> bootstrap (same as bootstrap-configure and bootstrap-build)
> bootstrap-install
> bootstrap-check-llvm
> bootstrap-check-clang
> bootstrap-check-all
>
> If you are using 3.3.20150708 or greater it utilizes the ninja
> USES_TERMINAL_* settings on the external project so that the output is
> properly buffered.
>
> Reviewers: bogner, chandlerc
>
> Subscribers: filcab, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D11743
>
> Modified:
> cfe/trunk/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=244070&r1=244069&r2=244070&view=diff
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Wed Aug  5 12:38:12 2015
> @@ -96,6 +96,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
>  
>option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
>  "Set to ON to force using an old, unsupported host toolchain." OFF)
> +  option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
>  
>include(AddLLVM)
>include(TableGen)
> @@ -551,3 +552,76 @@ if (CLANG_BUILT_STANDALONE)
>  ${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
>  COPYONLY)
>  endif ()
> +
> +if (CLANG_ENABLE_BOOTSTRAP)
> +  include(ExternalProject)
> +
> +  if(CMAKE_VERSION VERSION_LESS 3.3.20150708)
> +set(cmake_3_4_USES_TERMINAL_OPTIONS)
> +  else()
> +set(cmake_3_4_USES_TERMINAL_OPTIONS
> +  USES_TERMINAL_CONFIGURE 1
> +  USES_TERMINAL_BUILD 1
> +  USES_TERMINAL_INSTALL 1
> +  )
> +  endif()
> +  
> +  set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-stamps/)
> +  set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-bins/)
> +
> +  add_custom_target(bootstrap-clear
> +DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
> +)
> +  add_custom_command(
> +OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
> +DEPENDS clang
> +COMMAND ${CMAKE_COMMAND} -E remove_directory ${BINARY_DIR}
> +COMMAND ${CMAKE_COMMAND} -E make_directory ${BINARY_DIR}
> +COMMAND ${CMAKE_COMMAND} -E remove_directory ${STAMP_DIR}
> +COMMAND ${CMAKE_COMMAND} -E make_directory ${STAMP_DIR}
> +COMMAND ${CMAKE_COMMAND} -E touch 
> ${CMAKE_CURRENT_BINARY_DIR}/bootstrap-cleared
> +COMMENT "Clobberring bootstrap build and stamp directories"
> +)
> +
> +  ExternalProject_Add(bootstrap
> +DEPENDS clang
> +PREFIX bootstrap
> +SOURCE_DIR ${CMAKE_SOURCE_DIR}
> +STAMP_DIR ${STAMP_DIR}
> +BINARY_DIR ${BINARY_DIR}
> +CMAKE_ARGS
> +# We shouldn't need to set this here, but INSTALL_DIR doesn't
> +# seem to work, so instead I'm passing this through
> +-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
> +${CLANG_BOOTSTRAP_CMAKE_ARGS}
> +-DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++
> +-DCMAKE_C_COMPILER=${CMAKE_BINARY_DIR}/bin/clang
> +INSTALL_COMMAND ""
> +STEP_TARGETS configure build
> +${cmake_3_4_USES_TERMINAL_OPTIONS}
> +)
> +
> +  # exclude really-install from main target
> +  set_target_properties(bootstrap PROPERTIES 
> _EP_really-install_EXCLUDE_FROM_MAIN On)
> +  ExternalProject_Add_Step(bootstrap really-install
> +COMMAND ${CMAKE_COMMAND} --build  --target install
> +COMMENT "Performing install step for 'bootstrap'"
> +DEPENDEES build
> +  )
> +  ExternalProject_Add_StepTargets(bootstrap really-install)
> +  add_custom_target(bootstrap-install DEPENDS bootstrap-really-install)
> +
> +
> +  set(ADDITIONAL_TARGETS_TO_ADD check-llvm check-clang check-all)
> +  foreach(target ${ADDITIONAL_TARGETS_TO_ADD})
> +# exclude from main target
> +set_target_properties(bootstrap PROPERTIES 
> _EP_${target}_EXCLUDE_FROM_MAIN On)
> +
> +ExternalProject_Add_Step(bootstrap ${target}
> +  COMMAND ${CMAKE_COMMAND} --build  --target ${target}
> +  COMMENT "Performing ${target} for 'bootstrap'"
> +  DEPENDEES configure
> +)
> +ExternalProject_Add_StepTargets(bootstrap ${target})
> +  endforeach()
> +endif()
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commit

r244161 - function_ref-ize ExternalASTSource::FindExternalLexicalDecl and remove its

2015-08-05 Thread Richard Smith
Author: rsmith
Date: Wed Aug  5 17:41:45 2015
New Revision: 244161

URL: http://llvm.org/viewvc/llvm-project?rev=244161&view=rev
Log:
function_ref-ize ExternalASTSource::FindExternalLexicalDecl and remove its
useless return value. Switch to using it directly when completing the
redeclaration chain for an anonymous declaration, and reduce the set of
declarations that we load in the process to just those of the right kind.

Modified:
cfe/trunk/include/clang/AST/ExternalASTSource.h
cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ModuleManager.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/ExternalASTSource.cpp
cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/include/clang/AST/ExternalASTSource.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExternalASTSource.h?rev=244161&r1=244160&r2=244161&view=diff
==
--- cfe/trunk/include/clang/AST/ExternalASTSource.h (original)
+++ cfe/trunk/include/clang/AST/ExternalASTSource.h Wed Aug  5 17:41:45 2015
@@ -33,20 +33,6 @@ class Selector;
 class Stmt;
 class TagDecl;
 
-/// \brief Enumeration describing the result of loading information from
-/// an external source.
-enum ExternalLoadResult {
-  /// \brief Loading the external information has succeeded.
-  ELR_Success,
-  
-  /// \brief Loading the external information has failed.
-  ELR_Failure,
-  
-  /// \brief The external information has already been loaded, and therefore
-  /// no additional processing is required.
-  ELR_AlreadyLoaded
-};
-
 /// \brief Abstract interface for external sources of AST nodes.
 ///
 /// External AST sources provide AST nodes constructed from some
@@ -173,30 +159,20 @@ public:
   /// \brief Finds all declarations lexically contained within the given
   /// DeclContext, after applying an optional filter predicate.
   ///
-  /// \param isKindWeWant a predicate function that returns true if the passed
-  /// declaration kind is one we are looking for. If NULL, all declarations
-  /// are returned.
-  ///
-  /// \return an indication of whether the load succeeded or failed.
+  /// \param IsKindWeWant a predicate function that returns true if the passed
+  /// declaration kind is one we are looking for.
   ///
   /// The default implementation of this method is a no-op.
-  virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
-bool (*isKindWeWant)(Decl::Kind),
-SmallVectorImpl &Result);
+  virtual void
+  FindExternalLexicalDecls(const DeclContext *DC,
+   llvm::function_ref IsKindWeWant,
+   SmallVectorImpl &Result);
 
   /// \brief Finds all declarations lexically contained within the given
   /// DeclContext.
-  ///
-  /// \return true if an error occurred
-  ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
-SmallVectorImpl &Result) {
-return FindExternalLexicalDecls(DC, nullptr, Result);
-  }
-
-  template 
-  ExternalLoadResult FindExternalLexicalDeclsBy(const DeclContext *DC,
-  SmallVectorImpl &Result) {
-return FindExternalLexicalDecls(DC, DeclTy::classofKind, Result);
+  void FindExternalLexicalDecls(const DeclContext *DC,
+SmallVectorImpl &Result) {
+FindExternalLexicalDecls(DC, [](Decl::Kind) { return true; }, Result);
   }
 
   /// \brief Get the decls that are contained in a file in the Offset/Length

Modified: cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h?rev=244161&r1=244160&r2=244161&view=diff
==
--- cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h (original)
+++ cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h Wed Aug  5 
17:41:45 2015
@@ -102,29 +102,12 @@ public:
   /// \brief Finds all declarations lexically contained within the given
   /// DeclContext, after applying an optional filter predicate.
   ///
-  /// \param isKindWeWant a predicate function that returns true if the passed
-  /// declaration kind is one we are looking for. If NULL, all declarations
-  /// are returned.
-  ///
-  /// \return an indication of whether the load succeeded or failed.
-  ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
-bool (*isKindWeWant)(Decl::Kind),
-SmallVectorImpl &Result) override;
-
-  /// \brief Finds all declarations lexically contained within 

Re: r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Argyrios Kyrtzidis
I tentatively made a change to one of the tests and it looks like it worked, so 
I’ll make the same change to the rest.

> On Aug 5, 2015, at 3:10 PM, Renato Golin  wrote:
> 
> On 5 August 2015 at 18:23, Argyrios Kyrtzidis  wrote:
>> Author: akirtzidis
>> Date: Wed Aug  5 12:23:59 2015
>> New Revision: 244066
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev
>> Log:
>> [test/Index] Update libclang tests to use libclang for creating PCH files.
> 
> Hi,
> 
> This also broke our bots:
> 
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6914
> 
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1882
> 
> and 244076 didn't fix it.
> 
> cheers,
> --renato

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


[PATCH] D11789: Modify DeclaratorChuck::getFunction to be passed an Exception Specification SourceRange

2015-08-05 Thread Nathan Wilson
nwilson created this revision.
nwilson added reviewers: rsmith, hubert.reinterpretcast, fraggamuffin, faisalv, 
aaron.ballman.
nwilson added a subscriber: cfe-commits.

- Store the exception specification range's begin and end SourceLocation in 
DeclaratorChuck::FunctionTypeInfo. These SourceLocations can be used in a 
FixItHint Range.
- Add diagnostic; function concept having an exception specification.


http://reviews.llvm.org/D11789

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/DeclSpec.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaType.cpp
  test/SemaCXX/cxx-concept-declaration.cpp

Index: test/SemaCXX/cxx-concept-declaration.cpp
===
--- test/SemaCXX/cxx-concept-declaration.cpp
+++ test/SemaCXX/cxx-concept-declaration.cpp
@@ -23,3 +23,5 @@
 template
 concept bool D6; // expected-error {{variable concept declaration must be initialized}}
 
+template
+concept bool D7() throw(int) { return true; } // expected-error {{function concept can not have exception specifiers}}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -700,7 +700,7 @@
   /*VolatileQualifierLoc=*/NoLoc,
   /*RestrictQualifierLoc=*/NoLoc,
   /*MutableLoc=*/NoLoc, EST_None,
-  /*ESpecLoc=*/NoLoc,
+  /*ESpecRange=*/SourceRange(),
   /*Exceptions=*/nullptr,
   /*ExceptionRanges=*/nullptr,
   /*NumExceptions=*/0,
@@ -3833,7 +3833,7 @@
   // Exception specs are not allowed in typedefs. Complain, but add it
   // anyway.
   if (IsTypedefName && FTI.getExceptionSpecType())
-S.Diag(FTI.getExceptionSpecLoc(), diag::err_exception_spec_in_typedef)
+S.Diag(FTI.getExceptionSpecLocBeg(), diag::err_exception_spec_in_typedef)
   << (D.getContext() == Declarator::AliasDeclContext ||
   D.getContext() == Declarator::AliasTemplateContext);
 
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -7444,6 +7444,21 @@
 NewFD->setInvalidDecl();
   }
 
+  if (const FunctionProtoType *FPT = R->getAs()) {
+if (FPT->hasExceptionSpec()) {
+  auto LocBeg = D.getFunctionTypeInfo().getExceptionSpecLocBeg();
+  auto LocEnd = D.getFunctionTypeInfo().getExceptionSpecLocEnd();
+  Diag(LocBeg, diag::err_function_concept_exception_spec)
+<< FixItHint::CreateRemoval(SourceRange(LocBeg, LocEnd));
+  NewFD->setInvalidDecl();
+}
+else {
+  NewFD->setType(Context.getFunctionType(
+FPT->getReturnType(), FPT->getParamTypes(),
+FPT->getExtProtoInfo().withExceptionSpec(EST_BasicNoexcept)));
+}
+  }
+
   // C++ Concepts TS [dcl.spec.concept]p2: Every concept definition is
   // implicity defined to be a constexpr declaration (implicitly inline)
   NewFD->setImplicitlyInline();
@@ -11077,7 +11092,7 @@
  /*RestrictQualifierLoc=*/NoLoc,
  /*MutableLoc=*/NoLoc,
  EST_None,
- /*ESpecLoc=*/NoLoc,
+ /*ESpecRange=*/SourceRange(),
  /*Exceptions=*/nullptr,
  /*ExceptionRanges=*/nullptr,
  /*NumExceptions=*/0,
Index: lib/Sema/DeclSpec.cpp
===
--- lib/Sema/DeclSpec.cpp
+++ lib/Sema/DeclSpec.cpp
@@ -177,7 +177,7 @@
  SourceLocation MutableLoc,
  ExceptionSpecificationType
  ESpecType,
- SourceLocation ESpecLoc,
+ SourceRange ESpecRange,
  ParsedType *Exceptions,
  SourceRange *ExceptionRanges,
  unsigned NumExceptions,
@@ -212,7 +212,8 @@
   I.Fun.RestrictQualifierLoc= RestrictQualifierLoc.getRawEncoding();
   I.Fun.MutableLoc  = MutableLoc.getRawEncoding();
   I.Fun.ExceptionSpecType   = ESpecType;
-  I.Fun.ExceptionSpecLoc= ESpecLoc.getRawEncoding();
+  I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin().getRawEncoding();
+  I.Fun.ExceptionSpecLocEnd = ESpecRange.getEnd().getRawEncoding();
   I.Fun.NumExceptions   = 0;
   I.Fun.Exceptions  = nullptr;
   I.Fun.NoexceptExpr= n

Re: [PATCH] D8940: Clang changes for indirect call target profiling

2015-08-05 Thread Ivan Baev
ivanbaev added a subscriber: ivanbaev.


Comment at: lib/CodeGen/CodeGenPGO.cpp:858
@@ +857,3 @@
+  if (PGOReader && haveRegionCounts()) {
+// We record the top most called five function at each call site.
+// Profile metadata contains "indirect_call_targets" string identifying

davidxl wrote:
> 5 is too large as the default value. I suggest change the default to 2 
> targets and also make it controllable via an internal option.
3 is perhaps better; in the indirect call promotion pass we try to promote 2 
targets, and it would be good to know what the hotness for the next target is.  


http://reviews.llvm.org/D8940



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


r244170 - Add -fno-coverage-mapping flag.

2015-08-05 Thread Diego Novillo
Author: dnovillo
Date: Wed Aug  5 18:27:40 2015
New Revision: 244170

URL: http://llvm.org/viewvc/llvm-project?rev=244170&view=rev
Log:
Add -fno-coverage-mapping flag.

This new flag allows the user to disable a previous instance of
-fcoverage-mapping, if needed.

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=244170&r1=244169&r2=244170&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Aug  5 18:27:40 2015
@@ -436,6 +436,9 @@ def fprofile_instr_use_EQ : Joined<["-"]
 def fcoverage_mapping : Flag<["-"], "fcoverage-mapping">,
 Group, Flags<[CC1Option]>,
 HelpText<"Generate coverage mapping to enable code coverage analysis">;
+def fno_coverage_mapping : Flag<["-"], "fno-coverage-mapping">,
+Group, Flags<[DriverOption]>,
+HelpText<"Disable code coverage analysis">;
 def fprofile_generate : Flag<["-"], "fprofile-generate">,
 Alias;
 def fprofile_generate_EQ : Joined<["-"], "fprofile-generate=">,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=244170&r1=244169&r2=244170&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug  5 18:27:40 2015
@@ -2905,12 +2905,15 @@ static void addPGOAndCoverageFlags(Compi
   Args.hasArg(options::OPT_coverage))
 CmdArgs.push_back("-femit-coverage-data");
 
-  if (Args.hasArg(options::OPT_fcoverage_mapping) && !ProfileGenerateArg)
+  if (Args.hasFlag(options::OPT_fcoverage_mapping,
+   options::OPT_fno_coverage_mapping, false) &&
+  !ProfileGenerateArg)
 D.Diag(diag::err_drv_argument_only_allowed_with)
 << "-fcoverage-mapping"
 << "-fprofile-instr-generate";
 
-  if (Args.hasArg(options::OPT_fcoverage_mapping))
+  if (Args.hasFlag(options::OPT_fcoverage_mapping,
+   options::OPT_fno_coverage_mapping, false))
 CmdArgs.push_back("-fcoverage-mapping");
 
   if (C.getArgs().hasArg(options::OPT_c) ||

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=244170&r1=244169&r2=244170&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Aug  5 18:27:40 2015
@@ -456,7 +456,8 @@ static bool ParseCodeGenArgs(CodeGenOpti
   Args.hasArg(OPT_fprofile_instr_generate_EQ);
   Opts.InstrProfileOutput = 
Args.getLastArgValue(OPT_fprofile_instr_generate_EQ);
   Opts.InstrProfileInput = Args.getLastArgValue(OPT_fprofile_instr_use_EQ);
-  Opts.CoverageMapping = Args.hasArg(OPT_fcoverage_mapping);
+  Opts.CoverageMapping =
+  Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);
   Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
   Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
   Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=244170&r1=244169&r2=244170&view=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Wed Aug  5 18:27:40 2015
@@ -94,12 +94,17 @@
 // RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-use %s 2>&1 | 
FileCheck -check-prefix=CHECK-DISABLE-USE %s
 // RUN: %clang -### -S -fprofile-use=file -fno-profile-use %s 2>&1 | FileCheck 
-check-prefix=CHECK-DISABLE-USE %s
 // RUN: %clang -### -S -fprofile-use=file -fno-profile-instr-use %s 2>&1 | 
FileCheck -check-prefix=CHECK-DISABLE-USE %s
+// RUN: %clang -### -S -fcoverage-mapping %s 2>&1 | FileCheck 
-check-prefix=CHECK-COVERAGE-AND-GEN %s
+// RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | 
FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
+// RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping 
-fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE 
%s
 // CHECK-PROFILE-GENERATE: "-fprofile-instr-generate"
 // CHECK-PROFILE-GENERATE-DIR: 
"-fprofile-instr-generate=/some/dir{{/|}}default.profraw"
 // CHECK-PROFILE-GENERATE-FILE: 
"-fprofile-instr-generate=/tmp/somefile.profraw"
 // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
 // CHECK-DISABLE-GEN-NOT: "-fprofile-instr-generate"
 // CHECK-DISABLE-US

Re: r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Argyrios Kyrtzidis
r244176.

> On Aug 5, 2015, at 4:11 PM, Argyrios Kyrtzidis  wrote:
> 
> I tentatively made a change to one of the tests and it looks like it worked, 
> so I’ll make the same change to the rest.
> 
>> On Aug 5, 2015, at 3:10 PM, Renato Golin  wrote:
>> 
>> On 5 August 2015 at 18:23, Argyrios Kyrtzidis  wrote:
>>> Author: akirtzidis
>>> Date: Wed Aug  5 12:23:59 2015
>>> New Revision: 244066
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev
>>> Log:
>>> [test/Index] Update libclang tests to use libclang for creating PCH files.
>> 
>> Hi,
>> 
>> This also broke our bots:
>> 
>> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6914
>> 
>> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1882
>> 
>> and 244076 didn't fix it.
>> 
>> cheers,
>> --renato
> 

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


r244178 - Rename DescriptionString -> DataLayoutString as it matches the actual

2015-08-05 Thread Eric Christopher
Author: echristo
Date: Wed Aug  5 18:48:05 2015
New Revision: 244178

URL: http://llvm.org/viewvc/llvm-project?rev=244178&view=rev
Log:
Rename DescriptionString -> DataLayoutString as it matches the actual
use of the string.

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=244178&r1=244177&r2=244178&view=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Aug  5 18:48:05 2015
@@ -74,7 +74,7 @@ protected:
   unsigned short MaxVectorAlign;
   unsigned short MaxTLSAlign;
   unsigned short SimdDefaultAlign;
-  const char *DescriptionString;
+  const char *DataLayoutString;
   const char *UserLabelPrefix;
   const char *MCountName;
   const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
@@ -692,9 +692,9 @@ public:
 return Triple;
   }
 
-  const char *getTargetDescription() const {
-assert(DescriptionString);
-return DescriptionString;
+  const char *getDataLayoutString() const {
+assert(DataLayoutString && "Uninitialized DataLayoutString!");
+return DataLayoutString;
   }
 
   struct GCCRegAlias {

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=244178&r1=244177&r2=244178&view=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Wed Aug  5 18:48:05 2015
@@ -71,7 +71,7 @@ TargetInfo::TargetInfo(const llvm::Tripl
   FloatFormat = &llvm::APFloat::IEEEsingle;
   DoubleFormat = &llvm::APFloat::IEEEdouble;
   LongDoubleFormat = &llvm::APFloat::IEEEdouble;
-  DescriptionString = nullptr;
+  DataLayoutString = nullptr;
   UserLabelPrefix = "_";
   MCountName = "mcount";
   RegParmMax = 0;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=244178&r1=244177&r2=244178&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug  5 18:48:05 2015
@@ -560,7 +560,7 @@ public:
 this->IntMaxType = TargetInfo::SignedLongLong;
 this->Int64Type = TargetInfo::SignedLongLong;
 this->SizeType = TargetInfo::UnsignedInt;
-this->DescriptionString = "E-m:e-p:32:32-i64:64-n32:64";
+this->DataLayoutString = "E-m:e-p:32:32-i64:64-n32:64";
   }
 };
 
@@ -722,14 +722,14 @@ public:
 if (Triple.getArch() == llvm::Triple::arm) {
   // Handled in ARM's setABI().
 } else if (Triple.getArch() == llvm::Triple::x86) {
-  this->DescriptionString = "e-m:e-p:32:32-i64:64-n8:16:32-S128";
+  this->DataLayoutString = "e-m:e-p:32:32-i64:64-n8:16:32-S128";
 } else if (Triple.getArch() == llvm::Triple::x86_64) {
-  this->DescriptionString = "e-m:e-p:32:32-i64:64-n8:16:32:64-S128";
+  this->DataLayoutString = "e-m:e-p:32:32-i64:64-n8:16:32:64-S128";
 } else if (Triple.getArch() == llvm::Triple::mipsel) {
-  // Handled on mips' setDescriptionString.
+  // Handled on mips' setDataLayoutString.
 } else {
   assert(Triple.getArch() == llvm::Triple::le32);
-  this->DescriptionString = "e-p:32:32-i64:64";
+  this->DataLayoutString = "e-p:32:32-i64:64";
 }
   }
 };
@@ -1459,7 +1459,7 @@ void PPCTargetInfo::getGCCRegAliases(con
 class PPC32TargetInfo : public PPCTargetInfo {
 public:
   PPC32TargetInfo(const llvm::Triple &Triple) : PPCTargetInfo(Triple) {
-DescriptionString = "E-m:e-p:32:32-i64:64-n32";
+DataLayoutString = "E-m:e-p:32:32-i64:64-n32";
 
 switch (getTriple().getOS()) {
 case llvm::Triple::Linux:
@@ -1498,10 +1498,10 @@ public:
 Int64Type = SignedLong;
 
 if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-  DescriptionString = "e-m:e-i64:64-n32:64";
+  DataLayoutString = "e-m:e-i64:64-n32:64";
   ABI = "elfv2";
 } else {
-  DescriptionString = "E-m:e-i64:64-n32:64";
+  DataLayoutString = "E-m:e-i64:64-n32:64";
   ABI = "elfv1";
 }
 
@@ -1544,7 +1544,7 @@ public:
 PtrDiffType = SignedInt; // for http://llvm.org/bugs/show_bug.cgi?id=15726
 LongLongAlign = 32;
 SuitableAlign = 128;
-DescriptionString = "E-m:o-p:32:32-f64:32:64-n32";
+DataLayoutString = "E-m:o-p:32:32-f64:32:64-n32";
   }
   BuiltinVaListKind getBuiltinVaListKind() const override {
 return TargetInfo::CharPtrBuiltinVaList;
@@ -1558,7 +1558,7 @@ public:
   : Darwin

Re: [PATCH]es: algorithm: Avoid moving initial subsequences in std::inplace_merge()

2015-08-05 Thread Duncan P. N. Exon Smith

> On 2015-Aug-05, at 16:43, Duncan P. N. Exon Smith  
> wrote:
> 
> 
>> On 2015-Jul-29, at 14:34, Duncan P. N. Exon Smith  
>> wrote:
>> 
>> r227808 (and r227811) changed `std::inplace_merge()` to meet the
>> complexity guidelines of the standard, which strictly restricts the
>> number of calls to the predicate.  Unfortunately, this removed an
>> optimization that avoided moving any elements if the sequence was
>> already fully sorted.  Moroever, any initial/final subsequence that was
>> in the right spot would previously never be touched.
>> 
>> r243530, whose main purpose was to fix a latent self-move bug made more
>> common by r227808/r227811, already brought half of this optimization
>> back.  It avoids unnecessarily moving the final subsequence.
>> 
>> These patches close the loop, bringing back the other half of the
>> optimization without re-introducing the extra predicate call that
>> r227808 avoided.
>> 
>> 0001 is an NFC refactor, while 0002 has the actual change.
>> 
>> (The change in r227811 was to *always* malloc a temporary buffer.  I
>> wonder if something like this could safely optimize that away as well?)
> 
> ping.
> 
> <0001-algorithm-Refactor-__buffered_inplace_merge-NFC.patch><0002-algorithm-Avoid-moving-initial-subsequences-in-std-i.patch>

(sorry for the double-ping; this time I've CC'ed the new mailing list)



0001-algorithm-Refactor-__buffered_inplace_merge-NFC.patch
Description: Binary data


0002-algorithm-Avoid-moving-initial-subsequences-in-std-i.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11572: [Static Analyzer] Checker for OS X / iOS localizability issues

2015-08-05 Thread Anna Zaks
zaks.anna added inline comments.


Comment at: test/Analysis/localization-aggressive.m:202
@@ +201,3 @@
+// EmptyLocalizationContextChecker tests
+#define HOM(s) YOLOC(s)
+#define YOLOC(x) NSLocalizedString(x, nil)

How about something like this, where the last argument to the user defined 
macro is nil, but it has noting to do with the comment.

#define POSSIBLE_FALSE_POSITIVE(s, myarg) YOLOC(s)

..
POSSIBLE_FALSE_POSITIVE(@"Hello", nil)


http://reviews.llvm.org/D11572



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


Re: r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Eric Christopher
Still broken here locally on my machine after updating:

FAIL: Clang :: Index/print-mangled-name.cpp (3844 of 22837)
 TEST 'Clang :: Index/print-mangled-name.cpp' FAILED

Script:
--
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
-write-pch
/usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_linux.ast
-target i686-pc-linux-gnu
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
-test-print-mangle
/usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_linux.ast
|
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
--check-prefix=ITANIUM
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
-write-pch
/usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_macho.ast
-arch x86_64 -mmacosx-version-min=10.6
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
-test-print-mangle
/usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_macho.ast
|
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
--check-prefix=MACHO
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
-write-pch
/usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_msft.ast
-target i686-pc-win32
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
-test-print-mangle
/usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_msft.ast
|
/usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
--check-prefix=MICROSOFT
--
Exit Code: 1

Command Output (stderr):
--
/usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp:13:11:
error: expected string not found in input
// MACHO: mangled=__Z3fooii
  ^
:1:1: note: scanning from here
macro definition=__llvm__ [mangled=]
^
:1:28: note: possible intended match here
macro definition=__llvm__ [mangled=]
   ^

--

-eric

On Wed, Aug 5, 2015 at 4:11 PM Argyrios Kyrtzidis  wrote:

> I tentatively made a change to one of the tests and it looks like it
> worked, so I’ll make the same change to the rest.
>
> > On Aug 5, 2015, at 3:10 PM, Renato Golin 
> wrote:
> >
> > On 5 August 2015 at 18:23, Argyrios Kyrtzidis  wrote:
> >> Author: akirtzidis
> >> Date: Wed Aug  5 12:23:59 2015
> >> New Revision: 244066
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev
> >> Log:
> >> [test/Index] Update libclang tests to use libclang for creating PCH
> files.
> >
> > Hi,
> >
> > This also broke our bots:
> >
> > http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6914
> >
> >
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1882
> >
> > and 244076 didn't fix it.
> >
> > cheers,
> > --renato
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Argyrios Kyrtzidis
What about this change:

diff --git a/test/Index/print-mangled-name.cpp 
b/test/Index/print-mangled-name.cpp
index 6dcda70..3d74fe5 100644
--- a/test/Index/print-mangled-name.cpp
+++ b/test/Index/print-mangled-name.cpp
@@ -2,7 +2,7 @@
 // RUN: c-index-test -write-pch %t_linux.ast -target i686-pc-linux-gnu %s
 // RUN: c-index-test -test-print-mangle %t_linux.ast | FileCheck %s 
--check-prefix=ITANIUM
 
-// RUN: c-index-test -write-pch %t_macho.ast -arch x86_64 
-mmacosx-version-min=10.6 %s
+// RUN: c-index-test -write-pch %t_macho.ast -target x86_64-apple-darwin %s
 // RUN: c-index-test -test-print-mangle %t_macho.ast | FileCheck %s 
--check-prefix=MACHO
 
 // RUN: c-index-test -write-pch %t_msft.ast -target i686-pc-win32 %s


> On Aug 5, 2015, at 5:06 PM, Eric Christopher  wrote:
> 
> Still broken here locally on my machine after updating:
> 
> FAIL: Clang :: Index/print-mangled-name.cpp (3844 of 22837)
>  TEST 'Clang :: Index/print-mangled-name.cpp' FAILED 
> 
> Script:
> --
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
>  -write-pch 
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_linux.ast
>  -target i686-pc-linux-gnu 
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
>  -test-print-mangle 
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_linux.ast
>  | 
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck 
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
>  --check-prefix=ITANIUM
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
>  -write-pch 
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_macho.ast
>  -arch x86_64 -mmacosx-version-min=10.6 
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
>  -test-print-mangle 
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_macho.ast
>  | 
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck 
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
>  --check-prefix=MACHO
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
>  -write-pch 
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_msft.ast
>  -target i686-pc-win32 
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
>  -test-print-mangle 
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_msft.ast
>  | 
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck 
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
>  --check-prefix=MICROSOFT
> --
> Exit Code: 1
> 
> Command Output (stderr):
> --
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp:13:11:
>  error: expected string not found in input
> // MACHO: mangled=__Z3fooii
>   ^
> :1:1: note: scanning from here
> macro definition=__llvm__ [mangled=]
> ^
> :1:28: note: possible intended match here
> macro definition=__llvm__ [mangled=]
>^
> 
> --
> 
> -eric
> 
> On Wed, Aug 5, 2015 at 4:11 PM Argyrios Kyrtzidis  > wrote:
> I tentatively made a change to one of the tests and it looks like it worked, 
> so I’ll make the same change to the rest.
> 
> > On Aug 5, 2015, at 3:10 PM, Renato Golin  > > wrote:
> >
> > On 5 August 2015 at 18:23, Argyrios Kyrtzidis  > > wrote:
> >> Author: akirtzidis
> >> Date: Wed Aug  5 12:23:59 2015
> >> New Revision: 244066
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev 
> >> 
> >> Log:
> >> [test/Index] Update libclang tests to use libclang for creating PCH files.
> >
> > Hi,
> >
> > This also broke our bots:
> >
> > http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6914 
> > 
> >
> > http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1882
> >  
> > 
> >
> > and 244076 didn't fix it.
> >
> > cheers,
> > --renato
> 
> __

Re: [PATCH] D11789: Modify DeclaratorChuck::getFunction to be passed an Exception Specification SourceRange

2015-08-05 Thread Richard Smith
rsmith added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:1977
@@ -1976,1 +1976,3 @@
+def  err_function_concept_exception_spec : Error<
+  "function concept can not have exception specifiers">;
 

def  err -> def err
can not -> cannot
specifiers -> specification


Comment at: include/clang/Sema/DeclSpec.h:1330-1336
@@ -1325,5 +1329,9 @@
 
-SourceLocation getExceptionSpecLoc() const {
-  return SourceLocation::getFromRawEncoding(ExceptionSpecLoc);
+SourceLocation getExceptionSpecLocBeg() const {
+  return SourceLocation::getFromRawEncoding(ExceptionSpecLocBeg);
+}
+
+SourceLocation getExceptionSpecLocEnd() const {
+  return SourceLocation::getFromRawEncoding(ExceptionSpecLocEnd);
 }
 

Please add a `getExceptionSpecRange` function returning the `SourceRange`...


Comment at: lib/Sema/SemaDecl.cpp:7447-7450
@@ -7446,1 +7446,6 @@
 
+  if (const FunctionProtoType *FPT = R->getAs()) {
+if (FPT->hasExceptionSpec()) {
+  auto LocBeg = D.getFunctionTypeInfo().getExceptionSpecLocBeg();
+  auto LocEnd = D.getFunctionTypeInfo().getExceptionSpecLocEnd();
+  Diag(LocBeg, diag::err_function_concept_exception_spec)

This will assert if there isn't a `FunctionTypeInfo` for the declaration, which 
can theoretically happen if it's declared via an (ill-formed today) `typedef`. 
(It also might not provide a source range if the exception specification is 
implicit, for instance because the function template is a destructor or 
deallocation function, but passing an empty SourceRange to the FixItHint should 
just result it in being ignored.)


Comment at: lib/Sema/SemaDecl.cpp:7449-7452
@@ +7448,6 @@
+if (FPT->hasExceptionSpec()) {
+  auto LocBeg = D.getFunctionTypeInfo().getExceptionSpecLocBeg();
+  auto LocEnd = D.getFunctionTypeInfo().getExceptionSpecLocEnd();
+  Diag(LocBeg, diag::err_function_concept_exception_spec)
+<< FixItHint::CreateRemoval(SourceRange(LocBeg, LocEnd));
+  NewFD->setInvalidDecl();

... and use it here.


Comment at: lib/Sema/SemaDecl.cpp:7454-7455
@@ +7453,4 @@
+  NewFD->setInvalidDecl();
+}
+else {
+  NewFD->setType(Context.getFunctionType(

No newline before `else`.


Comment at: lib/Sema/SemaDecl.cpp:7456
@@ +7455,3 @@
+else {
+  NewFD->setType(Context.getFunctionType(
+FPT->getReturnType(), FPT->getParamTypes(),

rsmith wrote:
> Use `ASTContext::adjustExceptionSpec(NewFD, EST_BasicNoexcept)` for this.
Add a comment here indicating why we're doing this. Maybe a snippet of the 
relevant rule from the TS?


Comment at: lib/Sema/SemaDecl.cpp:7456-7458
@@ +7455,5 @@
+else {
+  NewFD->setType(Context.getFunctionType(
+FPT->getReturnType(), FPT->getParamTypes(),
+FPT->getExtProtoInfo().withExceptionSpec(EST_BasicNoexcept)));
+}

Use `ASTContext::adjustExceptionSpec(NewFD, EST_BasicNoexcept)` for this.


Comment at: lib/Sema/SemaDecl.cpp:7456-7458
@@ +7455,5 @@
+else {
+  NewFD->setType(Context.getFunctionType(
+FPT->getReturnType(), FPT->getParamTypes(),
+FPT->getExtProtoInfo().withExceptionSpec(EST_BasicNoexcept)));
+}

rsmith wrote:
> rsmith wrote:
> > Use `ASTContext::adjustExceptionSpec(NewFD, EST_BasicNoexcept)` for this.
> Add a comment here indicating why we're doing this. Maybe a snippet of the 
> relevant rule from the TS?
You don't seem to have test coverage for this part. Maybe test it with 
`static_assert(noexcept(SomeConcept()));`?


http://reviews.llvm.org/D11789



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


r244186 - Rename the non-coding style conformant functions in namespace Builtins

2015-08-05 Thread Eric Christopher
Author: echristo
Date: Wed Aug  5 20:01:12 2015
New Revision: 244186

URL: http://llvm.org/viewvc/llvm-project?rev=244186&view=rev
Log:
Rename the non-coding style conformant functions in namespace Builtins
to match the rest of their brethren and reformat the bits that need it.

Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Basic/Builtins.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
cfe/trunk/lib/Frontend/FrontendAction.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CheckerContext.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=244186&r1=244185&r2=244186&view=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Wed Aug  5 20:01:12 2015
@@ -23,22 +23,22 @@
 #undef alloca
 
 namespace clang {
-  class TargetInfo;
-  class IdentifierTable;
-  class ASTContext;
-  class QualType;
-  class LangOptions;
-
-  enum LanguageID {
-GNU_LANG = 0x1,  // builtin requires GNU mode.
-C_LANG = 0x2,// builtin for c only.
-CXX_LANG = 0x4,  // builtin for cplusplus only.
-OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
-MS_LANG = 0x10,  // builtin requires MS mode.
-ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all 
languages.
-ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG,  // builtin requires GNU 
mode.
-ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
-  };
+class TargetInfo;
+class IdentifierTable;
+class ASTContext;
+class QualType;
+class LangOptions;
+
+enum LanguageID {
+  GNU_LANG = 0x1,  // builtin requires GNU mode.
+  C_LANG = 0x2,// builtin for c only.
+  CXX_LANG = 0x4,  // builtin for cplusplus only.
+  OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
+  MS_LANG = 0x10,  // builtin requires MS mode.
+  ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
+  ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG,  // builtin requires GNU mode.
+  ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
+};
 
 namespace Builtin {
 enum ID {
@@ -62,90 +62,90 @@ public:
   Context();
 
   /// \brief Perform target-specific initialization
-  void InitializeTarget(const TargetInfo &Target);
+  void initializeTarget(const TargetInfo &Target);
   
   /// \brief Mark the identifiers for all the builtins with their
   /// appropriate builtin ID # and mark any non-portable builtin identifiers as
   /// such.
-  void InitializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts);
+  void initializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts);
 
   /// \brief Return the identifier name for the specified builtin,
   /// e.g. "__builtin_abs".
-  const char *GetName(unsigned ID) const {
-return GetRecord(ID).Name;
+  const char *getName(unsigned ID) const {
+return getRecord(ID).Name;
   }
 
   /// \brief Get the type descriptor string for the specified builtin.
-  const char *GetTypeString(unsigned ID) const {
-return GetRecord(ID).Type;
+  const char *getTypeString(unsigned ID) const {
+return getRecord(ID).Type;
   }
 
   /// \brief Return true if this function has no side effects and doesn't
   /// read memory.
   bool isConst(unsigned ID) const {
-return strchr(GetRecord(ID).Attributes, 'c') != nullptr;
+return strchr(getRecord(ID).Attributes, 'c') != nullptr;
   }
 
   /// \brief Return true if we know this builtin never throws an exception.
   bool isNoThrow(unsigned ID) const {
-return strchr(GetRecord(ID).Attributes, 'n') != nullptr;
+return strchr(getRecord(ID).Attributes, 'n') != nullptr;
   }
 
   /// \brief Return true if we know this builtin never returns.
   bool isNoReturn(unsigned ID) const {
-return strchr(GetRecord(ID).Attributes, 'r') != nullptr;
+return strchr(getRecord(ID).Attributes, 'r') != nullptr;
   }
 
   /// \brief Return true if we know this builtin can return twice.
   bool isReturnsTwice(unsigned ID) const {
-return strchr(GetRecord(ID).Attributes, 'j') != nullptr;
+return strchr(getRecord(ID).Attributes, 'j') != nullptr;
   }
 
   /// \brief Returns true if this builtin does not perform the side-effects
   /// of its arguments.
   bool isUnevaluated(unsigned ID) const {
-return strchr(GetRecord(ID).Attributes, 'u') != nullptr;
+return strchr(getRecord(ID).Attributes, 'u') != nullptr;
   }
 
   /// \brief Return true if this is a builtin for a libc/libm function,
   /// with a "__builtin_" prefix (e.g. __builtin_abs).
   bool isLibFunction(unsigned ID) const {
-return strchr(GetRe

Re: r244066 - [test/Index] Update libclang tests to use libclang for creating PCH files.

2015-08-05 Thread Eric Christopher
Yep. That works.

-eric

On Wed, Aug 5, 2015 at 5:40 PM Argyrios Kyrtzidis  wrote:

> What about this change:
>
> diff --git a/test/Index/print-mangled-name.cpp
> b/test/Index/print-mangled-name.cpp
> index 6dcda70..3d74fe5 100644
> --- a/test/Index/print-mangled-name.cpp
> +++ b/test/Index/print-mangled-name.cpp
> @@ -2,7 +2,7 @@
>  // RUN: c-index-test -write-pch %t_linux.ast -target i686-pc-linux-gnu %s
>
>  // RUN: c-index-test -test-print-mangle %t_linux.ast | FileCheck %s
> --check-prefix=ITANIUM
>
> -// RUN: c-index-test -write-pch %t_macho.ast -arch x86_64
> -mmacosx-version-min=10.6 %s
> +// RUN: c-index-test -write-pch %t_macho.ast -target x86_64-apple-darwin
> %s
>
>  // RUN: c-index-test -test-print-mangle %t_macho.ast | FileCheck %s
> --check-prefix=MACHO
>
>  // RUN: c-index-test -write-pch %t_msft.ast -target i686-pc-win32 %s
>
>
> On Aug 5, 2015, at 5:06 PM, Eric Christopher  wrote:
>
> Still broken here locally on my machine after updating:
>
> FAIL: Clang :: Index/print-mangled-name.cpp (3844 of 22837)
>  TEST 'Clang :: Index/print-mangled-name.cpp' FAILED
> 
> Script:
> --
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
> -write-pch
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_linux.ast
> -target i686-pc-linux-gnu
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
> -test-print-mangle
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_linux.ast
> |
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> --check-prefix=ITANIUM
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
> -write-pch
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_macho.ast
> -arch x86_64 -mmacosx-version-min=10.6
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
> -test-print-mangle
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_macho.ast
> |
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> --check-prefix=MACHO
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
> -write-pch
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_msft.ast
> -target i686-pc-win32
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/c-index-test
> -test-print-mangle
> /usr/local/google/home/echristo/builds/build-llvm/tools/clang/test/Index/Output/print-mangled-name.cpp.tmp_msft.ast
> |
> /usr/local/google/home/echristo/builds/build-llvm/Debug+Asserts/bin/FileCheck
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp
> --check-prefix=MICROSOFT
> --
> Exit Code: 1
>
> Command Output (stderr):
> --
> /usr/local/google/home/echristo/sources/llvm/tools/clang/test/Index/print-mangled-name.cpp:13:11:
> error: expected string not found in input
> // MACHO: mangled=__Z3fooii
>   ^
> :1:1: note: scanning from here
> macro definition=__llvm__ [mangled=]
> ^
> :1:28: note: possible intended match here
> macro definition=__llvm__ [mangled=]
>^
>
> --
>
> -eric
>
> On Wed, Aug 5, 2015 at 4:11 PM Argyrios Kyrtzidis 
> wrote:
>
>> I tentatively made a change to one of the tests and it looks like it
>> worked, so I’ll make the same change to the rest.
>>
>> > On Aug 5, 2015, at 3:10 PM, Renato Golin 
>> wrote:
>> >
>> > On 5 August 2015 at 18:23, Argyrios Kyrtzidis 
>> wrote:
>> >> Author: akirtzidis
>> >> Date: Wed Aug  5 12:23:59 2015
>> >> New Revision: 244066
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=244066&view=rev
>> >> Log:
>> >> [test/Index] Update libclang tests to use libclang for creating PCH
>> files.
>> >
>> > Hi,
>> >
>> > This also broke our bots:
>> >
>> >
>> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/6914
>> >
>> >
>> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1882
>> >
>> > and 244076 didn't fix it.
>> >
>> > cheers,
>> > --renato
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
___
cfe-commits 

Re: [PATCH] D11789: Modify DeclaratorChuck::getFunction to be passed an Exception Specification SourceRange

2015-08-05 Thread Nathan Wilson
nwilson added a comment.

I'll make the fixes based on the comments, but had question about the 
FunctionTypeInfo in the meantime.



Comment at: lib/Sema/SemaDecl.cpp:7447-7450
@@ -7446,1 +7446,6 @@
 
+  if (const FunctionProtoType *FPT = R->getAs()) {
+if (FPT->hasExceptionSpec()) {
+  auto LocBeg = D.getFunctionTypeInfo().getExceptionSpecLocBeg();
+  auto LocEnd = D.getFunctionTypeInfo().getExceptionSpecLocEnd();
+  Diag(LocBeg, diag::err_function_concept_exception_spec)

rsmith wrote:
> This will assert if there isn't a `FunctionTypeInfo` for the declaration, 
> which can theoretically happen if it's declared via an (ill-formed today) 
> `typedef`. (It also might not provide a source range if the exception 
> specification is implicit, for instance because the function template is a 
> destructor or deallocation function, but passing an empty SourceRange to the 
> FixItHint should just result it in being ignored.)
Hmm, I'm not sure if we'd run into that case because I don't believe we can 
have a `concept` specified as a typedef (check is yet to be added) and a check 
exists for being in a non-namespace scope. Do you think a check should still be 
added verifying that the FunctionTypeInfo exists?


http://reviews.llvm.org/D11789



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


Re: r243964 - [OPENMP] Fix compiler crash during data-sharing attributes analysis.

2015-08-05 Thread Bataev, Alexey

Thanks!

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

05.08.2015 21:39, Hans Wennborg пишет:

Sorry for the delay. Merged in r244090.

Cheers,
Hans

On Tue, Aug 4, 2015 at 3:05 AM, Bataev, Alexey  wrote:

Hans,
This patch fixes crash in clang. Could you backport it to 3.7 branch?

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team


04.08.2015 11:10, Alexey Bataev пишет:


Author: abataev
Date: Tue Aug  4 03:10:48 2015
New Revision: 243964

URL: http://llvm.org/viewvc/llvm-project?rev=243964&view=rev
Log:
[OPENMP] Fix compiler crash during data-sharing attributes analysis.

If a global variable is marked as private in OpenMP construct and then is
used in of the private clauses of the same construct, it might cause
compiler crash because of incorrect capturing.

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

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=243964&r1=243963&r2=243964&view=diff

==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Aug  4 03:10:48 2015
@@ -657,7 +657,9 @@ void Sema::InitDataSharingAttributesStac
   bool Sema::IsOpenMPCapturedVar(VarDecl *VD) {
 assert(LangOpts.OpenMP && "OpenMP is not allowed");
 VD = VD->getCanonicalDecl();
-  if (DSAStack->getCurrentDirective() != OMPD_unknown) {
+  if (DSAStack->getCurrentDirective() != OMPD_unknown &&
+  (!DSAStack->isClauseParsingMode() ||
+   DSAStack->getParentDirective() != OMPD_unknown)) {
   if (DSAStack->isLoopControlVariable(VD) ||
   (VD->hasLocalStorage() &&
isParallelOrTaskRegion(DSAStack->getCurrentDirective())) ||

Modified: cfe/trunk/test/OpenMP/simd_linear_messages.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_linear_messages.cpp?rev=243964&r1=243963&r2=243964&view=diff

==
--- cfe/trunk/test/OpenMP/simd_linear_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/simd_linear_messages.cpp Tue Aug  4 03:10:48
2015
@@ -156,6 +156,7 @@ namespace C {
   using A::x;
   }
   +int f;
   int main(int argc, char **argv) {
 double darr[100];
 // expected-note@+1 {{in instantiation of function template
specialization 'test_template<-4, double, int>' requested here}}
@@ -167,6 +168,8 @@ int main(int argc, char **argv) {
 S5 g(5); // expected-note {{'g' defined here}}
 int i;
 int &j = i; // expected-note {{'j' defined here}}
+  #pragma omp simd linear(f) linear(f) // expected-error {{linear
variable cannot be linear}} expected-note {{defined as linear}}
+  for (int k = 0; k < argc; ++k) ++k;
 #pragma omp simd linear // expected-error {{expected '(' after
'linear'}}
 for (int k = 0; k < argc; ++k) ++k;
 #pragma omp simd linear ( // expected-error {{expected expression}}
expected-error {{expected ')'}} expected-note {{to match this '('}}





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


  1   2   >