summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-08-07 01:18:33 +0000
committerEric Christopher <echristo@gmail.com>2013-08-07 01:18:33 +0000
commit8552e22b076fbd2f53793ef57de392f4f42696a5 (patch)
tree23f4aaaf3717ff20e11de213cf231b2d8f6ce13e /llvm/lib/CodeGen/AsmPrinter/DIE.cpp
parentaf15f8dd5a4c73acb8fad42e5a5337b4b488f5ab (diff)
downloadbcm5719-llvm-8552e22b076fbd2f53793ef57de392f4f42696a5.tar.gz
bcm5719-llvm-8552e22b076fbd2f53793ef57de392f4f42696a5.zip
Add a way to grab a particular attribute out of a DIE.
Use it when we're looking for a string in particular. Update comments as well. llvm-svn: 187844
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 0b154123315..ab03861f9dd 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -122,6 +122,18 @@ DIE *DIE::getCompileUnit() {
llvm_unreachable("We should not have orphaned DIEs.");
}
+DIEValue *DIE::findAttribute(unsigned Attribute) {
+ const SmallVectorImpl<DIEValue *> &Values = getValues();
+ const DIEAbbrev &Abbrevs = getAbbrev();
+
+ // Iterate through all the attributes until we find the one we're
+ // looking for, if we can't find it return NULL.
+ for (size_t i = 0; i < Values.size(); ++i)
+ if (Abbrevs.getData()[i].getAttribute() == Attribute)
+ return Values[i];
+ return NULL;
+}
+
#ifndef NDEBUG
void DIE::print(raw_ostream &O, unsigned IndentCount) const {
const std::string Indent(IndentCount, ' ');
OpenPOWER on IntegriCloud