[PATCH] D51192: Fix reported range of partial token replacement
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 6 13:18:13 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE341583: Fix reported range of partial token replacement (authored by steveire, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D51192?vs=163447&id=164275#toc
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D51192
Files:
clang-tidy/ClangTidy.cpp
Index: clang-tidy/ClangTidy.cpp
===================================================================
--- clang-tidy/ClangTidy.cpp
+++ clang-tidy/ClangTidy.cpp
@@ -122,10 +122,6 @@
<< Message.Message << Name;
for (const auto &FileAndReplacements : Error.Fix) {
for (const auto &Repl : FileAndReplacements.second) {
- // Retrieve the source range for applicable fixes. Macro definitions
- // on the command line have locations in a virtual buffer and don't
- // have valid file paths and are therefore not applicable.
- SourceRange Range;
SourceLocation FixLoc;
++TotalFixes;
bool CanBeApplied = false;
@@ -166,7 +162,11 @@
FixLoc = getLocation(FixAbsoluteFilePath, Repl.getOffset());
SourceLocation FixEndLoc =
FixLoc.getLocWithOffset(Repl.getLength());
- Range = SourceRange(FixLoc, FixEndLoc);
+ // Retrieve the source range for applicable fixes. Macro definitions
+ // on the command line have locations in a virtual buffer and don't
+ // have valid file paths and are therefore not applicable.
+ CharSourceRange Range =
+ CharSourceRange::getCharRange(SourceRange(FixLoc, FixEndLoc));
Diag << FixItHint::CreateReplacement(Range,
Repl.getReplacementText());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51192.164275.patch
Type: text/x-patch
Size: 1452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180906/5ea152a8/attachment.bin>
More information about the cfe-commits
mailing list