blob: 45082935c1f794324bb165e24199fff73733d0d4 [file] [log] [blame]
John McCallc45f8d42019-10-01 23:12:57 +00001#include "TableGenBackends.h"
Johannes Altmanninger1509da02017-09-06 13:20:51 +00002#include "llvm/TableGen/Record.h"
3#include "llvm/TableGen/TableGenBackend.h"
4
5using namespace llvm;
6
John McCallc45f8d42019-10-01 23:12:57 +00007void clang::EmitClangDataCollectors(RecordKeeper &RK, raw_ostream &OS) {
Johannes Altmanninger1509da02017-09-06 13:20:51 +00008 const auto &Defs = RK.getClasses();
9 for (const auto &Entry : Defs) {
10 Record &R = *Entry.second;
Konstantin Zhuravlyov500c25e2017-09-08 16:17:16 +000011 OS << "DEF_ADD_DATA(" << R.getName() << ", {\n";
Johannes Altmanninger1509da02017-09-06 13:20:51 +000012 auto Code = R.getValue("Code")->getValue();
13 OS << Code->getAsUnquotedString() << "}\n)";
14 OS << "\n";
15 }
16 OS << "#undef DEF_ADD_DATA\n";
17}