================ @@ -3298,7 +3298,18 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, } // Handle __FINITE_MATH_ONLY__ similarly. - if (!HonorINFs && !HonorNaNs) + bool InfValues = true; + bool NanValues = true; + auto processArg = [&](const auto *Arg) { + if (StringRef(Arg->getValue()) == "-menable-no-nans") + NanValues = false; + if (StringRef(Arg->getValue()) == "-menable-no-infs") + InfValues = false; + }; + for (auto *Arg : Args.filtered(options::OPT_Xclang)) + processArg(Arg); ---------------- zahiraam wrote:
I see. I could write something like this as a compromise? `bool shouldAddFiniteMathOnly = false;` `if (!HonorINFs && !HonorNaNs) {` `shouldAddFiniteMathOnly = true;` `} else {` `bool InfValues = true;` `bool NanValues = true;` `for (const auto *Arg : Args.filtered(options::OPT_Xclang)) {` `StringRef ArgValue = Arg->getValue();` `if (ArgValue == "-menable-no-nans")` `NanValues = false;` `else if (ArgValue == "-menable-no-infs")` `InfValues = false;` `}` ` if (!NanValues && !InfValues)` `shouldAddFiniteMathOnly = true;` `}` `if (shouldAddFiniteMathOnly) {` `CmdArgs.push_back("-ffinite-math-only");` `}` https://github.com/llvm/llvm-project/pull/97342 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits