[PATCH] D35230: [clang] buildFixItInsertionLine should use Hints of the same FID and LineNo
Chih-Hung Hsieh via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 09:26:17 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307809: [clang] buildFixItInsertionLine should use Hints of the same FID and LineNo (authored by chh).
Changed prior to commit:
https://reviews.llvm.org/D35230?vs=105937&id=106240#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35230
Files:
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
Index: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
===================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp
@@ -1052,7 +1052,8 @@
std::fill(CaretLine.begin()+StartColNo,CaretLine.begin()+EndColNo,'~');
}
-static std::string buildFixItInsertionLine(unsigned LineNo,
+static std::string buildFixItInsertionLine(FileID FID,
+ unsigned LineNo,
const SourceColumnMap &map,
ArrayRef<FixItHint> Hints,
const SourceManager &SM,
@@ -1069,7 +1070,8 @@
// code contains no newlines and is on the same line as the caret.
std::pair<FileID, unsigned> HintLocInfo
= SM.getDecomposedExpansionLoc(I->RemoveRange.getBegin());
- if (LineNo == SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) &&
+ if (FID == HintLocInfo.first &&
+ LineNo == SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) &&
StringRef(I->CodeToInsert).find_first_of("\n\r") == StringRef::npos) {
// Insert the new code into the line just below the code
// that the user wrote.
@@ -1105,9 +1107,6 @@
PrevHintEndCol =
HintCol + llvm::sys::locale::columnWidth(I->CodeToInsert);
- } else {
- FixItInsertionLine.clear();
- break;
}
}
}
@@ -1222,7 +1221,7 @@
}
std::string FixItInsertionLine = buildFixItInsertionLine(
- LineNo, sourceColMap, Hints, SM, DiagOpts.get());
+ FID, LineNo, sourceColMap, Hints, SM, DiagOpts.get());
// If the source line is too long for our terminal, select only the
// "interesting" source region within that line.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35230.106240.patch
Type: text/x-patch
Size: 1848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170712/79690165/attachment-0001.bin>
More information about the cfe-commits
mailing list