diff --git a/cpp11-migrate/Core/CustomMatchers.h b/cpp11-migrate/Core/CustomMatchers.h
new file mode 100644
index 0000000..586c53a
--- /dev/null
+++ b/cpp11-migrate/Core/CustomMatchers.h
@@ -0,0 +1,59 @@
+//===-- Core/PerfSupport.h - Perf measurement helpers -----------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief This file provides custom matchers to be used by different
+/// transforms that requier the same matchers.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef CPP11_MIGRATE_CUSTOMMATCHERS_H
+#define CPP11_MIGRATE_CUSTOMMATCHERS_H
+
+#include "clang/ASTMatchers/ASTMatchers.h"
+
+namespace clang {
+namespace ast_matchers {
+
+/// \brief Matches declarations whose declaration context is the C++ standard
+/// library namespace \c std.
+///
+/// Note that inline namespaces are silently ignored during the lookup since
+/// both libstdc++ and libc++ are known to use them for versioning purposes.
+///
+/// Given
+/// \code
+///   namespace ns {
+///     struct my_type {};
+///     using namespace std;
+///   }
+///
+///   using std::vector;
+///   using ns::my_type;
+///   using ns::list;
+/// \endcode
+/// usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(isFromStdNamespace())))
+///   matches "using std::vector" and "using ns::list".
+AST_MATCHER(Decl, isFromStdNamespace) {
+  const DeclContext *D = Node.getDeclContext();
+
+  while (D->isInlineNamespace())
+    D = D->getParent();
+
+  if (!D->isNamespace() || !D->getParent()->isTranslationUnit())
+    return false;
+
+  const IdentifierInfo *Info = cast<NamespaceDecl>(D)->getIdentifier();
+
+  return Info && Info->isStr("std");
+}
+} // namespace ast_matchers
+} // namespace clang
+
+#endif // CPP11_MIGRATE_CUSTOMMATCHERS_H
diff --git a/cpp11-migrate/ReplaceAutoPtr/ReplaceAutoPtrMatchers.cpp b/cpp11-migrate/ReplaceAutoPtr/ReplaceAutoPtrMatchers.cpp
index 1115229..e03a2c3 100644
--- a/cpp11-migrate/ReplaceAutoPtr/ReplaceAutoPtrMatchers.cpp
+++ b/cpp11-migrate/ReplaceAutoPtr/ReplaceAutoPtrMatchers.cpp
@@ -1,113 +1,81 @@
 //===-- ReplaceAutoPtrMatchers.cpp -- std::auto_ptr replacement -----------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 ///
 /// \file
 /// \brief This file contains the definitions for matcher-generating functions
 /// and names for bound nodes found by AST matchers.
 ///
 //===----------------------------------------------------------------------===//
 
 #include "ReplaceAutoPtrMatchers.h"
