[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 15:46:29 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 172c4a4a147833f1c08df1555f3170aa9ccb6cbe 973e7fb1a09f5479f88616e19642a71edc977b4a --extensions cpp,h,c -- clang/include/clang/Basic/LangOptions.h clang/lib/Basic/LangOptions.cpp clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Sema/SemaAttr.cpp clang/test/CodeGen/ffp-contract-fast-honor-pramga-option.cpp clang/test/CodeGen/ffp-contract-fhp-pragma-override.cpp clang/test/CodeGen/fp-function-attrs.cpp clang/test/Driver/fp-contract.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index e880347aed..cf1c96088c 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -374,7 +374,7 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
   Options.UnsafeFPMath = LangOpts.AllowFPReassoc && LangOpts.AllowRecip &&
                          LangOpts.NoSignedZero && LangOpts.ApproxFunc &&
                          (LangOpts.getDefaultFPContractMode() ==
-                              LangOptions::FPModeKind::FPM_Fast);
+                          LangOptions::FPModeKind::FPM_Fast);
   Options.ApproxFuncFPMath = LangOpts.ApproxFunc;
 
   Options.BBAddrMap = CodeGenOpts.BBAddrMap;
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 06e633f88c..b513052ea0 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1919,7 +1919,7 @@ static void getTrivialDefaultFunctionAttributes(
     if (LangOpts.AllowFPReassoc && LangOpts.AllowRecip &&
         LangOpts.NoSignedZero && LangOpts.ApproxFunc &&
         (LangOpts.getDefaultFPContractMode() ==
-             LangOptions::FPModeKind::FPM_Fast))
+         LangOptions::FPModeKind::FPM_Fast))
       FuncAttrs.addAttribute("unsafe-fp-math", "true");
     if (CodeGenOpts.SoftFloat)
       FuncAttrs.addAttribute("use-soft-float", "true");
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index cb63f00838..77d1847738 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3181,8 +3181,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
         // fast-honor-pragmas is deprecated -- replace it with fast
         if (Val == "fast-honor-pragmas") {
           D.Diag(diag::warn_drv_deprecated_arg)
-            << A->getAsString(Args) << /*hasReplacement=*/true
-            << "-ffp-contract=fast";
+              << A->getAsString(Args) << /*hasReplacement=*/true
+              << "-ffp-contract=fast";
           Val = "fast";
         }
         if (Val != FPContract && LastFpContractOverrideOption != "") {

``````````

</details>


https://github.com/llvm/llvm-project/pull/105746


More information about the cfe-commits mailing list