[clang] [clang][NFC] Refactor Builtins.def to be a tablegen file (PR #68324)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 11:01:05 PST 2023


================
@@ -0,0 +1,121 @@
+//===--- BuiltinsBase.td - common structured used by builtins ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Attributes
+// ==========
+
+class Attribute<string mangling> {
+  string Mangling = mangling;
+}
+
+class IndexedAttribute<string baseMangling, int I> : Attribute<baseMangling> {
+  int Index = I;
+}
+
+// Standard Attributes
+// -------------------
+def NoReturn : Attribute<"r">;
+
+// Attributes from the gnu:: namespace
+// -----------------------------------
+def Const : Attribute<"c">;
+def NoThrow : Attribute<"n">;
+def Pure : Attribute<"U">;
+def ReturnsTwice : Attribute<"j">;
+//  FIXME: gcc has nonnull
+
+// builtin-specific attributes
+// ---------------------------
+
+// signature is meaningless, use custom typechecking
+def CustomTypeChecking : Attribute<"t">;
+
+// type is not important to semantic analysis and codegen; recognize as builtin
+// even if type doesn't match signature, and don't warn if we can't be sure the
+// type is right
----------------
AaronBallman wrote:

```suggestion
// even if type doesn't match signature, and don't warn if we can't be sure the
// type is right.
```

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


More information about the cfe-commits mailing list