Skip to content

Commit 68da27a

Browse files
committed
[COMGR][Cache] In executeCommand use the stream passed by parameter to initialize the DiagnosticPrinter
executeCommand is the function that will get cached. To capture the error-stream, the cache passes a raw_string_ostream in place of the error stream in as the LogS parameter. co-authored by anjenner and jmmartinez Change-Id: I93c4afa7595f63475f9c95dec3129731449f9228
1 parent 6cc4746 commit 68da27a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

amd/comgr/src/comgr-compiler.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,11 @@ void logArgv(raw_ostream &OS, StringRef ProgramName,
644644
}
645645

646646
amd_comgr_status_t executeCommand(const Command &Job, raw_ostream &LogS,
647-
TextDiagnosticPrinter *DiagClient,
648-
DiagnosticsEngine &Diags) {
647+
DiagnosticOptions &DiagOpts) {
648+
TextDiagnosticPrinter DiagClient(LogS, &DiagOpts);
649+
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs);
650+
DiagnosticsEngine Diags(DiagID, &DiagOpts, &DiagClient, false);
651+
649652
auto Arguments = Job.getArguments();
650653
SmallVector<const char *, 128> Argv;
651654
initializeCommandLineArgs(Argv);
@@ -677,7 +680,7 @@ amd_comgr_status_t executeCommand(const Command &Job, raw_ostream &LogS,
677680
// Internally this call refers to the invocation created above, so at
678681
// this point the DiagnosticsEngine should accurately reflect all user
679682
// requested configuration from Argv.
680-
Clang->createDiagnostics(DiagClient, /* ShouldOwnClient */ false);
683+
Clang->createDiagnostics(&DiagClient, /* ShouldOwnClient */ false);
681684
if (!Clang->hasDiagnostics()) {
682685
return AMD_COMGR_STATUS_ERROR;
683686
}
@@ -766,7 +769,7 @@ AMDGPUCompiler::executeInProcessDriver(ArrayRef<const char *> Args) {
766769
}
767770

768771
for (auto &Job : C->getJobs()) {
769-
if (auto Status = executeCommand(Job, LogS, DiagClient, Diags)) {
772+
if (auto Status = executeCommand(Job, LogS, *DiagOpts)) {
770773
return Status;
771774
}
772775
}

0 commit comments

Comments
 (0)