that separates out language and version. To avoid reinventing the wheel and introducing subtle incompatibilities, this API uses the table of languages and versiond defined by the upcoming DWARF 6 standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not finialized, the list of languages is broadly considered stable. The primary motivation for this is to allow the Swift language plugin to switch between language dialects between, e.g., Swift 5.9 and 6.0 with out introducing a ton of new language codes. On the main branch this change is considered NFC. Depends on https://github.com/llvm/llvm-project/pull/89980
91 lines
3.0 KiB
C++
91 lines
3.0 KiB
C++
//===- LLDBTableGen.cpp - Top-Level TableGen implementation for LLDB ------===//
|
|
//
|
|
// 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 file contains the main function for LLDB's TableGen.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "LLDBTableGenBackends.h" // Declares all backends.
|
|
#include "llvm/Support/CommandLine.h"
|
|
#include "llvm/Support/PrettyStackTrace.h"
|
|
#include "llvm/Support/Signals.h"
|
|
#include "llvm/TableGen/Error.h"
|
|
#include "llvm/TableGen/Main.h"
|
|
#include "llvm/TableGen/Record.h"
|
|
|
|
using namespace llvm;
|
|
using namespace lldb_private;
|
|
|
|
enum ActionType {
|
|
PrintRecords,
|
|
DumpJSON,
|
|
GenOptionDefs,
|
|
GenPropertyDefs,
|
|
GenPropertyEnumDefs,
|
|
GenSBAPIDWARFEnum
|
|
};
|
|
|
|
static cl::opt<ActionType> Action(
|
|
cl::desc("Action to perform:"),
|
|
cl::values(clEnumValN(PrintRecords, "print-records",
|
|
"Print all records to stdout (default)"),
|
|
clEnumValN(DumpJSON, "dump-json",
|
|
"Dump all records as machine-readable JSON"),
|
|
clEnumValN(GenOptionDefs, "gen-lldb-option-defs",
|
|
"Generate lldb option definitions"),
|
|
clEnumValN(GenPropertyDefs, "gen-lldb-property-defs",
|
|
"Generate lldb property definitions"),
|
|
clEnumValN(GenPropertyEnumDefs, "gen-lldb-property-enum-defs",
|
|
"Generate lldb property enum definitions"),
|
|
clEnumValN(GenSBAPIDWARFEnum, "gen-lldb-sbapi-dwarf-enum",
|
|
"Generate lldb property enum definitions")));
|
|
|
|
static bool LLDBTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
|
|
switch (Action) {
|
|
case PrintRecords:
|
|
OS << Records; // No argument, dump all contents
|
|
break;
|
|
case DumpJSON:
|
|
EmitJSON(Records, OS);
|
|
break;
|
|
case GenOptionDefs:
|
|
EmitOptionDefs(Records, OS);
|
|
break;
|
|
case GenPropertyDefs:
|
|
EmitPropertyDefs(Records, OS);
|
|
break;
|
|
case GenPropertyEnumDefs:
|
|
EmitPropertyEnumDefs(Records, OS);
|
|
break;
|
|
case GenSBAPIDWARFEnum:
|
|
llvm_unreachable("already handled");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
sys::PrintStackTraceOnErrorSignal(argv[0]);
|
|
PrettyStackTraceProgram X(argc, argv);
|
|
cl::ParseCommandLineOptions(argc, argv);
|
|
llvm_shutdown_obj Y;
|
|
|
|
if (Action == GenSBAPIDWARFEnum)
|
|
return EmitSBAPIDWARFEnum(argc, argv);
|
|
|
|
return TableGenMain(argv[0], &LLDBTableGenMain);
|
|
}
|
|
|
|
#ifdef __has_feature
|
|
#if __has_feature(address_sanitizer)
|
|
#include <sanitizer/lsan_interface.h>
|
|
// Disable LeakSanitizer for this binary as it has too many leaks that are not
|
|
// very interesting to fix. See compiler-rt/include/sanitizer/lsan_interface.h .
|
|
int __lsan_is_turned_off() { return 1; }
|
|
#endif // __has_feature(address_sanitizer)
|
|
#endif // defined(__has_feature)
|