diff options
| author | Devang Patel <dpatel@apple.com> | 2010-03-08 18:25:48 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2010-03-08 18:25:48 +0000 |
| commit | d8cc5d5256e79a74188dfef5a12d43127330dad3 (patch) | |
| tree | 101754d10f06c31c00dc93aacdba0b2b466ce139 /include/llvm | |
| parent | fab4a25d46cdd178c20e6a8029a2eed10f61f0ba (diff) | |
| download | external_llvm-d8cc5d5256e79a74188dfef5a12d43127330dad3.zip external_llvm-d8cc5d5256e79a74188dfef5a12d43127330dad3.tar.gz external_llvm-d8cc5d5256e79a74188dfef5a12d43127330dad3.tar.bz2 | |
Avoid using DIDescriptor.isNull().
This is a first step towards eliminating unncessary constructor checks in light weight DIDescriptor wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
| -rw-r--r-- | include/llvm/Analysis/DebugInfo.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index f105c20..14c3e1b 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -67,7 +67,7 @@ namespace llvm { explicit DIDescriptor() : DbgNode(0) {} 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 +246,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 +362,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 +496,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 |
