Index: include/clang/Basic/Diagnostic.h =================================================================== --- include/clang/Basic/Diagnostic.h +++ include/clang/Basic/Diagnostic.h @@ -496,7 +496,7 @@ /// \brief Set color printing, so the type diffing will inject color markers /// into the output. void setShowColors(bool Val = false) { ShowColors = Val; } - bool getShowColors() { return ShowColors; } + bool getShowColors() const { return ShowColors; } /// \brief Specify which overload candidates to show when overload resolution /// fails. Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -278,6 +278,12 @@ // and only supported on native toolchains. if (!TC.isCrossCompiling()) addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); + + // Add an extra parameter for LLD. If the linker is LLD, we want to + // propagate -fdiagnostics-color. + if (StringRef(TC.GetLinkerPath()).endswith("ld.lld") && + D.getDiags().getShowColors()) + CmdArgs.push_back("-color-diagnostics=always"); } /// Add OpenMP linker script arguments at the end of the argument list so that