]> granicus.if.org Git - clang/commitdiff
TableGen backends: use emitSourceFileHeader() to emit the warning about
authorDmitri Gribenko <gribozavr@gmail.com>
Wed, 30 Jan 2013 21:54:20 +0000 (21:54 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Wed, 30 Jan 2013 21:54:20 +0000 (21:54 +0000)
file contents being autogenerated

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173979 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/ClangASTNodesEmitter.cpp
utils/TableGen/ClangAttrEmitter.cpp
utils/TableGen/ClangCommentCommandInfoEmitter.cpp
utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
utils/TableGen/ClangCommentHTMLTagsEmitter.cpp

index c51ca9645db011052b804ec1507758a92a00c5be..682f9c7ba1161e7a078daa7988712daa0dca8fb9 100644 (file)
@@ -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";
index 3530e7e738b065a686e88d68332987e04b9b2a97..97f4403f9614c772710d33531a4f001ed7326889 100644 (file)
@@ -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"
index 36fbcd40b2f45c31b066569f00fc3b6cb6c2907c..70821ff322252507dd94159fe23a7ada8bc221b3 100644 (file)
@@ -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";
index 3afe2b73f0aae5c708910932cef8de2cd61abfa9..bfdb268b63ba51603c8a871ef14621626ee69bad 100644 (file)
@@ -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";
index 0ae23b293e656188c43eb874486d36893483c193..bfcd2cfd15a438532deffc1e232775cafcc6f93f 100644 (file)
@@ -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();