[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)
Zahira Ammarguellat via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 15 14:02:10 PDT 2024
================
@@ -2824,26 +2816,89 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
switch (optID) {
default:
break;
- case options::OPT_fcx_limited_range: {
- EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Limited);
- Range = LangOptions::ComplexRangeKind::CX_Limited;
+ case options::OPT_fcx_limited_range:
+ if (GccRangeComplexOption.empty()) {
+ if (Range != LangOptions::ComplexRangeKind::CX_Basic)
+ EmitComplexRangeDiag(D, RenderComplexRangeOption(Range),
+ "-fcx-limited-range");
+ } else {
+ if (GccRangeComplexOption != "-fno-cx-limited-range")
+ EmitComplexRangeDiag(D, GccRangeComplexOption, "-fcx-limited-range");
+ }
+ GccRangeComplexOption = "-fcx-limited-range";
+ Range = LangOptions::ComplexRangeKind::CX_Basic;
break;
- }
case options::OPT_fno_cx_limited_range:
- EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Full,
- "-fno-cx-limited-range");
+ if (GccRangeComplexOption.empty()) {
+ EmitComplexRangeDiag(D, RenderComplexRangeOption(Range),
+ "-fno-cx-limited-range");
+ } else {
+ if (GccRangeComplexOption.compare("-fcx-limited-range") != 0 &&
+ GccRangeComplexOption.compare("-fno-cx-fortran-rules") != 0)
+ EmitComplexRangeDiag(D, GccRangeComplexOption,
+ "-fno-cx-limited-range");
+ }
+ GccRangeComplexOption = "-fno-cx-limited-range";
Range = LangOptions::ComplexRangeKind::CX_Full;
break;
- case options::OPT_fcx_fortran_rules: {
- EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Fortran);
- Range = LangOptions::ComplexRangeKind::CX_Fortran;
+ case options::OPT_fcx_fortran_rules:
+ if (GccRangeComplexOption.empty())
+ EmitComplexRangeDiag(D, RenderComplexRangeOption(Range),
+ "-fcx-fortran-rules");
+ else
+ EmitComplexRangeDiag(D, GccRangeComplexOption, "-fcx-fortran-rules");
+ GccRangeComplexOption = "-fcx-fortran-rules";
+ Range = LangOptions::ComplexRangeKind::CX_Improved;
break;
- }
case options::OPT_fno_cx_fortran_rules:
- EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Full,
- "-fno-cx-fortran-rules");
+ if (GccRangeComplexOption.empty()) {
+ EmitComplexRangeDiag(D, RenderComplexRangeOption(Range),
+ "-fno-cx-fortran-rules");
+ } else {
+ if (GccRangeComplexOption != "-fno-cx-limited-range")
+ EmitComplexRangeDiag(D, GccRangeComplexOption,
+ "-fno-cx-fortran-rules");
+ }
+ GccRangeComplexOption = "-fno-cx-fortran-rules";
Range = LangOptions::ComplexRangeKind::CX_Full;
break;
+ case options::OPT_fcomplex_arithmetic_EQ: {
+ LangOptions::ComplexRangeKind RangeVal;
+ StringRef Val = A->getValue();
+ if (Val.equals("full"))
+ RangeVal = LangOptions::ComplexRangeKind::CX_Full;
+ else if (Val.equals("improved"))
+ RangeVal = LangOptions::ComplexRangeKind::CX_Improved;
+ else if (Val.equals("promoted"))
+ RangeVal = LangOptions::ComplexRangeKind::CX_Promoted;
+ else if (Val.equals("basic"))
+ RangeVal = LangOptions::ComplexRangeKind::CX_Basic;
+ else
+ D.Diag(diag::err_drv_unsupported_option_argument)
+ << A->getSpelling() << LangOptions::ComplexRangeKind::CX_None;
+ if (GccRangeComplexOption.empty() && !SeenUnsafeMathModeOption) {
----------------
zahiraam wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/81514
More information about the cfe-commits
mailing list