зеркало из https://github.com/microsoft/clang-1.git
Fix crash in source-line truncation code for diagnostic
printing. Also, when we only need to truncate the line at the end, make sure there is room for the ellipsis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70781 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
ee1ec39f54
Коммит
2167de4c49
|
@ -158,7 +158,7 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
|
|||
|
||||
// If the end of the interesting region comes before we run out of
|
||||
// space in the terminal, start at the beginning of the line.
|
||||
if (CaretEnd < Columns)
|
||||
if (CaretEnd < Columns - 3)
|
||||
CaretStart = 0;
|
||||
|
||||
unsigned TargetColumns = Columns - 8; // Give us extra room for the ellipses.
|
||||
|
@ -251,7 +251,8 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
|
|||
// before the lines so that it looks nicer.
|
||||
if (CaretEnd < SourceLine.size())
|
||||
SourceLine.replace(CaretEnd, std::string::npos, "...");
|
||||
//CaretLine.erase(CaretEnd, std::string::npos);
|
||||
if (CaretEnd < CaretLine.size())
|
||||
CaretLine.erase(CaretEnd, std::string::npos);
|
||||
if (FixItInsertionLine.size() > CaretEnd)
|
||||
FixItInsertionLine.erase(CaretEnd, std::string::npos);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче