@@ -139,10 +139,10 @@ bool PrescanAndSemaAction::BeginSourceFileAction(CompilerInstance &c1) {
139
139
auto &parseTree{*ci.parsing ().parseTree ()};
140
140
141
141
// Prepare semantics
142
- setSemantics (std::make_unique<Fortran::semantics::Semantics>(
142
+ ci. setSemantics (std::make_unique<Fortran::semantics::Semantics>(
143
143
ci.invocation ().semanticsContext (), parseTree,
144
144
ci.invocation ().debugModuleDir ()));
145
- auto &semantics = this -> semantics ();
145
+ auto &semantics = ci. semantics ();
146
146
147
147
// Run semantic checks
148
148
semantics.Perform ();
@@ -224,8 +224,10 @@ void DebugDumpProvenanceAction::ExecuteAction() {
224
224
}
225
225
226
226
void ParseSyntaxOnlyAction::ExecuteAction () {
227
- reportFatalSemanticErrors (semantics (), this ->instance ().diagnostics (),
228
- GetCurrentFileOrBufferName ());
227
+ CompilerInstance &ci = this ->instance ();
228
+
229
+ reportFatalSemanticErrors (
230
+ ci.semantics (), ci.diagnostics (), GetCurrentFileOrBufferName ());
229
231
}
230
232
231
233
void DebugUnparseNoSemaAction::ExecuteAction () {
@@ -256,24 +258,25 @@ void DebugUnparseAction::ExecuteAction() {
256
258
invoc.useAnalyzedObjectsForUnparse () ? &invoc.asFortran () : nullptr );
257
259
258
260
// Report fatal semantic errors
259
- reportFatalSemanticErrors (semantics (), this ->instance ().diagnostics (),
261
+ reportFatalSemanticErrors (ci. semantics (), this ->instance ().diagnostics (),
260
262
GetCurrentFileOrBufferName ());
261
263
}
262
264
263
265
void DebugUnparseWithSymbolsAction::ExecuteAction () {
266
+ CompilerInstance &ci = this ->instance ();
264
267
auto &parseTree{*instance ().parsing ().parseTree ()};
265
268
266
269
Fortran::semantics::UnparseWithSymbols (
267
270
llvm::outs (), parseTree, /* encoding=*/ Fortran::parser::Encoding::UTF_8);
268
271
269
272
// Report fatal semantic errors
270
- reportFatalSemanticErrors (semantics (), this -> instance (). diagnostics (),
271
- GetCurrentFileOrBufferName ());
273
+ reportFatalSemanticErrors (
274
+ ci. semantics (), ci. diagnostics (), GetCurrentFileOrBufferName ());
272
275
}
273
276
274
277
void DebugDumpSymbolsAction::ExecuteAction () {
275
278
CompilerInstance &ci = this ->instance ();
276
- auto &semantics = this -> semantics ();
279
+ auto &semantics = ci. semantics ();
277
280
278
281
auto tables{Fortran::semantics::BuildRuntimeDerivedTypeTables (
279
282
instance ().invocation ().semanticsContext ())};
@@ -306,7 +309,7 @@ void DebugDumpAllAction::ExecuteAction() {
306
309
Fortran::parser::DumpTree (
307
310
llvm::outs (), parseTree, &ci.invocation ().asFortran ());
308
311
309
- auto &semantics = this -> semantics ();
312
+ auto &semantics = ci. semantics ();
310
313
auto tables{Fortran::semantics::BuildRuntimeDerivedTypeTables (
311
314
instance ().invocation ().semanticsContext ())};
312
315
// The runtime derived type information table builder may find and report
@@ -339,15 +342,16 @@ void DebugDumpParseTreeNoSemaAction::ExecuteAction() {
339
342
}
340
343
341
344
void DebugDumpParseTreeAction::ExecuteAction () {
345
+ CompilerInstance &ci = this ->instance ();
342
346
auto &parseTree{instance ().parsing ().parseTree ()};
343
347
344
348
// Dump parse tree
345
349
Fortran::parser::DumpTree (
346
350
llvm::outs (), parseTree, &this ->instance ().invocation ().asFortran ());
347
351
348
352
// Report fatal semantic errors
349
- reportFatalSemanticErrors (semantics (), this -> instance (). diagnostics (),
350
- GetCurrentFileOrBufferName ());
353
+ reportFatalSemanticErrors (
354
+ ci. semantics (), ci. diagnostics (), GetCurrentFileOrBufferName ());
351
355
}
352
356
353
357
void DebugMeasureParseTreeAction::ExecuteAction () {
@@ -385,7 +389,7 @@ void DebugPreFIRTreeAction::ExecuteAction() {
385
389
CompilerInstance &ci = this ->instance ();
386
390
// Report and exit if fatal semantic errors are present
387
391
if (reportFatalSemanticErrors (
388
- semantics (), ci.diagnostics (), GetCurrentFileOrBufferName ())) {
392
+ ci. semantics (), ci.diagnostics (), GetCurrentFileOrBufferName ())) {
389
393
return ;
390
394
}
391
395
@@ -410,12 +414,13 @@ void DebugDumpParsingLogAction::ExecuteAction() {
410
414
}
411
415
412
416
void GetDefinitionAction::ExecuteAction () {
417
+ CompilerInstance &ci = this ->instance ();
418
+
413
419
// Report and exit if fatal semantic errors are present
414
- if (reportFatalSemanticErrors (semantics (), this -> instance (). diagnostics (),
415
- GetCurrentFileOrBufferName ()))
420
+ if (reportFatalSemanticErrors (
421
+ ci. semantics (), ci. diagnostics (), GetCurrentFileOrBufferName ()))
416
422
return ;
417
423
418
- CompilerInstance &ci = this ->instance ();
419
424
parser::AllCookedSources &cs = ci.allCookedSources ();
420
425
unsigned diagID = ci.diagnostics ().getCustomDiagID (
421
426
clang::DiagnosticsEngine::Error, " Symbol not found" );
@@ -457,12 +462,14 @@ void GetDefinitionAction::ExecuteAction() {
457
462
}
458
463
459
464
void GetSymbolsSourcesAction::ExecuteAction () {
465
+ CompilerInstance &ci = this ->instance ();
466
+
460
467
// Report and exit if fatal semantic errors are present
461
- if (reportFatalSemanticErrors (semantics (), this -> instance (). diagnostics (),
462
- GetCurrentFileOrBufferName ()))
468
+ if (reportFatalSemanticErrors (
469
+ ci. semantics (), ci. diagnostics (), GetCurrentFileOrBufferName ()))
463
470
return ;
464
471
465
- semantics ().DumpSymbolsSources (llvm::outs ());
472
+ ci. semantics ().DumpSymbolsSources (llvm::outs ());
466
473
}
467
474
468
475
void EmitObjAction::ExecuteAction () {
0 commit comments