Skip to content

Commit 85f9179

Browse files
committed
Address review comments, fix test
1 parent 4b7ecac commit 85f9179

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

clang/test/CodeGenCXX/debug-info-coff.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// CHECK-NEXT: Magic: 0x4
1414
// CHECK-NEXT: Subsection [
1515
// CHECK-NEXT: SubSectionType: Symbols (0xF1)
16-
// CHECK-NEXT: SubSectionSize: 0x40
16+
// CHECK-NEXT: SubSectionSize:
1717
// CHECK-NEXT: ObjNameSym {
1818
// CHECK-NEXT: Kind: S_OBJNAME (0x1101)
1919
// CHECK-NEXT: Signature: 0x0

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,10 @@ bool AsmPrinter::doInitialization(Module &M) {
562562
if (MAI->doesSupportDebugInformation()) {
563563
// On Windows targets, emit minimal CodeView compiler info even when debug
564564
// info is disabled.
565-
if ((TM.getTargetTriple().isOSWindows() || TM.getTargetTriple().isUEFI()) &&
566-
M.getNamedMetadata("llvm.dbg.cu"))
565+
if (M.getNamedMetadata("llvm.dbg.cu") &&
566+
(TM.getTargetTriple().isOSWindows() || TM.getTargetTriple().isUEFI()))
567567
Handlers.push_back(std::make_unique<CodeViewDebug>(this));
568-
if (M.getDwarfVersion() || !M.getCodeViewFlag()) {
568+
if (!M.getCodeViewFlag() || M.getDwarfVersion()) {
569569
if (hasDebugInfo()) {
570570
DD = new DwarfDebug(this);
571571
Handlers.push_back(std::unique_ptr<DwarfDebug>(DD));

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,7 @@ static SourceLanguage MapDWLangToCVLang(unsigned DWLang) {
611611
}
612612

613613
void CodeViewDebug::beginModule(Module *M) {
614-
// If module doesn't have named metadata anchors or COFF debug section
615-
// is not available, skip any debug info related stuff.
614+
// If COFF debug section is not available, skip any debug info related stuff.
616615
if (!Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) {
617616
Asm = nullptr;
618617
return;
@@ -633,9 +632,9 @@ void CodeViewDebug::beginModule(Module *M) {
633632
const auto *CU = cast<DICompileUnit>(Node);
634633

635634
CurrentSourceLanguage = MapDWLangToCVLang(CU->getSourceLanguage());
636-
NoDebug =
635+
OnlyCompilerInfo =
637636
!M->getCodeViewFlag() || CU->getEmissionKind() == DICompileUnit::NoDebug;
638-
if (NoDebug)
637+
if (OnlyCompilerInfo)
639638
return;
640639

641640
collectGlobalVariableInfo();
@@ -663,7 +662,7 @@ void CodeViewDebug::endModule() {
663662
emitObjName();
664663
emitCompilerInformation();
665664
endCVSubsection(CompilerInfo);
666-
if (NoDebug)
665+
if (OnlyCompilerInfo)
667666
return;
668667

669668
emitInlineeLinesSubsection();
@@ -1453,7 +1452,7 @@ void CodeViewDebug::collectVariableInfo(const DISubprogram *SP) {
14531452
}
14541453

14551454
void CodeViewDebug::beginFunctionImpl(const MachineFunction *MF) {
1456-
if (NoDebug)
1455+
if (OnlyCompilerInfo)
14571456
return;
14581457

14591458
const TargetSubtargetInfo &TSI = MF->getSubtarget();
@@ -3047,7 +3046,7 @@ void CodeViewDebug::collectLexicalBlockInfo(
30473046
}
30483047

30493048
void CodeViewDebug::endFunctionImpl(const MachineFunction *MF) {
3050-
if (NoDebug)
3049+
if (OnlyCompilerInfo)
30513050
return;
30523051

30533052
const Function &GV = MF->getFunction();
@@ -3108,7 +3107,7 @@ static bool isUsableDebugLoc(DebugLoc DL) {
31083107

31093108
void CodeViewDebug::beginInstruction(const MachineInstr *MI) {
31103109
DebugHandlerBase::beginInstruction(MI);
3111-
if (NoDebug)
3110+
if (OnlyCompilerInfo)
31123111
return;
31133112

31143113
// Ignore DBG_VALUE and DBG_LABEL locations and function prologue.

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
9999
codeview::CPUType TheCPU;
100100

101101
/// Whether to emit compiler information only.
102-
bool NoDebug = false;
102+
bool OnlyCompilerInfo = false;
103103

104104
static LocalVarDef createDefRangeMem(uint16_t CVRegister, int Offset);
105105

0 commit comments

Comments
 (0)