================
@@ -277,23 +277,89 @@ bool isContainerInvalidationMethod(const CXXMethodDecl
&MD) {
if (!isInStlNamespace(RD))
return false;
- StringRef ContainerName = getName(*RD);
- static const llvm::StringSet<> Containers = {
- // Sequence
- "vector", "basic_string", "deque",
- // Adaptors
- // FIXME: Add queue and stack and check for underlying container (e.g. no
- // invalidation for std::list).
- "priority_queue",
- // Associative
- "set", "multiset", "map", "multimap",
- // Unordered Associative
- "unordered_set", "unordered_multiset", "unordered_map",
- "unordered_multimap",
- // C++23 Flat
- "flat_map", "flat_set", "flat_multimap", "flat_multiset"};
-
- if (!Containers.contains(ContainerName))
+ // `pop_back` is excluded: it only invalidates references to the removed
+ // element, not to other elements.
+ // https://en.cppreference.com/w/cpp/container/vector/pop_back.html
----------------
Xazax-hun wrote:
I don't think we need links to cppreference. We sometimes have references to
the C++ standard directly but I think we do not need any references in this
case.
https://github.com/llvm/llvm-project/pull/183000
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits