[PATCH] D24914: [clang-rename] Do not print out error message upon encountering multiple replacements in the same SourceLocation.
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 26 07:35:46 PDT 2016
omtcyfz created this revision.
omtcyfz added a reviewer: alexfh.
omtcyfz added a subscriber: cfe-commits.
`clang-rename` might sometimes have multiple replacements at one SourceLocation, both trying to perform the same renaming. While this issue should be addressed properly at some point, for now it's fine to prevent `clang-rename` from printing out the error message to prevent confusion as it works just fine even if the error happens.
@@ -68,12 +68,14 @@
<< ":" << FullLoc.getSpellingLineNumber() << ":"
<< FullLoc.getSpellingColumnNumber() << "\n";
- // FIXME: better error handling.
tooling::Replacement Replace(SourceMgr, Loc, PrevNameLen, NewName);
llvm::Error Err = FileToReplaces[Replace.getFilePath()].add(Replace);
+ // FIXME: As for clang-rename, replacement fails IFF either the AST node
+ // has been matched multiple times (which shouldn't happen in reality,
+ // need to fix that) or when it's a specific header. For now, just ingore
+ // there error that happened as it doesn't mean a failure.
- llvm::errs() << "Renaming failed in " << Replace.getFilePath() << "! "
- << llvm::toString(std::move(Err)) << "\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1052 bytes
Desc: not available
More information about the cfe-commits