[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:04 PST 2023
================
@@ -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();
----------------
AaronBallman wrote:
This seems suspicious, why two trims?
https://github.com/llvm/llvm-project/pull/68324
More information about the cfe-commits
mailing list