REPOSITORY
  rL LLVM

================
Comment at: clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.cpp:27
@@ +26,3 @@
+
+  Finder->addMatcher(
+      memberCallExpr(
----------------
Interestingly, the matcher also matches this code:

  $ cat test.cc
  #include <map>
  #include <memory>
  
  void f() {
    std::map<int, std::unique_ptr<int>> m;
    auto iter = m.begin();
    m.erase(iter++);
  }

  $ clang-tidy test.cc -- -std=c++11
  ...
  test.cc:7:3: warning: this call will remove at most one item even when 
multiple items should be removed [misc-inaccurate-erase]
    m.erase(iter++);
    ^
  ...

I suspect that getQualifiedNameAsString() for std::unique_ptr<>::operator++ is 
matched by the "std::unique" part of the regexp. One possible solution is to 
enclose the regexp in ^$.

http://reviews.llvm.org/D7496

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to