[NFC] Workaround MSVC2019 32-bit compiler crash
authorSven van Haastregt <sven.vanhaastregt@arm.com>
Tue, 27 Apr 2021 10:15:47 +0000 (11:15 +0100)
committerSven van Haastregt <sven.vanhaastregt@arm.com>
Tue, 27 Apr 2021 10:15:47 +0000 (11:15 +0100)
As reported on D100492, this restructuring should stop the internal
compiler error from happening.

Fixes PR50128.

clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

index 1e27438..9122779 100644 (file)
@@ -525,17 +525,18 @@ void BuiltinNameEmitter::EmitBuiltinTable() {
 
     for (const auto &Overload : SLM.second.Signatures) {
       StringRef ExtName = Overload.first->getValueAsDef("Extension")->getName();
+      unsigned int MinVersion =
+          Overload.first->getValueAsDef("MinVersion")->getValueAsInt("ID");
+      unsigned int MaxVersion =
+          Overload.first->getValueAsDef("MaxVersion")->getValueAsInt("ID");
+
       OS << "  { " << Overload.second << ", "
          << Overload.first->getValueAsListOfDefs("Signature").size() << ", "
          << (Overload.first->getValueAsBit("IsPure")) << ", "
          << (Overload.first->getValueAsBit("IsConst")) << ", "
          << (Overload.first->getValueAsBit("IsConv")) << ", "
          << FunctionExtensionIndex[ExtName] << ", "
-         << EncodeVersions(Overload.first->getValueAsDef("MinVersion")
-                               ->getValueAsInt("ID"),
-                           Overload.first->getValueAsDef("MaxVersion")
-                               ->getValueAsInt("ID"))
-         << " },\n";
+         << EncodeVersions(MinVersion, MaxVersion) << " },\n";
       Index++;
     }
   }