aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorRenaud Kauffmann <rkauffmann@nvidia.com>2024-09-04 08:59:55 -0700
committerGitHub <noreply@github.com>2024-09-04 08:59:55 -0700
commit697bc748f97736b294dd85b8f78530d023557b72 (patch)
treea587bcb472caa14ea103d56ecdcf79472eb78dda /flang/lib/Frontend/CompilerInvocation.cpp
parent0367305af849da7ee9237fd83c04ed3a01e8d223 (diff)
downloadllvm-697bc748f97736b294dd85b8f78530d023557b72.zip
llvm-697bc748f97736b294dd85b8f78530d023557b72.tar.gz
llvm-697bc748f97736b294dd85b8f78530d023557b72.tar.bz2
Allow disabling of types from the command line (#107126)
Adding hidden options to disable types through the `TargetCharacteristics`. I am seeing issues when I do this programmatically and would like, for anyone, to have the ability to reproduce them for development and testing purposes. I am planning to file a couple of issues following this patch.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 9e42fcc..90c3275 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -438,8 +438,19 @@ static void parseTargetArgs(TargetOptions &opts, llvm::opt::ArgList &args) {
for (const llvm::opt::Arg *currentArg :
args.filtered(clang::driver::options::OPT_target_feature))
opts.featuresAsWritten.emplace_back(currentArg->getValue());
-}
+ if (args.hasArg(clang::driver::options::OPT_fdisable_real_10))
+ opts.disabledRealKinds.push_back(10);
+
+ if (args.hasArg(clang::driver::options::OPT_fdisable_real_3))
+ opts.disabledRealKinds.push_back(3);
+
+ if (args.hasArg(clang::driver::options::OPT_fdisable_integer_2))
+ opts.disabledIntegerKinds.push_back(2);
+
+ if (args.hasArg(clang::driver::options::OPT_fdisable_integer_16))
+ opts.disabledIntegerKinds.push_back(16);
+}
// Tweak the frontend configuration based on the frontend action
static void setUpFrontendBasedOnAction(FrontendOptions &opts) {
if (opts.programAction == DebugDumpParsingLog)
@@ -1531,8 +1542,8 @@ CompilerInvocation::getSemanticsCtx(
std::string compilerVersion = Fortran::common::getFlangFullVersion();
Fortran::tools::setUpTargetCharacteristics(
- semanticsContext->targetCharacteristics(), targetMachine, compilerVersion,
- allCompilerInvocOpts);
+ semanticsContext->targetCharacteristics(), targetMachine, getTargetOpts(),
+ compilerVersion, allCompilerInvocOpts);
return semanticsContext;
}