1 //===-- ClangDataCollectorsEmitter.cpp - Generate Clang data collector ----===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This tablegen backend emit Clang data collector tables.
11 //===----------------------------------------------------------------------===//
13 #include "TableGenBackends.h"
14 #include "llvm/TableGen/Record.h"
15 #include "llvm/TableGen/TableGenBackend.h"
19 void clang::EmitClangDataCollectors(const RecordKeeper
&RK
, raw_ostream
&OS
) {
20 const auto &Defs
= RK
.getClasses();
21 for (const auto &Entry
: Defs
) {
22 Record
&R
= *Entry
.second
;
23 OS
<< "DEF_ADD_DATA(" << R
.getName() << ", {\n";
24 auto Code
= R
.getValue("Code")->getValue();
25 OS
<< Code
->getAsUnquotedString() << "}\n)";
28 OS
<< "#undef DEF_ADD_DATA\n";