Skip to content

Commit 18d1e19

Browse files
committed
[llvm-project] Drop temporary parser functionality
1 parent 07e738c commit 18d1e19

File tree

4 files changed

+20
-41
lines changed

4 files changed

+20
-41
lines changed

Diff for: interpreter/llvm-project/clang/include/clang/Parse/Parser.h

+4-7
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,8 @@ class Parser : public CodeCompletionHandler {
459459
/// a statement expression and builds a suitable expression statement.
460460
StmtResult handleExprStmt(ExprResult E, ParsedStmtContext StmtCtx);
461461

462-
bool IsTemporary;
463-
464462
public:
465-
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies,
466-
bool isTemp = false);
463+
Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies);
467464
~Parser() override;
468465

469466
const LangOptions &getLangOpts() const { return PP.getLangOpts(); }
@@ -482,7 +479,7 @@ class Parser : public CodeCompletionHandler {
482479

483480
public:
484481
ParserCurTokRestoreRAII(Parser &P)
485-
: P(P), SavedTok(P.Tok)
482+
: P(P), SavedTok(P.Tok)
486483
{
487484
}
488485

@@ -491,7 +488,7 @@ class Parser : public CodeCompletionHandler {
491488
return;
492489

493490
P.Tok = SavedTok;
494-
491+
495492
SavedTok.startToken();
496493
}
497494

@@ -1261,7 +1258,7 @@ class Parser : public CodeCompletionHandler {
12611258
return Diag(Tok, DiagID);
12621259
}
12631260

1264-
protected:
1261+
private:
12651262
void SuggestParentheses(SourceLocation Loc, unsigned DK,
12661263
SourceRange ParenRange);
12671264
void CheckNestedObjCContexts(SourceLocation AtLoc);

Diff for: interpreter/llvm-project/clang/lib/Parse/ParsePragma.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,6 @@ void markAsReinjectedForRelexing(llvm::MutableArrayRef<clang::Token> Toks) {
415415
} // end namespace
416416

417417
void Parser::initializePragmaHandlers() {
418-
// No pragma parsing for temporary parsers.
419-
if (IsTemporary)
420-
return;
421-
422418
AlignHandler = std::make_unique<PragmaAlignHandler>();
423419
PP.AddPragmaHandler(AlignHandler.get());
424420

@@ -572,10 +568,6 @@ void Parser::initializePragmaHandlers() {
572568
}
573569

574570
void Parser::resetPragmaHandlers() {
575-
// No pragma parsing for temporary parsers.
576-
if (IsTemporary)
577-
return;
578-
579571
// Remove the pragma handlers we installed.
580572
PP.RemovePragmaHandler(AlignHandler.get());
581573
AlignHandler.reset();

Diff for: interpreter/llvm-project/clang/lib/Parse/Parser.cpp

+15-25
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,15 @@ IdentifierInfo *Parser::getSEHExceptKeyword() {
5050
return Ident__except;
5151
}
5252

53-
Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies,
54-
bool isTemporary /*=false*/)
53+
Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies)
5554
: PP(pp), PreferredType(pp.isCodeCompletionEnabled()), Actions(actions),
5655
Diags(PP.getDiagnostics()), GreaterThanIsOperator(true),
5756
ColonIsSacred(false), InMessageExpression(false),
58-
TemplateParameterDepth(0), ParsingInObjCContainer(false),
59-
IsTemporary(isTemporary) {
57+
TemplateParameterDepth(0), ParsingInObjCContainer(false) {
6058
SkipFunctionBodies = pp.isCodeCompletionEnabled() || skipFunctionBodies;
6159
Tok.startToken();
6260
Tok.setKind(tok::eof);
63-
if (!IsTemporary)
64-
Actions.CurScope = nullptr;
61+
Actions.CurScope = nullptr;
6562
NumCachedScopes = 0;
6663
CurParsedObjCImpl = nullptr;
6764

@@ -70,17 +67,14 @@ Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies,
7067
initializePragmaHandlers();
7168

7269
CommentSemaHandler.reset(new ActionCommentHandler(actions));
73-
if (!IsTemporary)
74-
PP.addCommentHandler(CommentSemaHandler.get());
75-
76-
if (!IsTemporary) {
77-
PP.setCodeCompletionHandler(*this);
78-
Actions.ParseTypeFromStringCallback = [this](StringRef TypeStr,
79-
StringRef Context,
80-
SourceLocation IncludeLoc) {
81-
return this->ParseTypeFromString(TypeStr, Context, IncludeLoc);
82-
};
83-
}
70+
PP.addCommentHandler(CommentSemaHandler.get());
71+
72+
PP.setCodeCompletionHandler(*this);
73+
74+
Actions.ParseTypeFromStringCallback =
75+
[this](StringRef TypeStr, StringRef Context, SourceLocation IncludeLoc) {
76+
return this->ParseTypeFromString(TypeStr, Context, IncludeLoc);
77+
};
8478
}
8579

8680
DiagnosticBuilder Parser::Diag(SourceLocation Loc, unsigned DiagID) {
@@ -474,22 +468,18 @@ Parser::ParseScopeFlags::~ParseScopeFlags() {
474468

475469
Parser::~Parser() {
476470
// If we still have scopes active, delete the scope tree.
477-
if (!IsTemporary) {
478-
delete getCurScope();
479-
Actions.CurScope = nullptr;
480-
}
471+
delete getCurScope();
472+
Actions.CurScope = nullptr;
481473

482474
// Free the scope cache.
483475
for (unsigned i = 0, e = NumCachedScopes; i != e; ++i)
484476
delete ScopeCache[i];
485477

486478
resetPragmaHandlers();
487479

488-
if (!IsTemporary)
489-
PP.removeCommentHandler(CommentSemaHandler.get());
480+
PP.removeCommentHandler(CommentSemaHandler.get());
490481

491-
if (!IsTemporary)
492-
PP.clearCodeCompletionHandler();
482+
PP.clearCodeCompletionHandler();
493483

494484
DestroyTemplateIds();
495485
}

Diff for: interpreter/llvm-project/llvm-project.tag

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ROOT-llvm18-20250207-02
1+
ROOT-llvm18-20250225-01

0 commit comments

Comments
 (0)