xref: /freebsd/contrib/llvm-project/clang/utils/TableGen/ClangDataCollectorsEmitter.cpp (revision 5b27928474e6a4103d65b347544705c40c9618fd)
1*a7dea167SDimitry Andric #include "TableGenBackends.h"
20b57cec5SDimitry Andric #include "llvm/TableGen/Record.h"
30b57cec5SDimitry Andric #include "llvm/TableGen/TableGenBackend.h"
40b57cec5SDimitry Andric 
50b57cec5SDimitry Andric using namespace llvm;
60b57cec5SDimitry Andric 
EmitClangDataCollectors(RecordKeeper & RK,raw_ostream & OS)7*a7dea167SDimitry Andric void clang::EmitClangDataCollectors(RecordKeeper &RK, raw_ostream &OS) {
80b57cec5SDimitry Andric   const auto &Defs = RK.getClasses();
90b57cec5SDimitry Andric   for (const auto &Entry : Defs) {
100b57cec5SDimitry Andric     Record &R = *Entry.second;
110b57cec5SDimitry Andric     OS << "DEF_ADD_DATA(" << R.getName() << ", {\n";
120b57cec5SDimitry Andric     auto Code = R.getValue("Code")->getValue();
130b57cec5SDimitry Andric     OS << Code->getAsUnquotedString() << "}\n)";
140b57cec5SDimitry Andric     OS << "\n";
150b57cec5SDimitry Andric   }
160b57cec5SDimitry Andric   OS << "#undef DEF_ADD_DATA\n";
170b57cec5SDimitry Andric }
18