r173979 - TableGen backends: use emitSourceFileHeader() to emit the warning about

Dmitri Gribenko gribozavr at gmail.com
Wed Jan 30 13:54:21 PST 2013


Author: gribozavr
Date: Wed Jan 30 15:54:20 2013
New Revision: 173979

URL: http://llvm.org/viewvc/llvm-project?rev=173979&view=rev
Log:
TableGen backends: use emitSourceFileHeader() to emit the warning about
file contents being autogenerated

Modified:
    cfe/trunk/utils/TableGen/ClangASTNodesEmitter.cpp
    cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
    cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
    cfe/trunk/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
    cfe/trunk/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangASTNodesEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangASTNodesEmitter.cpp?rev=173979&r1=173978&r2=173979&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangASTNodesEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangASTNodesEmitter.cpp Wed Jan 30 15:54:20 2013
@@ -133,6 +133,8 @@ std::pair<Record *, Record *> ClangASTNo
 }
 
 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,
 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";

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=173979&r1=173978&r2=173979&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Wed Jan 30 15:54:20 2013
@@ -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 &Re
 
 // 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 &Rec
 
 // 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 &
 
 // 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 
 
 // 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(RecordKee
 }
 
 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(Reco
 
 // 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(RecordK
 
 // 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(Re
 
 // 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(RecordK
 
 // 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(Record
 
 // 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"

Modified: cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp?rev=173979&r1=173978&r2=173979&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp Wed Jan 30 15:54:20 2013
@@ -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";

Modified: cfe/trunk/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp?rev=173979&r1=173978&r2=173979&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp Wed Jan 30 15:54:20 2013
@@ -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 EmitClangCommentHTMLNamedCharacterR
     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";

Modified: cfe/trunk/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp?rev=173979&r1=173978&r2=173979&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp Wed Jan 30 15:54:20 2013
@@ -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(RecordKeep
     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(
       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();





More information about the cfe-commits mailing list