From 8be5c159df96c88880a50086a41efc86b89a46a4 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 25 Sep 2011 22:31:58 +0000 Subject: [PATCH] Actually remove the members of CaretDiagnostic no longer in use for tracking the start and stop of macro expansion suppression. Also remove the Columns variable which was just a convenience variable based on DiagOpts. Instead we materialize it in the one piece of code that cared. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140475 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/TextDiagnosticPrinter.h | 2 +- lib/Frontend/TextDiagnosticPrinter.cpp | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h index 3310426e24..354df101e6 100644 --- a/include/clang/Frontend/TextDiagnosticPrinter.h +++ b/include/clang/Frontend/TextDiagnosticPrinter.h @@ -68,7 +68,7 @@ private: void EmitCaretDiagnostic(SourceLocation Loc, SmallVectorImpl &Ranges, const SourceManager &SM, - ArrayRef Hints, unsigned Columns); + ArrayRef Hints); }; diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 214ee44eee..ca060b6d66 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -314,17 +314,14 @@ class CaretDiagnostic { const SourceManager &SM; const LangOptions &LangOpts; const DiagnosticOptions &DiagOpts; - const unsigned Columns, MacroSkipStart, MacroSkipEnd; public: CaretDiagnostic(TextDiagnosticPrinter &Printer, raw_ostream &OS, const SourceManager &SM, const LangOptions &LangOpts, - const DiagnosticOptions &DiagOpts, - unsigned Columns) - : Printer(Printer), OS(OS), SM(SM), LangOpts(LangOpts), DiagOpts(DiagOpts), - Columns(Columns), MacroSkipStart(0), MacroSkipEnd(0) { + const DiagnosticOptions &DiagOpts) + : Printer(Printer), OS(OS), SM(SM), LangOpts(LangOpts), DiagOpts(DiagOpts) { } /// \brief Emit the caret diagnostic text. @@ -506,6 +503,7 @@ public: // If the source line is too long for our terminal, select only the // "interesting" source region within that line. + unsigned Columns = DiagOpts.MessageLength; if (Columns && SourceLine.size() > Columns) SelectInterestingSourceRegion(SourceLine, CaretLine, FixItInsertionLine, CaretEndColNo, Columns); @@ -766,14 +764,13 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic( SourceLocation Loc, SmallVectorImpl& Ranges, const SourceManager &SM, - ArrayRef Hints, - unsigned Columns) { + ArrayRef Hints) { assert(LangOpts && "Unexpected diagnostic outside source file processing"); assert(DiagOpts && "Unexpected diagnostic without options set"); // FIXME: Remove this method and have clients directly build and call Emit on // the CaretDiagnostic object. - CaretDiagnostic CaretDiag(*this, OS, SM, *LangOpts, *DiagOpts, Columns); + CaretDiagnostic CaretDiag(*this, OS, SM, *LangOpts, *DiagOpts); unsigned MacroDepth = 0; CaretDiag.Emit(Loc, Ranges, Hints, MacroDepth); } @@ -1246,8 +1243,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, EmitCaretDiagnostic(LastLoc, Ranges, LastLoc.getManager(), llvm::makeArrayRef(Info.getFixItHints(), - Info.getNumFixItHints()), - DiagOpts->MessageLength); + Info.getNumFixItHints())); } OS.flush(); -- 2.40.0