[flang-commits] [clang] [flang] [flang] Add -fcomplex-arithmetic= option and select complex division algorithm (PR #146641)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Thu Jul 3 02:31:01 PDT 2025


================
@@ -595,6 +595,30 @@ void Flang::addOffloadOptions(Compilation &C, const InputInfoList &Inputs,
   addOpenMPHostOffloadingArgs(C, JA, Args, CmdArgs);
 }
 
+static std::string ComplexRangeKindToStr(LangOptions::ComplexRangeKind Range) {
+  switch (Range) {
+  case LangOptions::ComplexRangeKind::CX_Full:
+    return "full";
+    break;
+  case LangOptions::ComplexRangeKind::CX_Improved:
+    return "improved";
+    break;
+  case LangOptions::ComplexRangeKind::CX_Basic:
+    return "basic";
+    break;
+  default:
+    return "";
+  }
+}
+
+static std::string
+RenderComplexRangeOption(LangOptions::ComplexRangeKind Range) {
+  std::string ComplexRangeStr = ComplexRangeKindToStr(Range);
+  if (!ComplexRangeStr.empty())
+    return "-complex-range=" + ComplexRangeStr;
+  return ComplexRangeStr;
+}
+
----------------
kiranchandramohan wrote:

Can we share this code with similar code in Clang.cpp by moving to CommonArgs.cpp or a suitable place?

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


More information about the flang-commits mailing list