aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-06-28 00:41:44 +0000
committerBill Wendling <isanbard@gmail.com>2012-06-28 00:41:44 +0000
commit58a6cf2c620ce4c127b926408d78aa607a373251 (patch)
tree6fc28bb8139222cbd98531a5897919cc1ac1c4fc /lib/VMCore
parentd7df6cf8d0ad965499a993836704afdfae6f2e52 (diff)
downloadexternal_llvm-58a6cf2c620ce4c127b926408d78aa607a373251.zip
external_llvm-58a6cf2c620ce4c127b926408d78aa607a373251.tar.gz
external_llvm-58a6cf2c620ce4c127b926408d78aa607a373251.tar.bz2
Use the interface through DIDescriptor to get the tag/version for a debug info
MDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 9147b63..99e2687 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -20,6 +20,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/CallingConv.h"
#include "llvm/Constants.h"
+#include "llvm/DebugInfo.h"
#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/IntrinsicInst.h"
@@ -2031,20 +2032,21 @@ static void WriteMDNodeComment(const MDNode *Node,
formatted_raw_ostream &Out) {
if (Node->getNumOperands() < 1)
return;
- ConstantInt *CI = dyn_cast_or_null<ConstantInt>(Node->getOperand(0));
- if (!CI) return;
- APInt Val = CI->getValue();
- APInt Tag = Val & ~APInt(Val.getBitWidth(), LLVMDebugVersionMask);
- if (Val.ult(LLVMDebugVersion11))
+
+ Value *Op = Node->getOperand(0);
+ if (!Op || !isa<ConstantInt>(Op) || cast<ConstantInt>(Op)->getBitWidth() < 32)
+ return;
+
+ DIDescriptor Desc(Node);
+ if (Desc.getVersion() < LLVMDebugVersion11)
return;
+ unsigned Tag = Desc.getTag();
Out.PadToColumn(50);
if (Tag == dwarf::DW_TAG_user_base)
Out << "; [ DW_TAG_user_base ]";
- else if (Tag.isIntN(32)) {
- if (const char *TagName = dwarf::TagString(Tag.getZExtValue()))
- Out << "; [ " << TagName << " ]";
- }
+ else if (const char *TagName = dwarf::TagString(Tag))
+ Out << "; [ " << TagName << " ]";
}
void AssemblyWriter::writeAllMDNodes() {