1//===-- ClangDataCollectorsEmitter.cpp - Generate Clang data collector ----===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This tablegen backend emit Clang data collector tables.
10//
11//===----------------------------------------------------------------------===//
12
13#include "TableGenBackends.h"
14#include "llvm/TableGen/Record.h"
15#include "llvm/TableGen/TableGenBackend.h"
16
17using namespace llvm;
18
19void clang::EmitClangDataCollectors(const RecordKeeper &RK, raw_ostream &OS) {
20 for (const Record *Class : RK.getClasses()) {
21 const Record &R = *Class;
22 OS << "DEF_ADD_DATA(" << R.getName() << ", {\n";
23 auto Code = R.getValue(Name: "Code")->getValue();
24 OS << Code->getAsUnquotedString() << "}\n)";
25 OS << "\n";
26 }
27 OS << "#undef DEF_ADD_DATA\n";
28}
29