[llvm] r233563 - DebugInfo: Simplify logic in DISubprogram::Verify(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Mar 30 10:06:38 PDT 2015
Author: dexonsmith
Date: Mon Mar 30 12:06:38 2015
New Revision: 233563
URL: http://llvm.org/viewvc/llvm-project?rev=233563&view=rev
Log:
DebugInfo: Simplify logic in DISubprogram::Verify(), NFC
Simplify the logic in `DISubprogram::Verify()` by using the new debug
info hierarchy directly instead of the `DebugLoc` wrapper.
Modified:
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=233563&r1=233562&r2=233563&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Mar 30 12:06:38 2015
@@ -343,24 +343,19 @@ bool DISubprogram::Verify() const {
if (auto *F = getFunction()) {
for (auto &BB : *F) {
for (auto &I : BB) {
- DebugLoc DL = I.getDebugLoc();
- if (DL.isUnknown())
+ MDLocation *DL =
+ cast_or_null<MDLocation>(I.getDebugLoc().getAsMDNode());
+ if (!DL)
continue;
- MDNode *Scope = nullptr;
- MDNode *IA = nullptr;
// walk the inlined-at scopes
- while ((IA = DL.getInlinedAt()))
- DL = DebugLoc::getFromDILocation(IA);
- DL.getScopeAndInlinedAt(Scope, IA);
+ while (MDLocation *IA = DL->getInlinedAt())
+ DL = IA;
+ MDScope *Scope = DL->getScope();
if (!Scope)
return false;
- assert(!IA);
- while (!DIDescriptor(Scope).isSubprogram()) {
- DILexicalBlockFile D(Scope);
- Scope = D.isLexicalBlockFile()
- ? D.getScope()
- : DebugLoc::getFromDILexicalBlock(Scope).getScope();
+ while (!isa<MDSubprogram>(Scope)) {
+ Scope = cast<MDLexicalBlockBase>(Scope)->getScope();
if (!Scope)
return false;
}
More information about the llvm-commits
mailing list