2024-11-17 07:54:10 -08:00
|
|
|
//===-- ClangDataCollectorsEmitter.cpp - Generate Clang data collector ----===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This tablegen backend emit Clang data collector tables.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2019-10-01 23:12:57 +00:00
|
|
|
#include "TableGenBackends.h"
|
2017-09-06 13:20:51 +00:00
|
|
|
#include "llvm/TableGen/Record.h"
|
|
|
|
#include "llvm/TableGen/TableGenBackend.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2024-09-11 10:50:57 -07:00
|
|
|
void clang::EmitClangDataCollectors(const RecordKeeper &RK, raw_ostream &OS) {
|
2017-09-06 13:20:51 +00:00
|
|
|
const auto &Defs = RK.getClasses();
|
|
|
|
for (const auto &Entry : Defs) {
|
|
|
|
Record &R = *Entry.second;
|
2017-09-08 16:17:16 +00:00
|
|
|
OS << "DEF_ADD_DATA(" << R.getName() << ", {\n";
|
2017-09-06 13:20:51 +00:00
|
|
|
auto Code = R.getValue("Code")->getValue();
|
|
|
|
OS << Code->getAsUnquotedString() << "}\n)";
|
|
|
|
OS << "\n";
|
|
|
|
}
|
|
|
|
OS << "#undef DEF_ADD_DATA\n";
|
|
|
|
}
|