Finder->addMatcher(
memberCallExpr(
- on(hasType(namedDecl(matchesName("std::")))),
+ on(hasType(namedDecl(matchesName("^::std::")))),
callee(methodDecl(hasName("erase"))), argumentCountIs(1),
hasArgument(0, has(callExpr(callee(functionDecl(matchesName(
- "std::(remove_if|remove|unique)"))),
+ "^::std::(remove(_if)?|unique)$"))),
CheckForEndCall).bind("InaccAlgCall"))),
unless(isInTemplateInstantiation())).bind("InaccErase"),
this);
// REQUIRES: shell
namespace std {
-struct vec_iterator {};
+template <typename T> struct vec_iterator {
+ T *ptr;
+ vec_iterator operator++(int);
+};
template <typename T> struct vector {
- typedef vec_iterator iterator;
+ typedef vec_iterator<T> iterator;
iterator begin();
iterator end();
FwIt remove_if(FwIt begin, FwIt end, Func f);
template <typename FwIt> FwIt unique(FwIt begin, FwIt end);
+
+template <typename T> struct unique_ptr {};
} // namespace std
struct custom_iter {};
ERASE(v, 15);
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: this call will remove at most one
// CHECK-FIXES: {{^ }}ERASE(v, 15);{{$}}
+
+ std::vector<std::unique_ptr<int>> vupi;
+ auto iter = vupi.begin();
+ vupi.erase(iter++);
+ // CHECK-FIXES: {{^ }}vupi.erase(iter++);{{$}}
}