mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 05:46:45 +00:00
[clang][TableGen] Change SyntaxEmitter to use const RecordKeeper (#108478)
Change SyntaxEmitter to use const RecordKeeper. This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
This commit is contained in:
parent
f637273d77
commit
d757bbf68f
@ -41,11 +41,12 @@ using llvm::formatv;
|
||||
// stable and useful way, where abstract Node subclasses correspond to ranges.
|
||||
class Hierarchy {
|
||||
public:
|
||||
Hierarchy(llvm::RecordKeeper &Records) {
|
||||
for (llvm::Record *T : Records.getAllDerivedDefinitions("NodeType"))
|
||||
Hierarchy(const llvm::RecordKeeper &Records) {
|
||||
for (const llvm::Record *T : Records.getAllDerivedDefinitions("NodeType"))
|
||||
add(T);
|
||||
for (llvm::Record *Derived : Records.getAllDerivedDefinitions("NodeType"))
|
||||
if (llvm::Record *Base = Derived->getValueAsOptionalDef("base"))
|
||||
for (const llvm::Record *Derived :
|
||||
Records.getAllDerivedDefinitions("NodeType"))
|
||||
if (const llvm::Record *Base = Derived->getValueAsOptionalDef("base"))
|
||||
link(Derived, Base);
|
||||
for (NodeType &N : AllTypes) {
|
||||
llvm::sort(N.Derived, [](const NodeType *L, const NodeType *R) {
|
||||
@ -127,7 +128,7 @@ struct SyntaxConstraint {
|
||||
|
||||
} // namespace
|
||||
|
||||
void clang::EmitClangSyntaxNodeList(llvm::RecordKeeper &Records,
|
||||
void clang::EmitClangSyntaxNodeList(const llvm::RecordKeeper &Records,
|
||||
llvm::raw_ostream &OS) {
|
||||
llvm::emitSourceFileHeader("Syntax tree node list", OS, Records);
|
||||
Hierarchy H(Records);
|
||||
@ -186,7 +187,7 @@ static void printDoc(llvm::StringRef Doc, llvm::raw_ostream &OS) {
|
||||
}
|
||||
}
|
||||
|
||||
void clang::EmitClangSyntaxNodeClasses(llvm::RecordKeeper &Records,
|
||||
void clang::EmitClangSyntaxNodeClasses(const llvm::RecordKeeper &Records,
|
||||
llvm::raw_ostream &OS) {
|
||||
llvm::emitSourceFileHeader("Syntax tree node list", OS, Records);
|
||||
Hierarchy H(Records);
|
||||
|
@ -110,9 +110,9 @@ void EmitClangCommentCommandList(const llvm::RecordKeeper &Records,
|
||||
llvm::raw_ostream &OS);
|
||||
void EmitClangOpcodes(const llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
||||
|
||||
void EmitClangSyntaxNodeList(llvm::RecordKeeper &Records,
|
||||
void EmitClangSyntaxNodeList(const llvm::RecordKeeper &Records,
|
||||
llvm::raw_ostream &OS);
|
||||
void EmitClangSyntaxNodeClasses(llvm::RecordKeeper &Records,
|
||||
void EmitClangSyntaxNodeClasses(const llvm::RecordKeeper &Records,
|
||||
llvm::raw_ostream &OS);
|
||||
|
||||
void EmitNeon(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user