llvm-for-llvmta/tools/clang/utils/TableGen/ClangDataCollectorsEmitter.cpp

18 lines
513 B
C++
Raw Permalink Normal View History

2022-04-25 13:02:35 +02:00
#include "TableGenBackends.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
using namespace llvm;
void clang::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() << ", {\n";
auto Code = R.getValue("Code")->getValue();
OS << Code->getAsUnquotedString() << "}\n)";
OS << "\n";
}
OS << "#undef DEF_ADD_DATA\n";
}