From 510ccd20a9169537342a497263f2ccbe564d860e 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229734 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/DebugInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index 32521b160a2..c39c11988a2 100644 --- a/lib/IR/DebugInfo.cpp +++ b/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. -- 2.34.1