diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
commit | 0883ccd9eac3b974df00e6548ee319a7dd3646f4 (patch) | |
tree | d6a70c3518b8dea8be7062438d7e8676820ed17f /lib/Frontend/TextDiagnosticPrinter.cpp | |
parent | 60bfabcd8ce617297c0d231f77d14ab507e98796 (diff) | |
download | src-0883ccd9eac3b974df00e6548ee319a7dd3646f4.tar.gz src-0883ccd9eac3b974df00e6548ee319a7dd3646f4.zip |
Update clang to r103004.
Notes
Notes:
svn path=/vendor/clang/dist/; revision=207619
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r-- | lib/Frontend/TextDiagnosticPrinter.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 4e91f8d4c221..28bb17ac3efa 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -148,9 +148,16 @@ static void SelectInterestingSourceRegion(std::string &SourceLine, std::string &FixItInsertionLine, unsigned EndOfCaretToken, unsigned Columns) { - if (CaretLine.size() > SourceLine.size()) - SourceLine.resize(CaretLine.size(), ' '); - + unsigned MaxSize = std::max(SourceLine.size(), + std::max(CaretLine.size(), + FixItInsertionLine.size())); + if (MaxSize > SourceLine.size()) + SourceLine.resize(MaxSize, ' '); + if (MaxSize > CaretLine.size()) + CaretLine.resize(MaxSize, ' '); + if (!FixItInsertionLine.empty() && MaxSize > FixItInsertionLine.size()) + FixItInsertionLine.resize(MaxSize, ' '); + // Find the slice that we need to display the full caret line // correctly. unsigned CaretStart = 0, CaretEnd = CaretLine.size(); @@ -275,7 +282,7 @@ static void SelectInterestingSourceRegion(std::string &SourceLine, void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, SourceRange *Ranges, unsigned NumRanges, - SourceManager &SM, + const SourceManager &SM, const FixItHint *Hints, unsigned NumHints, unsigned Columns) { @@ -796,8 +803,13 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, OutStr += " [-W"; OutStr += Opt; OutStr += ']'; - } else if (Diagnostic::isBuiltinExtensionDiag(Info.getID())) { - OutStr += " [-pedantic]"; + } else { + // If the diagnostic is an extension diagnostic and not enabled by default + // then it must have been turned on with -pedantic. + bool EnabledByDefault; + if (Diagnostic::isBuiltinExtensionDiag(Info.getID(), EnabledByDefault) && + !EnabledByDefault) + OutStr += " [-pedantic]"; } } |