[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

2017-06-08 Thread Christof Douma via Phabricator via cfe-commits
christof commandeered this revision.
christof added a reviewer: sanwou01.
christof added a comment.

This refactoring was ready to land some time ago, except for a few small 
details.  It's a shame if we don't commit this refactoring, so with @sanwou01 
his agreement, I'm taking over this patch.


https://reviews.llvm.org/D31709



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


[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

2017-06-08 Thread Christof Douma via Phabricator via cfe-commits
christof updated this revision to Diff 101933.
christof marked 6 inline comments as done.
christof added a comment.

Rebased onto current HEAD and addressed the comments from Reid.


https://reviews.llvm.org/D31709

Files:
  include/clang/Basic/SourceLocation.h
  include/clang/Frontend/DiagnosticRenderer.h
  include/clang/Frontend/TextDiagnostic.h
  lib/Basic/SourceLocation.cpp
  lib/Frontend/DiagnosticRenderer.cpp
  lib/Frontend/SerializedDiagnosticPrinter.cpp
  lib/Frontend/TextDiagnostic.cpp
  lib/Frontend/TextDiagnosticPrinter.cpp
  tools/libclang/CIndexDiagnostic.cpp

Index: tools/libclang/CIndexDiagnostic.cpp
===
--- tools/libclang/CIndexDiagnostic.cpp
+++ tools/libclang/CIndexDiagnostic.cpp
@@ -110,40 +110,34 @@
   CurrentSet = &CD.getChildDiagnostics();
   }
 
-  void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc,
- DiagnosticsEngine::Level Level,
- StringRef Message,
+  void emitDiagnosticMessage(FullSourceLoc Loc, PresumedLoc PLoc,
+ DiagnosticsEngine::Level Level, StringRef Message,
  ArrayRef Ranges,
- const SourceManager *SM,
  DiagOrStoredDiag D) override {
 if (!D.isNull())
   return;
 
 CXSourceLocation L;
-if (SM)
-  L = translateSourceLocation(*SM, LangOpts, Loc);
+if (Loc.hasManager())
+  L = translateSourceLocation(Loc.getManager(), LangOpts, Loc);
 else
   L = clang_getNullLocation();
 CurrentSet->appendDiagnostic(
 llvm::make_unique(Message, L));
   }
 
-  void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
+  void emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc,
  DiagnosticsEngine::Level Level,
- ArrayRef Ranges,
- const SourceManager &SM) override {}
+ ArrayRef Ranges) override {}
 
-  void emitCodeContext(SourceLocation Loc,
-   DiagnosticsEngine::Level Level,
-   SmallVectorImpl& Ranges,
-   ArrayRef Hints,
-   const SourceManager &SM) override {}
+  void emitCodeContext(FullSourceLoc Loc, DiagnosticsEngine::Level Level,
+   SmallVectorImpl &Ranges,
+   ArrayRef Hints) override {}
 
