Only reset error count if there was no error before!
This commit is contained in:
parent
fa6d32fe73
commit
91f23f3d4a
@ -31,6 +31,8 @@ namespace cling {
|
||||
clang::Preprocessor& PP;
|
||||
decltype(clang::Parser::TemplateIds) OldTemplateIds;
|
||||
bool ResetIncrementalProcessing;
|
||||
bool PPDiagHadErrors;
|
||||
bool SemaDiagHadErrors;
|
||||
bool OldSuppressAllDiagnostics;
|
||||
bool OldPPSuppressAllDiagnostics;
|
||||
bool OldSpellChecking;
|
||||
|
@ -17,6 +17,8 @@ cling::ParserStateRAII::ParserStateRAII(Parser& p, bool skipToEOF)
|
||||
: P(&p), PP(p.getPreprocessor()),
|
||||
ResetIncrementalProcessing(p.getPreprocessor()
|
||||
.isIncrementalProcessingEnabled()),
|
||||
PPDiagHadErrors(PP.getDiagnostics().hasErrorOccurred()),
|
||||
SemaDiagHadErrors(P->getActions().getDiagnostics().hasErrorOccurred()),
|
||||
OldSuppressAllDiagnostics(P->getActions().getDiagnostics()
|
||||
.getSuppressAllDiagnostics()),
|
||||
OldPPSuppressAllDiagnostics(p.getPreprocessor().getDiagnostics()
|
||||
@ -53,10 +55,13 @@ cling::ParserStateRAII::~ParserStateRAII() {
|
||||
if (SkipToEOF)
|
||||
P->SkipUntil(tok::eof);
|
||||
PP.enableIncrementalProcessing(ResetIncrementalProcessing);
|
||||
// Doesn't reset the diagnostic mappings
|
||||
P->getActions().getDiagnostics().Reset(/*soft=*/true);
|
||||
if (!SemaDiagHadErrors) {
|
||||
// Doesn't reset the diagnostic mappings
|
||||
P->getActions().getDiagnostics().Reset(/*soft=*/true);
|
||||
}
|
||||
P->getActions().getDiagnostics().setSuppressAllDiagnostics(OldSuppressAllDiagnostics);
|
||||
PP.getDiagnostics().Reset(/*soft=*/true);
|
||||
if (!PPDiagHadErrors)
|
||||
PP.getDiagnostics().Reset(/*soft=*/true);
|
||||
PP.getDiagnostics().setSuppressAllDiagnostics(OldPPSuppressAllDiagnostics);
|
||||
const_cast<LangOptions&>(PP.getLangOpts()).SpellChecking =
|
||||
OldSpellChecking;
|
||||
|
Loading…
x
Reference in New Issue
Block a user