[clang] [flang] Allow disabling of types from the command line (PR #107126)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 09:52:16 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff f9ad24946026c45e22c445f8ebc79b8b651e1dad 8a1c51bdd290fc47cac359646aeb01623574231f --extensions h,cpp -- flang/include/flang/Frontend/TargetOptions.h flang/include/flang/Tools/TargetSetup.h flang/lib/Frontend/CompilerInvocation.cpp flang/tools/bbc/bbc.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/include/flang/Frontend/TargetOptions.h b/flang/include/flang/Frontend/TargetOptions.h
index b0b64ae583..332adcbe6b 100644
--- a/flang/include/flang/Frontend/TargetOptions.h
+++ b/flang/include/flang/Frontend/TargetOptions.h
@@ -41,7 +41,7 @@ public:
/// The real KINDs disabled for this target
std::vector<int> disabledRealKinds;
-
+
/// The integer KINDs disabled for this target
std::vector<int> disabledIntegerKinds;
};
diff --git a/flang/include/flang/Tools/TargetSetup.h b/flang/include/flang/Tools/TargetSetup.h
index b112b6b4d8..fcf1bdde0b 100644
--- a/flang/include/flang/Tools/TargetSetup.h
+++ b/flang/include/flang/Tools/TargetSetup.h
@@ -27,12 +27,10 @@ namespace Fortran::tools {
targetCharacteristics.DisableType(
Fortran::common::TypeCategory::Real, /*kind=*/10);
for (auto realKind : targetOptions.disabledRealKinds) {
- targetCharacteristics.DisableType(
- common::TypeCategory::Real, realKind);
+ targetCharacteristics.DisableType(common::TypeCategory::Real, realKind);
}
for (auto intKind : targetOptions.disabledIntegerKinds) {
- targetCharacteristics.DisableType(
- common::TypeCategory::Integer, intKind);
+ targetCharacteristics.DisableType(common::TypeCategory::Integer, intKind);
}
targetCharacteristics.set_compilerOptionsString(compilerOptions)
.set_compilerVersionString(compilerVersion);
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 5676947c2b..c2b8816cd7 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -442,11 +442,11 @@ static void parseTargetArgs(TargetOptions &opts, llvm::opt::ArgList &args) {
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_16)) {
opts.disabledIntegerKinds.push_back(16);
}
diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index 279b040557..dcff4503f1 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -557,8 +557,8 @@ int main(int argc, char **argv) {
std::string compilerVersion = Fortran::common::getFlangToolFullVersion("bbc");
std::string compilerOptions = "";
Fortran::tools::setUpTargetCharacteristics(
- semanticsContext.targetCharacteristics(), *targetMachine,
- {}, compilerVersion, compilerOptions);
+ semanticsContext.targetCharacteristics(), *targetMachine, {},
+ compilerVersion, compilerOptions);
return mlir::failed(
convertFortranSourceToMLIR(inputFilename, options, programPrefix,
``````````
</details>
https://github.com/llvm/llvm-project/pull/107126
More information about the cfe-commits
mailing list