-  void emitNote(SourceLocation Loc, StringRef Message,
-const SourceManager *SM) override {
+  void emitNote(FullSourceLoc Loc, StringRef Message) override {
 CXSourceLocation L;
-if (SM)
-  L = translateSourceLocation(*SM, LangOpts, Loc);
+if (Loc.hasManager())
+  L = translateSourceLocation(Loc.getManager(), LangOpts, Loc);
 else
   L = clang_getNullLocation();
 CurrentSet->appendDiagnostic(
Index: lib/Frontend/TextDiagnosticPrinter.cpp
===
--- lib/Frontend/TextDiagnosticPrinter.cpp
+++ lib/Frontend/TextDiagnosticPrinter.cpp
@@ -150,10 +150,9 @@
  "Unexpected diagnostic with no source manager");
   assert(TextDiag && "Unexpected diagnostic outside source file processing");
 
-  TextDiag->emitDiagnostic(Info.getLocation(), Level, DiagMessageStream.str(),
-   Info.getRanges(),
-   Info.getFixItHints(),
-   &Info.getSourceManager());
+  TextDiag->emitDiagnostic(
+  FullSourceLoc(Info.getLocation(), Info.getSourceManager()), Level,
+  DiagMessageStream.str(), Info.getRanges(), Info.getFixItHints());
 
   OS.flush();
 }
Index: lib/Frontend/TextDiagnostic.cpp
===
--- lib/Frontend/TextDiagnostic.cpp
+++ lib/Frontend/TextDiagnostic.cpp
@@ -672,20 +672,16 @@
 
 TextDiagnostic::~TextDiagnostic() {}
 
-void
-TextDiagnostic::emitDiagnosticMessage(SourceLocation Loc,
-  PresumedLoc PLoc,
-  DiagnosticsEngine::Level Level,
-  StringRef Message,
-  ArrayRef Ranges,
-  const SourceManager *SM,
-  DiagOrStoredDiag D) {
+void TextDiagnostic::emitDiagnosticMessage(
+FullSourceLoc Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level,
+StringRef Message, ArrayRef Ranges,
+DiagOrStoredDiag D) {
   uint64_t StartOfLocationInfo = OS.tell();
 
   // Emit the location of this particular diagnostic.
   if (Loc.isValid())
-emitDiagnosticLoc(Loc, PLoc, Level, Ranges, *SM);
-  
+emitDiagnosticLoc(Loc, PLoc, Level, Ranges);
+
   if (DiagOpts->ShowColors)
 OS.resetColor();
   
@@ -787,17 +783,16 @@
 /// This includes extracting as much location information as is present for
 /// the diagnostic and printing it, as

[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

2017-06-08 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

@rnk can you let me know if you are happy with the changes?
@rovka I assume the rebase did not change your mind about the patch. But please 
let me know if you have new reservations.

Thanks




Comment at: lib/Frontend/DiagnosticRenderer.cpp:512
   // Produce a stack of macro backtraces.
-  SmallVector LocationStack;
+  SmallVector LocationStack;
   unsigned IgnoredEnd = 0;

sanwou01 wrote:
> rnk wrote:
> > This seems inefficient, it wastes space on `SourceManager` pointers that 
> > will all be the same.
> True, but it does make the rest of this function more readable. I'd prefer to 
> leave it as is. Maybe just reducing the SmallVector size to, say, 4, to take 
> up less stack space?
We indeed waste that space, but it is 8 times a pointer while we printing 
diagnostics. I don't think that this inefficiency is is of any concern, 
especially not considering the amount of buffering that goes on during printing 
anyway.


https://reviews.llvm.org/D31709



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


[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

2017-06-19 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

I'll go ahead and commit this on the grounds that it was already approved and 
the changes I made were the last nit-picks of @rnk


https://reviews.llvm.org/D31709



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


[PATCH] D34513: [NFC] Update to account for DiagnosticRenderer use of FullSourceLoc

2017-06-22 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

This looks good to me. But since I have never touch this code, I'll wait a bit 
till accepting this for others to have a say.


https://reviews.llvm.org/D34513



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


[PATCH] D34513: [NFC] Update to account for DiagnosticRenderer use of FullSourceLoc

2017-06-22 Thread Christof Douma via Phabricator via cfe-commits
christof added a reviewer: alexfh.
christof added a comment.

Added Alexander as he seems to have touched clang-tidy recently.


https://reviews.llvm.org/D34513



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


[PATCH] D31814: Add option to add command-line options and version info to output file

2017-08-02 Thread Christof Douma via Phabricator via cfe-commits
christof commandeered this revision.
christof added a reviewer: salari01.
christof added a comment.
Herald added a subscriber: aheejin.

With the ok of the author, I'll try to get some movement on this work again.


https://reviews.llvm.org/D31814



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


[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-03 Thread Christof Douma via Phabricator via cfe-commits
christof created this revision.
christof added reviewers: peter.smith, jroelofs.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When the clang baremetal driver selects the rt.builtins static library it 
prefix with "-l" and appends ".a". The result is a nonsense option which lld 
refuses to accept.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73904

Files:
  clang/lib/Driver/ToolChains/BareMetal.cpp


Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -157,7 +157,7 @@
 void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
   ArgStringList &CmdArgs) const {
   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
-   getTriple().getArchName() + ".a"));
+   getTriple().getArchName()));
 }
 
 void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,


Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -157,7 +157,7 @@
 void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
   ArgStringList &CmdArgs) const {
   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
-   getTriple().getArchName() + ".a"));
+   getTriple().getArchName()));
 }
 
 void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-11 Thread Christof Douma via Phabricator via cfe-commits
christof updated this revision to Diff 243868.
christof added a comment.

With updated tests


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73904/new/

https://reviews.llvm.org/D73904

Files:
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/test/Driver/baremetal.cpp


Index: clang/test/Driver/baremetal.cpp
===
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" 
"-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -35,7 +35,7 @@
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-DEFAULTCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -48,7 +48,7 @@
 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -61,7 +61,7 @@
 // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBSTDCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
-// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -157,7 +157,7 @@
 void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
   ArgStringList &CmdArgs) const {
   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
-   getTriple().getArchName() + ".a"));
+   getTriple().getArchName()));
 }
 
 void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,


Index: clang/test/Driver/baremetal.cpp
===
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -35,7 +35,7 @@
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -48,7 +48,7 @@
 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" 

