Turn these two options in to trinary state so that they can be
turned on and off separate from the platform if you're on darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162487 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 1991785..fb4ae0f 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -54,13 +54,29 @@
cl::desc("Make an absence of debug location information explicit."),
cl::init(false));
-static cl::opt<bool> DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
- cl::desc("Output prototype dwarf accelerator tables."),
- cl::init(false));
+namespace {
+ enum DefaultOnOff {
+ Default, Enable, Disable
+ };
+}
-static cl::opt<bool> DarwinGDBCompat("darwin-gdb-compat", cl::Hidden,
+static cl::opt<DefaultOnOff> DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
+ cl::desc("Output prototype dwarf accelerator tables."),
+ cl::values(
+ clEnumVal(Default, "Default for platform"),
+ clEnumVal(Enable, "Enabled"),
+ clEnumVal(Disable, "Disabled"),
+ clEnumValEnd),
+ cl::init(Default));
+
+static cl::opt<DefaultOnOff> DarwinGDBCompat("darwin-gdb-compat", cl::Hidden,
cl::desc("Compatibility with Darwin gdb."),
- cl::init(false));
+ cl::values(
+ clEnumVal(Default, "Default for platform"),
+ clEnumVal(Enable, "Enabled"),
+ clEnumVal(Disable, "Disabled"),
+ clEnumValEnd),
+ cl::init(Default));
namespace {
const char *DWARFGroupName = "DWARF Emission";
@@ -141,13 +157,23 @@
// Turn on accelerator tables and older gdb compatibility
// for Darwin.
- if (Triple(M->getTargetTriple()).isOSDarwin()) {
- DwarfAccelTables = true;
- DarwinGDBCompat = true;
- }
+ bool isDarwin = Triple(M->getTargetTriple()).isOSDarwin();
+ if (DarwinGDBCompat == Default) {
+ if (isDarwin)
+ isDarwinGDBCompat = true;
+ else
+ isDarwinGDBCompat = false;
+ } else
+ isDarwinGDBCompat = DarwinGDBCompat == Enable ? true : false;
- isDarwinGDBCompat = DarwinGDBCompat;
-
+ if (DwarfAccelTables == Default) {
+ if (isDarwin)
+ hasDwarfAccelTables = true;
+ else
+ hasDwarfAccelTables = false;
+ } else
+ hasDwarfAccelTables = DwarfAccelTables == Enable ? true : false;
+
{
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
beginModule(M);
@@ -826,7 +852,7 @@
emitAbbreviations();
// Emit info into the dwarf accelerator table sections.
- if (DwarfAccelTables) {
+ if (useDwarfAccelTables()) {
emitAccelNames();
emitAccelObjC();
emitAccelNamespaces();
@@ -836,7 +862,7 @@
// Emit info into a debug pubtypes section.
// TODO: When we don't need the option anymore we can
// remove all of the code that adds to the table.
- if (DarwinGDBCompat)
+ if (useDarwinGDBCompat())
emitDebugPubTypes();
// Emit info into a debug loc section.
@@ -855,7 +881,7 @@
// TODO: When we don't need the option anymore we
// can remove all of the code that this section
// depends upon.
- if (DarwinGDBCompat)
+ if (useDarwinGDBCompat())
emitDebugInlineInfo();
// Emit info into a debug str section.