Add prefix to the diagnostic engine

- add the prefix "cling" (normal interpreter error) or
"cling-ptx" (ptx interpreter -> just in CUDA mode) to every
interpreter error message

- example before:
error: cannot find CUDA installation.  Provide its path via --cuda-path, or pass -nocudainc to build without CUDA includes.
error: cannot find libdevice for sm_20. Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with libdevice.
error: cannot find CUDA installation.  Provide its path via --cuda-path, or pass -nocudainc to build without CUDA includes.

- example after:
cling: error: cannot find CUDA installation.  Provide its path via --cuda-path, or pass -nocudainc to build without CUDA includes.
cling-ptx: error: cannot find libdevice for sm_20. Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with libdevice.
cling-ptx: error: cannot find CUDA installation.  Provide its path via --cuda-path, or pass -nocudainc to build without CUDA includes.
This commit is contained in:
Simeon Ehrig 2019-11-13 09:43:59 +01:00 committed by jenkins
parent c7558a2c0d
commit b8e245ac4f

View File

@ -873,7 +873,7 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
}
static llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
SetupDiagnostics(DiagnosticOptions& DiagOpts) {
SetupDiagnostics(DiagnosticOptions& DiagOpts, std::string ExeName) {
// The compiler invocation is the owner of the diagnostic options.
// Everything else points to them.
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagIDs(new DiagnosticIDs());
@ -881,6 +881,8 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
std::unique_ptr<TextDiagnosticPrinter>
DiagnosticPrinter(new TextDiagnosticPrinter(cling::errs(), &DiagOpts));
DiagnosticPrinter->setPrefix(ExeName);
llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
Diags(new DiagnosticsEngine(DiagIDs, &DiagOpts,
DiagnosticPrinter.get(), /*Owns it*/ true));
@ -1333,7 +1335,7 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
// Everything else points to them.
DiagnosticOptions& DiagOpts = InvocationPtr->getDiagnosticOpts();
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
SetupDiagnostics(DiagOpts);
SetupDiagnostics(DiagOpts, COpts.CUDADevice ? "cling-ptx" : "cling");
if (!Diags) {
cling::errs() << "Could not setup diagnostic engine.\n";
return nullptr;