[llvm] r229734 - IR: isScopeRef() should check isScope()

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Feb 18 11:46:02 PST 2015


Author: dexonsmith
Date: Wed Feb 18 13:46:02 2015
New Revision: 229734

URL: http://llvm.org/viewvc/llvm-project?rev=229734&view=rev
Log:
IR: isScopeRef() should check isScope()

r229733 removed an invalid use of `DIScopeRef`, so now we can enforce
that a `DIScopeRef` is actually a scope.

Modified:
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=229734&r1=229733&r2=229734&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Feb 18 13:46:02 2015
@@ -418,7 +418,9 @@ static bool isScopeRef(const Metadata *M
     return true;
   if (auto *S = dyn_cast<MDString>(MD))
     return !S->getString().empty();
-  return isa<MDNode>(MD);
+  if (auto *N = dyn_cast<MDNode>(MD))
+    return DIScope(N).isScope();
+  return false;
 }
 
 /// \brief Check if a field at position Elt of a MDNode can be a ScopeRef.





More information about the llvm-commits mailing list