From: Devang Patel Date: Fri, 7 May 2010 23:04:32 +0000 (+0000) Subject: Add DINameSpace::Verify(). X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=47e2265a30d0a990839f81315ce6387c09d2c36b;p=oota-llvm.git Add DINameSpace::Verify(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103318 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 0ba0c5a33ee..af4b5f7f144 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -541,6 +541,7 @@ namespace llvm { return F.getCompileUnit(); } unsigned getLineNumber() const { return getUnsignedField(4); } + bool Verify() const; }; /// DILocation - This object holds location information. This object diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 56c9b210222..7bbae59b87a 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -350,6 +350,17 @@ bool DILocation::Verify() const { return DbgNode->getNumOperands() == 4; } +/// Verify - Verify that a namespace descriptor is well formed. +bool DINameSpace::Verify() const { + if (!DbgNode) + return false; + if (getName().empty()) + return false; + if (!getCompileUnit().Verify()) + return false; + return true; +} + /// getOriginalTypeSize - If this type is derived from a base type then /// return base type size. uint64_t DIDerivedType::getOriginalTypeSize() const {