Globally enable incremental extensions

We are relying on this since a while, for example for reemission of
template symbols. At the moment, we get the incremental extensions
because Preprocessor::enableIncrementalProcessing() turns them on
internally, but this will change with LLVM 18 where this method only
controls incremental processing of a single Preprocessor object.
This commit is contained in:
Jonas Hahnfeld 2024-08-07 17:47:27 +02:00 committed by jenkins
parent 9c3ae91ff5
commit 52df1a551a
6 changed files with 2 additions and 17 deletions

View File

@ -30,7 +30,6 @@ namespace cling {
clang::Parser* P;
clang::Preprocessor& PP;
decltype(clang::Parser::TemplateIds) OldTemplateIds;
bool ResetIncrementalProcessing;
bool PPDiagHadErrors;
bool SemaDiagHadErrors;
bool OldSuppressAllDiagnostics;

View File

@ -396,6 +396,8 @@ namespace {
// Opts.StackProtector = 0;
#endif // _MSC_VER
Opts.IncrementalExtensions = 1;
Opts.Exceptions = 1;
if (Opts.CPlusPlus) {
Opts.CXXExceptions = 1;

View File

@ -870,7 +870,6 @@ namespace cling {
nullptr, SourceLocation());
}
assert(PP.isIncrementalProcessingEnabled() && "Not in incremental mode!?");
PP.enableIncrementalProcessing();
smallstream source_name;
// FIXME: Pre-increment to avoid failing tests.

View File

@ -266,9 +266,6 @@ namespace cling {
Sema& SemaRef = getSema();
Preprocessor& PP = SemaRef.getPreprocessor();
// Enable incremental processing, which prevents the preprocessor destroying
// the lexer on EOF token.
PP.enableIncrementalProcessing();
m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef,
/*SkipFunctionBodies*/false,

View File

@ -89,15 +89,6 @@ namespace cling {
// Tell the parser to not attempt spelling correction.
//
const_cast<LangOptions&>(PP.getLangOpts()).SpellChecking = 0;
//
// Turn on ignoring of the main file eof token.
//
// Note: We need this because token readahead in the following
// routine calls ends up parsing it multiple times.
//
if (!PP.isIncrementalProcessingEnabled()) {
PP.enableIncrementalProcessing();
}
assert(!code.empty() &&
"prepareForParsing should only be called when need");

View File

@ -16,8 +16,6 @@ using namespace clang;
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()
@ -61,7 +59,6 @@ cling::ParserStateRAII::~ParserStateRAII() {
P->SkipUntil(tok::eof);
else
P->Tok = OldTok;
PP.enableIncrementalProcessing(ResetIncrementalProcessing);
if (!SemaDiagHadErrors) {
// Doesn't reset the diagnostic mappings
P->getActions().getDiagnostics().Reset(/*soft=*/true);