[clang] [llvm] [Frontend] Add leaf constructs and association to OpenMP/ACC directives (PR #83625)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 3 17:36:48 PST 2024
================
@@ -435,6 +450,213 @@ static void GenerateIsAllowedClause(const DirectiveLanguage &DirLang,
OS << "}\n"; // End of function isAllowedClauseForDirective
}
+// Generate the getLeafConstructs function implementation.
+static void GenerateGetLeafConstructs(const DirectiveLanguage &DirLang,
+ raw_ostream &OS) {
+ auto getQualifiedName = [&](StringRef Formatted) -> std::string {
+ return (llvm::Twine("llvm::") + DirLang.getCppNamespace() +
+ "::Directive::" + DirLang.getDirectivePrefix() + Formatted)
+ .str();
+ };
+
+ // For each list of leafs, generate a static local object, then
+ // return a reference to that object for a given directive, e.g.
+ //
+ // static ListTy leafConstructs_A_B = { A, B };
----------------
alexey-bataev wrote:
Looks like this approach breaks https://llvm.org/docs/CodingStandards.html#do-not-use-static-constructors. Better to avoid static SmallVectors (IIUC you're creating static SmallVector vars here) and use POD instead to avoid use of static constructors/destructors.
https://github.com/llvm/llvm-project/pull/83625
More information about the llvm-commits
mailing list