[PATCH] D96045: [llvm-dwarfdump][locstats] Unify handling of inlined vars with no loc

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 09:59:39 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/tools/llvm-dwarfdump/Statistics.cpp:653-655
+          InlinedVars.erase(std::remove(InlinedVars.begin(), InlinedVars.end(),
+                                        (*OffsetVar).getRawUValue()),
+                            InlinedVars.end());
----------------
jmorse wrote:
> Isn't this "removing" twice, once with std::remove, the other with the erase method?
Ah the joys of C++. This code is correct and an application of the classic "erase remove" idiom ( https://en.wikipedia.org/wiki/Erase%E2%80%93remove_idiom ).

Though we do have an llmv wrapper that tidies this up a bit, llvm::erase_if and llvm::erase_value


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96045/new/

https://reviews.llvm.org/D96045



More information about the llvm-commits mailing list