Add 'getInt64Field()' method to get the signed integer instead of unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169145 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2012-12-03 19:44:25 +00:00
parent b0dcf61252
commit 9127be8a19
2 changed files with 13 additions and 0 deletions

View File

@ -71,6 +71,7 @@ namespace llvm {
return (unsigned)getUInt64Field(Elt);
}
uint64_t getUInt64Field(unsigned Elt) const;
int64_t getInt64Field(unsigned Elt) const;
DIDescriptor getDescriptorField(unsigned Elt) const;
template <typename DescTy>

View File

@ -75,6 +75,18 @@ uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
return 0;
}
int64_t DIDescriptor::getInt64Field(unsigned Elt) const {
if (DbgNode == 0)
return 0;
if (Elt < DbgNode->getNumOperands())
if (ConstantInt *CI
= dyn_cast_or_null<ConstantInt>(DbgNode->getOperand(Elt)))
return CI->getSExtValue();
return 0;
}
DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
if (DbgNode == 0)
return DIDescriptor();