Johannes Altmanninger | 1509da0 | 2017-09-06 13:20:51 +0000 | [diff] [blame] | 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; |
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 | } |
| 18 | } // end namespace clang |