https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/108826
Fixes build failure by avoiding conflicting with `Record` class name. >From 4c9eb0b0edb3487097f44d1afc58397f03a370b7 Mon Sep 17 00:00:00 2001 From: Rahul Joshi <rjo...@nvidia.com> Date: Mon, 16 Sep 2024 06:50:09 -0700 Subject: [PATCH] [LLVM][CLange] Rename NodeType::Record to NodeType::Rec Fixes build failure by avoiding conflicting with `Record` class name. --- clang/utils/TableGen/ClangSyntaxEmitter.cpp | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/clang/utils/TableGen/ClangSyntaxEmitter.cpp b/clang/utils/TableGen/ClangSyntaxEmitter.cpp index 3457e5bd283706..4098a5e88e6820 100644 --- a/clang/utils/TableGen/ClangSyntaxEmitter.cpp +++ b/clang/utils/TableGen/ClangSyntaxEmitter.cpp @@ -50,20 +50,20 @@ class Hierarchy { link(Derived, Base); for (NodeType &N : AllTypes) { sort(N.Derived, [](const NodeType *L, const NodeType *R) { - return L->Record->getName() < R->Record->getName(); + return L->Rec->getName() < R->Rec->getName(); }); // Alternatives nodes must have subclasses, External nodes may do. - assert(N.Record->isSubClassOf("Alternatives") || - N.Record->isSubClassOf("External") || N.Derived.empty()); - assert(!N.Record->isSubClassOf("Alternatives") || !N.Derived.empty()); + assert(N.Rec->isSubClassOf("Alternatives") || + N.Rec->isSubClassOf("External") || N.Derived.empty()); + assert(!N.Rec->isSubClassOf("Alternatives") || !N.Derived.empty()); } } struct NodeType { - const Record *Record = nullptr; + const Record *Rec = nullptr; const NodeType *Base = nullptr; std::vector<const NodeType *> Derived; - StringRef name() const { return Record->getName(); } + StringRef name() const { return Rec->getName(); } }; NodeType &get(StringRef Name = "Node") { @@ -85,7 +85,7 @@ class Hierarchy { private: void add(const Record *R) { AllTypes.emplace_back(); - AllTypes.back().Record = R; + AllTypes.back().Rec = R; bool Inserted = ByName.try_emplace(R->getName(), &AllTypes.back()).second; assert(Inserted && "Duplicate node name"); (void)Inserted; @@ -200,9 +200,9 @@ void clang::EmitClangSyntaxNodeClasses(const RecordKeeper &Records, OS << "\n// Node definitions\n\n"; H.visit([&](const Hierarchy::NodeType &N) { - if (N.Record->isSubClassOf("External")) + if (N.Rec->isSubClassOf("External")) return; - printDoc(N.Record->getValueAsString("documentation"), OS); + printDoc(N.Rec->getValueAsString("documentation"), OS); OS << formatv("class {0}{1} : public {2} {{\n", N.name(), N.Derived.empty() ? " final" : "", N.Base->name()); @@ -214,9 +214,9 @@ void clang::EmitClangSyntaxNodeClasses(const RecordKeeper &Records, OS << formatv("protected:\n {0}(NodeKind K) : {1}(K) {{}\npublic:\n", N.name(), N.Base->name()); - if (N.Record->isSubClassOf("Sequence")) { + if (N.Rec->isSubClassOf("Sequence")) { // Getters for sequence elements. - for (const auto &C : N.Record->getValueAsListOfDefs("children")) { + for (const auto &C : N.Rec->getValueAsListOfDefs("children")) { assert(C->isSubClassOf("Role")); StringRef Role = C->getValueAsString("role"); SyntaxConstraint Constraint(*C->getValueAsDef("syntax")); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits