r255990 - [OPENMP] Fix for http://llvm.org/PR25878: Error compiling an OpenMP program

2015-12-18 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Dec 18 01:58:25 2015
New Revision: 255990

URL: http://llvm.org/viewvc/llvm-project?rev=255990&view=rev
Log:
[OPENMP] Fix for http://llvm.org/PR25878: Error compiling an OpenMP program
OpenMP codegen tried to emit the code for its constructs even if it was 
detected as a dead-code. Added checks to ensure that the code is emitted if the 
code is not dead.

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/test/OpenMP/critical_codegen.cpp
cfe/trunk/test/OpenMP/parallel_reduction_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=255990&r1=255989&r2=255990&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Fri Dec 18 01:58:25 2015
@@ -278,6 +278,8 @@ LValue CGOpenMPRegionInfo::getThreadIDVa
 }
 
 void CGOpenMPRegionInfo::EmitBody(CodeGenFunction &CGF, const Stmt * /*S*/) {
+  if (!CGF.HaveInsertPoint())
+return;
   // 1.2.2 OpenMP Language Terminology
   // Structured block - An executable statement with a single entry at the
   // top and a single exit at the bottom.
@@ -1263,6 +1265,8 @@ void CGOpenMPRuntime::emitParallelCall(C
llvm::Value *OutlinedFn,
ArrayRef CapturedVars,
const Expr *IfCond) {
+  if (!CGF.HaveInsertPoint())
+return;
   auto *RTLoc = emitUpdateLocation(CGF, Loc);
   auto &&ThenGen = [this, OutlinedFn, CapturedVars,
 RTLoc](CodeGenFunction &CGF) {
@@ -1372,6 +1376,8 @@ public:
 std::copy(CleanupArgs.begin(), CleanupArgs.end(), std::begin(Args));
   }
   void Emit(CodeGenFunction &CGF, Flags /*flags*/) override {
+if (!CGF.HaveInsertPoint())
+  return;
 CGF.EmitRuntimeCall(Callee, Args);
   }
 };
@@ -1385,6 +1391,8 @@ void CGOpenMPRuntime::emitCriticalRegion
   // CriticalOpGen();
   // __kmpc_end_critical(ident_t *, gtid, Lock);
   // Prepare arguments and build a call to __kmpc_critical
+  if (!CGF.HaveInsertPoint())
+return;
   CodeGenFunction::RunCleanupsScope Scope(CGF);
   llvm::Value *Args[] = {emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
  getCriticalRegionLock(CriticalName)};
@@ -1427,6 +1435,8 @@ static void emitIfStmt(CodeGenFunction &
 void CGOpenMPRuntime::emitMasterRegion(CodeGenFunction &CGF,
const RegionCodeGenTy &MasterOpGen,
SourceLocation Loc) {
+  if (!CGF.HaveInsertPoint())
+return;
   // if(__kmpc_master(ident_t *, gtid)) {
   //   MasterOpGen();
   //   __kmpc_end_master(ident_t *, gtid);
@@ -1449,6 +1459,8 @@ void CGOpenMPRuntime::emitMasterRegion(C
 
 void CGOpenMPRuntime::emitTaskyieldCall(CodeGenFunction &CGF,
 SourceLocation Loc) {
+  if (!CGF.HaveInsertPoint())
+return;
   // Build call __kmpc_omp_taskyield(loc, thread_id, 0);
   llvm::Value *Args[] = {
   emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
@@ -1459,6 +1471,8 @@ void CGOpenMPRuntime::emitTaskyieldCall(
 void CGOpenMPRuntime::emitTaskgroupRegion(CodeGenFunction &CGF,
   const RegionCodeGenTy 
&TaskgroupOpGen,
   SourceLocation Loc) {
+  if (!CGF.HaveInsertPoint())
+return;
   // __kmpc_taskgroup(ident_t *, gtid);
   // TaskgroupOpGen();
   // __kmpc_end_taskgroup(ident_t *, gtid);
@@ -1546,6 +1560,8 @@ void CGOpenMPRuntime::emitSingleRegion(C
ArrayRef SrcExprs,
ArrayRef DstExprs,
ArrayRef AssignmentOps) {
+  if (!CGF.HaveInsertPoint())
+return;
   assert(CopyprivateVars.size() == SrcExprs.size() &&
  CopyprivateVars.size() == DstExprs.size() &&
  CopyprivateVars.size() == AssignmentOps.size());
@@ -1627,6 +1643,8 @@ void CGOpenMPRuntime::emitSingleRegion(C
 void CGOpenMPRuntime::emitOrderedRegion(CodeGenFunction &CGF,
 const RegionCodeGenTy &OrderedOpGen,
 SourceLocation Loc, bool IsThreads) {
+  if (!CGF.HaveInsertPoint())
+return;
   // __kmpc_ordered(ident_t *, gtid);
   // OrderedOpGen();
   // __kmpc_end_ordered(ident_t *, gtid);
@@ -1646,6 +1664,8 @@ void CGOpenMPRuntime::emitOrderedRegion(
 void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc,
   OpenMPDirectiveKind Kind, bool 
EmitChecks,
   bool ForceSimpleCall) {
+  if (!CGF.HaveInsertPoint())
+return;
   // Build call __kmpc_cancel_barrier(loc, thread_id);
   // Build call __km

Re: [PATCH] D15561: [OpenMP] Remove explicit call for implicit barrier

2015-12-18 Thread Alexey Bataev via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL255992: [OPENMP] Remove explicit call for implicit barrier 
(authored by ABataev).

Changed prior to commit:
  http://reviews.llvm.org/D15561?vs=42984&id=43210#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15561

Files:
  cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
  cfe/trunk/test/OpenMP/cancel_codegen.cpp
  cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp
  cfe/trunk/test/OpenMP/for_lastprivate_codegen.cpp
  cfe/trunk/test/OpenMP/for_reduction_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_for_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_for_linear_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_for_simd_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_reduction_codegen.cpp
  cfe/trunk/test/OpenMP/parallel_sections_codegen.cpp
  cfe/trunk/test/OpenMP/sections_codegen.cpp
  cfe/trunk/test/OpenMP/sections_lastprivate_codegen.cpp
  cfe/trunk/test/OpenMP/sections_reduction_codegen.cpp
  cfe/trunk/test/OpenMP/single_firstprivate_codegen.cpp

Index: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
===
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
@@ -893,10 +893,6 @@
 (void)PrivateScope.Privatize();
 CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt());
 CGF.EmitOMPReductionClauseFinal(S);
-// Emit implicit barrier at the end of the 'parallel' directive.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen);
 }
@@ -1873,12 +1869,6 @@
   (void)emitScheduleClause(*this, S, /*OuterRegion=*/true);
   auto &&CodeGen = [&S](CodeGenFunction &CGF) {
 CGF.EmitOMPWorksharingLoop(S);
-// Emit implicit barrier at the end of parallel region, but this barrier
-// is at the end of 'for' directive, so emit it as the implicit barrier for
-// this 'for' directive.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_parallel, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_for, CodeGen);
 }
@@ -1891,12 +1881,6 @@
   (void)emitScheduleClause(*this, S, /*OuterRegion=*/true);
   auto &&CodeGen = [&S](CodeGenFunction &CGF) {
 CGF.EmitOMPWorksharingLoop(S);
-// Emit implicit barrier at the end of parallel region, but this barrier
-// is at the end of 'for' directive, so emit it as the implicit barrier for
-// this 'for' directive.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_parallel, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_simd, CodeGen);
 }
@@ -1908,10 +1892,6 @@
   LexicalScope Scope(*this, S.getSourceRange());
   auto &&CodeGen = [&S](CodeGenFunction &CGF) {
 (void)CGF.EmitSections(S);
-// Emit implicit barrier at the end of parallel region.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_parallel, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_sections, CodeGen);
 }
Index: cfe/trunk/test/OpenMP/parallel_codegen.cpp
===
--- cfe/trunk/test/OpenMP/parallel_codegen.cpp
+++ cfe/trunk/test/OpenMP/parallel_codegen.cpp
@@ -57,7 +57,6 @@
 // CHECK:   [[ARGC_REF:%.+]] = load i32*, i32** [[ARGC_PTR_ADDR]]
 // CHECK-NEXT:  [[ARGC:%.+]] = load i32, i32* [[ARGC_REF]]
 // CHECK-NEXT:  invoke {{.*}}void [[FOO:@.+foo.+]](i32{{[ ]?[a-z]*}} [[ARGC]])
-// CHECK:   call {{.+}} @__kmpc_barrier(
 // CHECK:   ret void
 // CHECK:   call {{.*}}void @{{.+terminate.*|abort}}(
 // CHECK-NEXT:  unreachable
@@ -68,7 +67,6 @@
 // CHECK-DEBUG:  [[ARGC_REF:%.+]] = load i32*, i32** [[ARGC_PTR_ADDR]]
 // CHECK-DEBUG-NEXT:  [[ARGC:%.+]] = load i32, i32* [[ARGC_REF]]
 // CHECK-DEBUG-NEXT:  invoke void [[FOO:@.+foo.+]](i32 [[ARGC]])
-// CHECK-DEBUG:   call {{.+}} @__kmpc_barrier(
 // CHECK-DEBUG:   ret void
 // CHECK-DEBUG:   call void @{{.+terminate.*|abort}}(
 // CHECK-DEBUG-NEXT:  unreachable
@@ -101,7 +99,6 @@
 // CHECK:   [[ARGC_REF:%.+]] = load i8***, i8 [[ARGC_PTR_ADDR]]
 // CHECK-NEXT:  [[ARGC:%.+]] = load i8**, i8*** [[ARGC_REF]]
 // CHECK-NEXT:  invoke {{.*}}void [[FOO1:@.+foo.+]](i8** [[ARGC]])
-// CHECK:   call {{.+}} @__kmpc_barrier(
 // CHECK:   ret void
 // CHECK:   call {{.*}}void @{{.+terminate.*|abort}}(
 // CHECK-NEXT:  unreachable
@@ -111,7 +108,6 @@
 // CHECK-DEBUG:   [[ARGC_REF:%.+]] = load i8***, i8 [[ARGC_PTR_ADDR]]
 // CHECK-DEBUG-NEXT:  [[ARGC:%.+]] = load i8**, i8*** [[ARGC_REF]]
 // CHECK-DEBUG-NEXT: 

r255992 - [OPENMP] Remove explicit call for implicit barrier

2015-12-18 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Dec 18 04:24:53 2015
New Revision: 255992

URL: http://llvm.org/viewvc/llvm-project?rev=255992&view=rev
Log:
[OPENMP] Remove explicit call for implicit barrier
#pragma omp parallel needs an implicit barrier that is currently done by an 
explicit call to __kmpc_barrier. However, the runtime already ensures a barrier 
in __kmpc_fork_call which currently leads to two barriers per region per thread.
Differential Revision: http://reviews.llvm.org/D15561

Modified:
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/test/OpenMP/cancel_codegen.cpp
cfe/trunk/test/OpenMP/cancellation_point_codegen.cpp
cfe/trunk/test/OpenMP/for_lastprivate_codegen.cpp
cfe/trunk/test/OpenMP/for_reduction_codegen.cpp
cfe/trunk/test/OpenMP/parallel_codegen.cpp
cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/parallel_for_codegen.cpp
cfe/trunk/test/OpenMP/parallel_for_linear_codegen.cpp
cfe/trunk/test/OpenMP/parallel_for_simd_codegen.cpp
cfe/trunk/test/OpenMP/parallel_reduction_codegen.cpp
cfe/trunk/test/OpenMP/parallel_sections_codegen.cpp
cfe/trunk/test/OpenMP/sections_codegen.cpp
cfe/trunk/test/OpenMP/sections_lastprivate_codegen.cpp
cfe/trunk/test/OpenMP/sections_reduction_codegen.cpp
cfe/trunk/test/OpenMP/single_firstprivate_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=255992&r1=255991&r2=255992&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Fri Dec 18 04:24:53 2015
@@ -893,10 +893,6 @@ void CodeGenFunction::EmitOMPParallelDir
 (void)PrivateScope.Privatize();
 CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt());
 CGF.EmitOMPReductionClauseFinal(S);
-// Emit implicit barrier at the end of the 'parallel' directive.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen);
 }
@@ -1873,12 +1869,6 @@ void CodeGenFunction::EmitOMPParallelFor
   (void)emitScheduleClause(*this, S, /*OuterRegion=*/true);
   auto &&CodeGen = [&S](CodeGenFunction &CGF) {
 CGF.EmitOMPWorksharingLoop(S);
-// Emit implicit barrier at the end of parallel region, but this barrier
-// is at the end of 'for' directive, so emit it as the implicit barrier for
-// this 'for' directive.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_parallel, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_for, CodeGen);
 }
@@ -1891,12 +1881,6 @@ void CodeGenFunction::EmitOMPParallelFor
   (void)emitScheduleClause(*this, S, /*OuterRegion=*/true);
   auto &&CodeGen = [&S](CodeGenFunction &CGF) {
 CGF.EmitOMPWorksharingLoop(S);
-// Emit implicit barrier at the end of parallel region, but this barrier
-// is at the end of 'for' directive, so emit it as the implicit barrier for
-// this 'for' directive.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_parallel, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_simd, CodeGen);
 }
@@ -1908,10 +1892,6 @@ void CodeGenFunction::EmitOMPParallelSec
   LexicalScope Scope(*this, S.getSourceRange());
   auto &&CodeGen = [&S](CodeGenFunction &CGF) {
 (void)CGF.EmitSections(S);
-// Emit implicit barrier at the end of parallel region.
-CGF.CGM.getOpenMPRuntime().emitBarrierCall(
-CGF, S.getLocStart(), OMPD_parallel, /*EmitChecks=*/false,
-/*ForceSimpleCall=*/true);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_sections, CodeGen);
 }

Modified: cfe/trunk/test/OpenMP/cancel_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/cancel_codegen.cpp?rev=255992&r1=255991&r2=255992&view=diff
==
--- cfe/trunk/test/OpenMP/cancel_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/cancel_codegen.cpp Fri Dec 18 04:24:53 2015
@@ -111,7 +111,6 @@ for (int i = 0; i < argc; ++i) {
 // CHECK: br label %[[RETURN:.+]]
 // CHECK: [[ELSE]]
 // CHECK: br label
-// CHECK: call void @__kmpc_barrier
 // CHECK: [[RETURN]]
 // CHECK: ret void
 
@@ -129,7 +128,6 @@ for (int i = 0; i < argc; ++i) {
 // CHECK: call i32 @__kmpc_single(
 // CHECK-NOT: @__kmpc_cancel
 // CHECK: call void @__kmpc_end_single(
-// CHECK: call void @__kmpc_barrier(%ident_t*
 // CHECK: ret void
 
 // CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
@@ -164,7 +162,6 @@ for (int i = 0; i < argc; ++i) {
 // CHECK: [[CONTINUE]]
 // CHECK: br label
 // CHECK: call void @__kmpc_for_static_fin

Re: [PATCH] D15561: [OpenMP] Remove explicit call for implicit barrier

2015-12-18 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Fixed tests and committed. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D15561



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


r255993 - Replace SM.getFileEntryForID(Lexer->getFileID()) with Lexer->getFileEntry().

2015-12-18 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Dec 18 04:30:12 2015
New Revision: 255993

URL: http://llvm.org/viewvc/llvm-project?rev=255993&view=rev
Log:
Replace SM.getFileEntryForID(Lexer->getFileID()) with Lexer->getFileEntry().


Modified:
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/PPLexerChange.cpp

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=255993&r1=255992&r2=255993&view=diff
==
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Fri Dec 18 04:30:12 2015
@@ -650,8 +650,7 @@ const FileEntry *Preprocessor::LookupFil
   for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) {
 IncludeStackInfo &ISEntry = IncludeMacroStack[e - i - 1];
 if (IsFileLexer(ISEntry))
-  if ((FileEnt = SourceMgr.getFileEntryForID(
-   ISEntry.ThePPLexer->getFileID(
+  if ((FileEnt = ISEntry.ThePPLexer->getFileEntry()))
 Includers.push_back(std::make_pair(FileEnt, FileEnt->getDir()));
   }
 }
@@ -696,7 +695,7 @@ const FileEntry *Preprocessor::LookupFil
   // to one of the headers on the #include stack.  Walk the list of the current
   // headers on the #include stack and pass them to HeaderInfo.
   if (IsFileLexer()) {
-if ((CurFileEnt = SourceMgr.getFileEntryForID(CurPPLexer->getFileID( {
+if ((CurFileEnt = CurPPLexer->getFileEntry())) {
   if ((FE = HeaderInfo.LookupSubframeworkHeader(Filename, CurFileEnt,
 SearchPath, RelativePath,
 RequestingModule,
@@ -712,8 +711,7 @@ const FileEntry *Preprocessor::LookupFil
   for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) {
 IncludeStackInfo &ISEntry = IncludeMacroStack[e-i-1];
 if (IsFileLexer(ISEntry)) {
-  if ((CurFileEnt =
-   SourceMgr.getFileEntryForID(ISEntry.ThePPLexer->getFileID( {
+  if ((CurFileEnt = ISEntry.ThePPLexer->getFileEntry())) {
 if ((FE = HeaderInfo.LookupSubframeworkHeader(
 Filename, CurFileEnt, SearchPath, RelativePath,
 RequestingModule, SuggestedModule))) {

Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=255993&r1=255992&r2=255993&view=diff
==
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Fri Dec 18 04:30:12 2015
@@ -301,8 +301,7 @@ bool Preprocessor::HandleEndOfFile(Token
 if (const IdentifierInfo *ControllingMacro =
   CurPPLexer->MIOpt.GetControllingMacroAtEndOfFile()) {
   // Okay, this has a controlling macro, remember in HeaderFileInfo.
-  if (const FileEntry *FE =
-SourceMgr.getFileEntryForID(CurPPLexer->getFileID())) {
+  if (const FileEntry *FE = CurPPLexer->getFileEntry()) {
 HeaderInfo.SetFileControllingMacro(FE, ControllingMacro);
 if (MacroInfo *MI =
   getMacroInfo(const_cast(ControllingMacro))) {


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


Re: [PATCH] D15070: [mips] Added support for -Wa, -mips32 and similar.

2015-12-18 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

With a couple small changes it will LGTM



Comment at: lib/Driver/Tools.cpp:2567-2568
@@ -2547,1 +2566,4 @@
   }
+  StringRef MipsFeatureStringRef = MipsTargetFeature;
+  if (MipsFeatureStringRef != "") {
+CmdArgs.push_back("-target-feature");

It would be better to use a null pointer check and use nullptr instead of the 
empty strings in the initial and default cases.


Comment at: test/Driver/mips-ias-Wa.s:121-129
@@ +120,11 @@
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r6 
2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R6 %s
+// MIPS64R6: -cc1as
+// MIPS64R6: "-target-feature" "+mips64r6"
+
+// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 
-Wa,-mips64r2,-mips4 2>&1 | \
+// RUN:   FileCheck -check-prefix=MIPS64R2-MIPS4 %s
+// MIPS64R2-MIPS4: -cc1as
+// MIPS64R2-MIPS4: "-target-feature" "+mips4"
+// MIPS64R2-MIPS4-NOT: "-target-feature" "+mips64r2"

You need to check the CHECK-NOT's on both sides of the CHECK.


http://reviews.llvm.org/D15070



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


[PATCH] D15636: Reduce false positives in printf/scanf format checker

2015-12-18 Thread Andy Gibbs via cfe-commits
AndyG created this revision.
AndyG added a reviewer: cfe-commits.

The printf/scanf format checker is a little over-zealous in handling the 
conditional operator.  This patch reduces work by not checking code-paths that 
are never used and reduces false positives regarding uncovered arguments, for 
example in the code fragment:

printf(minimal ? "%i\n" : "%i: %s\n", code, msg);

http://reviews.llvm.org/D15636

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaChecking.cpp
  test/Sema/format-strings.c

Index: test/Sema/format-strings.c
===
--- test/Sema/format-strings.c
+++ test/Sema/format-strings.c
@@ -86,6 +86,19 @@
   printf(i == 0 ? (i == 1 ? "yes" : "no") : "dont know"); // no-warning
   printf(i == 0 ? (i == 1 ? s : "no") : "dont know"); // expected-warning{{format string is not a string literal}}
   printf("yes" ?: "no %d", 1); // expected-warning{{data argument not used by format string}}
+  printf(0 ? "yes %s" : "no %d", 1); // no-warning
+  printf(0 ? "yes %d" : "no %s", 1); // expected-warning{{format specifies type 'char *'}}
+
+  printf(0 ? "yes" : "no %d", 1); // no-warning
+  printf(0 ? "yes %d" : "no", 1); // expected-warning{{data argument not used by format string}}
+  printf(1 ? "yes" : "no %d", 1); // expected-warning{{data argument not used by format string}}
+  printf(1 ? "yes %d" : "no", 1); // no-warning
+  printf(i ? "yes" : "no %d", 1); // no-warning
+  printf(i ? "yes %s" : "no %d", 1); // expected-warning{{format specifies type 'char *'}}
+  printf(i ? "yes" : "no %d", 1, 2); // expected-warning{{data argument not used by format string}}
+
+  printf(i ? "%*s" : "-", i, s); // no-warning
+  printf(i ? "yes" : 0 ? "no %*d" : "dont know %d", 1, 2); // expected-warning{{data argument not used by format string}}
 }
 
 void check_writeback_specifier()
@@ -519,7 +532,7 @@
 
   // Make sure that the "format string is defined here" note is not emitted
   // when the original string is within the argument expression.
-  printf(1 ? "yes %d" : "no %d"); // expected-warning 2{{more '%' conversions than data arguments}}
+  printf(1 ? "yes %d" : "no %d"); // expected-warning{{more '%' conversions than data arguments}}
 
   const char kFormat17[] = "%hu"; // expected-note{{format string is defined here}}}
   printf(kFormat17, (int[]){0}); // expected-warning{{format specifies type 'unsigned short' but the argument}}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -3004,6 +3004,15 @@
 }
 
 namespace {
+struct UncoveredArgHandler {
+  enum { Unknown = -1, AllCovered = -2 };
+  signed FirstUncoveredArg;
+  const Expr *DiagnosticExpr;
+
+  UncoveredArgHandler() : FirstUncoveredArg(Unknown), DiagnosticExpr(0) { }
+  void Diagnose(Sema &S, bool IsFunctionCall, const Expr *ArgExpr);
+};
+
 enum StringLiteralCheckType {
   SLCT_NotALiteral,
   SLCT_UncheckedLiteral,
@@ -3020,7 +3029,8 @@
   bool HasVAListArg, unsigned format_idx,
   unsigned firstDataArg, Sema::FormatStringType Type,
   Sema::VariadicCallType CallType, bool InFunctionCall,
-  llvm::SmallBitVector &CheckedVarArgs) {
+  llvm::SmallBitVector &CheckedVarArgs,
+  UncoveredArgHandler &UncoveredArg) {
  tryAgain:
   if (E->isTypeDependent() || E->isValueDependent())
 return SLCT_NotALiteral;
@@ -3041,17 +3051,39 @@
 // completely checked only if both sub-expressions were checked.
 const AbstractConditionalOperator *C =
 cast(E);
-StringLiteralCheckType Left =
-checkFormatStringExpr(S, C->getTrueExpr(), Args,
-  HasVAListArg, format_idx, firstDataArg,
-  Type, CallType, InFunctionCall, CheckedVarArgs);
-if (Left == SLCT_NotALiteral)
-  return SLCT_NotALiteral;
+
+// Determine whether it is necessary to check both sub-expressions, for
+// example, because the condition expression is a constant that can be
+// evaluated at compile time.
+bool CheckLeft = true, CheckRight = true;
+
+bool Cond;
+if (C->getCond()->EvaluateAsBooleanCondition(Cond, S.getASTContext())) {
+  if (Cond)
+CheckRight = false;
+  else
+CheckLeft = false;
+}
+
+StringLiteralCheckType Left;
+if (!CheckLeft)
+  Left = SLCT_UncheckedLiteral;
+else {
+  Left = checkFormatStringExpr(S, C->getTrueExpr(), Args,
+   HasVAListArg, format_idx, firstDataArg,
+   Type, CallType, InFunctionCall,
+   CheckedVarArgs, UncoveredArg);
+  if (Left == SLCT_NotALiteral || !CheckRight)
+return Left;
+}
+
 StringLiteralCheckType Right =
 checkFormatStringExpr(S, C->getFalseExpr(), Args,
  

Re: [PATCH] D15410: AnalysisConsumer: use canonical decl for both lookup and store of visited decls

2015-12-18 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

Thank you. I'm not familiar with Objective-C/C++ issues so I missed that. I'll 
take an another look. BTW, maybe it is better to use definition decl instead of 
canonical?


Repository:
  rL LLVM

http://reviews.llvm.org/D15410



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


Re: [PATCH] D13330: Implement __attribute__((unique_instantiation))

2015-12-18 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 43218.
loladiro added a comment.

Rebased


http://reviews.llvm.org/D13330

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AttributeList.h
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/CodeGen/CGVTables.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaTemplate.cpp
  test/CodeGenCXX/unique-instantiation.cpp
  test/SemaCXX/unique-instantiations.cpp
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -2369,6 +2369,8 @@
 case Func | ObjCMethod | Param: return "ExpectedFunctionMethodOrParameter";
 case Func | ObjCMethod: return "ExpectedFunctionOrMethod";
 case Func | Var: return "ExpectedVariableOrFunction";
+case Func | Class:
+  return "ExpectedFunctionOrClass";
 
 // If not compiling for C++, the class portion does not apply.
 case Func | Var | Class:
Index: test/SemaCXX/unique-instantiations.cpp
===
--- /dev/null
+++ test/SemaCXX/unique-instantiations.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang -cc1 -std=c++14 -fsyntax-only -verify %s
+
+// Correct usage
+template 
+struct foo {};
+extern template struct __attribute__((unique_instantiation)) foo;
+template struct __attribute__((unique_instantiation)) foo;
+
+template 
+T pi = T(3.1415926535897932385);
+extern template __attribute__((unique_instantiation)) float pi;
+template __attribute__((unique_instantiation)) float pi;
+
+// Usages on non-templates
+float __attribute__((unique_instantiation)) notpi(2.71828182845904523536028747135); // expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+struct __attribute__((unique_instantiation)) bar {};// expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+void __attribute__((unique_instantiation)) func() {}// expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+
+// Usages that violate one of the conditions required conditions
+template 
+struct foo1 {};
+template struct __attribute__((unique_instantiation)) foo1; // expected-error{{'unique_instantiation' attribute on an explicit instantiation requires a previous explicit instantiation declaration}}
+
+template 
+T pi1 = T(3.1415926535897932385);
+template __attribute__((unique_instantiation)) float pi1; // expected-error{{'unique_instantiation' attribute on an explicit instantiation requires a previous explicit instantiation declaration}}
+
+template 
+struct foo2 {};
+extern template struct foo2;// expected-note{{previous explicit instantiation is here}}
+template struct __attribute__((unique_instantiation)) foo2; // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template 
+struct foo3 {};
+extern template struct __attribute__((unique_instantiation)) foo3; // expected-note{{previous explicit instantiation is here}}
+extern template struct foo3;   // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template 
+struct __attribute__((unique_instantiation)) foo4 {}; // expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+
+template 
+struct foo5 {};
+extern template struct __attribute__((unique_instantiation)) foo5; // expected-note{{previous explicit instantiation is here}}
+template struct foo5;  // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template 
+struct foo6 {};
+extern template struct __attribute__((unique_instantiation(16))) foo6; // expected-error{{'unique_instantiation' attribute takes no arguments}}
Index: test/CodeGenCXX/unique-instantiation.cpp
===
--- /dev/null
+++ test/CodeGenCXX/unique-instantiation.cpp
@@ -0,0 +1,74 @@
+// RUN: %clang -std=c++14 -emit-llvm -c -S -o - %s | FileCheck %s
+
+// CHECK: @_Z2piIfE = global float
+// CHECK-NOT: @_Z2piIfE = weak_odr global float
+template 
+T pi = T(3.1415926535897932385);
+extern template __attribute__((unique_instantiation)) float pi;
+template __attribute__((unique_instantiation)) float pi;
+
+template 
+struct foo {
+  T x;
+  T getX() { return x; }
+  struct bar {
+T y;
+

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-18 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 4 inline comments as done.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:41
@@ +40,3 @@
+const Stmt *Parent = PM.getParent(Cast);
+if (!Parent)
+  return;

a.sidorin wrote:
> Parent should always exist for an implicit cast. May be it's better to assert 
> here?
If I comment out lines 41 and 42 and run "make check-all" I get:

FAIL: Clang :: Analysis/misc-ps-region-store.cpp (668 of 24574)
 TEST 'Clang :: Analysis/misc-ps-region-store.cpp' 
FAILED 

#0 ...
#1 ...
...
#9 0x02f1d062 llvm::isa_impl_cl::doit(clang::Stmt const*) 
/home/danielm/llvm/include/llvm/Support/Casting.h:96:0




Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:44
@@ +43,3 @@
+
+const BinaryOperator *B = dyn_cast(Parent);
+if (!B)

a.sidorin wrote:
> Note that InitExprs of DeclStmts are not binary operators. So you will not 
> get a warning on initialization and this test:
> 
> ```
> void test(unsigned int p) {
>   unsigned X = 1000;
>   unsigned char uc = X; // expected-warning {{Loss of precision}}
> }
> ```
> will fail.
I have limited this patch hoping that it will be easier to triage and review. 
Right now I only warn if there is assignment and RHS is a DeclRefExpr and only 
for loss of precision. I will definitely look into initializations also later.


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:49
@@ +48,3 @@
+BinaryOperator::Opcode Opc = B->getOpcode();
+if (Opc == BO_Assign || Opc == BO_MulAssign)
+  diagnoseLossOfPrecision(Cast, C);

a.sidorin wrote:
> It's not evident why do you omit other Assign operators here, like 
> BO_SubAssign, BO_AddAssign and BO_DivAssign. As I see from your test, there 
> are some problems with them. Could you add a comment?
DivAssign is obvious; if the rhs is too large there won't be loss of precision.
But I fail to think of additional problems to handle BO_AddAssign and 
BO_SubAssign also immediately.. I'll add it in next patch


Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:158
@@ +157,3 @@
+
+  unsigned long long MaxVal = 1ULL << W;
+  if (canBeGreaterEqual(C, Cast->getSubExpr(), MaxVal))

NoQ wrote:
> `BasicValueFactory::getMaxValue(QualType)` might be useful.
Imho this seems harder.

To start with the getMaxValue returns 127 for a signed 8-bit integer.

I don't want to warn here:

 S8 = 0xff;  // <- no loss of precision, all bits are saved

So instead of 1 line I'd get 4+ lines:

SValBuilder &Bldr = C.getSValBuilder();
BasicValueFactory &BVF = Bldr.getBasicValueFactory();
QualType U = ResultType...  // I don't know how to convert ResultType
const llvm::APSInt &MaxVal1 = BVF.getMaxValue(U);

Maybe I am missing something. Let me know if I do.


http://reviews.llvm.org/D13126



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


[PATCH] D15639: [clang-format] Ensure Sort include is stable with negative Priority

2015-12-18 Thread Jean-Philippe Dufraigne via cfe-commits
jeanphilippeD created this revision.
jeanphilippeD added a reviewer: djasper.
jeanphilippeD added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

The new sort include with negative priority was not stable when running it 
again over the updated includes.

Extend the test NegativePriorities to have an extra header. Test pas still 
passing
Add a new assertion to test that the sorting is stable. This new assertion 
failed.

From this:
#include "important_os_header.h"
#include "c_main_header.h"
#include "a_other_header.h"

Before fix:
#include "important_os_header.h"
#include "a_other_header.h"
#include "c_main_header.h"

After fix:
#include "important_os_header.h"
#include "c_main_header.h"
#include "a_other_header.h"

http://reviews.llvm.org/D15639

Files:
  lib/Format/Format.cpp
  unittests/Format/SortIncludesTest.cpp

Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -188,9 +188,19 @@
 TEST_F(SortIncludesTest, NegativePriorities) {
   Style.IncludeCategories = {{".*important_os_header.*", -1}, {".*", 1}};
   EXPECT_EQ("#include \"important_os_header.h\"\n"
-"#include \"a.h\"\n",
-sort("#include \"a.h\"\n"
+"#include \"c_main_header.h\"\n"
+"#include \"a_other_header.h\"\n",
+sort("#include \"c_main_header.h\"\n"
+ "#include \"a_other_header.h\"\n"
  "#include \"important_os_header.h\"\n"));
+
+  // check stable when re-run
+  EXPECT_EQ("#include \"important_os_header.h\"\n"
+"#include \"c_main_header.h\"\n"
+"#include \"a_other_header.h\"\n",
+sort("#include \"important_os_header.h\"\n"
+ "#include \"c_main_header.h\"\n"
+ "#include \"a_other_header.h\"\n"));
 }
 
 TEST_F(SortIncludesTest, CalculatesCorrectCursorPosition) {
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1807,19 +1807,21 @@
 if (!FormattingOff && !Line.endswith("\\")) {
   if (IncludeRegex.match(Line, &Matches)) {
 StringRef IncludeName = Matches[2];
-int Category;
-if (LookForMainHeader && !IncludeName.startswith("<")) {
-  Category = 0;
-} else {
-  Category = INT_MAX;
-  for (unsigned i = 0, e = CategoryRegexs.size(); i != e; ++i) {
+int Category = INT_MAX;
+for (unsigned i = 0, e = CategoryRegexs.size(); i != e; ++i) {
 if (CategoryRegexs[i].match(IncludeName)) {
-  Category = Style.IncludeCategories[i].Priority;
-  break;
+Category = Style.IncludeCategories[i].Priority;
+break;
 }
-  }
 }
-LookForMainHeader = false;
+
+if (Category >= 0 ) {
+if (LookForMainHeader && !IncludeName.startswith("<")) {
+Category = 0;
+}
+LookForMainHeader = false;
+}
+
 IncludesInBlock.push_back({IncludeName, Line, Prev, Category});
   } else if (!IncludesInBlock.empty()) {
 sortIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces,


Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -188,9 +188,19 @@
 TEST_F(SortIncludesTest, NegativePriorities) {
   Style.IncludeCategories = {{".*important_os_header.*", -1}, {".*", 1}};
   EXPECT_EQ("#include \"important_os_header.h\"\n"
-"#include \"a.h\"\n",
-sort("#include \"a.h\"\n"
+"#include \"c_main_header.h\"\n"
+"#include \"a_other_header.h\"\n",
+sort("#include \"c_main_header.h\"\n"
+ "#include \"a_other_header.h\"\n"
  "#include \"important_os_header.h\"\n"));
+
+  // check stable when re-run
+  EXPECT_EQ("#include \"important_os_header.h\"\n"
+"#include \"c_main_header.h\"\n"
+"#include \"a_other_header.h\"\n",
+sort("#include \"important_os_header.h\"\n"
+ "#include \"c_main_header.h\"\n"
+ "#include \"a_other_header.h\"\n"));
 }
 
 TEST_F(SortIncludesTest, CalculatesCorrectCursorPosition) {
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -1807,19 +1807,21 @@
 if (!FormattingOff && !Line.endswith("\\")) {
   if (IncludeRegex.match(Line, &Matches)) {
 StringRef IncludeName = Matches[2];
-int Category;
-if (LookForMainHeader && !IncludeName.startswith("<")) {
-  Category = 0;
-} else {
-  Category = INT_MAX;
-  for (unsigned i = 0, e = CategoryRe

[PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread James Molloy via cfe-commits
jmolloy created this revision.
jmolloy added a reviewer: joerg.
jmolloy added a subscriber: cfe-commits.
jmolloy set the repository for this revision to rL LLVM.
Herald added a subscriber: joker.eph.

The gold plugin understands -O0..-O3, but these are not currently being passed 
to it.

Repository:
  rL LLVM

http://reviews.llvm.org/D15641

Files:
  lib/Driver/Tools.cpp
  test/Driver/gold-lto.c

Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -1,23 +1,26 @@
 // RUN: touch %t.o
 //
 // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -Wl,-plugin-opt=foo \
+// RUN: -Wl,-plugin-opt=foo -O3 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-BASIC
 // CHECK-X86-64-BASIC: "-plugin" "{{.*}}/LLVMgold.so"
+// CHECK-X86-64-BASIC: "-plugin-opt=O3"
 // CHECK-X86-64-BASIC: "-plugin-opt=foo"
 //
 // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -march=corei7 -Wl,-plugin-opt=foo \
+// RUN: -march=corei7 -Wl,-plugin-opt=foo -Ofast \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7
 // CHECK-X86-64-COREI7: "-plugin" "{{.*}}/LLVMgold.so"
 // CHECK-X86-64-COREI7: "-plugin-opt=mcpu=corei7"
+// CHECK-X86-64-COREI7: "-plugin-opt=O3"
 // CHECK-X86-64-COREI7: "-plugin-opt=foo"
 //
 // RUN: %clang -target arm-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -march=armv7a -Wl,-plugin-opt=foo \
+// RUN: -march=armv7a -Wl,-plugin-opt=foo -O0 \
 // RUN: | FileCheck %s --check-prefix=CHECK-ARM-V7A
 // CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
 // CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
+// CHECK-ARM-V7A: "-plugin-opt=O0"
 // CHECK-ARM-V7A: "-plugin-opt=foo"
 //
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1804,6 +1804,21 @@
   if (!CPU.empty())
 CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=mcpu=") + CPU));
 
+  if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
+if (A->getOption().matches(options::OPT_O4) ||
+A->getOption().matches(options::OPT_Ofast)) {
+  CmdArgs.push_back("-plugin-opt=O3");
+} else if (A->getOption().matches(options::OPT_O)) {
+  CmdArgs.push_back(
+  Args.MakeArgString(Twine("-plugin-opt=O") + A->getValue()));
+} else if (A->getOption().matches(options::OPT_O0)) {
+  CmdArgs.push_back("-plugin-opt=O0");
+} else {
+  ToolChain.getDriver().Diag(clang::diag::warn_drv_unused_argument)
+  << A->getAsString(Args);
+}
+  }
+
   if (IsThinLTO)
 CmdArgs.push_back("-plugin-opt=thinlto");
 }


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -1,23 +1,26 @@
 // RUN: touch %t.o
 //
 // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -Wl,-plugin-opt=foo \
+// RUN: -Wl,-plugin-opt=foo -O3 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-BASIC
 // CHECK-X86-64-BASIC: "-plugin" "{{.*}}/LLVMgold.so"
+// CHECK-X86-64-BASIC: "-plugin-opt=O3"
 // CHECK-X86-64-BASIC: "-plugin-opt=foo"
 //
 // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -march=corei7 -Wl,-plugin-opt=foo \
+// RUN: -march=corei7 -Wl,-plugin-opt=foo -Ofast \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7
 // CHECK-X86-64-COREI7: "-plugin" "{{.*}}/LLVMgold.so"
 // CHECK-X86-64-COREI7: "-plugin-opt=mcpu=corei7"
+// CHECK-X86-64-COREI7: "-plugin-opt=O3"
 // CHECK-X86-64-COREI7: "-plugin-opt=foo"
 //
 // RUN: %clang -target arm-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -march=armv7a -Wl,-plugin-opt=foo \
+// RUN: -march=armv7a -Wl,-plugin-opt=foo -O0 \
 // RUN: | FileCheck %s --check-prefix=CHECK-ARM-V7A
 // CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
 // CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
+// CHECK-ARM-V7A: "-plugin-opt=O0"
 // CHECK-ARM-V7A: "-plugin-opt=foo"
 //
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1804,6 +1804,21 @@
   if (!CPU.empty())
 CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=mcpu=") + CPU));
 
+  if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
+if (A->getOption().matches(options::OPT_O4) ||
+A->getOption().matches(options::OPT_Ofast)) {
+  CmdArgs.push_back("-plugin-opt=O3");
+} else if (A->getOption().matches(options::OPT_O)) {
+  CmdArgs.push_back(
+  Args.MakeArgString(Twine("-plugin-opt=O") + A->getValue()));
+} else if (A->getOption().matches(options::OPT_O0)) {
+  CmdArgs.push_back("-plugin-opt=O0");
+} else {
+  ToolChain.getDriver().D

Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread Rafael Ávila de Espíndola via cfe-commits
rafael added a subscriber: rafael.
rafael added a comment.

This introduces a meaning to -ON during the link. That normally show up by 
people passing CFLAGS when linking.

I think that is OK, but would like a second opinion.



Comment at: lib/Driver/Tools.cpp:1815
@@ +1814,3 @@
+} else if (A->getOption().matches(options::OPT_O0)) {
+  CmdArgs.push_back("-plugin-opt=O0");
+} else {

Can you refactor these 3 calls to push_back?


Comment at: lib/Driver/Tools.cpp:1817
@@ +1816,3 @@
+} else {
+  ToolChain.getDriver().Diag(clang::diag::warn_drv_unused_argument)
+  << A->getAsString(Args);

Why do you need to manually issue a diagnostic?



Repository:
  rL LLVM

http://reviews.llvm.org/D15641



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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread James Molloy via cfe-commits
jmolloy added a comment.

Hi Rafael,

Thanks for the review!

> This introduces a meaning to -ON during the link. That normally show up by 
> people passing CFLAGS when linking.


Yes. The rationale is that with -flto, the link is also part of the compile. I 
think it's more surprising that the compiler isn't called with the -O options 
than the reverse!

James



Comment at: lib/Driver/Tools.cpp:1815
@@ +1814,3 @@
+} else if (A->getOption().matches(options::OPT_O0)) {
+  CmdArgs.push_back("-plugin-opt=O0");
+} else {

rafael wrote:
> Can you refactor these 3 calls to push_back?
Sure!


Comment at: lib/Driver/Tools.cpp:1817
@@ +1816,3 @@
+} else {
+  ToolChain.getDriver().Diag(clang::diag::warn_drv_unused_argument)
+  << A->getAsString(Args);

rafael wrote:
> Why do you need to manually issue a diagnostic?
> 
You're right - I don't. I'll remove this.


Repository:
  rL LLVM

http://reviews.llvm.org/D15641



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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread Joerg Sonnenberger via cfe-commits
On Fri, Dec 18, 2015 at 01:53:58PM +, James Molloy wrote:
> The gold plugin understands -O0..-O3, but these are not currently being 
> passed to it.

Is this about generic optimizer flags in the sense of things that get
back to LLVM or about linker-style optimizations?

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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread James Molloy via cfe-commits
Hi Joerg,

This is about the standard generic optimizer flags. Currently when using
-flto, the backend behaves always as if "-O2" were passed (because this is
the default codegen optimization level inside the gold plugin and it's
never overridden!). So CodeGenOpt::Aggressive is never picked, and that can
significantly change the backend's behaviour.

This isn't about linker optimizations.

James

On Fri, 18 Dec 2015 at 15:50 Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Fri, Dec 18, 2015 at 01:53:58PM +, James Molloy wrote:
> > The gold plugin understands -O0..-O3, but these are not currently being
> passed to it.
>
> Is this about generic optimizer flags in the sense of things that get
> back to LLVM or about linker-style optimizations?
>
> Joerg
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D15643: Don't allow newline after uppercase Obj-C block return types

2015-12-18 Thread Kent Sutherland via cfe-commits
ksuther created this revision.
ksuther added a reviewer: djasper.
ksuther added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Fixes the following:

BOOL (^aaa)(void) = ^BOOL {
};

The first BOOL's token was getting set to TT_FunctionAnnotationRParen 
incorrectly, which was causing an unexpected newline after (^aaa). This was 
introduced in r245846.

http://reviews.llvm.org/D15643

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -10608,6 +10608,9 @@
"});");
   verifyFormat("Block b = ^int *(A *a, B *b) {}");
 
+  verifyFormat("BOOL (^aaa)(void) = ^BOOL {\n"
+   "};");
+
   FormatStyle FourIndent = getLLVMStyle();
   FourIndent.ObjCBlockIndentWidth = 4;
   verifyFormat("[operation setCompletionBlock:^{\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -955,12 +955,17 @@
   if (Current.MatchingParen && Current.Next &&
   !Current.Next->isBinaryOperator() &&
   !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace))
-if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
-  if (BeforeParen->is(tok::identifier) &&
-  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
-  (!BeforeParen->Previous ||
-   BeforeParen->Previous->ClosesTemplateDeclaration))
-Current.Type = TT_FunctionAnnotationRParen;
+if (FormatToken *AfterParen = Current.MatchingParen->Next) {
+  // Make sure this isn't the return type of an Obj-C block declaration
+  if (AfterParen->Tok.isNot(tok::caret)) {
+if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
+  if (BeforeParen->is(tok::identifier) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration))
+Current.Type = TT_FunctionAnnotationRParen;
+  }
+}
 } else if (Current.is(tok::at) && Current.Next) {
   if (Current.Next->isStringLiteral()) {
 Current.Type = TT_ObjCStringLiteral;


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -10608,6 +10608,9 @@
"});");
   verifyFormat("Block b = ^int *(A *a, B *b) {}");
 
+  verifyFormat("BOOL (^aaa)(void) = ^BOOL {\n"
+   "};");
+
   FormatStyle FourIndent = getLLVMStyle();
   FourIndent.ObjCBlockIndentWidth = 4;
   verifyFormat("[operation setCompletionBlock:^{\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -955,12 +955,17 @@
   if (Current.MatchingParen && Current.Next &&
   !Current.Next->isBinaryOperator() &&
   !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace))
-if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
-  if (BeforeParen->is(tok::identifier) &&
-  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
-  (!BeforeParen->Previous ||
-   BeforeParen->Previous->ClosesTemplateDeclaration))
-Current.Type = TT_FunctionAnnotationRParen;
+if (FormatToken *AfterParen = Current.MatchingParen->Next) {
+  // Make sure this isn't the return type of an Obj-C block declaration
+  if (AfterParen->Tok.isNot(tok::caret)) {
+if (FormatToken *BeforeParen = Current.MatchingParen->Previous)
+  if (BeforeParen->is(tok::identifier) &&
+  BeforeParen->TokenText == BeforeParen->TokenText.upper() &&
+  (!BeforeParen->Previous ||
+   BeforeParen->Previous->ClosesTemplateDeclaration))
+Current.Type = TT_FunctionAnnotationRParen;
+  }
+}
 } else if (Current.is(tok::at) && Current.Next) {
   if (Current.Next->isStringLiteral()) {
 Current.Type = TT_ObjCStringLiteral;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread Joerg Sonnenberger via cfe-commits
On Fri, Dec 18, 2015 at 03:59:03PM +, James Molloy via cfe-commits wrote:
> This is about the standard generic optimizer flags. Currently when using
> -flto, the backend behaves always as if "-O2" were passed (because this is
> the default codegen optimization level inside the gold plugin and it's
> never overridden!). So CodeGenOpt::Aggressive is never picked, and that can
> significantly change the backend's behaviour.

I thought we moved to per-function optimissation attributes?

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


Re: [PATCH] D14653: [libcxx] Introduce the mechanism for fixing -fno-exceptions test failures.

2015-12-18 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 43237.
rmaprath added a comment.

Addressing review comments by @mclow.lists:

- Introduced `TEST_TRY` and `TEST_CATCH` macros to avoid the non-standard 
`#define try/catch`.


http://reviews.llvm.org/D14653

Files:
  include/__config
  include/array
  test/std/containers/sequences/array/at.pass.cpp
  test/support/noexcept.h
  test/support/test_allocator.h

Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -65,13 +65,8 @@
 pointer allocate(size_type n, const void* = 0)
 {
 assert(data_ >= 0);
-if (time_to_throw >= throw_after) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw std::bad_alloc();
-#else
-std::terminate();
-#endif
-}
+if (time_to_throw >= throw_after)
+_LIBCPP_THROW(std::bad_alloc(), "std::bad_alloc");
 ++time_to_throw;
 ++alloc_count;
 return (pointer)::operator new(n * sizeof(T));
@@ -125,13 +120,8 @@
 pointer allocate(size_type n, const void* = 0)
 {
 assert(data_ >= 0);
-if (time_to_throw >= throw_after) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-throw std::bad_alloc();
-#else
-std::terminate();
-#endif
-}
+if (time_to_throw >= throw_after)
+_LIBCPP_THROW(std::bad_alloc(), "std::bad_alloc");
 ++time_to_throw;
 ++alloc_count;
 return (pointer)::operator new (n * sizeof(T));
Index: test/support/noexcept.h
===
--- /dev/null
+++ test/support/noexcept.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//===- noexcept.h -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef NOEXCEPT_H
+#define NOEXCEPT_H
+
+// These helper macros enable writing tests for the standard library exceptions
+// (i.e. tests that check the library throws where it should) while at the same
+// time catering for the no-exceptions library variant. In the no-exceptions
+// variant, the macros translate into a setjmp/longjmp duo that mimic the
+// control flow of exceptions. The goal here is to allow the tests to verify
+// that the library called __libcxx_noexceptions_abort() at the point where it
+// originally threw. Note that the longjmp (and hence the setjmp) is necessary
+// here as we cannot allow the execution to proceed past the point where the
+// library detects an error. Finally, this simple translation does not work when
+// tests use multiple catch statements, in those cases we have to use the
+// _LIBCPP_NO_EXCEPTIONS macro and exclude the additional catch statements.
+#ifndef _LIBCPP_NO_EXCEPTIONS
+#define TEST_TRY try
+#define TEST_CATCH(E) catch (E)
+#define TEST_THROW(E) throw E
+#else
+#define TEST_TRY if (!setjmp(try_buf))
+#define TEST_CATCH(E) else
+#define TEST_THROW(E) __libcxx_noexceptions_abort("exception")
+
+#include 
+#include 
+#include "test_macros.h"
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+# if TEST_STD_VER >= 11
+#   define TLS_SPEC thread_local
+# elif defined(_LIBCPP_MSVC)
+#   define TLS_SPEC __declspec(thread)
+# else
+#   define TLS_SPEC __thread
+# endif
+#else
+# define TLS_SPEC
+#endif
+
+// Some tests launch multiple threads, in which case we need to make sure that
+// try_buf is maintained per-thread, otherwise setjmp()/longjmp() will attempt
+// to jump between threads!
+TLS_SPEC jmp_buf try_buf;
+#undef TLS_SPEC
+
+void __libcxx_noexceptions_abort(const char *msg) {
+  fprintf(stderr, "%s\n", msg);
+  longjmp(try_buf, 1);
+}
+#endif // _LIBCPP_NO_EXCEPTIONS
+
+#endif // NOEXCEPT_H
Index: test/std/containers/sequences/array/at.pass.cpp
===
--- test/std/containers/sequences/array/at.pass.cpp
+++ test/std/containers/sequences/array/at.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // reference operator[] (size_type)
@@ -19,6 +18,7 @@
 #include 
 
 #include "test_macros.h"
+#include "noexcept.h"
 
 // std::array is explicitly allowed to be initialized with A a = { init-list };.
 // Disable the missing braces warning for this reason.
@@ -40,8 +40,8 @@
 r2 = 7.5;
 assert(c.back() == 7.5);
 
-try { (void) c.at(3); }
-catch (const std::out_of_range &) {}
+TEST_TRY { (void) c.at(3); }
+TEST_CATCH (const std::out_of_range &) {}
 }
 {
 typedef double T;
@@ -53,8 +53,8 @@
 C::const_reference

Re: [PATCH] D14653: [libcxx] Introduce the mechanism for fixing -fno-exceptions test failures.

2015-12-18 Thread Asiri Rathnayake via cfe-commits
rmaprath marked an inline comment as done.
rmaprath added a comment.

http://reviews.llvm.org/D14653



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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread James Molloy via cfe-commits
Evidently not, at least not completely. I see codegen differences with this
patch (and at least one significant improvement).

James
On Fri, 18 Dec 2015 at 16:31, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Fri, Dec 18, 2015 at 03:59:03PM +, James Molloy via cfe-commits
> wrote:
> > This is about the standard generic optimizer flags. Currently when using
> > -flto, the backend behaves always as if "-O2" were passed (because this
> is
> > the default codegen optimization level inside the gold plugin and it's
> > never overridden!). So CodeGenOpt::Aggressive is never picked, and that
> can
> > significantly change the backend's behaviour.
>
> I thought we moved to per-function optimissation attributes?
>
> Joerg
> ___
> 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] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread Joerg Sonnenberger via cfe-commits
On Fri, Dec 18, 2015 at 05:31:45PM +, James Molloy via cfe-commits wrote:
> Evidently not, at least not completely. I see codegen differences with this
> patch (and at least one significant improvement).

I don't mind the patch as is, but it seems to be a move in the wrong
direction by hiding the real issue. Just saying.

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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread James Molloy via cfe-commits
Hi,

I'll take a look and see what actual codepath is being triggered. That
might give us some insight into the current behaviour. Because like you I
don't like doing things when we don't exactly know why they're necessary.

James

On Fri, 18 Dec 2015 at 17:48 Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Fri, Dec 18, 2015 at 05:31:45PM +, James Molloy via cfe-commits
> wrote:
> > Evidently not, at least not completely. I see codegen differences with
> this
> > patch (and at least one significant improvement).
>
> I don't mind the patch as is, but it seems to be a move in the wrong
> direction by hiding the real issue. Just saying.
>
> Joerg
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D15647: [X86] Fix stack alignment for MCU target (Clang part)

2015-12-18 Thread Anton Nadolskiy via cfe-commits
anadolskiy created this revision.
anadolskiy added a reviewer: rjmccall.
anadolskiy added a subscriber: cfe-commits.

This patch fixes stack alignments for MCU (should be aligned to 4 bytes) 
LLVM part: http://reviews.llvm.org/D15646

http://reviews.llvm.org/D15647

Files:
  tools/clang/lib/AST/ASTContext.cpp
  tools/clang/lib/Basic/Targets.cpp
  tools/clang/test/CodeGen/iamcu-abi.c

Index: tools/clang/test/CodeGen/iamcu-abi.c
===
--- tools/clang/test/CodeGen/iamcu-abi.c
+++ tools/clang/test/CodeGen/iamcu-abi.c
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple i386-pc-elfiamcu -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: target datalayout = 
"e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32"
+// CHECK: target triple = "i386-pc-elfiamcu"
+
+
+void food(double *d);
+void fooll(long long *ll);
+void fooull(unsigned long long *ull);
+void foold(long double *ld);
+
+// CHECK-LABEL: define void @testdouble()
+// CHECK: alloca double, align 4
+void testdouble() {
+  double d = 2.0;
+  food(&d);
+}
+
+// CHECK-LABEL: define void @testlonglong()
+// CHECK: alloca i64, align 4
+void testlonglong() {
+  long long ll = 2;
+  fooll(&ll);
+}
+
+// CHECK-LABEL: define void @testunsignedlonglong()
+// CHECK: alloca i64, align 4
+void testunsignedlonglong() {
+  unsigned long long ull = 2;
+  fooull(&ull);
+}
+
+// CHECK-LABEL: define void @testlongdouble()
+// CHECK: alloca double, align 4
+void testlongdouble() {
+  long double ld = 2.0;
+  foold(&ld);
+}
Index: tools/clang/lib/Basic/Targets.cpp
===
--- tools/clang/lib/Basic/Targets.cpp
+++ tools/clang/lib/Basic/Targets.cpp
@@ -3877,6 +3877,8 @@
   MCUX86_32TargetInfo(const llvm::Triple &Triple) : X86_32TargetInfo(Triple) {
 LongDoubleWidth = 64;
 LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+DataLayoutString =
+"e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32";
   }
 
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override 
{
Index: tools/clang/lib/AST/ASTContext.cpp
===
--- tools/clang/lib/AST/ASTContext.cpp
+++ tools/clang/lib/AST/ASTContext.cpp
@@ -1898,8 +1898,9 @@
   if (T->isMemberPointerType())
 return getPreferredTypeAlign(getPointerDiffType().getTypePtr());
 
-  if (Target->getTriple().getArch() == llvm::Triple::xcore)
-return ABIAlign;  // Never overalign on XCore.
+  if (Target->getTriple().getArch() == llvm::Triple::xcore ||
+  Target->getTriple().isOSIAMCU())
+return ABIAlign;  // Never overalign on XCore and IAMCU.
 
   // Double and long long should be naturally aligned if possible.
   if (const ComplexType *CT = T->getAs())


Index: tools/clang/test/CodeGen/iamcu-abi.c
===
--- tools/clang/test/CodeGen/iamcu-abi.c
+++ tools/clang/test/CodeGen/iamcu-abi.c
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple i386-pc-elfiamcu -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: target datalayout = "e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32"
+// CHECK: target triple = "i386-pc-elfiamcu"
+
+
+void food(double *d);
+void fooll(long long *ll);
+void fooull(unsigned long long *ull);
+void foold(long double *ld);
+
+// CHECK-LABEL: define void @testdouble()
+// CHECK: alloca double, align 4
+void testdouble() {
+  double d = 2.0;
+  food(&d);
+}
+
+// CHECK-LABEL: define void @testlonglong()
+// CHECK: alloca i64, align 4
+void testlonglong() {
+  long long ll = 2;
+  fooll(&ll);
+}
+
+// CHECK-LABEL: define void @testunsignedlonglong()
+// CHECK: alloca i64, align 4
+void testunsignedlonglong() {
+  unsigned long long ull = 2;
+  fooull(&ull);	
+}
+
+// CHECK-LABEL: define void @testlongdouble()
+// CHECK: alloca double, align 4
+void testlongdouble() {
+  long double ld = 2.0;
+  foold(&ld);
+}
Index: tools/clang/lib/Basic/Targets.cpp
===
--- tools/clang/lib/Basic/Targets.cpp
+++ tools/clang/lib/Basic/Targets.cpp
@@ -3877,6 +3877,8 @@
   MCUX86_32TargetInfo(const llvm::Triple &Triple) : X86_32TargetInfo(Triple) {
 LongDoubleWidth = 64;
 LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+DataLayoutString =
+"e-m:e-p:32:32-i64:32-f64:32-f128:32-n8:16:32-a:0:32-S32";
   }
 
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
Index: tools/clang/lib/AST/ASTContext.cpp
===
--- tools/clang/lib/AST/ASTContext.cpp
+++ tools/clang/lib/AST/ASTContext.cpp
@@ -1898,8 +1898,9 @@
   if (T->isMemberPointerType())
 return getPreferredTypeAlign(getPointerDiffType().getTypePtr());
 
-  if (Target->getTriple().getArch() == llvm::Triple::xcore)
-return ABIAlign;  // Never overalign on XCore.
+  if (Target->getTriple().getArch() == llvm::Triple::xcore ||
+  Target->get

Re: [PATCH] D10370: clang-format: Implement AlwaysBreakAfterDeclarationReturnType.

2015-12-18 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Generally looks good.



Comment at: include/clang/Format/Format.h:166
@@ +165,3 @@
+  enum ReturnTypeBreakingStyle {
+/// Break after return type automatically.
+/// \c PenaltyReturnTypeOnItsOwnLine is taken into account.

Use tools/dump_format_style.py to update the documentation, too.


Comment at: include/clang/Format/Format.h:171
@@ +170,3 @@
+RTBS_All,
+/// Always break after the return types of top level functions.
+RTBS_TopLevel,

nit: top-level


Comment at: lib/Format/TokenAnnotator.cpp:1642
@@ +1641,3 @@
+if (!Current->MustBreakBefore && InFunctionDecl &&
+Current->is(TT_FunctionDeclarationName)) {
+  Current->MustBreakBefore = mustBreakForReturnType(Line, *Current);

No braces, I think.


Comment at: lib/Format/TokenAnnotator.h:168
@@ -158,1 +167,3 @@
 
+  bool mustBreakForReturnType(const AnnotatedLine &Line,
+  FormatToken &Token) const;

Some comment might help. E.g. at the very least, does that mean must break 
before or after "Token" (alternatively, name that Left or Right).


http://reviews.llvm.org/D10370



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


Re: [PATCH] D10370: clang-format: Implement AlwaysBreakAfterDeclarationReturnType.

2015-12-18 Thread Zachary Turner via cfe-commits
zturner added inline comments.


Comment at: lib/Format/TokenAnnotator.h:168
@@ -158,1 +167,3 @@
 
+  bool mustBreakForReturnType(const AnnotatedLine &Line,
+  FormatToken &Token) const;

djasper wrote:
> Some comment might help. E.g. at the very least, does that mean must break 
> before or after "Token" (alternatively, name that Left or Right).
Turns out this variable wasn't even used.  I'll just delete it.


http://reviews.llvm.org/D10370



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


r256012 - Add a defensive check for a nullptr.

2015-12-18 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Fri Dec 18 13:44:31 2015
New Revision: 256012

URL: http://llvm.org/viewvc/llvm-project?rev=256012&view=rev
Log:
Add a defensive check for a nullptr.

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

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=256012&r1=256011&r2=256012&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Dec 18 13:44:31 2015
@@ -3443,11 +3443,13 @@ void CGDebugInfo::EmitUsingDecl(const Us
 }
 
 void CGDebugInfo::EmitImportDecl(const ImportDecl &ID) {
-  auto Info = ExternalASTSource::ASTSourceDescriptor(*ID.getImportedModule());
-  DBuilder.createImportedDeclaration(
-  getCurrentContextDescriptor(cast(ID.getDeclContext())),
-  getOrCreateModuleRef(Info, DebugTypeExtRefs),
-  getLineNumber(ID.getLocation()));
+  if (Module *M = ID.getImportedModule()) {
+auto Info = 
ExternalASTSource::ASTSourceDescriptor(*ID.getImportedModule());
+DBuilder.createImportedDeclaration(
+getCurrentContextDescriptor(cast(ID.getDeclContext())),
+getOrCreateModuleRef(Info, DebugTypeExtRefs),
+getLineNumber(ID.getLocation()));
+  }
 }
 
 llvm::DIImportedEntity *


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


Re: [PATCH] D15363: [UBSan] Implement runtime suppressions (PR25066).

2015-12-18 Thread Alexey Samsonov via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL256018: [UBSan] Implement runtime suppressions (PR25066). 
(authored by samsonov).

Changed prior to commit:
  http://reviews.llvm.org/D15363?vs=42250&id=43254#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15363

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.h
  compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
  compiler-rt/trunk/lib/ubsan/ubsan_diag.h
  compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
  compiler-rt/trunk/lib/ubsan/ubsan_handlers_cxx.cc
  compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp

Index: compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp
===
--- compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp
+++ compiler-rt/trunk/test/ubsan/TestCases/Integer/suppressions.cpp
@@ -0,0 +1,33 @@
+// RUN: %clangxx -fsanitize=integer -g0 %s -o %t
+
+// Fails without any suppression.
+// RUN: %env_ubsan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s
+
+// RUN: echo "signed-integer-overflow:%t" > %t.wrong-supp
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.wrong-supp" not %run %t 2>&1 | FileCheck %s
+
+// RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.func-supp" %run %t
+// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.module-supp" %run %t
+
+// Note: file-level suppressions should work even without debug info.
+// RUN: echo "unsigned-integer-overflow:%s" > %t.file-supp
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.file-supp" %run %t
+
+// Suppressions don't work for unrecoverable kinds.
+// RUN: %clangxx -fsanitize=integer -fno-sanitize-recover=integer %s -o %t-norecover
+// RUN: %env_ubsan_opts=halt_on_error=1:suppressions="%t.module-supp" not %run %t-norecover 2>&1 | FileCheck %s
+
+#include 
+
+extern "C" void do_overflow() {
+  (void)(uint64_t(1000ull) + uint64_t(900ull));
+  // CHECK: runtime error: unsigned integer overflow
+}
+
+int main() {
+  do_overflow();
+  return 0;
+}
+
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.h
===
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.h
@@ -43,7 +43,7 @@
   void GetMatched(InternalMmapVector *matched);
 
  private:
-  static const int kMaxSuppressionTypes = 16;
+  static const int kMaxSuppressionTypes = 32;
   const char **const suppression_types_;
   const int suppression_types_num_;
 
Index: compiler-rt/trunk/lib/ubsan/ubsan_handlers_cxx.cc
===
--- compiler-rt/trunk/lib/ubsan/ubsan_handlers_cxx.cc
+++ compiler-rt/trunk/lib/ubsan/ubsan_handlers_cxx.cc
@@ -43,10 +43,11 @@
 return false;
 
   SourceLocation Loc = Data->Loc.acquire();
-  if (Loc.isDisabled())
+  ErrorType ET = ErrorType::DynamicTypeMismatch;
+  if (ignoreReport(Loc, Opts, ET))
 return false;
 
-  ScopedReport R(Opts, Loc, ErrorType::DynamicTypeMismatch);
+  ScopedReport R(Opts, Loc, ET);
 
   Diag(Loc, DL_Error,
"%0 address %1 which does not point to an object of type %2")
@@ -89,10 +90,12 @@
 static void HandleCFIBadType(CFIBadTypeData *Data, ValueHandle Vtable,
  ReportOptions Opts) {
   SourceLocation Loc = Data->Loc.acquire();
+  ErrorType ET = ErrorType::CFIBadType;
 
-  if (ignoreReport(Loc, Opts))
+  if (ignoreReport(Loc, Opts, ET))
 return;
-  ScopedReport R(Opts, Loc, ErrorType::CFIBadType);
+
+  ScopedReport R(Opts, Loc, ET);
   DynamicTypeInfo DTI = getDynamicTypeInfoFromVtable((void*)Vtable);
 
   static const char *TypeCheckKinds[] = {
Index: compiler-rt/trunk/lib/ubsan/ubsan_diag.h
===
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.h
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.h
@@ -225,7 +225,7 @@
 #undef UBSAN_CHECK
 };
 
-bool ignoreReport(SourceLocation SLoc, ReportOptions Opts);
+bool ignoreReport(SourceLocation SLoc, ReportOptions Opts, ErrorType ET);
 
 #define GET_REPORT_OPTIONS(unrecoverable_handler) \
 GET_CALLER_PC_BP; \
@@ -246,6 +246,9 @@
 
 void InitializeSuppressions();
 bool IsVptrCheckSuppressed(const char *TypeName);
+// Sometimes UBSan runtime can know filename from handlers arguments, even if
+// debug info is missing.
+bool IsPCSuppressed(ErrorType ET, uptr PC, const char *Filename);
 
 } // namespace __ubsan
 
Index: compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
===
--- compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
+++ compiler-rt/trunk/lib/ubsan/ubsan_diag.cc
@@ -54,6 +54,17 @@
   UNREACHABLE("unknown ErrorType!");
 }
 
+static const char 

r256023 - Fix an unused variable warning from r256012.

2015-12-18 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Fri Dec 18 14:08:40 2015
New Revision: 256023

URL: http://llvm.org/viewvc/llvm-project?rev=256023&view=rev
Log:
Fix an unused variable warning from r256012.

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

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=256023&r1=256022&r2=256023&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Dec 18 14:08:40 2015
@@ -3444,7 +3444,7 @@ void CGDebugInfo::EmitUsingDecl(const Us
 
 void CGDebugInfo::EmitImportDecl(const ImportDecl &ID) {
   if (Module *M = ID.getImportedModule()) {
-auto Info = 
ExternalASTSource::ASTSourceDescriptor(*ID.getImportedModule());
+auto Info = ExternalASTSource::ASTSourceDescriptor(*M);
 DBuilder.createImportedDeclaration(
 getCurrentContextDescriptor(cast(ID.getDeclContext())),
 getOrCreateModuleRef(Info, DebugTypeExtRefs),


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


Re: [PATCH] D8599: Command-line options to set debugger "target"

2015-12-18 Thread Paul Robinson via cfe-commits
probinson abandoned this revision.
probinson added a comment.

Split into separate CC1 and Driver parts for easier reviewing.


http://reviews.llvm.org/D8599



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


[PATCH] D15651: Driver part of debugger tuning

2015-12-18 Thread Paul Robinson via cfe-commits
probinson created this revision.
probinson added reviewers: echristo, dblaikie, aprantl, dougk.
probinson added a subscriber: cfe-commits.

Adds driver options named -glldb and -gsce to mean -g plus tuning for
lldb and SCE debuggers respectively; the existing -ggdb option does
the same for gdb. Existing options -ggdb0, -ggdb1 etc. unpack into
-ggdb -g.  (There will not be -glldb or -gsce options.) The
tuning gets a target-specific default in the driver, and is passed
into cc1 with the new -debugger-tuning option.

As fallout, fixes where '-gsplit-dwarf -g0' would ignore the -g0 part
on Linux.


http://reviews.llvm.org/D15651

Files:
  docs/UsersManual.rst
  include/clang/Driver/Options.td
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  test/Driver/debug-options.c
  test/Driver/split-debug.c

Index: test/Driver/split-debug.c
===
--- test/Driver/split-debug.c
+++ test/Driver/split-debug.c
@@ -45,3 +45,16 @@
 //
 // CHECK-SPLIT-OVER-GMLT: "-split-dwarf=Enable" "-debug-info-kind=limited"
 // CHECK-SPLIT-OVER-GMLT: "-split-dwarf-file"
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g0 -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s
+//
+// CHECK-G0-OVER-SPLIT-NOT: "-debug-info-kind
+// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf=Enable"
+// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf-file"
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -g0 -gsplit-dwarf -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-SPLIT-OVER-G0 < %t %s
+//
+// CHECK-SPLIT-OVER-G0: "-split-dwarf=Enable" "-debug-info-kind=limited"
+// CHECK-SPLIT-OVER-G0: "-split-dwarf-file"
Index: test/Driver/debug-options.c
===
--- test/Driver/debug-options.c
+++ test/Driver/debug-options.c
@@ -2,38 +2,47 @@
 // rdar://10383444
 
 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G %s
+// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
 // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G %s
 // RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G %s
 // RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G %s
+// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
 // RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
+// RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s
 // RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \
+// RUN: | FileCheck -check-prefix=G -check-prefix=G_LLDB %s
+// RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \
+// RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
 
 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN %s
+// RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_LLDB %s
 // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
 // RUN: | FileCheck -check-prefix=G_DARWIN %s
 // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
 // RUN: | FileCheck -check-prefix=G_DARWIN %s
 // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN %s
+// RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_GDB %s
 // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
 // RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
 // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
 // RUN: | FileCheck -check-prefix=G_DARWIN %s
 
+// RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \
+// RUN: | FileCheck -check-prefix=G_LLDB %s
+
 // On the PS4, -g defaults to -gno-column-info, and we always generate the
 // arange section.
 // RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
 // RUN: | FileCheck -check-prefix=NOG_PS4 %s
 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
 // RUN: | FileCheck -check-prefix=G_PS4 %s
 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
+// RUN: | FileCheck -check-prefix=G_SCE %s
+// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
 // RUN: | FileCheck -check-prefix=NOCI %s
 // RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
 // RUN: | FileCheck -check-prefix=CI %s
@@ -43,6 +52,14 @@
 // RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
 // RUN: %clang -### -c -g -g0 %s 2>

Re: [PATCH] D15650: CC1 part of debugger tuning; pass through setting from driver to LLVM.

2015-12-18 Thread Paul Robinson via cfe-commits
probinson added a comment.

As the only effect is to set a field in the options struct passed down to LLVM, 
no idea how to test this.


http://reviews.llvm.org/D15650



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


r256026 - PIC should not be enabled by default on Darwin with -static.

2015-12-18 Thread Bob Wilson via cfe-commits
Author: bwilson
Date: Fri Dec 18 14:37:54 2015
New Revision: 256026

URL: http://llvm.org/viewvc/llvm-project?rev=256026&view=rev
Log:
PIC should not be enabled by default on Darwin with -static.

r245667 changed -static so that it doesn't override an explicit -fPIC
option, but -static should still change the default for Darwin for -fno-PIC.
This matches longstanding GCC and Clang behavior on Darwin and changing it
would be disruptive, with no significant benefit.
http://reviews.llvm.org/D15455
rdar://problem/23811045

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256026&r1=256025&r2=256026&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Dec 18 14:37:54 2015
@@ -3226,6 +3226,9 @@ ParsePICArgs(const ToolChain &ToolChain,
   // ToolChain.getTriple() and Triple?
   bool PIE = ToolChain.isPIEDefault();
   bool PIC = PIE || ToolChain.isPICDefault();
+  // The Darwin default to use PIC does not apply when using -static.
+  if (ToolChain.getTriple().isOSDarwin() && Args.hasArg(options::OPT_static))
+PIE = PIC = false;
   bool IsPICLevelTwo = PIC;
 
   bool KernelOrKext =

Modified: cfe/trunk/test/Driver/pic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/pic.c?rev=256026&r1=256025&r2=256026&view=diff
==
--- cfe/trunk/test/Driver/pic.c (original)
+++ cfe/trunk/test/Driver/pic.c Fri Dec 18 14:37:54 2015
@@ -217,7 +217,7 @@
 // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext 
-miphoneos-version-min=5.0.0 -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
 // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext 
-miphoneos-version-min=6.0.0 -static -### 2>&1 \
-// RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
 //
 // On OpenBSD, PIE is enabled by default, but can be disabled.
 // RUN: %clang -c %s -target amd64-pc-openbsd -### 2>&1 \


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


Re: r256023 - Fix an unused variable warning from r256012.

2015-12-18 Thread Adrian Prantl via cfe-commits
Thanks, Chad!

-- adrian
> On Dec 18, 2015, at 12:08 PM, Chad Rosier via cfe-commits 
>  wrote:
> 
> Author: mcrosier
> Date: Fri Dec 18 14:08:40 2015
> New Revision: 256023
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=256023&view=rev
> Log:
> Fix an unused variable warning from r256012.
> 
> Modified:
>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=256023&r1=256022&r2=256023&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Dec 18 14:08:40 2015
> @@ -3444,7 +3444,7 @@ void CGDebugInfo::EmitUsingDecl(const Us
> 
> void CGDebugInfo::EmitImportDecl(const ImportDecl &ID) {
>   if (Module *M = ID.getImportedModule()) {
> -auto Info = 
> ExternalASTSource::ASTSourceDescriptor(*ID.getImportedModule());
> +auto Info = ExternalASTSource::ASTSourceDescriptor(*M);
> DBuilder.createImportedDeclaration(
> getCurrentContextDescriptor(cast(ID.getDeclContext())),
> getOrCreateModuleRef(Info, DebugTypeExtRefs),
> 
> 
> ___
> 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] D15455: [Driver] Let -static override the toolchain default PIC setting.

2015-12-18 Thread Bob Wilson via cfe-commits

> On Dec 17, 2015, at 10:59 AM, Bob Wilson via cfe-commits 
>  wrote:
> 
> 
>> On Dec 17, 2015, at 10:16 AM, Joerg Sonnenberger via cfe-commits 
>>  wrote:
>> 
>> On Wed, Dec 16, 2015 at 11:59:10PM +, Bob Wilson via cfe-commits wrote:
>>> We can change this to be Darwin-specific if you prefer, but we should
>>> maintain compatibility with GCC and previous Clang releases in this 
>>> behavior.
>> 
>> Who is really affected by this? I don't care too much about obscure
>> Darwin hacks, but I really wonder why it isn't better to just explicitly
>> add -fno-PIC (e.g. when building a kernel module). It's not like that
>> will break on older versions of GCC or Clang.
> 
> Apple has internal projects that are failing to build. This behavior has been 
> in places for many years and I don’t even know how we could find all the 
> people relying on this behavior. Yes, we could break them and force everyone 
> to add -fno-PIC, but typically when we make disruptive and incompatible 
> changes like that, we need to stage the changes and give people a transition 
> plan. For example, we could keep the old behavior but add a warning about the 
> change, something like “warning: -static may be changed in future versions of 
> clang to stop implying -fno-PIC”. After a year or two, we could then go ahead 
> with the change. That is all a lot of work and there needs to be some 
> significant benefit to justify breaking compatibility with older compilers. I 
> don’t see any significant benefit here. It’s a 2-line change to the driver.

Joerg, I’m going to interpret your “I don’t care too much” comment as an 
indication that you’re not opposed to moving forward with the Darwin-specific 
change to restore the previous behavior. I went ahead and committed the change 
in r256026.

I can also add another data point on the impact. We just spent several days 
tracking down a problem that turned out to be caused by this. The code built 
successfully but crashed at run-time. It was extremely difficult to figure out 
what was going wrong.

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


Re: [PATCH] D15455: [Driver] Let -static override the toolchain default PIC setting.

2015-12-18 Thread Joerg Sonnenberger via cfe-commits
On Fri, Dec 18, 2015 at 12:45:47PM -0800, Bob Wilson via cfe-commits wrote:
> 
> > On Dec 17, 2015, at 10:59 AM, Bob Wilson via cfe-commits 
> >  wrote:
> > 
> > 
> >> On Dec 17, 2015, at 10:16 AM, Joerg Sonnenberger via cfe-commits 
> >>  wrote:
> >> 
> >> On Wed, Dec 16, 2015 at 11:59:10PM +, Bob Wilson via cfe-commits wrote:
> >>> We can change this to be Darwin-specific if you prefer, but we should
> >>> maintain compatibility with GCC and previous Clang releases in this 
> >>> behavior.
> >> 
> >> Who is really affected by this? I don't care too much about obscure
> >> Darwin hacks, but I really wonder why it isn't better to just explicitly
> >> add -fno-PIC (e.g. when building a kernel module). It's not like that
> >> will break on older versions of GCC or Clang.
> > 
> > Apple has internal projects that are failing to build. This behavior has 
> > been in places for many years and I don’t even know how we could find all 
> > the people relying on this behavior. Yes, we could break them and force 
> > everyone to add -fno-PIC, but typically when we make disruptive and 
> > incompatible changes like that, we need to stage the changes and give 
> > people a transition plan. For example, we could keep the old behavior but 
> > add a warning about the change, something like “warning: -static may be 
> > changed in future versions of clang to stop implying -fno-PIC”. After a 
> > year or two, we could then go ahead with the change. That is all a lot of 
> > work and there needs to be some significant benefit to justify breaking 
> > compatibility with older compilers. I don’t see any significant benefit 
> > here. It’s a 2-line change to the driver.
> 
> Joerg, I’m going to interpret your “I don’t care too much” comment as
> an indication that you’re not opposed to moving forward with the
> Darwin-specific change to restore the previous behavior. I went ahead
> and committed the change in r256026.

Correct.

> I can also add another data point on the impact. We just spent several
> days tracking down a problem that turned out to be caused by this. The
> code built successfully but crashed at run-time. It was extremely
> difficult to figure out what was going wrong.

OK, nasty. I'd like to see the warning suggested above at some point :)

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


Re: [PATCH] D15443: Fix getLocEnd for function declarations with exception specification.

2015-12-18 Thread Adrian Zgorzałek via cfe-commits
adek05 added reviewers: aaron.ballman, jroelofs.
adek05 added a comment.

Ping


http://reviews.llvm.org/D15443



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


r256037 - Wire a SourceLocation into IsDerivedFrom and move the RequireCompleteType call

2015-12-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 18 15:45:41 2015
New Revision: 256037

URL: http://llvm.org/viewvc/llvm-project?rev=256037&view=rev
Log:
Wire a SourceLocation into IsDerivedFrom and move the RequireCompleteType call
for the derived class into it. This is mostly just a cleanup, but could in
principle be a bugfix if there is some codepath that reaches here and didn't
previously require a complete type (I couldn't find any such codepath, though).

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaFixItUtils.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256037&r1=256036&r2=256037&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Dec 18 15:45:41 2015
@@ -5370,8 +5370,9 @@ public:
   void ActOnBaseSpecifiers(Decl *ClassDecl, CXXBaseSpecifier **Bases,
unsigned NumBases);
 
-  bool IsDerivedFrom(QualType Derived, QualType Base);
-  bool IsDerivedFrom(QualType Derived, QualType Base, CXXBasePaths &Paths);
+  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base);
+  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base,
+ CXXBasePaths &Paths);
 
   // FIXME: I don't like this name.
   void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);

Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=256037&r1=256036&r2=256037&view=diff
==
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Fri Dec 18 15:45:41 2015
@@ -683,7 +683,8 @@ void CastOperation::CheckDynamicCast() {
 
   // C++ 5.2.7p5
   // Upcasts are resolved statically.
-  if (DestRecord && Self.IsDerivedFrom(SrcPointee, DestPointee)) {
+  if (DestRecord &&
+  Self.IsDerivedFrom(OpRange.getBegin(), SrcPointee, DestPointee)) {
 if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
OpRange.getBegin(), OpRange, 
&BasePath)) {
@@ -1171,7 +1172,8 @@ TryLValueToRValueCast(Sema &Self, Expr *
 Kind = CK_DerivedToBase;
 CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
/*DetectVirtual=*/true);
-if (!Self.IsDerivedFrom(SrcExpr->getType(), R->getPointeeType(), Paths))
+if (!Self.IsDerivedFrom(SrcExpr->getLocStart(), SrcExpr->getType(),
+R->getPointeeType(), Paths))
   return TC_NotApplicable;
   
 Self.BuildBasePathArray(Paths, BasePath);
@@ -1271,7 +1273,7 @@ TryStaticDowncast(Sema &Self, CanQualTyp
 
   CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
  /*DetectVirtual=*/true);
-  if (!Self.IsDerivedFrom(DestType, SrcType, Paths)) {
+  if (!Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths)) {
 return TC_NotApplicable;
   }
 
@@ -1307,7 +1309,7 @@ TryStaticDowncast(Sema &Self, CanQualTyp
 if (!Paths.isRecordingPaths()) {
   Paths.clear();
   Paths.setRecordingPaths(true);
-  Self.IsDerivedFrom(DestType, SrcType, Paths);
+  Self.IsDerivedFrom(OpRange.getBegin(), DestType, SrcType, Paths);
 }
 std::string PathDisplayStr;
 std::set DisplayedPaths;
@@ -1410,16 +1412,15 @@ TryStaticMemberPointerUpcast(Sema &Self,
   QualType DestClass(DestMemPtr->getClass(), 0);
   CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
   /*DetectVirtual=*/true);
-  if (Self.RequireCompleteType(OpRange.getBegin(), SrcClass, 0) ||
-  !Self.IsDerivedFrom(SrcClass, DestClass, Paths)) {
+  if (!Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths))
 return TC_NotApplicable;
-  }
 
   // B is a base of D. But is it an allowed base? If not, it's a hard error.
   if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) {
 Paths.clear();
 Paths.setRecordingPaths(true);
-bool StillOkay = Self.IsDerivedFrom(SrcClass, DestClass, Paths);
+bool StillOkay =
+Self.IsDerivedFrom(OpRange.getBegin(), SrcClass, DestClass, Paths);
 assert(StillOkay);
 (void)StillOkay;
 std::string PathDisplayStr = Self.getAmbiguousPathsDisplayString(Paths);

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

Re: [PATCH] D15651: Driver part of debugger tuning

2015-12-18 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

LGTM.

Thanks!

-eric


http://reviews.llvm.org/D15651



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


Re: [PATCH] D15650: CC1 part of debugger tuning; pass through setting from driver to LLVM.

2015-12-18 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Sadly, isn't really a way to test this part.

Thanks!

-eric


http://reviews.llvm.org/D15650



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


r256045 - [modules] Don't try to use the definition of a class if

2015-12-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 18 16:19:11 2015
New Revision: 256045

URL: http://llvm.org/viewvc/llvm-project?rev=256045&view=rev
Log:
[modules] Don't try to use the definition of a class if
RequireCompleteType(..., 0) says we're not permitted to do so. The definition
might not be visible, even though we know what it is.

Added:
cfe/trunk/test/Modules/hidden-definition.cpp
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/Modules/cxx-templates.cpp
cfe/trunk/test/Modules/submodules-merge-defs.cpp
cfe/trunk/test/SemaTemplate/ms-lookup-template-base-classes.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256045&r1=256044&r2=256045&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Dec 18 16:19:11 2015
@@ -1348,7 +1348,7 @@ public:
 void emit(const SemaDiagnosticBuilder &DB,
   llvm::index_sequence) const {
   // Apply all tuple elements to the builder in order.
-  bool Dummy[] = {(DB << getPrintable(std::get(Args)))...};
+  bool Dummy[] = {false, (DB << getPrintable(std::get(Args)))...};
   (void)Dummy;
 }
 
@@ -1425,6 +1425,7 @@ public:
 return RequireCompleteType(Loc, T, Diagnoser);
   }
 
+  void completeExprArrayBound(Expr *E);
   bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser);
   bool RequireCompleteExprType(Expr *E, unsigned DiagID);
 

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=256045&r1=256044&r2=256045&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Dec 18 16:19:11 2015
@@ -2428,7 +2428,8 @@ addAssociatedClassesAndNamespaces(Associ
   }
 
   // Only recurse into base classes for complete types.
-  if (!Class->hasDefinition())
+  if (Result.S.RequireCompleteType(Result.InstantiationLoc,
+   Result.S.Context.getRecordType(Class), 0))
 return;
 
   // Add direct and indirect base classes along with their associated
@@ -2521,10 +2522,8 @@ addAssociatedClassesAndNamespaces(Associ
 //classes. Its associated namespaces are the namespaces in
 //which its associated classes are defined.
 case Type::Record: {
-  Result.S.RequireCompleteType(Result.InstantiationLoc, QualType(T, 0),
-   /*no diagnostic*/ 0);
-  CXXRecordDecl *Class
-= cast(cast(T)->getDecl());
+  CXXRecordDecl *Class =
+  cast(cast(T)->getDecl());
   addAssociatedClassesAndNamespaces(Result, Class);
   break;
 }
@@ -3208,7 +3207,8 @@ void Sema::ArgumentDependentLookup(Decla
 for (Decl *DI = D; DI; DI = DI->getPreviousDecl()) {
   DeclContext *LexDC = DI->getLexicalDeclContext();
   if (isa(LexDC) &&
-  AssociatedClasses.count(cast(LexDC))) {
+  AssociatedClasses.count(cast(LexDC)) &&
+  isVisible(cast(DI))) {
 DeclaredInAssociatedClass = true;
 break;
   }

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=256045&r1=256044&r2=256045&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Dec 18 16:19:11 2015
@@ -3085,11 +3085,7 @@ IsUserDefinedConversion(Sema &S, Expr *F
  S.IsDerivedFrom(From->getLocStart(), From->getType(), ToType)))
   ConstructorsOnly = true;
 
-S.RequireCompleteType(From->getExprLoc(), ToType, 0);
-// RequireCompleteType may have returned true due to some invalid decl
-// during template instantiation, but ToType may be complete enough now
-// to try to recover.
-if (ToType->isIncompleteType()) {
+if (S.RequireCompleteType(From->getExprLoc(), ToType, 0)) {
   // We're not going to find any constructors.
 } else if (CXXRecordDecl *ToRecordDecl
  = dyn_cast(ToRecordType->getDecl())) {
@@ -6685,7 +6681,8 @@ void Sema::AddMemberOperatorCandidates(O
   //the set of member candidates is empty.
   if (const RecordType *T1Rec = T1->getAs()) {
 // Complete the type if it can be completed.
-RequireCompleteType(OpLoc, T1, 0);
+if (RequireCompleteType(OpLoc, T1, 0) && !T1Rec->isBeingDefined())
+  return;
 // If the type is neither complete nor being defined, bail out now.
 if (!T1Rec->getDecl()->getDefinition())
   return;

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/ll

r256046 - Support AlwaysBreakAfterReturnType

2015-12-18 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Fri Dec 18 16:20:15 2015
New Revision: 256046

URL: http://llvm.org/viewvc/llvm-project?rev=256046&view=rev
Log:
Support AlwaysBreakAfterReturnType

This changes the behavior of AlwaysBreakAfterDeclarationReturnType
so that it supports breaking after declarations, definitions, or
both.

Differential Revision: http://reviews.llvm.org/D10370
Reviewed By: Daniel Jasper

Modified:
cfe/trunk/docs/ClangFormatStyleOptions.rst
cfe/trunk/include/clang/Format/Format.h
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/lib/Format/TokenAnnotator.h
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=256046&r1=256045&r2=256046&view=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Fri Dec 18 16:20:15 2015
@@ -254,7 +254,8 @@ the configuration (without a prefix: ``A
   single line.
 
 **AlwaysBreakAfterDefinitionReturnType** 
(``DefinitionReturnTypeBreakingStyle``)
-  The function definition return type breaking style to use.
+  The function definition return type breaking style to use.  This
+  option is deprecated and is retained for backwards compatibility.
 
   Possible values:
 
@@ -264,7 +265,25 @@ the configuration (without a prefix: ``A
   * ``DRTBS_All`` (in configuration: ``All``)
 Always break after the return type.
   * ``DRTBS_TopLevel`` (in configuration: ``TopLevel``)
-Always break after the return types of top level functions.
+Always break after the return types of top-level functions.
+
+
+**AlwaysBreakAfterReturnType** (``ReturnTypeBreakingStyle``)
+  The function declaration return type breaking style to use.
+
+  Possible values:
+
+  * ``RTBS_None`` (in configuration: ``None``)
+Break after return type automatically.
+``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
+  * ``RTBS_All`` (in configuration: ``All``)
+Always break after the return type.
+  * ``RTBS_TopLevel`` (in configuration: ``TopLevel``)
+Always break after the return types of top-level functions.
+  * ``RTBS_AllDefinitions`` (in configuration: ``AllDefinitions``)
+Always break after the return type of function definitions.
+  * ``RTBS_TopLevelDefinitions`` (in configuration: ``TopLevelDefinitions``)
+Always break after the return type of top-level definitions.
 
 
 **AlwaysBreakBeforeMultilineStrings** (``bool``)

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=256046&r1=256045&r2=256046&view=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Fri Dec 18 16:20:15 2015
@@ -156,13 +156,33 @@ struct FormatStyle {
 DRTBS_None,
 /// Always break after the return type.
 DRTBS_All,
-/// Always break after the return types of top level functions.
+/// Always break after the return types of top-level functions.
 DRTBS_TopLevel,
   };
 
-  /// \brief The function definition return type breaking style to use.
+  /// \brief Different ways to break after the function definition or
+  /// declaration return type.
+  enum ReturnTypeBreakingStyle {
+/// Break after return type automatically.
+/// \c PenaltyReturnTypeOnItsOwnLine is taken into account.
+RTBS_None,
+/// Always break after the return type.
+RTBS_All,
+/// Always break after the return types of top-level functions.
+RTBS_TopLevel,
+/// Always break after the return type of function definitions.
+RTBS_AllDefinitions,
+/// Always break after the return type of top-level definitions.
+RTBS_TopLevelDefinitions,
+  };
+
+  /// \brief The function definition return type breaking style to use.  This
+  /// option is deprecated and is retained for backwards compatibility.
   DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType;
 
+  /// \brief The function declaration return type breaking style to use.
+  ReturnTypeBreakingStyle AlwaysBreakAfterReturnType;
+
   /// \brief If \c true, always break before multiline string literals.
   ///
   /// This flag is mean to make cases where there are multiple multiline 
strings
@@ -584,8 +604,7 @@ struct FormatStyle {
AllowShortIfStatementsOnASingleLine ==
R.AllowShortIfStatementsOnASingleLine &&
AllowShortLoopsOnASingleLine == R.AllowShortLoopsOnASingleLine &&
-   AlwaysBreakAfterDefinitionReturnType ==
-   R.AlwaysBreakAfterDefinitionReturnType &&
+   AlwaysBreakAfterReturnType == R.AlwaysBreakAfterReturnType &&
AlwaysBreakBeforeMultilineSt

Re: [PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

2015-12-18 Thread Rafael Espíndola via cfe-commits
I am not sure what is "expected" is here:

$ gcc test.o -o test.so -lstdc++ -shared -static-libstdc++ && ldd
test.so | grep libst
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x7f848e57d000)

$ gcc test.o -o test.so -shared -static-libstdc++ -lstdc++ && ldd
test.so | grep libst
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x7fc25516d000)



On 16 December 2015 at 20:34, Alexey Samsonov  wrote:
> samsonov created this revision.
> samsonov added reviewers: rafael, compnerd.
> samsonov added a subscriber: cfe-commits.
>
> After this change, AddCXXStdlibLibArgs will check the presence of
> -static-libstdc++ flag and, if necessary, wrap -lc++/-lstdc++ in
> -Bstatic/-Bdynamic to force static linking of C++ standard library.
>
> It's no longer necessary to copy this code around across toolchains
> (unless toolchain is overriding AddCXXStdlibLibArgs).
>
> This change has an important consequnce: if the user provides "-lstdc++"
> manually (i.e. it's not added automatically when we're linking C++ binary),
> then "-static-libstdc++" *will* work as expected.
>
> Other than that, the change attempts to preserve the existing behavior.
>
> http://reviews.llvm.org/D15598
>
> Files:
>   lib/Driver/CrossWindowsToolChain.cpp
>   lib/Driver/ToolChain.cpp
>   lib/Driver/ToolChains.cpp
>   lib/Driver/Tools.cpp
>   test/Driver/static-libstdcxx.c
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

2015-12-18 Thread Eric Christopher via cfe-commits
echristo added a comment.

What's "expected" here? Do we know which of the options are overriding? IIRC 
shared and the static options aren't necessarily last one wins with gcc.

-eric


http://reviews.llvm.org/D15598



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


r256049 - Split RequireCompleteType into a function that actually requires that the type

2015-12-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 18 16:40:25 2015
New Revision: 256049

URL: http://llvm.org/viewvc/llvm-project?rev=256049&view=rev
Log:
Split RequireCompleteType into a function that actually requires that the type
is complete (with an error produced if not) and a function that merely queries
whether the type is complete. Either way we'll trigger instantiation if
necessary, but only the former will diagnose and recover from missing module
imports.

The intent of this change is to prevent a class of bugs where code would call
RequireCompleteType(..., 0) and then ignore the result. With modules, we must
check the return value and use it to determine whether the definition of the
type is visible.

This also fixes a debug info quality issue: calls to isCompleteType do not
trigger the emission of debug information for a type in limited-debug-info
mode. This allows us to avoid emitting debug information for type definitions
in more cases where we believe it is safe to do so.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenCXX/debug-info-limited.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256049&r1=256048&r2=256049&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Dec 18 16:40:25 2015
@@ -1316,9 +1316,7 @@ public:
 
   /// \brief Abstract class used to diagnose incomplete types.
   struct TypeDiagnoser {
-bool Suppressed;
-
-TypeDiagnoser(bool Suppressed = false) : Suppressed(Suppressed) { }
+TypeDiagnoser() {}
 
 virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
 virtual ~TypeDiagnoser() {}
@@ -1354,11 +1352,11 @@ public:
 
   public:
 BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
-: TypeDiagnoser(DiagID == 0), DiagID(DiagID), Args(Args...) {}
+: TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
+  assert(DiagID != 0 && "no diagnostic for type diagnoser");
+}
 
 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
-  if (Suppressed)
-return;
   const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
   emit(DB, llvm::index_sequence_for());
   DB << T;
@@ -1367,7 +1365,7 @@ public:
 
 private:
   bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
-   TypeDiagnoser &Diagnoser);
+   TypeDiagnoser *Diagnoser);
 
   VisibleModuleSet VisibleModules;
   llvm::SmallVector VisibleModulesStack;
@@ -1413,6 +1411,9 @@ public:
   SourceLocation Loc, const NamedDecl *D,
   ArrayRef Equiv);
 
+  bool isCompleteType(SourceLocation Loc, QualType T) {
+return !RequireCompleteTypeImpl(Loc, T, nullptr);
+  }
   bool RequireCompleteType(SourceLocation Loc, QualType T,
TypeDiagnoser &Diagnoser);
   bool RequireCompleteType(SourceLocation Loc, QualType T,
@@ -5502,6 +5503,7 @@ public:
 AbstractArrayType
   };
 
+  bool isAbstractType(SourceLocation Loc, QualType T);
   bool RequireNonAbstractType(SourceLocation Loc, QualType T,
   TypeDiagnoser &Diagnoser);
   template 
@@ -5513,9 +5515,6 @@ public:
 
   void DiagnoseAbstractType(const CXXRecordDecl *RD);
 
-  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
-  AbstractDiagSelID SelID = AbstractNone);
-
   
//======//
   // C++ Overloaded Operators [C++ 13.5]
   //

Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=256049&r1=256048&r2=256049&view=diff
==
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Fri Dec 18 16:40:25 2015
@@ -1262,8 +1262,8 @@ TryStaticDowncast(Sema &Self, CanQualTyp
   QualType OrigDestType, unsigned &msg, 
   CastKind &Kind, CXXCastPath &BasePath) {
   // We can only work with complete types. But don't complain if it doesn't 
work
-  if (Self.RequireCompleteType(OpRange.getBegin(), SrcType, 0) ||
-  Self.RequireCompleteType(OpRange.getBegin(), DestType, 0))
+  if

Re: [PATCH] D12834: add gcc abi_tag support

2015-12-18 Thread Elizabeth Myers via cfe-commits
elizafox added a comment.

In http://reviews.llvm.org/D12834#311890, @foutrelis wrote:

> We have received a few reports of clang crashes after applying the abi_tag 
> support patch to our llvm/clang package in Arch Linux.


Why would you put a patch clearly marked as "needs review" into a 
distribution?!?!?!?!

In any case, the recursion source seems obvious to me, but I can't add patches 
to this reviewboard item.


Repository:
  rL LLVM

http://reviews.llvm.org/D12834



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


r256055 - Fix invalid enum comparison.

2015-12-18 Thread Zachary Turner via cfe-commits
Author: zturner
Date: Fri Dec 18 16:58:42 2015
New Revision: 256055

URL: http://llvm.org/viewvc/llvm-project?rev=256055&view=rev
Log:
Fix invalid enum comparison.

Modified:
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=256055&r1=256054&r2=256055&view=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Dec 18 16:58:42 2015
@@ -9889,7 +9889,7 @@ TEST_F(FormatTest, ParsesConfiguration)
   CHECK_PARSE("AlwaysBreakAfterReturnType: All", AlwaysBreakAfterReturnType,
   FormatStyle::RTBS_All);
   CHECK_PARSE("AlwaysBreakAfterReturnType: TopLevel",
-  AlwaysBreakAfterReturnType, FormatStyle::DRTBS_TopLevel);
+  AlwaysBreakAfterReturnType, FormatStyle::RTBS_TopLevel);
   CHECK_PARSE("AlwaysBreakAfterReturnType: AllDefinitions",
   AlwaysBreakAfterReturnType, FormatStyle::RTBS_AllDefinitions);
   CHECK_PARSE("AlwaysBreakAfterReturnType: TopLevelDefinitions",


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


r256057 - [CMake] PGO training data

2015-12-18 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Dec 18 17:00:57 2015
New Revision: 256057

URL: http://llvm.org/viewvc/llvm-project?rev=256057&view=rev
Log:
[CMake] PGO training data

Adding in a few more lit substitutions for cc1 and the test exec path.

Modified:
cfe/trunk/utils/perf-training/lit.cfg

Modified: cfe/trunk/utils/perf-training/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/lit.cfg?rev=256057&r1=256056&r2=256057&view=diff
==
--- cfe/trunk/utils/perf-training/lit.cfg (original)
+++ cfe/trunk/utils/perf-training/lit.cfg Fri Dec 18 17:00:57 2015
@@ -29,7 +29,9 @@ config.suffixes = ['.c', '.cpp', '.m', '
 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
 config.test_format = lit.formats.ShTest(use_lit_shell == "0")
 config.substitutions.append( ('%clang_cpp', ' %s --driver-mode=cpp %s ' % 
(config.clang, sysroot_flags)))
+config.substitutions.append( ('%clang_cc1', ' %s --cc1 %s ' % (config.clang, 
sysroot_flags)))
 config.substitutions.append( ('%clang', ' %s %s ' % (config.clang, 
sysroot_flags) ) )
+config.substitutions.append( ('%test_root', config.test_exec_root ) )
 
 config.environment['LLVM_PROFILE_FILE'] = 'perf-training-%p.profraw'
 


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


Re: [PATCH] D12834: add gcc abi_tag support

2015-12-18 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

In http://reviews.llvm.org/D12834#305787, @sberg wrote:

> I can't figure out how to add code to someone else's Phabricator review, so 
> sent it to the mailing list 
>  instead: 
> 
>  
> 
>  "[PATCH] Re http://reviews.llvm.org/D12834 add gcc abi_tag support."


There's a "Commandeer Revision" action, that will let you take ownership of the 
diff. After you do that, you should be able to upload your own diff in the 
review.


Repository:
  rL LLVM

http://reviews.llvm.org/D12834



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


Re: [PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

2015-12-18 Thread Alexey Samsonov via cfe-commits
samsonov added a comment.

In http://reviews.llvm.org/D15598#314127, @rafael wrote:

> I am not sure what is "expected" is here:


Interesting.
I was assuming that Clang tends to understand "-lstdc++" as a special argument 
that says "link against C++ standard library", not "link against 
libstdc++.{a,so}".
For instance,

  clang a.cc -lstdc++ -stdlib=libc++

will effectively replace "-lstdc++" with "-lc++", and

  clang++ a.cc -stdlib=libc++ -static-libstdc++

will link against libc++ statically. In that sense, it makes sense to assume 
that "-static-libstdc++" will bind to "-lstdc++" argument.

Apparently, it's not what GCC does :( Do you think we should keep being 
compatible here?

> $ gcc test.o -o test.so -lstdc++ -shared -static-libstdc++ && ldd

>  test.so | grep libst

>  libstdc++.so.6 => /lib64/libstdc++.so.6 (0x7f848e57d000)

> 

> $ gcc test.o -o test.so -shared -static-libstdc++ -lstdc++ && ldd

>  test.so | grep libst

>  libstdc++.so.6 => /lib64/libstdc++.so.6 (0x7fc25516d000)



http://reviews.llvm.org/D15598



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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread Mehdi Amini via cfe-commits


Sent from my iPhone

> On Dec 18, 2015, at 4:06 AM, Rafael Ávila de Espíndola 
>  wrote:
> 
> rafael added a subscriber: rafael.
> rafael added a comment.
> 
> This introduces a meaning to -ON during the link. That normally show up by 
> people passing CFLAGS when linking.

I'm not sure what you mean? When I build clang with cake the link is driven by 
clang, it will accept the O flag by not propagate it to the actual linker. How 
would CFLAGS help?

Now we thought about that a few months ago and we were planning to do something 
during the bring up of ThinLTO. 
The alternative to the command line flag is to encode the optimization level in 
the bitcode itself.
It may have the advantage (for ThinLTO) to be able to LTO each file with 
different optimization level.

-- 
Mehdi



> 
> I think that is OK, but would like a second opinion.
> 
> 
> 
> Comment at: lib/Driver/Tools.cpp:1815
> @@ +1814,3 @@
> +} else if (A->getOption().matches(options::OPT_O0)) {
> +  CmdArgs.push_back("-plugin-opt=O0");
> +} else {
> 
> Can you refactor these 3 calls to push_back?
> 
> 
> Comment at: lib/Driver/Tools.cpp:1817
> @@ +1816,3 @@
> +} else {
> +  ToolChain.getDriver().Diag(clang::diag::warn_drv_unused_argument)
> +  << A->getAsString(Args);
> 
> Why do you need to manually issue a diagnostic?
> 
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D15641
> 
> 
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

2015-12-18 Thread Rafael Espíndola via cfe-commits
On 18 December 2015 at 18:13, Alexey Samsonov  wrote:
> samsonov added a comment.
>
> In http://reviews.llvm.org/D15598#314127, @rafael wrote:
>
>> I am not sure what is "expected" is here:
>
>
> Interesting.
> I was assuming that Clang tends to understand "-lstdc++" as a special 
> argument that says "link against C++ standard library", not "link against 
> libstdc++.{a,so}".
> For instance,
>
>   clang a.cc -lstdc++ -stdlib=libc++
>
> will effectively replace "-lstdc++" with "-lc++", and
>
>   clang++ a.cc -stdlib=libc++ -static-libstdc++
>
> will link against libc++ statically. In that sense, it makes sense to assume 
> that "-static-libstdc++" will bind to "-lstdc++" argument.
>
> Apparently, it's not what GCC does :( Do you think we should keep being 
> compatible here?

My preference would be for -lstdc++ to be as least special as
possible. Do you know why -stdlib=libc++ is not a clang++ only option?

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


Re: [PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

2015-12-18 Thread Alexey Samsonov via cfe-commits
On Fri, Dec 18, 2015 at 3:20 PM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> On 18 December 2015 at 18:13, Alexey Samsonov  wrote:
> > samsonov added a comment.
> >
> > In http://reviews.llvm.org/D15598#314127, @rafael wrote:
> >
> >> I am not sure what is "expected" is here:
> >
> >
> > Interesting.
> > I was assuming that Clang tends to understand "-lstdc++" as a special
> argument that says "link against C++ standard library", not "link against
> libstdc++.{a,so}".
> > For instance,
> >
> >   clang a.cc -lstdc++ -stdlib=libc++
> >
> > will effectively replace "-lstdc++" with "-lc++", and
> >
> >   clang++ a.cc -stdlib=libc++ -static-libstdc++
> >
> > will link against libc++ statically. In that sense, it makes sense to
> assume that "-static-libstdc++" will bind to "-lstdc++" argument.
> >
> > Apparently, it's not what GCC does :( Do you think we should keep being
> compatible here?
>
> My preference would be for -lstdc++ to be as least special as
> possible.


Got it. I can always use "-Bstatic -lstdc++ -Bdynamic" to manually link
against my explicitly passed libstdc++,
I just wanted to make it less ugly.


> Do you know why -stdlib=libc++ is not a clang++ only option?
>

Not really. However, I believe there are setups which only use "clang" (w/o
even --driver-mode=g++) and
pass include/library directories manually, and -stdlib=libc++ might be
handy to choose between standard lib version.


> Cheers,
> Rafael
>


-- 
Alexey Samsonov
vonos...@gmail.com
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15650: CC1 part of debugger tuning; pass through setting from driver to LLVM.

2015-12-18 Thread Paul Robinson via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL256063: CC1 part of debugger tuning; pass through setting 
from driver to LLVM. (authored by probinson).

Changed prior to commit:
  http://reviews.llvm.org/D15650?vs=43257&id=43280#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15650

Files:
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -134,6 +134,7 @@
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
+def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/Sanitizers.h"
 #include "llvm/Support/Regex.h"
+#include "llvm/Target/TargetOptions.h"
 #include 
 #include 
 #include 
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def
@@ -183,6 +183,10 @@
 /// The kind of generated debug info.
 ENUM_CODEGENOPT(DebugInfo, DebugInfoKind, 3, NoDebugInfo)
 
+/// Tune the debug info for this debugger.
+ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 2,
+llvm::DebuggerKind::Default)
+
 /// Dwarf version. Version zero indicates to LLVM that no DWARF should be
 /// emitted.
 VALUE_CODEGENOPT(DwarfVersion, 3, 0)
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -405,6 +405,13 @@
 .Case("limited", CodeGenOptions::LimitedDebugInfo)
 .Case("standalone", CodeGenOptions::FullDebugInfo));
   }
+  if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
+Opts.setDebuggerTuning(
+llvm::StringSwitch(A->getValue())
+.Case("gdb", llvm::DebuggerKind::GDB)
+.Case("lldb", llvm::DebuggerKind::LLDB)
+.Case("sce", llvm::DebuggerKind::SCE));
+  }
   Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
   Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
   Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -553,6 +553,7 @@
   Options.DataSections = CodeGenOpts.DataSections;
   Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
+  Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
 
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
   Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;


Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -134,6 +134,7 @@
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
+def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/Sanitizers.h"
 #include "llvm/Support/Regex.h"
+#include "llvm/Target/TargetOptions.h"
 #include 
 #include 
 #include 
Index: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
===
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def
@@ -183,6 +183,10 @@
 /// The kind of generated debug info.
 EN

r256063 - CC1 part of debugger tuning; pass through setting from driver to LLVM.

2015-12-18 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Fri Dec 18 17:41:11 2015
New Revision: 256063

URL: http://llvm.org/viewvc/llvm-project?rev=256063&view=rev
Log:
CC1 part of debugger tuning; pass through setting from driver to LLVM.

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

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=256063&r1=256062&r2=256063&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Dec 18 17:41:11 2015
@@ -134,6 +134,7 @@ let Flags = [CC1Option, CC1AsOption, NoD
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
+def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=256063&r1=256062&r2=256063&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Fri Dec 18 17:41:11 2015
@@ -183,6 +183,10 @@ VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
 /// The kind of generated debug info.
 ENUM_CODEGENOPT(DebugInfo, DebugInfoKind, 3, NoDebugInfo)
 
+/// Tune the debug info for this debugger.
+ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 2,
+llvm::DebuggerKind::Default)
+
 /// Dwarf version. Version zero indicates to LLVM that no DWARF should be
 /// emitted.
 VALUE_CODEGENOPT(DwarfVersion, 3, 0)

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=256063&r1=256062&r2=256063&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Fri Dec 18 17:41:11 2015
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/Sanitizers.h"
 #include "llvm/Support/Regex.h"
+#include "llvm/Target/TargetOptions.h"
 #include 
 #include 
 #include 

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=256063&r1=256062&r2=256063&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Dec 18 17:41:11 2015
@@ -553,6 +553,7 @@ TargetMachine *EmitAssemblyHelper::Creat
   Options.DataSections = CodeGenOpts.DataSections;
   Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
+  Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
 
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
   Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=256063&r1=256062&r2=256063&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Dec 18 17:41:11 2015
@@ -405,6 +405,13 @@ static bool ParseCodeGenArgs(CodeGenOpti
 .Case("limited", CodeGenOptions::LimitedDebugInfo)
 .Case("standalone", CodeGenOptions::FullDebugInfo));
   }
+  if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
+Opts.setDebuggerTuning(
+llvm::StringSwitch(A->getValue())
+.Case("gdb", llvm::DebuggerKind::GDB)
+.Case("lldb", llvm::DebuggerKind::LLDB)
+.Case("sce", llvm::DebuggerKind::SCE));
+  }
   Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
   Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
   Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);


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


Re: [PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

2015-12-18 Thread Rafael Espíndola via cfe-commits
>> This introduces a meaning to -ON during the link. That normally show up by 
>> people passing CFLAGS when linking.
>
> I'm not sure what you mean? When I build clang with cake the link is driven 
> by clang, it will accept the O flag by not propagate it to the actual linker. 
> How would CFLAGS help?

It doesn't. It is just a way -O3 sometimes ends up in a link (clang) line.

> Now we thought about that a few months ago and we were planning to do 
> something during the bring up of ThinLTO.
> The alternative to the command line flag is to encode the optimization level 
> in the bitcode itself.
> It may have the advantage (for ThinLTO) to be able to LTO each file with 
> different optimization level.

I don't have a strong preference one way or the other.

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


r256066 - Revert r256063, it's killing clang-tools-extra

2015-12-18 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Fri Dec 18 18:23:11 2015
New Revision: 256066

URL: http://llvm.org/viewvc/llvm-project?rev=256066&view=rev
Log:
Revert r256063, it's killing clang-tools-extra

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=256066&r1=256065&r2=256066&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Dec 18 18:23:11 2015
@@ -134,7 +134,6 @@ let Flags = [CC1Option, CC1AsOption, NoD
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
-def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=256066&r1=256065&r2=256066&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Fri Dec 18 18:23:11 2015
@@ -183,10 +183,6 @@ VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
 /// The kind of generated debug info.
 ENUM_CODEGENOPT(DebugInfo, DebugInfoKind, 3, NoDebugInfo)
 
-/// Tune the debug info for this debugger.
-ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 2,
-llvm::DebuggerKind::Default)
-
 /// Dwarf version. Version zero indicates to LLVM that no DWARF should be
 /// emitted.
 VALUE_CODEGENOPT(DwarfVersion, 3, 0)

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=256066&r1=256065&r2=256066&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Fri Dec 18 18:23:11 2015
@@ -16,7 +16,6 @@
 
 #include "clang/Basic/Sanitizers.h"
 #include "llvm/Support/Regex.h"
-#include "llvm/Target/TargetOptions.h"
 #include 
 #include 
 #include 

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=256066&r1=256065&r2=256066&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Dec 18 18:23:11 2015
@@ -553,7 +553,6 @@ TargetMachine *EmitAssemblyHelper::Creat
   Options.DataSections = CodeGenOpts.DataSections;
   Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
-  Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
 
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
   Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=256066&r1=256065&r2=256066&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Dec 18 18:23:11 2015
@@ -405,13 +405,6 @@ static bool ParseCodeGenArgs(CodeGenOpti
 .Case("limited", CodeGenOptions::LimitedDebugInfo)
 .Case("standalone", CodeGenOptions::FullDebugInfo));
   }
-  if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
-Opts.setDebuggerTuning(
-llvm::StringSwitch(A->getValue())
-.Case("gdb", llvm::DebuggerKind::GDB)
-.Case("lldb", llvm::DebuggerKind::LLDB)
-.Case("sce", llvm::DebuggerKind::SCE));
-  }
   Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
   Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
   Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);


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


r256069 - [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-18 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Dec 18 18:56:10 2015
New Revision: 256069

URL: http://llvm.org/viewvc/llvm-project?rev=256069&view=rev
Log:
[CMake] Support a simple case for bootstrap builds to generate PGO data

Summary:
This patch adds support for the clang multi-stage bootstrapping to support PGO 
profdata generation, and can build a 2 or 3 stage compiler.

With this patch applied you can configure your build directory with the 
following invocation of CMake:

cmake -G  -C /cmake/caches/PGO.cmake 

After configuration the following additional targets will be generated:

stage2-instrumented:
Builds a stage1 x86 compiler, runtime, and required tools (llvm-config, 
llvm-profdata) then uses that compiler to build an instrumented stage2 compiler.

stage2-instrumented-generate-profdata:
Depends on "stage2-instrumented" and will use the instrumented compiler to 
generate profdata based on the training files in /utils/perf-training

stage2:
Depends on "stage2-instrumented-generate-profdata" and will use the stage1 
compiler with the stage2 profdata to build a PGO-optimized compiler.

stage2-check-llvm:
Depends on stage2 and runs check-llvm using the stage3 compiler.

stage2-check-clang:
Depends on stage2 and runs check-clang using the stage3 compiler.

stage2-check-all:
Depends on stage2 and runs check-all using the stage3 compiler.

stage2-test-suite:
Depends on stage2 and runs the test-suite using the stage3 compiler (requires 
in-tree test-suite).

Reviewers: bogner, silvas, chandlerc

Subscribers: cfe-commits

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

Added:
cfe/trunk/cmake/caches/PGO-stage2.cmake
cfe/trunk/cmake/caches/PGO-stage3.cmake
cfe/trunk/cmake/caches/PGO.cmake
Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=256069&r1=256068&r2=256069&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Dec 18 18:56:10 2015
@@ -631,11 +631,19 @@ if (CLANG_ENABLE_BOOTSTRAP)
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
-set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+if(NOT LLVM_BUILD_INSTRUMENTED)
+  math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1")
+  set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+else()
+  set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1})
+endif()
   else()
 set(NEXT_CLANG_STAGE bootstrap)
   endif()
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
+  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -681,6 +689,26 @@ if (CLANG_ENABLE_BOOTSTRAP)
 set(RUNTIME_DEP compiler-rt)
   endif()
 
+  set(COMPILER_OPTIONS
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP llvm-profdata)
+set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+  endif()
+
+  if(LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP generate-profdata)
+set(PGO_OPT 
-DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
+set(COMPILER_OPTIONS
+  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+  -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+set(RUNTIME_DEP) # Don't set runtime dependencies
+  endif()
+
   # Find all variables that start with BOOTSTRAP_ and populate a variable with
   # them.
   get_cmake_property(variableNames VARIABLES)
@@ -703,7 +731,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
+DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
 PREFIX ${NEXT_CLANG_STAGE}
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
@@ -715,11 +743,9 @@ if (CLANG_ENABLE_BOOTSTRAP)
 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
 ${PASSTHROUGH_VARIABLES}
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCLANG_STAGE=${NEXT_CLANG_STAGE}
-${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
+ -DCLANG_STAGE=${NEXT_CLANG_STAGE}
+${COMPILER_OPTIONS}
+${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
 ${cmake_3_4_USES_TERMINAL_OPTIONS}

Added: cfe/trunk/cmake/caches/PGO-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/c

Re: [PATCH] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-18 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL256069: [CMake] Support a simple case for bootstrap builds 
to generate PGO data (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D15584?vs=43192&id=43285#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15584

Files:
  cfe/trunk/CMakeLists.txt
  cfe/trunk/cmake/caches/PGO-stage2.cmake
  cfe/trunk/cmake/caches/PGO-stage3.cmake
  cfe/trunk/cmake/caches/PGO.cmake

Index: cfe/trunk/cmake/caches/PGO-stage2.cmake
===
--- cfe/trunk/cmake/caches/PGO-stage2.cmake
+++ cfe/trunk/cmake/caches/PGO-stage2.cmake
@@ -0,0 +1,9 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
+  CACHE STRING "")
Index: cfe/trunk/cmake/caches/PGO.cmake
===
--- cfe/trunk/cmake/caches/PGO.cmake
+++ cfe/trunk/cmake/caches/PGO.cmake
@@ -0,0 +1,17 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS
+  generate-profdata
+  stage2
+  stage2-check-all
+  stage2-check-llvm
+  stage2-check-clang
+  stage2-test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
+  CACHE STRING "")
Index: cfe/trunk/cmake/caches/PGO-stage3.cmake
===
--- cfe/trunk/cmake/caches/PGO-stage3.cmake
+++ cfe/trunk/cmake/caches/PGO-stage3.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
Index: cfe/trunk/CMakeLists.txt
===
--- cfe/trunk/CMakeLists.txt
+++ cfe/trunk/CMakeLists.txt
@@ -631,11 +631,19 @@
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
-set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+if(NOT LLVM_BUILD_INSTRUMENTED)
+  math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1")
+  set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+else()
+  set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1})
+endif()
   else()
 set(NEXT_CLANG_STAGE bootstrap)
   endif()
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
+  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -681,6 +689,26 @@
 set(RUNTIME_DEP compiler-rt)
   endif()
 
+  set(COMPILER_OPTIONS
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP llvm-profdata)
+set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+  endif()
+
+  if(LLVM_BUILD_INSTRUMENTED)
+set(PGO_DEP generate-profdata)
+set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
+set(COMPILER_OPTIONS
+  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+  -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+set(RUNTIME_DEP) # Don't set runtime dependencies
+  endif()
+
   # Find all variables that start with BOOTSTRAP_ and populate a variable with
   # them.
   get_cmake_property(variableNames VARIABLES)
@@ -703,7 +731,7 @@
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
+DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
 PREFIX ${NEXT_CLANG_STAGE}
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
@@ -715,11 +743,9 @@
 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
 ${PASSTHROUGH_VARIABLES}
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCLANG_STAGE=${NEXT_CLANG_STAGE}
-${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
+ -DCLANG_STAGE=${NEXT_CLANG_STAGE}
+${COMPILER_OPTIONS}
+${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
 ${cmake_3_4_USES_TERMINAL_OPTIONS}
__

r256070 - [CMake] Fixing a typo in a flag

2015-12-18 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Dec 18 18:56:12 2015
New Revision: 256070

URL: http://llvm.org/viewvc/llvm-project?rev=256070&view=rev
Log:
[CMake] Fixing a typo in a flag

Turns out cc1's flag has 1 - not 2...

Modified:
cfe/trunk/utils/perf-training/lit.cfg

Modified: cfe/trunk/utils/perf-training/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/lit.cfg?rev=256070&r1=256069&r2=256070&view=diff
==
--- cfe/trunk/utils/perf-training/lit.cfg (original)
+++ cfe/trunk/utils/perf-training/lit.cfg Fri Dec 18 18:56:12 2015
@@ -29,7 +29,7 @@ config.suffixes = ['.c', '.cpp', '.m', '
 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
 config.test_format = lit.formats.ShTest(use_lit_shell == "0")
 config.substitutions.append( ('%clang_cpp', ' %s --driver-mode=cpp %s ' % 
(config.clang, sysroot_flags)))
-config.substitutions.append( ('%clang_cc1', ' %s --cc1 %s ' % (config.clang, 
sysroot_flags)))
+config.substitutions.append( ('%clang_cc1', ' %s -cc1 %s ' % (config.clang, 
sysroot_flags)))
 config.substitutions.append( ('%clang', ' %s %s ' % (config.clang, 
sysroot_flags) ) )
 config.substitutions.append( ('%test_root', config.test_exec_root ) )
 


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


Re: [PATCH] D15584: [CMake] Support a simple case for bootstrap builds to generate PGO data

2015-12-18 Thread Chandler Carruth via cfe-commits
Uh, did you intend to commit this prior to Justin or others giving an LGTM?

On Fri, Dec 18, 2015 at 4:59 PM Phabricator via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL256069: [CMake] Support a simple case for bootstrap
> builds to generate PGO data (authored by cbieneman).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D15584?vs=43192&id=43285#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D15584
>
> Files:
>   cfe/trunk/CMakeLists.txt
>   cfe/trunk/cmake/caches/PGO-stage2.cmake
>   cfe/trunk/cmake/caches/PGO-stage3.cmake
>   cfe/trunk/cmake/caches/PGO.cmake
>
> ___
> 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


r256076 - Use a command line alias to remove the need to rewrite a subtarget

2015-12-18 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Fri Dec 18 19:48:43 2015
New Revision: 256076

URL: http://llvm.org/viewvc/llvm-project?rev=256076&view=rev
Log:
Use a command line alias to remove the need to rewrite a subtarget
feature for command line compatibility.

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=256076&r1=256075&r2=256076&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Dec 18 19:48:43 2015
@@ -1414,8 +1414,10 @@ def mcmpb : Flag<["-"], "mcmpb">, Group<
 def mno_cmpb : Flag<["-"], "mno-cmpb">, Group;
 def misel : Flag<["-"], "misel">, Group;
 def mno_isel : Flag<["-"], "mno-isel">, Group;
-def mmfcrf : Flag<["-"], "mmfcrf">, Group;
-def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Group;
+def mmfocrf : Flag<["-"], "mmfocrf">, Group;
+def mmfcrf : Flag<["-"], "mmfcrf">, Alias;
+def mno_mfocrf : Flag<["-"], "mno-mfocrf">, Group;
+def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Alias;
 def mpopcntd : Flag<["-"], "mpopcntd">, Group;
 def mno_popcntd : Flag<["-"], "mno-popcntd">, Group;
 def mqpx : Flag<["-"], "mqpx">, Group;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256076&r1=256075&r2=256076&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Dec 18 19:48:43 2015
@@ -1421,14 +1421,6 @@ static void getPPCTargetFeatures(const D
 bool IsNegative = Name.startswith("no-");
 if (IsNegative)
   Name = Name.substr(3);
-
-// Note that gcc calls this mfcrf and LLVM calls this mfocrf so we
-// pass the correct option to the backend while calling the frontend
-// option the same.
-// TODO: Change the LLVM backend option maybe?
-if (Name == "mfcrf")
-  Name = "mfocrf";
-
 Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
   }
 


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


r256078 - Recommit CC1 part of debugger tuning; pass through setting from driver to LLVM.

2015-12-18 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Fri Dec 18 20:24:10 2015
New Revision: 256078

URL: http://llvm.org/viewvc/llvm-project?rev=256078&view=rev
Log:
Recommit CC1 part of debugger tuning; pass through setting from driver to LLVM.

Reapplies r256063, except instead of frugally re-using an LLVM enum,
we define a Clang enum, to avoid exposing too much LLVM interface.

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

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=256078&r1=256077&r2=256078&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Dec 18 20:24:10 2015
@@ -134,6 +134,7 @@ let Flags = [CC1Option, CC1AsOption, NoD
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
+def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=256078&r1=256077&r2=256078&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Fri Dec 18 20:24:10 2015
@@ -183,6 +183,9 @@ VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
 /// The kind of generated debug info.
 ENUM_CODEGENOPT(DebugInfo, DebugInfoKind, 3, NoDebugInfo)
 
+/// Tune the debug info for this debugger.
+ENUM_CODEGENOPT(DebuggerTuning, DebuggerKind, 2, DebuggerKindDefault)
+
 /// Dwarf version. Version zero indicates to LLVM that no DWARF should be
 /// emitted.
 VALUE_CODEGENOPT(DwarfVersion, 3, 0)

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=256078&r1=256077&r2=256078&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Fri Dec 18 20:24:10 2015
@@ -82,6 +82,13 @@ public:
 FullDebugInfo /// Generate complete debug info.
   };
 
+  enum DebuggerKind {
+DebuggerKindDefault,
+DebuggerKindGDB,
+DebuggerKindLLDB,
+DebuggerKindSCE
+  };
+
   enum TLSModel {
 GeneralDynamicTLSModel,
 LocalDynamicTLSModel,

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=256078&r1=256077&r2=256078&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Dec 18 20:24:10 2015
@@ -553,6 +553,19 @@ TargetMachine *EmitAssemblyHelper::Creat
   Options.DataSections = CodeGenOpts.DataSections;
   Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
+  switch (CodeGenOpts.getDebuggerTuning()) {
+  case CodeGenOptions::DebuggerKindGDB:
+Options.DebuggerTuning = llvm::DebuggerKind::GDB;
+break;
+  case CodeGenOptions::DebuggerKindLLDB:
+Options.DebuggerTuning = llvm::DebuggerKind::LLDB;
+break;
+  case CodeGenOptions::DebuggerKindSCE:
+Options.DebuggerTuning = llvm::DebuggerKind::SCE;
+break;
+  default:
+break;
+  }
 
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
   Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=256078&r1=256077&r2=256078&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Dec 18 20:24:10 2015
@@ -405,6 +405,13 @@ static bool ParseCodeGenArgs(CodeGenOpti
 .Case("limited", CodeGenOptions::LimitedDebugInfo)
 .Case("standalone", CodeGenOptions::FullDebugInfo));
   }
+  if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
+Opts.setDebuggerTuning(
+llvm::StringSwitch(A->getValue())
+.Case("gdb", CodeGenOptions::DebuggerKindGDB)
+.Case("lldb", CodeG

r256080 - Fix crash-on-invalid if a :: is followed by two or more open parentheses (and then something else).

2015-12-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 18 20:40:19 2015
New Revision: 256080

URL: http://llvm.org/viewvc/llvm-project?rev=256080&view=rev
Log:
Fix crash-on-invalid if a :: is followed by two or more open parentheses (and 
then something else).

Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/colon-colon-parentheses.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=256080&r1=256079&r2=256080&view=diff
==
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Dec 18 20:40:19 2015
@@ -5198,6 +5198,15 @@ void Parser::ParseDirectDeclarator(Decla
   }
   goto PastIdentifier;
 }
+
+if (D.getCXXScopeSpec().isNotEmpty()) {
+  // We have a scope specifier but no following unqualified-id.
+  Diag(PP.getLocForEndOfToken(D.getCXXScopeSpec().getEndLoc()),
+   diag::err_expected_unqualified_id)
+  << /*C++*/1;
+  D.SetIdentifier(nullptr, Tok.getLocation());
+  goto PastIdentifier;
+}
   } else if (Tok.is(tok::identifier) && D.mayHaveIdentifier()) {
 assert(!getLangOpts().CPlusPlus &&
"There's a C++-specific check for tok::identifier above");

Modified: cfe/trunk/test/Parser/colon-colon-parentheses.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/colon-colon-parentheses.cpp?rev=256080&r1=256079&r2=256080&view=diff
==
--- cfe/trunk/test/Parser/colon-colon-parentheses.cpp (original)
+++ cfe/trunk/test/Parser/colon-colon-parentheses.cpp Fri Dec 18 20:40:19 2015
@@ -22,9 +22,9 @@ void foo() {
 }
 
 #ifdef PR21815
-// expected-error@+4{{C++ requires a type specifier for all declarations}}
-// expected-error@+3{{expected unqualified-id}}
-// expected-error@+3{{expected expression}}
-// expected-error@+1{{expected ';' after top level declarator}}
-a (::(
+// expected-error@+2{{C++ requires a type specifier for all declarations}}
+// expected-error@+1{{expected unqualified-id}}
+a (::( ));
+
+::((c )); // expected-error{{expected unqualified-id}}
 #endif


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


r256083 - Test for diagnostic quality improvement in r256049.

2015-12-18 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Dec 18 21:12:14 2015
New Revision: 256083

URL: http://llvm.org/viewvc/llvm-project?rev=256083&view=rev
Log:
Test for diagnostic quality improvement in r256049.

Modified:
cfe/trunk/test/SemaTemplate/class-template-decl.cpp

Modified: cfe/trunk/test/SemaTemplate/class-template-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/class-template-decl.cpp?rev=256083&r1=256082&r2=256083&view=diff
==
--- cfe/trunk/test/SemaTemplate/class-template-decl.cpp (original)
+++ cfe/trunk/test/SemaTemplate/class-template-decl.cpp Fri Dec 18 21:12:14 2015
@@ -152,3 +152,10 @@ void DontCrashOnThis() {
   T &pT = T();
   pT;
 }
+
+namespace abstract_dependent_class {
+  template struct A {
+virtual A *clone() = 0; // expected-note {{pure virtual}}
+  };
+  template A *A::clone() { return new A; } // 
expected-error {{abstract class type 'A'}}
+}


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


r256088 - Revert "[CMake] Support a simple case for bootstrap builds to generate PGO data"

2015-12-18 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Dec 18 23:47:50 2015
New Revision: 256088

URL: http://llvm.org/viewvc/llvm-project?rev=256088&view=rev
Log:
Revert "[CMake] Support a simple case for bootstrap builds to generate PGO data"

This reverts commit r256069, which was an unintentional tag along on
another commit.

Removed:
cfe/trunk/cmake/caches/PGO-stage2.cmake
cfe/trunk/cmake/caches/PGO-stage3.cmake
cfe/trunk/cmake/caches/PGO.cmake
Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=256088&r1=256087&r2=256088&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Dec 18 23:47:50 2015
@@ -631,19 +631,11 @@ if (CLANG_ENABLE_BOOTSTRAP)
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-if(NOT LLVM_BUILD_INSTRUMENTED)
-  math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1")
-  set(NEXT_CLANG_STAGE stage${STAGE_NUM})
-else()
-  set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1})
-endif()
+math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
+set(NEXT_CLANG_STAGE stage${STAGE_NUM})
   else()
 set(NEXT_CLANG_STAGE bootstrap)
   endif()
-
-  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
-set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
-  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -689,26 +681,6 @@ if (CLANG_ENABLE_BOOTSTRAP)
 set(RUNTIME_DEP compiler-rt)
   endif()
 
-  set(COMPILER_OPTIONS
--DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
--DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
--DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
-
-  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
-set(PGO_DEP llvm-profdata)
-set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
-  endif()
-
-  if(LLVM_BUILD_INSTRUMENTED)
-set(PGO_DEP generate-profdata)
-set(PGO_OPT 
-DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
-set(COMPILER_OPTIONS
-  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-  -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
-set(RUNTIME_DEP) # Don't set runtime dependencies
-  endif()
-
   # Find all variables that start with BOOTSTRAP_ and populate a variable with
   # them.
   get_cmake_property(variableNames VARIABLES)
@@ -731,7 +703,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
+DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
 PREFIX ${NEXT_CLANG_STAGE}
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
@@ -743,9 +715,11 @@ if (CLANG_ENABLE_BOOTSTRAP)
 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
 ${PASSTHROUGH_VARIABLES}
- -DCLANG_STAGE=${NEXT_CLANG_STAGE}
-${COMPILER_OPTIONS}
-${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
+-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+-DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+-DCLANG_STAGE=${NEXT_CLANG_STAGE}
+${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
 ${cmake_3_4_USES_TERMINAL_OPTIONS}

Removed: cfe/trunk/cmake/caches/PGO-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/PGO-stage2.cmake?rev=256087&view=auto
==
--- cfe/trunk/cmake/caches/PGO-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/PGO-stage2.cmake (removed)
@@ -1,9 +0,0 @@
-set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
-set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
-
-set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE 
STRING "")
-
-set(CLANG_BOOTSTRAP_CMAKE_ARGS
-  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage3.cmake
-  CACHE STRING "")

Removed: cfe/trunk/cmake/caches/PGO-stage3.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/PGO-stage3.cmake?rev=256087&view=auto
==
--- cfe/trunk/cmake/caches/PGO-stage3.cmake (original)
+++ cfe/trunk/cmake/caches/PGO-stage3.cmake (removed)
@@ -1,2 +0,0 @@
-set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
-set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")

Removed: cfe/trunk/cmake/caches/PGO.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/PGO.cmake?rev=256087&view=auto