@@ -276,80 +276,81 @@ static void emitDirectivesDecl(const RecordKeeper &Records, raw_ostream &OS) {
276276 OS << " #include <utility>\n " ; // for std::pair
277277 OS << " \n " ;
278278 NamespaceEmitter LlvmNS (OS, " llvm" );
279- NamespaceEmitter DirLangNS (OS, DirLang.getCppNamespace ());
280-
281- if (DirLang.hasEnableBitmaskEnumInNamespace ())
282- OS << " LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();\n\n " ;
283-
284- // Emit Directive associations
285- std::vector<const Record *> Associations;
286- copy_if (DirLang.getAssociations (), std::back_inserter (Associations),
287- // Skip the "special" value
288- [](const Record *Def) { return Def->getName () != " AS_FromLeaves" ; });
289- generateEnumClass (Associations, OS, " Association" ,
290- /* Prefix=*/ " " , /* ExportEnums=*/ false );
279+ {
280+ NamespaceEmitter DirLangNS (OS, DirLang.getCppNamespace ());
281+
282+ if (DirLang.hasEnableBitmaskEnumInNamespace ())
283+ OS << " LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();\n\n " ;
284+
285+ // Emit Directive associations
286+ std::vector<const Record *> Associations;
287+ copy_if (
288+ DirLang.getAssociations (), std::back_inserter (Associations),
289+ // Skip the "special" value
290+ [](const Record *Def) { return Def->getName () != " AS_FromLeaves" ; });
291+ generateEnumClass (Associations, OS, " Association" ,
292+ /* Prefix=*/ " " , /* ExportEnums=*/ false );
291293
292- generateEnumClass (DirLang.getCategories (), OS, " Category" , /* Prefix=*/ " " ,
293- /* ExportEnums=*/ false );
294+ generateEnumClass (DirLang.getCategories (), OS, " Category" , /* Prefix=*/ " " ,
295+ /* ExportEnums=*/ false );
294296
295- generateEnumBitmask (DirLang.getSourceLanguages (), OS, " SourceLanguage" ,
296- /* Prefix=*/ " " , /* ExportEnums=*/ false );
297+ generateEnumBitmask (DirLang.getSourceLanguages (), OS, " SourceLanguage" ,
298+ /* Prefix=*/ " " , /* ExportEnums=*/ false );
297299
298- // Emit Directive enumeration
299- generateEnumClass (DirLang.getDirectives (), OS, " Directive" ,
300- DirLang.getDirectivePrefix (),
301- DirLang.hasMakeEnumAvailableInNamespace ());
300+ // Emit Directive enumeration
301+ generateEnumClass (DirLang.getDirectives (), OS, " Directive" ,
302+ DirLang.getDirectivePrefix (),
303+ DirLang.hasMakeEnumAvailableInNamespace ());
302304
303- // Emit Clause enumeration
304- generateEnumClass (DirLang.getClauses (), OS, " Clause" ,
305- DirLang.getClausePrefix (),
306- DirLang.hasMakeEnumAvailableInNamespace ());
305+ // Emit Clause enumeration
306+ generateEnumClass (DirLang.getClauses (), OS, " Clause" ,
307+ DirLang.getClausePrefix (),
308+ DirLang.hasMakeEnumAvailableInNamespace ());
307309
308- // Emit ClauseVals enumeration
309- std::string EnumHelperFuncs;
310- generateClauseEnumVal (DirLang.getClauses (), OS, DirLang, EnumHelperFuncs);
310+ // Emit ClauseVals enumeration
311+ std::string EnumHelperFuncs;
312+ generateClauseEnumVal (DirLang.getClauses (), OS, DirLang, EnumHelperFuncs);
311313
312- // Generic function signatures
313- OS << " // Enumeration helper functions\n " ;
314+ // Generic function signatures
315+ OS << " // Enumeration helper functions\n " ;
314316
315- OS << " LLVM_ABI std::pair<Directive, directive::VersionRange> get" << Lang
316- << " DirectiveKindAndVersions(StringRef Str);\n " ;
317+ OS << " LLVM_ABI std::pair<Directive, directive::VersionRange> get" << Lang
318+ << " DirectiveKindAndVersions(StringRef Str);\n " ;
317319
318- OS << " inline Directive get" << Lang << " DirectiveKind(StringRef Str) {\n " ;
319- OS << " return get" << Lang << " DirectiveKindAndVersions(Str).first;\n " ;
320- OS << " }\n " ;
321- OS << " \n " ;
320+ OS << " inline Directive get" << Lang << " DirectiveKind(StringRef Str) {\n " ;
321+ OS << " return get" << Lang << " DirectiveKindAndVersions(Str).first;\n " ;
322+ OS << " }\n " ;
323+ OS << " \n " ;
322324
323- OS << " LLVM_ABI StringRef get" << Lang
324- << " DirectiveName(Directive D, unsigned Ver = 0);\n " ;
325- OS << " \n " ;
325+ OS << " LLVM_ABI StringRef get" << Lang
326+ << " DirectiveName(Directive D, unsigned Ver = 0);\n " ;
327+ OS << " \n " ;
326328
327- OS << " LLVM_ABI std::pair<Clause, directive::VersionRange> get" << Lang
328- << " ClauseKindAndVersions(StringRef Str);\n " ;
329- OS << " \n " ;
329+ OS << " LLVM_ABI std::pair<Clause, directive::VersionRange> get" << Lang
330+ << " ClauseKindAndVersions(StringRef Str);\n " ;
331+ OS << " \n " ;
330332
331- OS << " inline Clause get" << Lang << " ClauseKind(StringRef Str) {\n " ;
332- OS << " return get" << Lang << " ClauseKindAndVersions(Str).first;\n " ;
333- OS << " }\n " ;
334- OS << " \n " ;
333+ OS << " inline Clause get" << Lang << " ClauseKind(StringRef Str) {\n " ;
334+ OS << " return get" << Lang << " ClauseKindAndVersions(Str).first;\n " ;
335+ OS << " }\n " ;
336+ OS << " \n " ;
335337
336- OS << " LLVM_ABI StringRef get" << Lang
337- << " ClauseName(Clause C, unsigned Ver = 0);\n " ;
338- OS << " \n " ;
338+ OS << " LLVM_ABI StringRef get" << Lang
339+ << " ClauseName(Clause C, unsigned Ver = 0);\n " ;
340+ OS << " \n " ;
339341
340- OS << " /// Return true if \\ p C is a valid clause for \\ p D in version \\ p "
341- << " Version.\n " ;
342- OS << " LLVM_ABI bool isAllowedClauseForDirective(Directive D, "
343- << " Clause C, unsigned Version);\n " ;
344- OS << " \n " ;
345- OS << " constexpr std::size_t getMaxLeafCount() { return "
346- << getMaxLeafCount (DirLang) << " ; }\n " ;
347- OS << " LLVM_ABI Association getDirectiveAssociation(Directive D);\n " ;
348- OS << " LLVM_ABI Category getDirectiveCategory(Directive D);\n " ;
349- OS << " LLVM_ABI SourceLanguage getDirectiveLanguages(Directive D);\n " ;
350- OS << EnumHelperFuncs;
351-
352- DirLangNS.close ();
342+ OS << " /// Return true if \\ p C is a valid clause for \\ p D in version \\ p "
343+ << " Version.\n " ;
344+ OS << " LLVM_ABI bool isAllowedClauseForDirective(Directive D, "
345+ << " Clause C, unsigned Version);\n " ;
346+ OS << " \n " ;
347+ OS << " constexpr std::size_t getMaxLeafCount() { return "
348+ << getMaxLeafCount (DirLang) << " ; }\n " ;
349+ OS << " LLVM_ABI Association getDirectiveAssociation(Directive D);\n " ;
350+ OS << " LLVM_ABI Category getDirectiveCategory(Directive D);\n " ;
351+ OS << " LLVM_ABI SourceLanguage getDirectiveLanguages(Directive D);\n " ;
352+ OS << EnumHelperFuncs;
353+ } // close DirLangNS
353354
354355 // These specializations need to be in ::llvm.
355356 for (StringRef Enum : {" Association" , " Category" , " Directive" , " Clause" }) {
0 commit comments