xref: /freebsd/contrib/llvm-project/clang/utils/TableGen/ClangDataCollectorsEmitter.cpp (revision 2f513db72b034fd5ef7f080b11be5c711c15186a)
1 #include "llvm/TableGen/Record.h"
2 #include "llvm/TableGen/TableGenBackend.h"
3 
4 using namespace llvm;
5 
6 namespace clang {
7 void EmitClangDataCollectors(RecordKeeper &RK, raw_ostream &OS) {
8   const auto &Defs = RK.getClasses();
9   for (const auto &Entry : Defs) {
10     Record &R = *Entry.second;
11     OS << "DEF_ADD_DATA(" << R.getName() << ", {\n";
12     auto Code = R.getValue("Code")->getValue();
13     OS << Code->getAsUnquotedString() << "}\n)";
14     OS << "\n";
15   }
16   OS << "#undef DEF_ADD_DATA\n";
17 }
18 } // end namespace clang
19