[libcxxabi] [libc] [compiler-rt] [flang] [llvm] [lld] [libunwind] [clang] [lldb] [clang-tools-extra] [libcxx] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 05:51:48 PST 2024


================
@@ -2712,9 +2712,22 @@ static void EmitComplexRangeDiag(const Driver &D,
         << EnumComplexRangeToStr(Range1) << EnumComplexRangeToStr(Range2);
 }
 
-static std::string RenderComplexRangeOption(std::string Range) {
+static std::string
+RenderComplexRangeOption(LangOptions::ComplexRangeKind Range) {
   std::string ComplexRangeStr = "-complex-range=";
-  ComplexRangeStr += Range;
+  switch (Range) {
+  case LangOptions::ComplexRangeKind::CX_Full:
+    ComplexRangeStr += "full";
+    break;
+  case LangOptions::ComplexRangeKind::CX_Limited:
+    ComplexRangeStr += "limited";
+    break;
+  case LangOptions::ComplexRangeKind::CX_Fortran:
+    ComplexRangeStr += "fortran";
+    break;
+  case LangOptions::ComplexRangeKind::CX_None:
+    ComplexRangeStr = "";
----------------
AaronBallman wrote:

Is it valid to pass `-complex-range=` without anything after the equals sign? Based on how this is called, I think this case should be an assertion instead, WDYT?

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


More information about the cfe-commits mailing list