Index: clang-modernize/UseNullptr/NullptrActions.cpp =================================================================== --- clang-modernize/UseNullptr/NullptrActions.cpp +++ clang-modernize/UseNullptr/NullptrActions.cpp @@ -372,7 +372,7 @@ /// /// \pre MacroLoc.isFileID() /// \returns true if such an ancestor was found, false otherwise. - bool findContainingAncestor(ast_type_traits::DynTypedNode Start, + bool findContainingAncestor(const ast_type_traits::DynTypedNode &Start, SourceLocation MacroLoc, ast_type_traits::DynTypedNode &Result) { // Below we're only following the first parent back up the AST. This should @@ -382,8 +382,10 @@ assert(MacroLoc.isFileID()); + ast_type_traits::DynTypedNode Node = Start; + do { - const auto &Parents = Context.getParents(Start); + const auto &Parents = Context.getParents(Node); if (Parents.empty()) return false; assert(Parents.size() == 1 && @@ -403,7 +405,7 @@ Result = Parent; return true; } - Start = Parent; + Node = Parent; } while (1); llvm_unreachable("findContainingAncestor");