John McCall | c45f8d4 | 2019-10-01 23:12:57 +0000 | [diff] [blame] | 1 | #include "TableGenBackends.h" |
Johannes Altmanninger | 1509da0 | 2017-09-06 13:20:51 +0000 | [diff] [blame] | 2 | #include "llvm/TableGen/Record.h" |
| 3 | #include "llvm/TableGen/TableGenBackend.h" |
| 4 | |
| 5 | using namespace llvm; |
| 6 | |
John McCall | c45f8d4 | 2019-10-01 23:12:57 +0000 | [diff] [blame] | 7 | void clang::EmitClangDataCollectors(RecordKeeper &RK, raw_ostream &OS) { |
Johannes Altmanninger | 1509da0 | 2017-09-06 13:20:51 +0000 | [diff] [blame] | 8 | const auto &Defs = RK.getClasses(); |
| 9 | for (const auto &Entry : Defs) { |
| 10 | Record &R = *Entry.second; |
Konstantin Zhuravlyov | 500c25e | 2017-09-08 16:17:16 +0000 | [diff] [blame] | 11 | OS << "DEF_ADD_DATA(" << R.getName() << ", {\n"; |
Johannes Altmanninger | 1509da0 | 2017-09-06 13:20:51 +0000 | [diff] [blame] | 12 | auto Code = R.getValue("Code")->getValue(); |
| 13 | OS << Code->getAsUnquotedString() << "}\n)"; |
| 14 | OS << "\n"; |
| 15 | } |
| 16 | OS << "#undef DEF_ADD_DATA\n"; |
| 17 | } |