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

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 6 15:00:59 PST 2024


================
@@ -0,0 +1,333 @@
+//=- ClangDiagnosticsEmitter.cpp - Generate Clang diagnostics tables -*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// These tablegen backends emit Clang diagnostics tables.
+//
+//===----------------------------------------------------------------------===//
+
+#include "TableGenBackends.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/TableGen/Error.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
+
+using namespace llvm;
+
+namespace {
+enum class BuiltinType {
+  Builtin,
+  AtomicBuiltin,
+  LibBuiltin,
+  LangBuiltin,
+  TargetBuiltin,
+};
+
+class PrototypeParser {
+public:
+  PrototypeParser(StringRef Substitution, const Record *Builtin)
+      : Loc(Builtin->getFieldLoc("Prototype")), Substitution(Substitution) {
+    ParsePrototype(Builtin->getValueAsString("Prototype"));
+  }
+
+private:
+  void ParsePrototype(StringRef Prototype) {
+    Prototype = Prototype.trim();
+    Prototype = Prototype.trim();
----------------
philnik777 wrote:

I don't know. It's probably just a leftover.

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


More information about the cfe-commits mailing list