aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp')
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp b/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp
index 8ef728f86c6b..b5813c6abc2b 100644
--- a/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2639,7 +2639,8 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS,
OS << ", ";
emitFormInitializer(OS, Spellings[0], "0");
} else {
- OS << ", (\n";
+ OS << ", [&]() {\n";
+ OS << " switch (S) {\n";
std::set<std::string> Uniques;
unsigned Idx = 0;
for (auto I = Spellings.begin(), E = Spellings.end(); I != E;
@@ -2647,15 +2648,19 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS,
const FlattenedSpelling &S = *I;
const auto &Name = SemanticToSyntacticMap[Idx];
if (Uniques.insert(Name).second) {
- OS << " S == " << Name << " ? AttributeCommonInfo::Form";
+ OS << " case " << Name << ":\n";
+ OS << " return AttributeCommonInfo::Form";
emitFormInitializer(OS, S, Name);
- OS << " :\n";
+ OS << ";\n";
}
}
- OS << " (llvm_unreachable(\"Unknown attribute spelling!\"), "
- << " AttributeCommonInfo::Form";
+ OS << " default:\n";
+ OS << " llvm_unreachable(\"Unknown attribute spelling!\");\n"
+ << " return AttributeCommonInfo::Form";
emitFormInitializer(OS, Spellings[0], "0");
- OS << "))";
+ OS << ";\n"
+ << " }\n"
+ << " }()";
}
OS << ");\n";