diff options
| author | Manman Ren <manman.ren@gmail.com> | 2013-07-25 19:33:30 +0000 |
|---|---|---|
| committer | Manman Ren <manman.ren@gmail.com> | 2013-07-25 19:33:30 +0000 |
| commit | 587377023819696cc21669e17dfcb228ac942848 (patch) | |
| tree | fa838383bb6a150a069f9d9ac5d813e0cbd8a9d1 /llvm/lib | |
| parent | 02983be252186caf1afb42f54786f5d88420cc13 (diff) | |
| download | bcm5719-llvm-587377023819696cc21669e17dfcb228ac942848.tar.gz bcm5719-llvm-587377023819696cc21669e17dfcb228ac942848.zip | |
Debug Info: improve the verifier to check field types.
Make sure the context field of DIType is MDNode.
Fix testing cases to make them pass the verifier.
llvm-svn: 187150
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index d171fc6c5b3..bbdff5e4831 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -420,6 +420,10 @@ static bool fieldIsMDNode(const MDNode *DbgNode, unsigned Elt) { bool DIType::Verify() const { if (!isType()) return false; + // Make sure Context @ field 2 is MDNode. + if (!fieldIsMDNode(DbgNode, 2)) + return false; + // FIXME: Sink this into the various subclass verifies. unsigned Tag = getTag(); if (!isBasicType() && Tag != dwarf::DW_TAG_const_type && |

