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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187844 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp
index 0b15412..ab03861 100644
--- a/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -122,6 +122,18 @@
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, ' ');