Chromium Code Reviews| Index: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| diff --git a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| index 9ae3201a4c2b0964141b30d3207de19373c716b6..e650e32bfc2baff67b14d094da0b0e73c64446a9 100644 |
| --- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| +++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| @@ -523,6 +523,15 @@ class RewriterBase : public MatchFinder::MatchCallback { |
| *result.Nodes.getNodeAs<TargetNode>( |
| TargetNodeTraits<TargetNode>::GetName())); |
| clang::CharSourceRange range = clang::CharSourceRange::getTokenRange(loc); |
| + |
| + // Check if |range| really covers text of |old_name|. This might not be |
| + // true when specializing a templatized class that had an unnamed parameter |
| + // in one of method declarations. |
| + StringRef old_text = clang::Lexer::getSourceText( |
| + range, *result.SourceManager, result.Context->getLangOpts()); |
| + if (!loc.isMacroID() && old_text != old_name) |
| + return; |
| + |
|
Łukasz Anforowicz
2016/08/15 23:05:08
The new code makes the new regression test pass.
dcheng
2016/08/25 04:08:51
How were you printing out this diagnostic info? Re
Łukasz Anforowicz
2016/08/25 23:32:33
Thanks for bringing up "spelling location". I can
|
| replacements_->emplace(*result.SourceManager, range, new_name); |
| replacement_names_.emplace(old_name.str(), std::move(new_name)); |
| } |