summaryrefslogtreecommitdiffstats
path: root/clang/utils/TableGen/ClangAttrEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/utils/TableGen/ClangAttrEmitter.cpp')
-rw-r--r--clang/utils/TableGen/ClangAttrEmitter.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 3530e7e738b..97f4403f961 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/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"
OpenPOWER on IntegriCloud