summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugInfoMetadata.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-07 03:49:59 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-07 03:49:59 +0000
commit86cc3324621ee6842f8b7955183e7342e374e7af (patch)
treef0f11d6ccf6c902a7c0ea2649bfc0fe34a500642 /llvm/lib/IR/DebugInfoMetadata.cpp
parent76c9184434877b55412c98ab50c9c9676fb8a4da (diff)
downloadbcm5719-llvm-86cc3324621ee6842f8b7955183e7342e374e7af.tar.gz
bcm5719-llvm-86cc3324621ee6842f8b7955183e7342e374e7af.zip
DebugInfo: Move DIExpression bit-piece API to MDExpression
llvm-svn: 234286
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 190a31d5551..6ce091f54d1 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -445,6 +445,24 @@ bool MDExpression::isValid() const {
return true;
}
+bool MDExpression::isBitPiece() const {
+ assert(isValid() && "Expected valid expression");
+ if (unsigned N = getNumElements())
+ if (N >= 3)
+ return getElement(N - 3) == dwarf::DW_OP_bit_piece;
+ return false;
+}
+
+uint64_t MDExpression::getBitPieceOffset() const {
+ assert(isBitPiece() && "Expected bit piece");
+ return getElement(getNumElements() - 2);
+}
+
+uint64_t MDExpression::getBitPieceSize() const {
+ assert(isBitPiece() && "Expected bit piece");
+ return getElement(getNumElements() - 1);
+}
+
MDObjCProperty *MDObjCProperty::getImpl(
LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
MDString *GetterName, MDString *SetterName, unsigned Attributes,
OpenPOWER on IntegriCloud