forked from OSchip/llvm-project
Fix reported range of partial token replacement
Summary: Fixes bug: 38678 Reviewers: klimek, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51192 llvm-svn: 341583
This commit is contained in:
parent
ec6b70572f
commit
9b11da91c7
|
@ -122,10 +122,6 @@ public:
|
||||||
<< Message.Message << Name;
|
<< Message.Message << Name;
|
||||||
for (const auto &FileAndReplacements : Error.Fix) {
|
for (const auto &FileAndReplacements : Error.Fix) {
|
||||||
for (const auto &Repl : FileAndReplacements.second) {
|
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;
|
SourceLocation FixLoc;
|
||||||
++TotalFixes;
|
++TotalFixes;
|
||||||
bool CanBeApplied = false;
|
bool CanBeApplied = false;
|
||||||
|
@ -166,7 +162,11 @@ public:
|
||||||
FixLoc = getLocation(FixAbsoluteFilePath, Repl.getOffset());
|
FixLoc = getLocation(FixAbsoluteFilePath, Repl.getOffset());
|
||||||
SourceLocation FixEndLoc =
|
SourceLocation FixEndLoc =
|
||||||
FixLoc.getLocWithOffset(Repl.getLength());
|
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,
|
Diag << FixItHint::CreateReplacement(Range,
|
||||||
Repl.getReplacementText());
|
Repl.getReplacementText());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue