================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to