aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAndrzej WarzyƄski <andrzej.warzynski@arm.com>2023-11-29 21:20:43 +0000
committerGitHub <noreply@github.com>2023-11-29 21:20:43 +0000
commitae4d7ac9c885d56c98c1a19af9c330de37883ad1 (patch)
tree72daa879f6fcfc94685be351c69315a89ea963f0 /flang/lib/Frontend/CompilerInvocation.cpp
parent73f8aa01d8b60bf4323359a9e2d45e68395ac290 (diff)
downloadllvm-ae4d7ac9c885d56c98c1a19af9c330de37883ad1.zip
llvm-ae4d7ac9c885d56c98c1a19af9c330de37883ad1.tar.gz
llvm-ae4d7ac9c885d56c98c1a19af9c330de37883ad1.tar.bz2
[flang][driver][nfc] Move the definition of SemanticsContext (#73669)
Moves the defintion of `SemanticsContext` within the Flang driver. Rather than in `CompilerInvocation`, semantic context fits better within `CompilerInstance` that encapsulates the objects that are required to run the frontend. `CompilerInvocation` is better suited for objects encapsulating compiler configuration (e.g. set-up resulting from user input or host set-up).
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 30e53ce..e7730d5 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1344,11 +1344,12 @@ void CompilerInvocation::setFortranOpts() {
fortranOptions.features.WarnOnAllUsage();
}
-void CompilerInvocation::setSemanticsOpts(
+std::unique_ptr<Fortran::semantics::SemanticsContext>
+CompilerInvocation::getSemanticsCtx(
Fortran::parser::AllCookedSources &allCookedSources) {
auto &fortranOptions = getFortranOpts();
- semanticsContext = std::make_unique<semantics::SemanticsContext>(
+ auto semanticsContext = std::make_unique<semantics::SemanticsContext>(
getDefaultKinds(), fortranOptions.features, allCookedSources);
semanticsContext->set_moduleDirectory(getModuleDir())
@@ -1372,6 +1373,8 @@ void CompilerInvocation::setSemanticsOpts(
if (targetTriple.isPPC())
semanticsContext->targetCharacteristics().set_isPPC(true);
+
+ return semanticsContext;
}
/// Set \p loweringOptions controlling lowering behavior based