rsmith added inline comments.

================
Comment at: lib/Driver/Tools.cpp:284
+  // propagate -fdiagnostics-color.
+  if (StringRef(TC.GetLinkerPath()).endswith("ld.lld") &&
+      D.getDiags().getShowColors())
----------------
I don't think this will work for `-fuse-ld=$BINDIR/lld` and the like. We also 
have code around Tools.cpp doing things like this:

    const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
    if (llvm::sys::path::filename(Exec) == "lld") {

and

    const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
    if (llvm::sys::path::stem(Exec).equals_lower("lld")) {

so detecting `ld.lld` here seems inconsistent. (Meanwhile, the above checks 
won't fire for `-fuse-ld=lld`, since that sets the linker path to .../ld.lld.)

I think it's time to factor out an `isLinkerLLD` function and use that to 
detect whether we're using lld.


https://reviews.llvm.org/D27603



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

Reply via email to