summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-20 19:37:03 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-20 19:37:03 +0000
commitd3a057733f2f584f26c2f6529f1161ec93343e51 (patch)
tree33803f47b532beb0856f31743a678e22b34d2bd0 /llvm/lib/CodeGen/AsmPrinter
parenta3bdc328a5ef1c915e897221aa29d17b0b7cb4d5 (diff)
downloadbcm5719-llvm-d3a057733f2f584f26c2f6529f1161ec93343e51.tar.gz
bcm5719-llvm-d3a057733f2f584f26c2f6529f1161ec93343e51.zip
DwarfDebug: Check for null DebugLocs
`DL` might be null, so check for that before using accessors. A WIP patch to make `DIDescriptors` more strict fails otherwise. As a bonus, I think the logic is easier to follow now (despite the extra nesting depth). llvm-svn: 232836
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index df5dd2e8333..e8e6c74e1ee 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -970,23 +970,25 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
// Check if source location changes, but ignore DBG_VALUE locations.
if (!MI->isDebugValue()) {
DebugLoc DL = MI->getDebugLoc();
- if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) {
- unsigned Flags = 0;
- PrevInstLoc = DL;
- if (DL == PrologEndLoc) {
- Flags |= DWARF2_FLAG_PROLOGUE_END;
- PrologEndLoc = DebugLoc();
- Flags |= DWARF2_FLAG_IS_STMT;
- }
- if (DL.getLine() !=
- Asm->OutStreamer.getContext().getCurrentDwarfLoc().getLine())
- Flags |= DWARF2_FLAG_IS_STMT;
-
+ if (DL != PrevInstLoc) {
if (!DL.isUnknown()) {
+ unsigned Flags = 0;
+ PrevInstLoc = DL;
+ if (DL == PrologEndLoc) {
+ Flags |= DWARF2_FLAG_PROLOGUE_END;
+ PrologEndLoc = DebugLoc();
+ Flags |= DWARF2_FLAG_IS_STMT;
+ }
+ if (DL.getLine() !=
+ Asm->OutStreamer.getContext().getCurrentDwarfLoc().getLine())
+ Flags |= DWARF2_FLAG_IS_STMT;
+
const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
- } else
+ } else if (UnknownLocations) {
+ PrevInstLoc = DL;
recordSourceLine(0, 0, nullptr, 0);
+ }
}
}
OpenPOWER on IntegriCloud