[libc-commits] [libc] [libc][RFC] add support for function level attributes (PR #79891)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Jan 30 08:48:53 PST 2024


================
@@ -87,6 +89,94 @@ void writeAPIFromIndex(APIIndexer &G,
   if (G.Enumerations.size() != 0)
     OS << "};\n\n";
 
+  // declare macros for attributes
+  llvm::DenseMap<llvm::StringRef, llvm::Record *> MacroAttr;
+  for (auto &Name : EntrypointNameList) {
+    if (G.FunctionSpecMap.find(Name) == G.FunctionSpecMap.end()) {
+      continue;
+    }
+    llvm::Record *FunctionSpec = G.FunctionSpecMap[Name];
+    auto Attributes = FunctionSpec->getValueAsListOfDefs("Attributes");
+    for (auto *Attr : Attributes) {
+      MacroAttr[Attr->getValueAsString("Macro")] = Attr;
+    }
----------------
nickdesaulniers wrote:

remove `{}` for single statement block statements.

https://github.com/llvm/llvm-project/pull/79891


More information about the libc-commits mailing list