hans created this revision.
hans added reviewers: rnk, Bigcheese.
hans added a subscriber: cfe-commits.
This is the clang-tools-extra part of http://reviews.llvm.org/D11167
http://reviews.llvm.org/D11169
Files:
clang-modernize/UseNullptr/NullptrActions.cpp
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");
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");
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits