diff options
| author | Devang Patel <dpatel@apple.com> | 2010-03-08 20:52:55 +0000 | 
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2010-03-08 20:52:55 +0000 | 
| commit | 3c91b05d2b1751b9e4e21fd958d358ec463dcd3c (patch) | |
| tree | c2ab35e6538f5c1bab0cb971317a571c87c81b93 /include/llvm | |
| parent | ccb4f2d813380d8cf139062b8c829e4b8b322c0d (diff) | |
| download | external_llvm-3c91b05d2b1751b9e4e21fd958d358ec463dcd3c.zip external_llvm-3c91b05d2b1751b9e4e21fd958d358ec463dcd3c.tar.gz external_llvm-3c91b05d2b1751b9e4e21fd958d358ec463dcd3c.tar.bz2 | |
Avoid using DIDescriptor.isNull(). 
This is a first step towards eliminating checks in Descriptor constructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97975 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
| -rw-r--r-- | include/llvm/Analysis/DebugInfo.h | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index f105c20..f1826e5 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -68,6 +68,7 @@ namespace llvm {      explicit DIDescriptor(MDNode *N) : DbgNode(N) {}      bool isNull() const { return DbgNode == 0; } +    bool Verify() const { return DbgNode != 0; }      MDNode *getNode() const { return DbgNode; } @@ -246,7 +247,9 @@ namespace llvm {      bool isArtificial() const {        return (getFlags() & FlagArtificial) != 0;      } - +    bool isValid() const { +      return DbgNode && (isBasicType() || isDerivedType() || isCompositeType()); +    }      /// dump - print type.      void dump() const;    }; @@ -360,7 +363,7 @@ namespace llvm {      /// DIType or as DICompositeType.      StringRef getReturnTypeName() const {        DICompositeType DCT(getFieldAs<DICompositeType>(8)); -      if (!DCT.isNull()) { +      if (DCT.Verify()) {          DIArray A = DCT.getTypeArray();          DIType T(A.getElement(0).getNode());          return T.getName(); @@ -494,6 +497,7 @@ namespace llvm {      DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }      StringRef getFilename() const    { return getScope().getFilename(); }      StringRef getDirectory() const   { return getScope().getDirectory(); } +    bool Verify() const;    };    /// DIFactory - This object assists with the construction of the various | 