+#include "Core/CustomMatchers.h"
 
 const char *AutoPtrTokenId = "AutoPtrTokenId";
 const char *AutoPtrOwnershipTransferId = "AutoPtrOwnershipTransferId";
 
 namespace clang {
 namespace ast_matchers {
 
 /// \brief Matches expressions that are lvalues.
 ///
 /// In the following example, a[0] matches expr(isLValue()):
 /// \code
 ///     std::string a[2];
 ///     std::string b;
 ///     b = a[0];
 ///     b = "this string won't match";
 /// \endcode
 AST_MATCHER(Expr, isLValue) {
   return Node.getValueKind() == VK_LValue;
 }
 
-/// \brief Matches declarations whose declaration context is the C++ standard
-/// library namespace \c std.
-///
-/// Note that inline namespaces are silently ignored during the lookup since
-/// both libstdc++ and libc++ are known to use them for versioning purposes.
-///
-/// Given
-/// \code
-///   namespace ns {
-///     struct my_type {};
-///     using namespace std;
-///   }
-///
-///   using std::vector;
-///   using ns::my_type;
-///   using ns::list;
-/// \endcode
-/// usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(isFromStdNamespace())))
-///   matches "using std::vector" and "using ns::list".
-AST_MATCHER(Decl, isFromStdNamespace) {
-  const DeclContext *D = Node.getDeclContext();
-
-  while (D->isInlineNamespace())
-    D = D->getParent();
-
-  if (!D->isNamespace() || !D->getParent()->isTranslationUnit())
-    return false;
-
-  const IdentifierInfo *Info = cast<NamespaceDecl>(D)->getIdentifier();
-
-  return Info && Info->isStr("std");
-}
-
 } // end namespace ast_matchers
 } // end namespace clang
 
 using namespace clang;
 using namespace clang::ast_matchers;
 
 // shared matchers
 static DeclarationMatcher AutoPtrDecl =
     recordDecl(hasName("auto_ptr"), isFromStdNamespace());
 
 static TypeMatcher AutoPtrType = qualType(hasDeclaration(AutoPtrDecl));
 
 // Matcher that finds expressions that are candidates to be wrapped with
 // 'std::move()'.
 //
 // Binds the id \c AutoPtrOwnershipTransferId to the expression.
 static StatementMatcher MovableArgumentMatcher = expr(
     allOf(isLValue(), hasType(AutoPtrType))).bind(AutoPtrOwnershipTransferId);
 
 TypeLocMatcher makeAutoPtrTypeLocMatcher() {
   // skip elaboratedType() as the named type will match soon thereafter.
   return typeLoc(loc(qualType(AutoPtrType, unless(elaboratedType()))))
       .bind(AutoPtrTokenId);
 }
 
 DeclarationMatcher makeAutoPtrUsingDeclMatcher() {
   return usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(
       allOf(hasName("auto_ptr"), isFromStdNamespace())))).bind(AutoPtrTokenId);
 }
 
 StatementMatcher makeTransferOwnershipExprMatcher() {
   StatementMatcher assignOperator =
     operatorCallExpr(allOf(
       hasOverloadedOperatorName("="),
       callee(methodDecl(ofClass(AutoPtrDecl))),
       hasArgument(1, MovableArgumentMatcher)));
 
   StatementMatcher copyCtor =
     constructExpr(allOf(hasType(AutoPtrType),
                         argumentCountIs(1),
                         hasArgument(0, MovableArgumentMatcher)));
 
   return anyOf(assignOperator, copyCtor);
 }
diff --git a/cpp11-migrate/UseAuto/UseAutoMatchers.cpp b/cpp11-migrate/UseAuto/UseAutoMatchers.cpp
index a4ada5a..4f314ad 100644
--- a/cpp11-migrate/UseAuto/UseAutoMatchers.cpp
+++ b/cpp11-migrate/UseAuto/UseAutoMatchers.cpp
@@ -1,287 +1,280 @@
 //===-- UseAutoMatchers.cpp - Matchers for use-auto transform -------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 ///
 /// \file
 /// \brief This file contains the implementation for matcher-generating
 /// functions and custom AST_MATCHERs.
 ///
 //===----------------------------------------------------------------------===//
 
 #include "UseAutoMatchers.h"
