From aecab7a93ded1b31097384ad0023e1d0454e59c0 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 7 Apr 2015 01:24:30 +0000 Subject: [PATCH] DebugInfo: Move DIType::is*() queries to MDType Move body of `DIType::isObjectPointer()` (etc.) to `MDType`, and change the versions in `DIType` to forward there. llvm-svn: 234275 --- llvm/include/llvm/IR/DebugInfo.h | 46 +++++++++++--------------------- llvm/include/llvm/IR/DebugInfoMetadata.h | 23 ++++++++++++++++ 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h index 1780232..f182785 100644 --- a/llvm/include/llvm/IR/DebugInfo.h +++ b/llvm/include/llvm/IR/DebugInfo.h @@ -330,36 +330,22 @@ public: // carry this is just plain insane. uint64_t getOffsetInBits() const { return get()->getOffsetInBits(); } unsigned getFlags() const { return get()->getFlags(); } - bool isPrivate() const { - return (getFlags() & FlagAccessibility) == FlagPrivate; - } - bool isProtected() const { - return (getFlags() & FlagAccessibility) == FlagProtected; - } - bool isPublic() const { - return (getFlags() & FlagAccessibility) == FlagPublic; - } - bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; } - bool isAppleBlockExtension() const { - return (getFlags() & FlagAppleBlock) != 0; - } - bool isBlockByrefStruct() const { - return (getFlags() & FlagBlockByrefStruct) != 0; - } - bool isVirtual() const { return (getFlags() & FlagVirtual) != 0; } - bool isArtificial() const { return (getFlags() & FlagArtificial) != 0; } - bool isObjectPointer() const { return (getFlags() & FlagObjectPointer) != 0; } - bool isObjcClassComplete() const { - return (getFlags() & FlagObjcClassComplete) != 0; - } - bool isVector() const { return (getFlags() & FlagVector) != 0; } - bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; } - bool isLValueReference() const { - return (getFlags() & FlagLValueReference) != 0; - } - bool isRValueReference() const { - return (getFlags() & FlagRValueReference) != 0; - } + + bool isPrivate() const { return get()->isPrivate(); } + bool isProtected() const { return get()->isProtected(); } + bool isPublic() const { return get()->isPublic(); } + bool isForwardDecl() const { return get()->isForwardDecl(); } + bool isAppleBlockExtension() const { return get()->isAppleBlockExtension(); } + bool isBlockByrefStruct() const { return get()->isBlockByrefStruct(); } + bool isVirtual() const { return get()->isVirtual(); } + bool isArtificial() const { return get()->isArtificial(); } + bool isObjectPointer() const { return get()->isObjectPointer(); } + bool isObjcClassComplete() const { return get()->isObjcClassComplete(); } + bool isVector() const { return get()->isVector(); } + bool isStaticMember() const { return get()->isStaticMember(); } + bool isLValueReference() const { return get()->isLValueReference(); } + bool isRValueReference() const { return get()->isRValueReference(); } + bool isValid() const { return DbgNode && isa(*this); } }; diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h index ccbc4ee..9cf84af 100644 --- a/llvm/include/llvm/IR/DebugInfoMetadata.h +++ b/llvm/include/llvm/IR/DebugInfoMetadata.h @@ -530,6 +530,29 @@ public: Flags = NewFlags; } + bool isPrivate() const { + return (getFlags() & FlagAccessibility) == FlagPrivate; + } + bool isProtected() const { + return (getFlags() & FlagAccessibility) == FlagProtected; + } + bool isPublic() const { + return (getFlags() & FlagAccessibility) == FlagPublic; + } + bool isForwardDecl() const { return getFlags() & FlagFwdDecl; } + bool isAppleBlockExtension() const { return getFlags() & FlagAppleBlock; } + bool isBlockByrefStruct() const { return getFlags() & FlagBlockByrefStruct; } + bool isVirtual() const { return getFlags() & FlagVirtual; } + bool isArtificial() const { return getFlags() & FlagArtificial; } + bool isObjectPointer() const { return getFlags() & FlagObjectPointer; } + bool isObjcClassComplete() const { + return getFlags() & FlagObjcClassComplete; + } + bool isVector() const { return getFlags() & FlagVector; } + bool isStaticMember() const { return getFlags() & FlagStaticMember; } + bool isLValueReference() const { return getFlags() & FlagLValueReference; } + bool isRValueReference() const { return getFlags() & FlagRValueReference; } + MDTypeRef getRef() const { return MDTypeRef::get(this); } static bool classof(const Metadata *MD) { -- 2.7.4