[PATCH] Fix UseAuto not transforming iterators when non-fully qualified names are used and libc++.

Guillaume Papin guillaume.papin at epitech.eu
Wed Jul 10 10:49:46 PDT 2013

  > Guillaume, I decided not to include the test you suggested since it fails, but the reason is not the the inline problem because if I don't use macros it works just fine, there's a test in iterator.cpp for std::vector. I'll log another bug for that.

  I don't see `USE_INLINE_NAMESPACE=1` in //iterator.cpp//, so I don't think it tests the bug.

  What about this test?

    // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
    // RUN: cpp11-migrate -use-auto %t.cpp -- --std=c++11 -I %S/Inputs
    // RUN: FileCheck -input-file=%t.cpp %s


    #define CONTAINER vector
    #include "test_std_container.h"
    #undef CONTAINER

    void f() {
      using namespace std;

      vector<int> std_vec;
      vector<int>::iterator I = std_vec.begin();
      // CHECK: auto I = std_vec.begin();

  > As for the matchers, hasStdContainerName and isFromStdNamespace can be combined but I think it is a better idea to have them separated. What do you think?

  I think so too. Something similar will be needed for some future matchers dealing with STL types, so I IMHO if `isFromStdNamespace()` doesn't fit we should change it instead of re-implementing the logic.

  Apart from the test case it looks good to me.

Comment at: cpp11-migrate/UseAuto/UseAutoMatchers.cpp:237
@@ -210,3 +236,3 @@
I'm not sure if this part is still needed but I don't think it hurts either.


More information about the cfe-commits mailing list