[llvm-commits] [llvm] r169145 - in /llvm/trunk: include/llvm/DebugInfo.h lib/VMCore/DebugInfo.cpp
Bill Wendling
isanbard at gmail.com
Mon Dec 3 11:44:25 PST 2012
Author: void
Date: Mon Dec 3 13:44:25 2012
New Revision: 169145
URL: http://llvm.org/viewvc/llvm-project?rev=169145&view=rev
Log:
Add 'getInt64Field()' method to get the signed integer instead of unsigned.
Modified:
llvm/trunk/include/llvm/DebugInfo.h
llvm/trunk/lib/VMCore/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=169145&r1=169144&r2=169145&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Mon Dec 3 13:44:25 2012
@@ -71,6 +71,7 @@
return (unsigned)getUInt64Field(Elt);
}
uint64_t getUInt64Field(unsigned Elt) const;
+ int64_t getInt64Field(unsigned Elt) const;
DIDescriptor getDescriptorField(unsigned Elt) const;
template <typename DescTy>
Modified: llvm/trunk/lib/VMCore/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DebugInfo.cpp?rev=169145&r1=169144&r2=169145&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/DebugInfo.cpp (original)
+++ llvm/trunk/lib/VMCore/DebugInfo.cpp Mon Dec 3 13:44:25 2012
@@ -75,6 +75,18 @@
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();
More information about the llvm-commits
mailing list