File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
clang/lib/Tooling/DependencyScanning Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -245,8 +245,17 @@ DependencyScanningWorker::computeDependenciesByNameWithContextOrError(
245245
246246llvm::Error
247247DependencyScanningWorker::finalizeCompilerInstanceWithContextOrError () {
248- bool Success = finalizeCompilerInstance ();
249- return CIWithContext->handleReturnStatus (Success);
248+ // TODO: this finalization interface is not ideal. Finalizing the
249+ // CIWithContext should happen automatically for successful scans, and
250+ // when errors occur.
251+ if (CIWithContext) {
252+ bool Success = finalizeCompilerInstance ();
253+ return CIWithContext->handleReturnStatus (Success);
254+ }
255+
256+ // There is nothing to finalize, so the finalization should not report an
257+ // error.
258+ return llvm::Error::success ();
250259}
251260
252261bool DependencyScanningWorker::initializeCompilerInstanceWithContext (
@@ -265,5 +274,6 @@ bool DependencyScanningWorker::computeDependenciesByNameWithContext(
265274}
266275
267276bool DependencyScanningWorker::finalizeCompilerInstance () {
277+ assert (CIWithContext && " Should not finalize without a CIWithContext" );
268278 return CIWithContext->finalize ();
269279}
You can’t perform that action at this time.
0 commit comments