From 8551d25fa909dca97222c56812e19ad37ff1a24b Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 18 Feb 2015 19:46:02 +0000 Subject: [PATCH] IR: isScopeRef() should check isScope() r229733 removed an invalid use of `DIScopeRef`, so now we can enforce that a `DIScopeRef` is actually a scope. llvm-svn: 229734 --- llvm/lib/IR/DebugInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 32521b160a2e..c39c11988a28 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -418,7 +418,9 @@ static bool isScopeRef(const Metadata *MD) { return true; if (auto *S = dyn_cast(MD)) return !S->getString().empty(); - return isa(MD); + if (auto *N = dyn_cast(MD)) + return DIScope(N).isScope(); + return false; } /// \brief Check if a field at position Elt of a MDNode can be a ScopeRef.