@@ -50,18 +50,15 @@ IdentifierInfo *Parser::getSEHExceptKeyword() {
50
50
return Ident__except;
51
51
}
52
52
53
- Parser::Parser (Preprocessor &pp, Sema &actions, bool skipFunctionBodies,
54
- bool isTemporary /* =false*/ )
53
+ Parser::Parser (Preprocessor &pp, Sema &actions, bool skipFunctionBodies)
55
54
: PP(pp), PreferredType(pp.isCodeCompletionEnabled()), Actions(actions),
56
55
Diags(PP.getDiagnostics()), GreaterThanIsOperator(true ),
57
56
ColonIsSacred(false ), InMessageExpression(false ),
58
- TemplateParameterDepth(0 ), ParsingInObjCContainer(false ),
59
- IsTemporary(isTemporary) {
57
+ TemplateParameterDepth(0 ), ParsingInObjCContainer(false ) {
60
58
SkipFunctionBodies = pp.isCodeCompletionEnabled () || skipFunctionBodies;
61
59
Tok.startToken ();
62
60
Tok.setKind (tok::eof);
63
- if (!IsTemporary)
64
- Actions.CurScope = nullptr ;
61
+ Actions.CurScope = nullptr ;
65
62
NumCachedScopes = 0 ;
66
63
CurParsedObjCImpl = nullptr ;
67
64
@@ -70,17 +67,14 @@ Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies,
70
67
initializePragmaHandlers ();
71
68
72
69
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
+ };
84
78
}
85
79
86
80
DiagnosticBuilder Parser::Diag (SourceLocation Loc, unsigned DiagID) {
@@ -474,22 +468,18 @@ Parser::ParseScopeFlags::~ParseScopeFlags() {
474
468
475
469
Parser::~Parser () {
476
470
// 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 ;
481
473
482
474
// Free the scope cache.
483
475
for (unsigned i = 0 , e = NumCachedScopes; i != e; ++i)
484
476
delete ScopeCache[i];
485
477
486
478
resetPragmaHandlers ();
487
479
488
- if (!IsTemporary)
489
- PP.removeCommentHandler (CommentSemaHandler.get ());
480
+ PP.removeCommentHandler (CommentSemaHandler.get ());
490
481
491
- if (!IsTemporary)
492
- PP.clearCodeCompletionHandler ();
482
+ PP.clearCodeCompletionHandler ();
493
483
494
484
DestroyTemplateIds ();
495
485
}
0 commit comments