+#include "Core/CustomMatchers.h"
 #include "clang/AST/ASTContext.h"
 
 using namespace clang::ast_matchers;
 using namespace clang;
 
 const char *IteratorDeclStmtId = "iterator_decl";
 const char *DeclWithNewId = "decl_new";
 const char *NewExprId = "new_expr";
 
 namespace clang {
 namespace ast_matchers {
 
 /// \brief Matches variable declarations that have explicit initializers that
 /// are not initializer lists.
 ///
 /// Given
 /// \code
 ///   iterator I = Container.begin();
 ///   MyType A(42);
 ///   MyType B{2};
 ///   MyType C;
 /// \endcode
 /// varDecl(hasWrittenNonListInitializer()) matches \c I and \c A but not \c B
 /// or \c C.
 AST_MATCHER(VarDecl, hasWrittenNonListInitializer) {
   const Expr *Init = Node.getAnyInitializer();
   if (!Init)
     return false;
 
   // The following test is based on DeclPrinter::VisitVarDecl() to find if an
   // initializer is implicit or not.
   bool ImplicitInit = false;
   if (const CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init)) {
     if (Construct->isListInitialization())
       return false;
     ImplicitInit = Construct->getNumArgs() == 0 ||
                    Construct->getArg(0)->isDefaultArgument();
   } else
     if (Node.getInitStyle() == VarDecl::ListInit)
       return false;
 
   return !ImplicitInit;
 }
 
 /// \brief Matches QualTypes that are type sugar for QualTypes that match \c
 /// SugarMatcher.
 ///
 /// Given
 /// \code
 ///   class C {};
 ///   typedef C my_type
 ///   typedef my_type my_other_type;
 /// \endcode
 ///
 /// \c qualType(isSugarFor(recordType(hasDeclaration(namedDecl(hasName("C"))))))
 /// matches \c my_type and \c my_other_type.
 AST_MATCHER_P(QualType, isSugarFor, internal::Matcher<QualType>, SugarMatcher) {
   QualType QT = Node;
   for (;;) {
     if (SugarMatcher.matches(QT, Finder, Builder))
       return true;
 
     QualType NewQT = QT.getSingleStepDesugaredType(Finder->getASTContext());
     if (NewQT == QT)
       break;
     QT = NewQT;
   }
   return false;
 }
 
 /// \brief Matches named declarations that have one of the standard iterator
 /// names: iterator, reverse_iterator, const_iterator, const_reverse_iterator.
 ///
 /// Given
 /// \code
 /// iterator I;
 /// const_iterator CI;
 /// \endcode
 ///
 /// \c namedDecl(hasStdIteratorName()) matches \c I and \c CI.
 AST_MATCHER(NamedDecl, hasStdIteratorName) {
   static const char *IteratorNames[] = {
     "iterator",
     "reverse_iterator",
     "const_iterator",
     "const_reverse_iterator"
   };
 
   for (unsigned int i = 0;
        i < llvm::array_lengthof(IteratorNames);
        ++i) {
     if (hasName(IteratorNames[i]).matches(Node, Finder, Builder))
       return true;
   }
   return false;
 }
 
 /// \brief Matches named declarations that have one of the standard container
 /// names.
 ///
 /// Given
 /// \code
 /// class vector {};
 /// class forward_list {};
 /// class my_vec {};
 /// \endcode
 ///
 /// \c recordDecl(hasStdContainerName()) matches \c vector and \c forward_list
 /// but not \c my_vec.
-AST_MATCHER_P(NamedDecl, hasStdContainerName, bool, WithStd) {
+AST_MATCHER(NamedDecl, hasStdContainerName) {
   static const char *ContainerNames[] = {
     "array",
     "deque",
     "forward_list",
     "list",
     "vector",
 
     "map",
     "multimap",
     "set",
     "multiset",
 
     "unordered_map",
     "unordered_multimap",
     "unordered_set",
     "unordered_multiset",
 
     "queue",
     "priority_queue",
     "stack"
   };
 
-  for (unsigned int i = 0;
-       i < llvm::array_lengthof(ContainerNames);
-       ++i) {
-    std::string Name(ContainerNames[i]);
-    if (WithStd)
-      Name = "std::" + Name;
-    if (hasName(Name).matches(Node, Finder, Builder))
+  for (unsigned int i = 0; i < llvm::array_lengthof(ContainerNames); ++i) {
+    if (hasName(ContainerNames[i]).matches(Node, Finder, Builder))
       return true;
   }
   return false;
 }
 
 } // namespace ast_matchers
 } // namespace clang
 
 namespace {
 // \brief Returns a TypeMatcher that matches typedefs for standard iterators
 // inside records with a standard container name.
 TypeMatcher typedefIterator() {
   return typedefType(
            hasDeclaration(
              allOf(
                namedDecl(hasStdIteratorName()),
                hasDeclContext(
-                 recordDecl(hasStdContainerName(true))
+                 recordDecl(hasStdContainerName(), isFromStdNamespace())
                )
              )
            )
          );
 }
 
 // \brief Returns a TypeMatcher that matches records named for standard
 // iterators nested inside records named for standard containers.
 TypeMatcher nestedIterator() {
   return recordType(
            hasDeclaration(
              allOf(
                namedDecl(hasStdIteratorName()),
                hasDeclContext(
-                 recordDecl(hasStdContainerName(true))
+                 recordDecl(hasStdContainerName(), isFromStdNamespace())
                )
              )
            )
          );
 }
 
 // \brief Returns a TypeMatcher that matches types declared with using
 // declarations and which name standard iterators for standard containers.
 TypeMatcher iteratorFromUsingDeclaration() {
   // Types resulting from using declarations are
   // represented by ElaboratedType.
   return elaboratedType(
            allOf(
              // Unwrap the nested name specifier to test for
              // one of the standard containers.
-             hasQualifier(allOf(
+             hasQualifier(
                specifiesType(
                  templateSpecializationType(
                    hasDeclaration(
-                     namedDecl(hasStdContainerName(false))
+                     namedDecl(hasStdContainerName(), isFromStdNamespace())
                    )
                  )
-               ),
-               hasPrefix(
-                 specifiesNamespace(hasName("std"))
                )
-             )),
+             ),
              // The named type is what comes after the final
              // '::' in the type. It should name one of the
              // standard iterator names.
              namesType(anyOf(
                typedefType(
                  hasDeclaration(
                    namedDecl(hasStdIteratorName())
                  )
                ),
                recordType(
                  hasDeclaration(
                    namedDecl(hasStdIteratorName())
                  )
                )
              ))
            )
          );
 }
 } // namespace
 
 // \brief This matcher returns delaration statements that contain variable
 // declarations with written non-list initializer for standard iterators.
 StatementMatcher makeIteratorDeclMatcher() {
   return declStmt(
     // At least one varDecl should be a child of the declStmt to ensure it's a
     // declaration list and avoid matching other declarations
     // e.g. using directives.
     has(varDecl()),
     unless(has(varDecl(
       anyOf(
         unless(hasWrittenNonListInitializer()),
         hasType(autoType()),
         unless(hasType(
           isSugarFor(
             anyOf(
               typedefIterator(),
               nestedIterator(),
               iteratorFromUsingDeclaration()
             )
           )
         ))
       )
     )))
   ).bind(IteratorDeclStmtId);
 }
 
 StatementMatcher makeDeclWithNewMatcher() {
   return declStmt(
     has(varDecl()),
     unless(has(varDecl(
       anyOf(
         unless(hasInitializer(
           ignoringParenImpCasts(newExpr())
         )),
         // FIXME: TypeLoc information is not reliable where CV qualifiers are
         // concerned so these types can't be handled for now.
         hasType(pointerType(pointee(hasCanonicalType(hasLocalQualifiers())))),
 
         // FIXME: Handle function pointers. For now we ignore them because
         // the replacement replaces the entire type specifier source range
         // which includes the identifier.
         hasType(
           pointsTo(
             pointsTo(
               parenType(innerType(functionType()))
             )
           )
         )
       )
     )))
    ).bind(DeclWithNewId);
 }
diff --git a/test/cpp11-migrate/UseAuto/Inputs/test_std_container.h b/test/cpp11-migrate/UseAuto/Inputs/test_std_container.h
index a856c45..5c92f6e 100644
--- a/test/cpp11-migrate/UseAuto/Inputs/test_std_container.h
+++ b/test/cpp11-migrate/UseAuto/Inputs/test_std_container.h
@@ -1,120 +1,119 @@
 //===-----------------------------------------------------------*- C++ -*--===//
 //
 // This file contains a shell implementation of a standard container with
 // iterators. This shell is targeted at supporting the container interfaces
 // recognized by cpp11-migrate's use-auto transformation. It requires the
 // preprocessor to parameterize the name of the container, and allows the
 // preprocessor to parameterize various mechanisms used in the implementation
 // of the container / iterator.
 //
 // Variations for how iterator types are presented:
 // * Typedef (array, deque, forward_list, list, vector)
 // * Nested class (map, multimap, set, multiset)
 // * Using declaration {unordered_} X {map, multimap, set, multiset}
 //
 // Variations for how container types are presented:
 // * Defined directly in namespace std
 // * Imported into namespace std with using declarations (a la libc++).
 //
 //===----------------------------------------------------------------------===//
 
 #ifndef CONTAINER
 #error You must define CONTAINER to the name of the desired container.
 #endif
 
 // If the test code needs multiple containers, only define our helpers once.
 #ifndef TEST_STD_CONTAINER_HELPERS
 #define TEST_STD_CONTAINER_HELPERS
 
 namespace internal {
 
 template <typename T, int i>
 struct iterator_wrapper {
   iterator_wrapper() {}
 
   // These are required for tests using iteration statements.
   bool operator!=(const iterator_wrapper<T, i>&) { return false; }
   iterator_wrapper& operator++() { return *this; }
   typename T::value_type operator*() { return typename T::value_type(); }
 };
 
 template <typename T>
 class iterator_provider {
 public:
   class iterator {
   public:
     iterator() {}
     iterator(const iterator&) {}
   };
   class const_iterator {
   public:
     const_iterator(int i=0) {}
     const_iterator(const iterator &) {}
     const_iterator(const const_iterator &) {}
     operator iterator() { return iterator(); }
   };
   class reverse_iterator {};
   class const_reverse_iterator {};
 };
 
 } // namespace internal
 
 #endif // TEST_STD_CONTAINER_HELPERS
 
 namespace std {
 
 #if USE_INLINE_NAMESPACE
-namespace _1 {
+inline namespace _1 {
 #endif
 
 template <typename T>
 class CONTAINER
 #if USE_BASE_CLASS_ITERATORS
   : internal::iterator_provider<CONTAINER<T> >
 #endif
 {
 public:
 
 #if USE_BASE_CLASS_ITERATORS
   using typename internal::iterator_provider<CONTAINER<T> >::iterator;
   using typename internal::iterator_provider<CONTAINER<T> >::const_iterator;
   using typename internal::iterator_provider<CONTAINER<T> >::reverse_iterator;
   using typename internal::iterator_provider<CONTAINER<T> >::const_reverse_iterator;
 #elif USE_INNER_CLASS_ITERATORS
   class iterator {};
   class const_iterator {};
   class reverse_iterator {};
   class const_reverse_iterator {};
 #else
   typedef T value_type;
   typedef typename internal::iterator_wrapper<CONTAINER<T>, 0> iterator;
   typedef typename internal::iterator_wrapper<CONTAINER<T>, 1> const_iterator;
   typedef typename internal::iterator_wrapper<CONTAINER<T>, 3> reverse_iterator;
   typedef typename internal::iterator_wrapper<CONTAINER<T>, 2> const_reverse_iterator;
 #endif
 
   // Every class requires these functions.
   CONTAINER() {}
 
   iterator begin() { return iterator(); }
   iterator end() { return iterator(); }
 
   const_iterator begin() const { return const_iterator(); }
   const_iterator end() const { return const_iterator(); }
 
   reverse_iterator rbegin() { return reverse_iterator(); }
   reverse_iterator rend() { return reverse_iterator(); }
 
   const_reverse_iterator rbegin() const { return const_reverse_iterator(); }
   const_reverse_iterator rend() const { return const_reverse_iterator(); }
 
   template <typename K>
   iterator find(const K &Key) { return iterator(); }
 };
 
 #if USE_INLINE_NAMESPACE
 } // namespace _1
-using _1::CONTAINER;
 #endif
 
 } // namespace std
diff --git a/test/cpp11-migrate/UseAuto/basic_iterator_tests.cpp b/test/cpp11-migrate/UseAuto/basic_iterator_tests.cpp
index 03779a6..30199e9 100644
--- a/test/cpp11-migrate/UseAuto/basic_iterator_tests.cpp
+++ b/test/cpp11-migrate/UseAuto/basic_iterator_tests.cpp
@@ -1,123 +1,123 @@
 // This file contains basic positive tests for the use-auto transform's ability
 // to replace standard iterators. Variables considered:
 // * All std container names
 // * All std iterator names
 // * Different patterns of defining iterators and containers
 //
 // // The most basic test.
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=array -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 //
 // Test variations on how the container and its iterators might be defined.
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=array \
-// RUN:   -DUSE_INLINE_NAMESPACE -I %S/Inputs
+// RUN:   -DUSE_INLINE_NAMESPACE=1 -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=array \
-// RUN:   -DUSE_BASE_CLASS_ITERATORS -I %S/Inputs
+// RUN:   -DUSE_BASE_CLASS_ITERATORS=1 -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=array \
-// RUN:   -DUSE_INNER_CLASS_ITERATORS -I %S/Inputs
+// RUN:   -DUSE_INNER_CLASS_ITERATORS=1 -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 //
 // Test all of the other container names in a basic configuration.
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=deque -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=forward_list -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=list -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=vector -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=map -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=multimap -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=set -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=multiset -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=unordered_map -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=unordered_multimap -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=unordered_set -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=unordered_multiset -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=queue -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=priority_queue -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 //
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
 // RUN: cpp11-migrate -use-auto %t.cpp -- -DCONTAINER=stack -I %S/Inputs
 // RUN: FileCheck -input-file=%t.cpp %s
 
 #ifndef CONTAINER
 #error You must define CONTAINER to the name of the container for testing.
 #endif
 
 #include "test_std_container.h"
 
 int main(int argc, char **argv) {
   {
     std::CONTAINER<int> C;
     std::CONTAINER<int>::iterator I = C.begin();
     // CHECK: auto I = C.begin();
   }
   {
     std::CONTAINER<int> C;
     std::CONTAINER<int>::reverse_iterator I = C.rbegin();
     // CHECK: auto I = C.rbegin();
   }
   {
     const std::CONTAINER<int> C;
     std::CONTAINER<int>::const_iterator I = C.begin();
     // CHECK: auto I = C.begin();
   }
   {
     const std::CONTAINER<int> C;
     std::CONTAINER<int>::const_reverse_iterator I = C.rbegin();
     // CHECK: auto I = C.rbegin();
   }
 
   return 0;
 }
diff --git a/test/cpp11-migrate/UseAuto/iterator.cpp b/test/cpp11-migrate/UseAuto/iterator.cpp
index 7c4b5aa..8871bc1 100644
--- a/test/cpp11-migrate/UseAuto/iterator.cpp
+++ b/test/cpp11-migrate/UseAuto/iterator.cpp
@@ -1,172 +1,178 @@
 // 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
+//
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: cpp11-migrate -use-auto %t.cpp -- --std=c++11 -I %S/Inputs \
+// RUN:   -DUSE_INLINE_NAMESPACE=1
+// RUN: FileCheck -input-file=%t.cpp %s
+
 
 #define CONTAINER array
 #include "test_std_container.h"
 #undef CONTAINER
 
 #define CONTAINER vector
 #include "test_std_container.h"
 #undef CONTAINER
 
 #define CONTAINER unordered_map
 #define USE_BASE_CLASS_ITERATORS 1
 #include "test_std_container.h"
 #undef USE_BASE_CLASS_ITERATORS
 #undef CONTAINER
 
 typedef std::vector<int>::iterator int_iterator;
 
 namespace foo {
   template <typename T>
   class vector {
   public:
     class iterator {};
 
     iterator begin() { return iterator(); }
   };
 } // namespace foo
 
 int main(int argc, char **argv) {
   std::vector<int> Vec;
   // CHECK: std::vector<int> Vec;
 
   std::unordered_map<int> Map;
   // CHECK: std::unordered_map<int> Map;
 
   // Types with more sugar should work. Types with less should not.
   {
     int_iterator more_sugar = Vec.begin();
     // CHECK: auto more_sugar = Vec.begin();
 
     internal::iterator_wrapper<std::vector<int>, 0> less_sugar = Vec.begin();
     // CHECK: internal::iterator_wrapper<std::vector<int>, 0> less_sugar = Vec.begin();
   }
 
   // Initialization from initializer lists isn't allowed. Using 'auto'
   // would result in std::initializer_list being deduced for the type.
   {
     std::unordered_map<int>::iterator I{Map.begin()};
     // CHECK: std::unordered_map<int>::iterator I{Map.begin()};
 
     std::unordered_map<int>::iterator I2 = {Map.begin()};
     // CHECK: std::unordered_map<int>::iterator I2 = {Map.begin()};
   }
 
   // Various forms of construction. Default constructors and constructors with
   // all-default parameters shouldn't get transformed. Construction from other
   // types is also not allowed.
   {
     std::unordered_map<int>::iterator copy(Map.begin());
     // CHECK: auto copy(Map.begin());
 
     std::unordered_map<int>::iterator def;
     // CHECK: std::unordered_map<int>::iterator def;
 
     // const_iterator has no default constructor, just one that has >0 params
     // with defaults.
     std::unordered_map<int>::const_iterator constI;
     // CHECK: std::unordered_map<int>::const_iterator constI;
 
     // Uses iterator_provider::const_iterator's conversion constructor.
 
     std::unordered_map<int>::const_iterator constI2 = def;
     // CHECK: std::unordered_map<int>::const_iterator constI2 = def;
 
     std::unordered_map<int>::const_iterator constI3(def);
     // CHECK: std::unordered_map<int>::const_iterator constI3(def);
 
     // Explicit use of conversion constructor
 
     std::unordered_map<int>::const_iterator constI4 = std::unordered_map<int>::const_iterator(def);
     // CHECK: auto constI4 = std::unordered_map<int>::const_iterator(def);
 
     // Uses iterator_provider::iterator's const_iterator conversion operator.
 
     std::unordered_map<int>::iterator I = constI;
     // CHECK: std::unordered_map<int>::iterator I = constI;
 
     std::unordered_map<int>::iterator I2(constI);
     // CHECK: std::unordered_map<int>::iterator I2(constI);
   }
 
   // Weird cases of pointers and references to iterators are not transformed.
   {
     int_iterator I = Vec.begin();
 
     int_iterator *IPtr = &I;
     // CHECK: int_iterator *IPtr = &I;
 
     int_iterator &IRef = I;
     // CHECK: int_iterator &IRef = I;
   }
 
   {
     // Variable declarations in iteration statements.
     for (std::vector<int>::iterator I = Vec.begin(); I != Vec.end(); ++I) {
       // CHECK: for (auto I = Vec.begin(); I != Vec.end(); ++I) {
     }
 
     // Range-based for loops.
     std::array<std::vector<int>::iterator> iter_arr;
     for (std::vector<int>::iterator I: iter_arr) {
       // CHECK: for (auto I: iter_arr) {
     }
 
     // Test with init-declarator-list.
     for (int_iterator I = Vec.begin(),
          E = Vec.end(); I != E; ++I) {
       // CHECK:      for (auto I = Vec.begin(),
       // CHECK-NEXT:      E = Vec.end(); I != E; ++I) {
     }
   }
 
   // Only std containers should be changed.
   {
     using namespace foo;
     vector<int> foo_vec;
     vector<int>::iterator I = foo_vec.begin();
     // CHECK: vector<int>::iterator I = foo_vec.begin();
   }
 
   // Ensure using directives don't interfere with replacement.
   {
     using namespace std;
     vector<int> std_vec;
     vector<int>::iterator I = std_vec.begin();
     // CHECK: auto I = std_vec.begin();
   }
 
   // Make sure references and cv qualifiers don't get removed (i.e. replaced
   // with just 'auto').
   {
     const auto & I = Vec.begin();
     // CHECK: const auto & I = Vec.begin();
 
     auto && I2 = Vec.begin();
     // CHECK: auto && I2 = Vec.begin();
   }
 
   // Passing a string as an argument to introduce a temporary object
   // that will create an expression with cleanups. Bugzilla: 15550
   {
     std::unordered_map<int> MapFind;
     std::unordered_map<int>::iterator I = MapFind.find("foo");
     // CHECK: auto I = MapFind.find("foo");
   }
 
   // Test for declaration lists
   {
     // Ensusre declaration lists that matches the declaration type with written
     // no-list initializer are transformed.
     std::vector<int>::iterator I = Vec.begin(), E = Vec.end();
     // CHECK: auto I = Vec.begin(), E = Vec.end();
 
     // Declaration lists with non-initialized variables should not be
     // transformed.
     std::vector<int>::iterator J = Vec.begin(), K;
     // CHECK: std::vector<int>::iterator J = Vec.begin(), K;
   }
   return 0;
 }
