[PATCH] D51192: Fix reported range of partial token replacement

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 23 15:45:48 PDT 2018


steveire created this revision.
steveire added reviewers: klimek, rsmith.
Herald added a subscriber: cfe-commits.

Fixes bug: 38678


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
@@ -125,7 +125,6 @@
           // 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 +165,7 @@
             FixLoc = getLocation(FixAbsoluteFilePath, Repl.getOffset());
             SourceLocation FixEndLoc =
                 FixLoc.getLocWithOffset(Repl.getLength());
-            Range = SourceRange(FixLoc, FixEndLoc);
+            CharSourceRange Range = CharSourceRange::getCharRange(FixLoc, FixEndLoc);
             Diag << FixItHint::CreateReplacement(Range,
                                                  Repl.getReplacementText());
           }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51192.162287.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180823/8e1d0e71/attachment.bin>


More information about the cfe-commits mailing list