2 changes: 1 addition & 1 deletion clang/lib/Analysis/CloneDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class CloneTypeIIStmtDataCollector
ConstStmtVisitor<CloneTypeIIStmtDataCollector<T>>::Visit##CLASS(S); \
}

#include "../AST/StmtDataCollectors.inc"
#include "clang/AST/StmtDataCollectors.inc"

// Type II clones ignore variable names and literals, so let's skip them.
#define SKIP(CLASS) \
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/AST/DataCollectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class StmtDataCollector : public ConstStmtVisitor<StmtDataCollector> {
ConstStmtVisitor<StmtDataCollector>::Visit##CLASS(S); \
}

#include "../../lib/AST/StmtDataCollectors.inc"
#include "clang/AST/StmtDataCollectors.inc"
};
} // end anonymous namespace

Expand Down
1 change: 1 addition & 0 deletions clang/utils/TableGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_tablegen(clang-tblgen CLANG
ClangCommentCommandInfoEmitter.cpp
ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
ClangCommentHTMLTagsEmitter.cpp
ClangDataCollectorsEmitter.cpp
ClangDiagnosticsEmitter.cpp
ClangOptionDocEmitter.cpp
ClangSACheckersEmitter.cpp
Expand Down
18 changes: 18 additions & 0 deletions clang/utils/TableGen/ClangDataCollectorsEmitter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"

using namespace llvm;

namespace clang {
void EmitClangDataCollectors(RecordKeeper &RK, raw_ostream &OS) {
const auto &Defs = RK.getClasses();
for (const auto &Entry : Defs) {
Record &R = *Entry.second;
OS << "DEF_ADD_DATA(" << R.getName() << ", {";
auto Code = R.getValue("Code")->getValue();
OS << Code->getAsUnquotedString() << "}\n)";
OS << "\n";
}
OS << "#undef DEF_ADD_DATA\n";
}
} // end namespace clang
6 changes: 6 additions & 0 deletions clang/utils/TableGen/TableGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ enum ActionType {
GenAttrDocs,
GenDiagDocs,
GenOptDocs,
GenDataCollectors,
GenTestPragmaAttributeSupportedAttributes
};

Expand Down Expand Up @@ -147,6 +148,8 @@ cl::opt<ActionType> Action(
clEnumValN(GenDiagDocs, "gen-diag-docs",
"Generate diagnostic documentation"),
clEnumValN(GenOptDocs, "gen-opt-docs", "Generate option documentation"),
clEnumValN(GenDataCollectors, "gen-clang-data-collectors",
"Generate data collectors for AST nodes"),
clEnumValN(GenTestPragmaAttributeSupportedAttributes,
"gen-clang-test-pragma-attribute-supported-attributes",
"Generate a list of attributes supported by #pragma clang "
Expand Down Expand Up @@ -262,6 +265,9 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
case GenOptDocs:
EmitClangOptDocs(Records, OS);
break;
case GenDataCollectors:
EmitClangDataCollectors(Records, OS);
break;
case GenTestPragmaAttributeSupportedAttributes:
EmitTestPragmaAttributeSupportedAttributes(Records, OS);
break;
Expand Down
2 changes: 2 additions & 0 deletions clang/utils/TableGen/TableGenBackends.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ void EmitClangAttrDocs(RecordKeeper &Records, raw_ostream &OS);
void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS);
void EmitClangOptDocs(RecordKeeper &Records, raw_ostream &OS);

void EmitClangDataCollectors(RecordKeeper &Records, raw_ostream &OS);

void EmitTestPragmaAttributeSupportedAttributes(RecordKeeper &Records,
raw_ostream &OS);

Expand Down