]> granicus.if.org Git - llvm/commitdiff
Correct placement of #ifndef NDEBUG in r375067
authorDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 17 Oct 2019 01:21:53 +0000 (01:21 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 17 Oct 2019 01:21:53 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375071 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/GICombinerEmitter.cpp

index f2437252a243024b17f1d95acd909ed65f00199c..5dc4d6b07740e8bece826a4f593b9011bcf04c58 100644 (file)
@@ -228,19 +228,19 @@ void GICombinerEmitter::emitNameMatcher(raw_ostream &OS) const {
     Cases.push_back(std::make_pair(EnumeratedRule.getName(), SS.str()));
   }
 
-  OS << "#ifndef NDEBUG\n"
-     << "static Optional<uint64_t> getRuleIdxForIdentifier(StringRef "
+  OS << "static Optional<uint64_t> getRuleIdxForIdentifier(StringRef "
         "RuleIdentifier) {\n"
      << "  uint64_t I;\n"
      << "  // getAtInteger(...) returns false on success\n"
      << "  bool Parsed = !RuleIdentifier.getAsInteger(0, I);\n"
      << "  if (Parsed)\n"
-     << "    return I;\n\n";
+     << "    return I;\n\n"
+     << "#ifndef NDEBUG\n";
   StringMatcher Matcher("RuleIdentifier", Cases, OS);
   Matcher.Emit();
-  OS << "  return None;\n"
-     << "}\n"
-     << "#endif // ifndef NDEBUG\n\n";
+  OS << "#endif // ifndef NDEBUG\n\n"
+     << "  return None;\n"
+     << "}\n";
 }
 
 std::unique_ptr<CombineRule>
@@ -379,19 +379,14 @@ void GICombinerEmitter::run(raw_ostream &OS) {
      << "    for (auto I = First.getValue(); I < Last.getValue(); ++I)\n"
      << "      DisabledRules.set(I);\n"
      << "    return true;\n"
-     << "  }\n"
-     << "#ifndef NDEBUG\n"
-     << "  else {\n"
+     << "  } else {\n"
      << "    const auto I = getRuleIdxForIdentifier(RangePair.first);\n"
      << "    if (!I.hasValue())\n"
      << "      return false;\n"
      << "    DisabledRules.set(I.getValue());\n"
      << "    return true;\n"
      << "  }\n"
-     << "#else // ifndef NDEBUG\n"
-     << "  llvm_unreachable(\"Cannot disable rules in non-asserts builds\");\n"
      << "  return false;\n"
-     << "#endif // ifndef NDEBUG\n\n"
      << "}\n";
 
   OS << "bool " << getClassName()