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
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 148fa21..3c7cf9e 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -92,7 +92,7 @@
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 @@
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(); }