[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-11 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

Just noticed the comment from Peter asking for 
clang/test/Driver/arm-compiler-rt.c, I'll add that in a moment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73904/new/

https://reviews.llvm.org/D73904



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


[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-11 Thread Christof Douma via Phabricator via cfe-commits
christof updated this revision to Diff 243896.
christof added a comment.

Added a test for arm-none-eabi selection
Note that the selection mechanism in the Baremetal driver is rather weak. It 
does not seem to respond on `-mthumb`, `-march` and `-mcpu` options. The cc1 
options show a normalized triple, but the sub-architecture suffix of 
compiler_rt is the argument exactly as typed on the command line. I'm not going 
to fix that in this patch, but maybe we want to record this problem somewhere, 
so we dont forget?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73904/new/

https://reviews.llvm.org/D73904

Files:
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/test/Driver/arm-compiler-rt.c
  clang/test/Driver/baremetal.cpp


Index: clang/test/Driver/baremetal.cpp
===
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" 
"-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -35,7 +35,7 @@
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-DEFAULTCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -48,7 +48,7 @@
 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -61,7 +61,7 @@
 // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBSTDCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
-// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Index: clang/test/Driver/arm-compiler-rt.c
===
--- clang/test/Driver/arm-compiler-rt.c
+++ clang/test/Driver/arm-compiler-rt.c
@@ -1,3 +1,10 @@
+// RUN: %clang -target arm-none-eabi \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -rtlib=compiler-rt -### %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix ARM-EABI
+// ARM-EABI: "-L{{.*[/\\]}}Inputs/resource_dir_with_arch_subdir/lib/baremetal"
+// ARM-EABI: "-lclang_rt.builtins-arm"
+
 // RUN: %clang -target arm-linux-gnueabi \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -rtlib=compiler-rt -### %s 2>&1 \
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -157,7 +157,7 @@
 void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
   ArgStringList &CmdArgs) const {
   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
-   getTriple().getArchName() + ".a"));
+   getTriple().getArchName()));
 }
 
 void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,


Index: clang/test/Driver/baremetal.cpp
===
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-l

[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-12 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

The function @MaskRay suggested does not address the problem with `-march=` and 
others, but it does sound good to use that function. I'm also not sure if `-L` 
is a feature that is relied upon at the moment by anybody that uses the 
baremetal driver. For the moment I'll commit this patch, but a single place 
across drivers that handles the compiler_rt selection mechanism certainly 
sounds nice.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73904/new/

https://reviews.llvm.org/D73904



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


[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-13 Thread Christof Douma via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc49866acceb1: [clang] stop baremetal driver to append .a to 
lib (authored by christof).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73904/new/

https://reviews.llvm.org/D73904

Files:
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/test/Driver/arm-compiler-rt.c
  clang/test/Driver/baremetal.cpp


Index: clang/test/Driver/baremetal.cpp
===
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" 
"-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -35,7 +35,7 @@
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-DEFAULTCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -48,7 +48,7 @@
 // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -61,7 +61,7 @@
 // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" 
"{{.*}}.o" "-Bstatic"
 // CHECK-V6M-LIBSTDCXX-SAME: 
"-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
-// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Index: clang/test/Driver/arm-compiler-rt.c
===
--- clang/test/Driver/arm-compiler-rt.c
+++ clang/test/Driver/arm-compiler-rt.c
@@ -1,3 +1,10 @@
+// RUN: %clang -target arm-none-eabi \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -rtlib=compiler-rt -### %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix ARM-EABI
+// ARM-EABI: "-L{{.*[/\\]}}Inputs/resource_dir_with_arch_subdir/lib/baremetal"
+// ARM-EABI: "-lclang_rt.builtins-arm"
+
 // RUN: %clang -target arm-linux-gnueabi \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -rtlib=compiler-rt -### %s 2>&1 \
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -157,7 +157,7 @@
 void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
   ArgStringList &CmdArgs) const {
   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
-   getTriple().getArchName() + ".a"));
+   getTriple().getArchName()));
 }
 
 void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,


Index: clang/test/Driver/baremetal.cpp
===
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
 // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
 // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -35,7 +35,7 @@
 // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bs

