Skip to content

Commit 105ed27

Browse files
committed
Revert "[AsmPrinter] fix -disable-debug-info option"
The test fails on Mac, see comment on the code review. > This option was in a rather convoluted place, causing global parameters > to be set in awkward and undesirable ways to try to account for it > indirectly. Add tests for the -disable-debug-info option and ensure we > don't print unintended markers from unintended places. > > Reviewed By: dstenb > > Differential Revision: https://reviews.llvm.org/D91083 This reverts commit 9606ef0.
1 parent d2d59d2 commit 105ed27

File tree

3 files changed

+15
-74
lines changed

3 files changed

+15
-74
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,6 @@ using namespace llvm;
131131

132132
#define DEBUG_TYPE "asm-printer"
133133

134-
// FIXME: this option currently only applies to DWARF, and not CodeView, tables
135-
static cl::opt<bool>
136-
DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden,
137-
cl::desc("Disable debug info printing"));
138-
139134
static const char *const DWARFGroupName = "dwarf";
140135
static const char *const DWARFGroupDescription = "DWARF Emission";
141136
static const char *const DbgTimerName = "emit";
@@ -237,11 +232,9 @@ void AsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
237232
}
238233

239234
void AsmPrinter::emitInitialRawDwarfLocDirective(const MachineFunction &MF) {
240-
if (DD) {
241-
assert(OutStreamer->hasRawTextSupport() &&
242-
"Expected assembly output mode.");
243-
(void)DD->emitInitialLocDirective(MF, /*CUID=*/0);
244-
}
235+
assert(DD && "Dwarf debug file is not defined.");
236+
assert(OutStreamer->hasRawTextSupport() && "Expected assembly output mode.");
237+
(void)DD->emitInitialLocDirective(MF, /*CUID=*/0);
245238
}
246239

247240
/// getCurrentSection() - Return the current section we are emitting to.
@@ -269,9 +262,6 @@ bool AsmPrinter::doInitialization(Module &M) {
269262

270263
OutStreamer->InitSections(false);
271264

272-
if (DisableDebugInfoPrinting)
273-
MMI->setDebugInfoAvailability(false);
274-
275265
// Emit the version-min deployment target directive if needed.
276266
//
277267
// FIXME: If we end up with a collection of these sorts of Darwin-specific
@@ -324,12 +314,10 @@ bool AsmPrinter::doInitialization(Module &M) {
324314
CodeViewLineTablesGroupDescription);
325315
}
326316
if (!EmitCodeView || M.getDwarfVersion()) {
327-
if (!DisableDebugInfoPrinting) {
328-
DD = new DwarfDebug(this);
329-
Handlers.emplace_back(std::unique_ptr<DwarfDebug>(DD), DbgTimerName,
330-
DbgTimerDescription, DWARFGroupName,
331-
DWARFGroupDescription);
332-
}
317+
DD = new DwarfDebug(this);
318+
Handlers.emplace_back(std::unique_ptr<DwarfDebug>(DD), DbgTimerName,
319+
DbgTimerDescription, DWARFGroupName,
320+
DWARFGroupDescription);
333321
}
334322
}
335323

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ using namespace llvm;
6767

6868
STATISTIC(NumCSParams, "Number of dbg call site params created");
6969

70+
static cl::opt<bool>
71+
DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden,
72+
cl::desc("Disable debug info printing"));
73+
7074
static cl::opt<bool> UseDwarfRangesBaseAddressSpecifier(
7175
"use-dwarf-ranges-base-address-specifier", cl::Hidden,
7276
cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
@@ -1118,7 +1122,7 @@ sortGlobalExprs(SmallVectorImpl<DwarfCompileUnit::GlobalExpr> &GVEs) {
11181122
void DwarfDebug::beginModule(Module *M) {
11191123
DebugHandlerBase::beginModule(M);
11201124

1121-
if (!Asm || !MMI->hasDebugInfo())
1125+
if (!Asm || !MMI->hasDebugInfo() || DisableDebugInfoPrinting)
11221126
return;
11231127

11241128
unsigned NumDebugCUs = std::distance(M->debug_compile_units_begin(),
@@ -1386,8 +1390,9 @@ void DwarfDebug::endModule() {
13861390
}
13871391

13881392
// If we aren't actually generating debug info (check beginModule -
1389-
// conditionalized on the presence of the llvm.dbg.cu metadata node)
1390-
if (!Asm || !MMI->hasDebugInfo())
1393+
// conditionalized on !DisableDebugInfoPrinting and the presence of the
1394+
// llvm.dbg.cu metadata node)
1395+
if (!Asm || !MMI->hasDebugInfo() || DisableDebugInfoPrinting)
13911396
return;
13921397

13931398
// Finalize the debug info for the module.

llvm/test/CodeGen/Generic/disable-debug-info-print.ll

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)