[clang] [Clang][Driver] Override complex number calculation method by -fno-fa… (PR #132680)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 26 02:52:25 PDT 2025


================
@@ -2997,6 +2997,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
   LangOptions::ComplexRangeKind Range = LangOptions::ComplexRangeKind::CX_None;
   std::string ComplexRangeStr = "";
   std::string GccRangeComplexOption = "";
+  std::string LastComplexRangeOption = "";
----------------
s-watanabe314 wrote:

Thank you for your feedback!
>  If you just set GccRangeComplexOption to empty for -ffast-math and -fno-fast-math, would that give us reasonable diagnostics?

I think it's difficult. I believe diagnostics should be emitted when `Range` specified with options other than `-ffast-math` is overridden by `-fno-fast-math`. To distinguish between these cases, I think we need a variable that determines what options, including Clang-specific options, were specified before `-fno-fast-math`. Even if we empty `GccRangeComplexOption` when `-ffast-math` is spcified, it's impossible to distinguish whether the preceding option before `-fno-fast-math` was `-ffast-math` or `-fcomplex-arithmetic=basic`. If it's acceptable to assign "-ffp-model" or "-fcomplex-arithmetic" to `GccRangeComplexOption`, then a new variable might not be necessary.

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


More information about the cfe-commits mailing list