diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-30 21:54:20 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-30 21:54:20 +0000 |
commit | 8f1fa25a9e9f3fa4f2d7ecc0a08ebb08c0c4e642 (patch) | |
tree | cb34553b5a69e92804a2fb3fbbfeabd6bb6e40cb /utils | |
parent | 825648a9e2de81f58e425690c2f4bd50404fa433 (diff) |
TableGen backends: use emitSourceFileHeader() to emit the warning about
file contents being autogenerated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173979 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/ClangASTNodesEmitter.cpp | 4 | ||||
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 33 | ||||
-rw-r--r-- | utils/TableGen/ClangCommentCommandInfoEmitter.cpp | 6 | ||||
-rw-r--r-- | utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp | 4 | ||||
-rw-r--r-- | utils/TableGen/ClangCommentHTMLTagsEmitter.cpp | 5 |
5 files changed, 34 insertions, 18 deletions
diff --git a/utils/TableGen/ClangASTNodesEmitter.cpp b/utils/TableGen/ClangASTNodesEmitter.cpp index c51ca9645d..682f9c7ba1 100644 --- a/utils/TableGen/ClangASTNodesEmitter.cpp +++ b/utils/TableGen/ClangASTNodesEmitter.cpp @@ -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"; diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index 3530e7e738..97f4403f96 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -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" diff --git a/utils/TableGen/ClangCommentCommandInfoEmitter.cpp b/utils/TableGen/ClangCommentCommandInfoEmitter.cpp index 36fbcd40b2..70821ff322 100644 --- a/utils/TableGen/ClangCommentCommandInfoEmitter.cpp +++ b/utils/TableGen/ClangCommentCommandInfoEmitter.cpp @@ -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"; diff --git a/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp b/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp index 3afe2b73f0..bfdb268b63 100644 --- a/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp +++ b/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp @@ -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"; diff --git a/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp b/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp index 0ae23b293e..bfcd2cfd15 100644 --- a/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp +++ b/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp @@ -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(); |