Verifier: Check accessors of MDLocation
[oota-llvm.git] / lib / IR / Verifier.cpp
index ee3582d00ca53f5846515176efb0a18c529225c7..fcf48c452e2102a04e01af072750699e6700ef6b 100644 (file)
@@ -659,8 +659,9 @@ void Verifier::visitMetadataAsValue(const MetadataAsValue &MDV, Function *F) {
 }
 
 void Verifier::visitMDLocation(const MDLocation &N) {
-  Assert(N.getScope(), "location requires a valid scope", &N);
-  if (auto *IA = N.getInlinedAt())
+  Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
+         "location requires a valid scope", &N, N.getRawScope());
+  if (auto *IA = N.getRawInlinedAt())
     Assert(isa<MDLocation>(IA), "inlined-at should be a location", &N, IA);
 }