summaryrefslogtreecommitdiffstats
path: root/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-07-28 06:24:07 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-07-28 06:24:07 +0000
commitbd68a052f292b5df7c5717bd880d796ac7507fc0 (patch)
treecca9c6eb174d5c2b71c5adaab65674bc3b370416 /lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
parentafd4a37b2a35d730a85a26d21428034915bd5b3f (diff)
downloadbcm5719-llvm-bd68a052f292b5df7c5717bd880d796ac7507fc0.tar.gz
bcm5719-llvm-bd68a052f292b5df7c5717bd880d796ac7507fc0.zip
[lldb] Also include the array definition in CommandOptions.inc
Summary: Right now our CommandOptions.inc only generates the initializer for the options list but not the array declaration boilerplate around it. As the array definition is identical for all arrays, we might as well also let the CommandOptions.inc generate it alongside the initializers. This patch will also allow us to generate additional declarations related to that option list in the future (e.g. a enum class representing the specific options which would make our handling code less prone). This patch also fixes a few option tables that didn't follow our naming style. Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65331 llvm-svn: 367186
Diffstat (limited to 'lldb/utils/TableGen/LLDBOptionDefEmitter.cpp')
-rw-r--r--lldb/utils/TableGen/LLDBOptionDefEmitter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp b/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
index 844d258568e..92dc80f0022 100644
--- a/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
+++ b/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp
@@ -129,18 +129,21 @@ static void emitOption(Record *Option, raw_ostream &OS) {
/// Emits all option initializers to the raw_ostream.
static void emitOptions(std::string Command, std::vector<Record *> Option,
raw_ostream &OS) {
+ std::string ID = Command;
+ std::replace(ID.begin(), ID.end(), ' ', '_');
// Generate the macro that the user needs to define before including the
// *.inc file.
- std::string NeededMacro = "LLDB_OPTIONS_" + Command;
- std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
+ std::string NeededMacro = "LLDB_OPTIONS_" + ID;
// All options are in one file, so we need put them behind macros and ask the
// user to define the macro for the options that are needed.
OS << "// Options for " << Command << "\n";
OS << "#ifdef " << NeededMacro << "\n";
+ OS << "constexpr static OptionDefinition g_" + ID + "_options[] = {\n";
for (Record *R : Option)
emitOption(R, OS);
// We undefine the macro for the user like Clang's include files are doing it.
+ OS << "};\n";
OS << "#undef " << NeededMacro << "\n";
OS << "#endif // " << Command << " command\n\n";
}
OpenPOWER on IntegriCloud