summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-16 21:03:55 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-16 21:03:55 +0000
commite9d379c038dbe57860290ee068cb18d13604b309 (patch)
tree0ce660a23ecc563e79bf780da8558ba22a20607c /llvm/lib
parente687bf83c0f9e6b75137a97edbb9967780e55562 (diff)
downloadbcm5719-llvm-e9d379c038dbe57860290ee068cb18d13604b309.tar.gz
bcm5719-llvm-e9d379c038dbe57860290ee068cb18d13604b309.zip
IR: Take advantage of -verify checks for MDExpression
Now that we check `MDExpression` during `-verify` (r232299), make the `DIExpression` wrapper more strict: - remove redundant checks in `DebugInfoVerifier`, - overload `get()` to `cast_or_null<MDExpression>` (superseding `getRaw()`), - stop checking for null in any accessor, and - remove `DIExpression::Verify()` entirely in favour of `MDExpression::isValid()`. There is still some logic in this class, mostly to do with high-level iterators; I'll defer cleaning up those until the rest of the wrappers are similarly strict. llvm-svn: 232412
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h3
-rw-r--r--llvm/lib/IR/DebugInfo.cpp8
-rw-r--r--llvm/lib/IR/Verifier.cpp4
4 files changed, 4 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
index 6f30d294f71..6914bbe9a59 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
@@ -43,7 +43,7 @@ public:
Value(const MDNode *Var, const MDNode *Expr, MachineLocation Loc)
: Variable(Var), Expression(Expr), EntryKind(E_Location), Loc(Loc) {
assert(DIVariable(Var).Verify());
- assert(DIExpression(Expr).Verify());
+ assert(DIExpression(Expr)->isValid());
}
/// The variable to which this location entry corresponds.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 6e462bf06d0..952da04a4b4 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -88,7 +88,8 @@ public:
: Var(V), Expr(1, E), TheDIE(nullptr), DotDebugLocOffset(~0U),
MInsn(nullptr), DD(DD) {
FrameIndex.push_back(FI);
- assert(Var.Verify() && E.Verify());
+ assert(Var.Verify());
+ assert(!E || E->isValid());
}
/// Construct a DbgVariable from a DEBUG_VALUE.
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 148fa2101c0..3c7cf9e1b8d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -92,7 +92,7 @@ bool DIDescriptor::Verify() const {
DIObjCProperty(DbgNode).Verify() ||
DITemplateTypeParameter(DbgNode).Verify() ||
DITemplateValueParameter(DbgNode).Verify() ||
- DIImportedEntity(DbgNode).Verify() || DIExpression(DbgNode).Verify());
+ DIImportedEntity(DbgNode).Verify());
}
static Metadata *getField(const MDNode *DbgNode, unsigned Elt) {
@@ -402,12 +402,6 @@ bool DIVariable::Verify() const {
return isTypeRef(N->getType());
}
-bool DIExpression::Verify() const {
- // FIXME: This should return false if it's null!
- auto *N = getRaw();
- return !N || N->isValid();
-}
-
bool DILocation::Verify() const { return getRaw(); }
bool DINameSpace::Verify() const { return getRaw(); }
bool DIFile::Verify() const { return getRaw(); }
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index ba33d792cb2..cc5fa690d58 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -3078,15 +3078,11 @@ void DebugInfoVerifier::processCallInst(DebugInfoFinder &Finder,
case Intrinsic::dbg_declare: {
auto *DDI = cast<DbgDeclareInst>(&CI);
Finder.processDeclare(*M, DDI);
- if (auto E = DDI->getExpression())
- Assert(DIExpression(E).Verify(), "DIExpression does not Verify!", E);
break;
}
case Intrinsic::dbg_value: {
auto *DVI = cast<DbgValueInst>(&CI);
Finder.processValue(*M, DVI);
- if (auto E = DVI->getExpression())
- Assert(DIExpression(E).Verify(), "DIExpression does not Verify!", E);
break;
}
default:
OpenPOWER on IntegriCloud