From e8c6bd7d9b334ddbd453e6845870d06c0a71076d Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Thu, 17 Oct 2019 01:21:53 +0000 Subject: [PATCH] Correct placement of #ifndef NDEBUG in r375067 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375071 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/GICombinerEmitter.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/utils/TableGen/GICombinerEmitter.cpp b/utils/TableGen/GICombinerEmitter.cpp index f2437252a24..5dc4d6b0774 100644 --- a/utils/TableGen/GICombinerEmitter.cpp +++ b/utils/TableGen/GICombinerEmitter.cpp @@ -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 getRuleIdxForIdentifier(StringRef " + OS << "static Optional 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 @@ -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() -- 2.40.0