diff options
| author | Fangrui Song <maskray@google.com> | 2019-03-27 09:38:05 +0000 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-03-27 09:38:05 +0000 |
| commit | 3f2e29b013722e129b470fb62a071d05fdcff468 (patch) | |
| tree | 8afe36485bd854fe18d1b4b3b2cb961ef4c87051 /llvm/lib | |
| parent | 38a4c619eb80ed46425c5b0358f015514971f3da (diff) | |
| download | bcm5719-llvm-3f2e29b013722e129b470fb62a071d05fdcff468.tar.gz bcm5719-llvm-3f2e29b013722e129b470fb62a071d05fdcff468.zip | |
[DWARF] Add D to Seen early to avoid duplicate elements in Worklist
llvm-svn: 357054
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 4a837cd3526..3015ce2e94b 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -396,6 +396,7 @@ DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const { // DWARF. This corresponds to following the DW_AT_abstract_origin and // DW_AT_specification just once. SmallSet<DWARFDie, 3> Seen; + Seen.insert(*this); while (!Worklist.empty()) { DWARFDie Die = Worklist.back(); @@ -404,19 +405,16 @@ DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const { if (!Die.isValid()) continue; - if (Seen.count(Die)) - continue; - - Seen.insert(Die); - if (auto Value = Die.find(Attrs)) return Value; if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin)) - Worklist.push_back(D); + if (Seen.insert(D).second) + Worklist.push_back(D); if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification)) - Worklist.push_back(D); + if (Seen.insert(D).second) + Worklist.push_back(D); } return None; |

