//=== ClangASTNodesEmitter.cpp - Generate Clang AST node 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 AST node tables // //===----------------------------------------------------------------------===// #include "ASTTableGen.h" #include "TableGenBackends.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenBackend.h" #include <map> #include <set> #include <string> usingnamespacellvm; usingnamespaceclang; usingnamespaceclang::tblgen; /// ClangASTNodesEmitter - The top-level class emits .inc files containing /// declarations of Clang statements. /// namespace { class ClangASTNodesEmitter { … }; } // end anonymous namespace //===----------------------------------------------------------------------===// // Statement Node Tables (.inc file) generation. //===----------------------------------------------------------------------===// // Returns the first and last non-abstract subrecords // Called recursively to ensure that nodes remain contiguous std::pair<ASTNode, ASTNode> ClangASTNodesEmitter::EmitNode(raw_ostream &OS, ASTNode Base) { … } void ClangASTNodesEmitter::deriveChildTree() { … } void ClangASTNodesEmitter::run(raw_ostream &OS) { … } void clang::EmitClangASTNodes(const RecordKeeper &RK, raw_ostream &OS, const std::string &N, const std::string &S, std::string_view PriorizeIfSubclassOf) { … } void printDeclContext(const std::multimap<const Record *, const Record *> &Tree, const Record *DeclContext, raw_ostream &OS) { … } // Emits and addendum to a .inc file to enumerate the clang declaration // contexts. void clang::EmitClangDeclContext(const RecordKeeper &Records, raw_ostream &OS) { … }