Skip to content

Commit 827307d

Browse files
committed
[clang] Don't fail clang::ExecuteCompilerInvocation() for unrelated errors
1 parent ec8819f commit 827307d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ CreateFrontendAction(CompilerInstance &CI) {
210210
}
211211

212212
bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
213+
unsigned NumErrorsBefore = Clang->getDiagnostics().getNumErrors();
214+
213215
// Honor -help.
214216
if (Clang->getFrontendOpts().ShowHelp) {
215217
driver::getDriverOptTable().printHelp(
@@ -293,7 +295,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
293295
#endif
294296

295297
// If there were errors in processing arguments, don't do anything else.
296-
if (Clang->getDiagnostics().hasErrorOccurred())
298+
if (Clang->getDiagnostics().getNumErrors() != NumErrorsBefore)
297299
return false;
298300
// Create and execute the frontend action.
299301
std::unique_ptr<FrontendAction> Act(CreateFrontendAction(*Clang));

0 commit comments

Comments
 (0)