forked from OSchip/llvm-project
TableGen backends: use emitSourceFileHeader() to emit the warning about
file contents being autogenerated llvm-svn: 173979
This commit is contained in:
parent
ff65cbac7f
commit
6b11fca83a
|
@ -133,6 +133,8 @@ std::pair<Record *, Record *> ClangASTNodesEmitter::EmitNode(
|
|||
}
|
||||
|
||||
void ClangASTNodesEmitter::run(raw_ostream &OS) {
|
||||
emitSourceFileHeader("List of AST nodes of a particular kind", OS);
|
||||
|
||||
// Write the preamble
|
||||
OS << "#ifndef ABSTRACT_" << macroName(Root.getName()) << "\n";
|
||||
OS << "# define ABSTRACT_" << macroName(Root.getName()) << "(Type) Type\n";
|
||||
|
@ -183,6 +185,8 @@ void EmitClangASTNodes(RecordKeeper &RK, raw_ostream &OS,
|
|||
void EmitClangDeclContext(RecordKeeper &Records, raw_ostream &OS) {
|
||||
// FIXME: Find a .td file format to allow for this to be represented better.
|
||||
|
||||
emitSourceFileHeader("List of AST Decl nodes", OS);
|
||||
|
||||
OS << "#ifndef DECL_CONTEXT\n";
|
||||
OS << "# define DECL_CONTEXT(DECL)\n";
|
||||
OS << "#endif\n";
|
||||
|
|
|
@ -818,7 +818,8 @@ namespace clang {
|
|||
|
||||
// Emits the class definitions for attributes.
|
||||
void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("Attribute classes' definitions", OS);
|
||||
|
||||
OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
|
||||
OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
|
||||
|
||||
|
@ -910,7 +911,7 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the class method definitions for attributes.
|
||||
void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("Attribute classes' member function definitions", OS);
|
||||
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||
std::vector<Record*>::iterator i = Attrs.begin(), e = Attrs.end(), ri, re;
|
||||
|
@ -966,7 +967,7 @@ namespace clang {
|
|||
|
||||
// Emits the enumeration list for attributes.
|
||||
void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("List of all attributes that Clang recognizes", OS);
|
||||
|
||||
OS << "#ifndef LAST_ATTR\n";
|
||||
OS << "#define LAST_ATTR(NAME) ATTR(NAME)\n";
|
||||
|
@ -1019,7 +1020,7 @@ void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the code to read an attribute from a precompiled header.
|
||||
void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("Attribute deserialization code", OS);
|
||||
|
||||
Record *InhClass = Records.getClass("InheritableAttr");
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"),
|
||||
|
@ -1063,6 +1064,8 @@ void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the code to write an attribute to a precompiled header.
|
||||
void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
|
||||
emitSourceFileHeader("Attribute serialization code", OS);
|
||||
|
||||
Record *InhClass = Records.getClass("InheritableAttr");
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
|
||||
std::vector<Record*>::iterator i = Attrs.begin(), e = Attrs.end(), ai, ae;
|
||||
|
@ -1092,7 +1095,8 @@ void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the list of spellings for attributes.
|
||||
void EmitClangAttrSpellingList(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("llvm::StringSwitch code to match all known attributes",
|
||||
OS);
|
||||
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||
|
||||
|
@ -1109,7 +1113,8 @@ void EmitClangAttrSpellingList(RecordKeeper &Records, raw_ostream &OS) {
|
|||
}
|
||||
|
||||
void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit it. \n\n";
|
||||
emitSourceFileHeader("Code to translate different attribute spellings "
|
||||
"into internal identifiers", OS);
|
||||
|
||||
OS <<
|
||||
" unsigned Index = 0;\n"
|
||||
|
@ -1169,7 +1174,8 @@ void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the LateParsed property for attributes.
|
||||
void EmitClangAttrLateParsedList(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("llvm::StringSwitch code to match late parsed "
|
||||
"attributes", OS);
|
||||
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||
|
||||
|
@ -1197,7 +1203,7 @@ void EmitClangAttrLateParsedList(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits code to instantiate dependent attributes on templates.
|
||||
void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("Template instantiation code for attributes", OS);
|
||||
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||
|
||||
|
@ -1270,8 +1276,8 @@ void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the list of parsed attributes.
|
||||
void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
|
||||
emitSourceFileHeader("List of all attributes that Clang recognizes", OS);
|
||||
|
||||
OS << "#ifndef PARSED_ATTR\n";
|
||||
OS << "#define PARSED_ATTR(NAME) NAME\n";
|
||||
OS << "#endif\n\n";
|
||||
|
@ -1308,9 +1314,8 @@ void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the kind list of parsed attributes
|
||||
void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
OS << "\n";
|
||||
|
||||
emitSourceFileHeader("Attribute name matcher", OS);
|
||||
|
||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
||||
|
||||
std::vector<StringMatcher::StringPair> Matches;
|
||||
|
@ -1360,6 +1365,8 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
|
|||
|
||||
// Emits the code to dump an attribute.
|
||||
void EmitClangAttrDump(RecordKeeper &Records, raw_ostream &OS) {
|
||||
emitSourceFileHeader("Attribute dumper", OS);
|
||||
|
||||
OS <<
|
||||
" switch (A->getKind()) {\n"
|
||||
" default:\n"
|
||||
|
|
|
@ -7,20 +7,22 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This tablegen backend emits command lists and efficient matchers command
|
||||
// This tablegen backend emits command lists and efficient matchers for command
|
||||
// names that are used in documentation comments.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/StringMatcher.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace clang {
|
||||
void EmitClangCommentCommandInfo(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("A list of commands useable in documentation "
|
||||
"comments", OS);
|
||||
|
||||
OS << "namespace {\n"
|
||||
"const CommandInfo Commands[] = {\n";
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/StringMatcher.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -70,7 +71,8 @@ void EmitClangCommentHTMLNamedCharacterReferences(RecordKeeper &Records,
|
|||
NameToUTF8.push_back(Match);
|
||||
}
|
||||
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("HTML named character reference to UTF-8 "
|
||||
"translation", OS);
|
||||
|
||||
OS << "StringRef translateHTMLNamedCharacterReferenceToUTF8(\n"
|
||||
" StringRef Name) {\n";
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/StringMatcher.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -29,7 +30,7 @@ void EmitClangCommentHTMLTags(RecordKeeper &Records, raw_ostream &OS) {
|
|||
Matches.push_back(StringMatcher::StringPair(Spelling, "return true;"));
|
||||
}
|
||||
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("HTML tag name matcher", OS);
|
||||
|
||||
OS << "bool isHTMLTagName(StringRef Name) {\n";
|
||||
StringMatcher("Name", Matches, OS).Emit();
|
||||
|
@ -53,7 +54,7 @@ void EmitClangCommentHTMLTagsProperties(RecordKeeper &Records,
|
|||
MatchesEndTagForbidden.push_back(Match);
|
||||
}
|
||||
|
||||
OS << "// This file is generated by TableGen. Do not edit.\n\n";
|
||||
emitSourceFileHeader("HTML tag properties", OS);
|
||||
|
||||
OS << "bool isHTMLEndTagOptional(StringRef Name) {\n";
|
||||
StringMatcher("Name", MatchesEndTagOptional, OS).Emit();
|
||||
|
|
Loading…
Reference in New Issue