[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-14 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

In D73904#1874303 , @thakis wrote:

> I fixed windows tests in a41550cff91b7fb2b56bf0e19ccb341bfd3e37b4 
>  . 
> Please watch bots after landing patches next time.


Thanks for fixing my broken tests @thakis. I always relied on bots to send me 
email. I just realized that my github privacy settings means that there is a 
noreply email-address in the git commit which I assume stops buildbot from 
sending emails to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73904/new/

https://reviews.llvm.org/D73904



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


[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

2017-06-27 Thread Christof Douma via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306384: Revert "Revert "[NFC] Refactor DiagnosticRenderer to 
use FullSourceLoc"" (authored by christof).

Changed prior to commit:
  https://reviews.llvm.org/D31709?vs=101933&id=104115#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31709

Files:
  cfe/trunk/include/clang/Basic/SourceLocation.h
  cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h
  cfe/trunk/include/clang/Frontend/TextDiagnostic.h
  cfe/trunk/lib/Basic/SourceLocation.cpp
  cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
  cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp
  cfe/trunk/lib/Frontend/TextDiagnostic.cpp
  cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
  cfe/trunk/tools/libclang/CIndexDiagnostic.cpp

Index: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
===
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp
@@ -672,20 +672,16 @@
 
 TextDiagnostic::~TextDiagnostic() {}
 
-void
-TextDiagnostic::emitDiagnosticMessage(SourceLocation Loc,
-  PresumedLoc PLoc,
-  DiagnosticsEngine::Level Level,
-  StringRef Message,
-  ArrayRef Ranges,
-  const SourceManager *SM,
-  DiagOrStoredDiag D) {
+void TextDiagnostic::emitDiagnosticMessage(
+FullSourceLoc Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level,
+StringRef Message, ArrayRef Ranges,
+DiagOrStoredDiag D) {
   uint64_t StartOfLocationInfo = OS.tell();
 
   // Emit the location of this particular diagnostic.
   if (Loc.isValid())
-emitDiagnosticLoc(Loc, PLoc, Level, Ranges, *SM);
-  
+emitDiagnosticLoc(Loc, PLoc, Level, Ranges);
+
   if (DiagOpts->ShowColors)
 OS.resetColor();
   
@@ -787,17 +783,16 @@
 /// This includes extracting as much location information as is present for
 /// the diagnostic and printing it, as well as any include stack or source
 /// ranges necessary.
-void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
+void TextDiagnostic::emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc,
DiagnosticsEngine::Level Level,
-   ArrayRef Ranges,
-   const SourceManager &SM) {
+   ArrayRef Ranges) {
   if (PLoc.isInvalid()) {
 // At least print the file name if available:
-FileID FID = SM.getFileID(Loc);
+FileID FID = Loc.getFileID();
 if (FID.isValid()) {
-  const FileEntry* FE = SM.getFileEntryForID(FID);
+  const FileEntry *FE = Loc.getFileEntry();
   if (FE && FE->isValid()) {
-emitFilename(FE->getName(), SM);
+emitFilename(FE->getName(), Loc.getManager());
 if (FE->isInPCH())
   OS << " (in PCH)";
 OS << ": ";
@@ -813,7 +808,7 @@
   if (DiagOpts->ShowColors)
 OS.changeColor(savedColor, true);
 
-  emitFilename(PLoc.getFilename(), SM);
+  emitFilename(PLoc.getFilename(), Loc.getManager());
   switch (DiagOpts->getFormat()) {
   case DiagnosticOptions::Clang: OS << ':'  << LineNo; break;
   case DiagnosticOptions::MSVC:  OS << '('  << LineNo; break;
@@ -848,29 +843,32 @@
   }
 
   if (DiagOpts->ShowSourceRanges && !Ranges.empty()) {
-FileID CaretFileID =
-  SM.getFileID(SM.getExpansionLoc(Loc));
+FileID CaretFileID = Loc.getExpansionLoc().getFileID();
 bool PrintedRange = false;
 
 for (ArrayRef::const_iterator RI = Ranges.begin(),
  RE = Ranges.end();
  RI != RE; ++RI) {
   // Ignore invalid ranges.
   if (!RI->isValid()) continue;
 
-  SourceLocation B = SM.getExpansionLoc(RI->getBegin());
-  SourceLocation E = SM.getExpansionLoc(RI->getEnd());
+  FullSourceLoc B =
+  FullSourceLoc(RI->getBegin(), Loc.getManager()).getExpansionLoc();
+  FullSourceLoc E =
+  FullSourceLoc(RI->getEnd(), Loc.getManager()).getExpansionLoc();
 
   // If the End location and the start location are the same and are a
   // macro location, then the range was something that came from a
   // macro expansion or _Pragma.  If this is an object-like macro, the
   // best we can do is to highlight the range.  If this is a
   // function-like macro, we'd also like to highlight the arguments.
   if (B == E && RI->getEnd().isMacroID())
-E = SM.getExpansionRange(RI->getEnd()).second;
+E = FullSourceLoc(RI->getEnd(), Loc.getManager())
+.getExpansionRange()
+.second;
 
-  std::pair BInfo = SM.getDecomposedLoc(B);
-  std::pair EInfo = SM.getDecomposedLoc(E);
+  std::pair BInfo = B.getDecomposedLoc();
+  std::pair EInfo = E.getDecomposedLoc();
 
   // If the start o

[PATCH] D31709: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc

2017-06-28 Thread Christof Douma via Phabricator via cfe-commits
christof marked an inline comment as done.
christof added a comment.

Sorry for missing the API comments. Thanks for the fix chapuni :-)


Repository:
  rL LLVM

https://reviews.llvm.org/D31709



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