[llvm-commits] [llvm] r142108 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/MC/MCParser/AsmParser.cpp lib/Support/SourceMgr.cpp

Chris Lattner sabre at nondot.org
Sat Oct 15 22:47:55 PDT 2011


Author: lattner
Date: Sun Oct 16 00:47:55 2011
New Revision: 142108

URL: http://llvm.org/viewvc/llvm-project?rev=142108&view=rev
Log:
remove the dead 'ShowLine' argument from SMDiagnostic.

Modified:
    llvm/trunk/include/llvm/Support/SourceMgr.h
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp
    llvm/trunk/lib/Support/SourceMgr.cpp

Modified: llvm/trunk/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=142108&r1=142107&r2=142108&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h (original)
+++ llvm/trunk/include/llvm/Support/SourceMgr.h Sun Oct 16 00:47:55 2011
@@ -126,8 +126,7 @@
   /// specified string.
   ///
   void PrintMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg,
-                    ArrayRef<SMRange> Ranges = ArrayRef<SMRange>(),
-                    bool ShowLine = true) const;
+                    ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) const;
 
 
   /// GetMessage - Return an SMDiagnostic at the specified location with the
@@ -135,10 +134,8 @@
   ///
   /// @param Type - If non-null, the kind of message (e.g., "error") which is
   /// prefixed to the message.
-  /// @param ShowLine - Should the diagnostic show the source line.
   SMDiagnostic GetMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg, 
-                          ArrayRef<SMRange> Ranges = ArrayRef<SMRange>(),
-                          bool ShowLine = true) const;
+                          ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) const;
 
   /// PrintIncludeStack - Prints the names of included files and the line of the
   /// file they were included from.  A diagnostic handler can use this before
@@ -159,24 +156,23 @@
   int LineNo, ColumnNo;
   SourceMgr::DiagKind Kind;
   std::string Message, LineContents;
-  unsigned ShowLine : 1;
   std::vector<std::pair<unsigned, unsigned> > Ranges;
 
 public:
   // Null diagnostic.
   SMDiagnostic()
-    : SM(0), LineNo(0), ColumnNo(0), Kind(SourceMgr::DK_Error), ShowLine(0) {}
+    : SM(0), LineNo(0), ColumnNo(0), Kind(SourceMgr::DK_Error) {}
   // Diagnostic with no location (e.g. file not found, command line arg error).
   SMDiagnostic(const std::string &filename, SourceMgr::DiagKind Kind,
                const std::string &Msg)
     : SM(0), Filename(filename), LineNo(-1), ColumnNo(-1), Kind(Kind),
-      Message(Msg), ShowLine(false) {}
+      Message(Msg) {}
   
   // Diagnostic with a location.
   SMDiagnostic(const SourceMgr &sm, SMLoc L, const std::string &FN,
                int Line, int Col, SourceMgr::DiagKind Kind,
                const std::string &Msg, const std::string &LineStr,
-               ArrayRef<std::pair<unsigned,unsigned> > Ranges, bool showline);
+               ArrayRef<std::pair<unsigned,unsigned> > Ranges);
 
   const SourceMgr *getSourceMgr() const { return SM; }
   SMLoc getLoc() const { return Loc; }
@@ -186,7 +182,6 @@
   SourceMgr::DiagKind getKind() const { return Kind; }
   const std::string &getMessage() const { return Message; }
   const std::string &getLineContents() const { return LineContents; }
-  bool getShowLine() const { return ShowLine; }
   const std::vector<std::pair<unsigned, unsigned> > &getRanges() const {
     return Ranges;
   }

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=142108&r1=142107&r2=142108&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Sun Oct 16 00:47:55 2011
@@ -172,9 +172,8 @@
 
   void PrintMacroInstantiations();
   void PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg,
-                    ArrayRef<SMRange> Ranges = ArrayRef<SMRange>(),
-                    bool ShowLine = true) const {
-    SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges, ShowLine);
+                    ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) const {
+    SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges);
   }
   static void DiagHandler(const SMDiagnostic &Diag, void *Context);
 
@@ -1306,8 +1305,7 @@
   SMDiagnostic NewDiag(*Diag.getSourceMgr(), Diag.getLoc(),
                        Filename, LineNo, Diag.getColumnNo(),
                        Diag.getKind(), Diag.getMessage(),
-                       Diag.getLineContents(),
-                       Diag.getRanges(), Diag.getShowLine());
+                       Diag.getLineContents(), Diag.getRanges());
 
   NewDiag.print(0, OS);
 }

Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=142108&r1=142107&r2=142108&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Sun Oct 16 00:47:55 2011
@@ -141,8 +141,8 @@
 /// @param Type - If non-null, the kind of message (e.g., "error") which is
 /// prefixed to the message.
 SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
-                                   const Twine &Msg, ArrayRef<SMRange> Ranges,
-                                   bool ShowLine) const {
+                                   const Twine &Msg,
+                                   ArrayRef<SMRange> Ranges) const {
 
   // First thing to do: find the current buffer containing the specified
   // location.
@@ -189,13 +189,12 @@
   return SMDiagnostic(*this, Loc,
                       CurMB->getBufferIdentifier(), FindLineNumber(Loc, CurBuf),
                       Loc.getPointer()-LineStart, Kind, Msg.str(),
-                      LineStr, ColRanges, ShowLine);
+                      LineStr, ColRanges);
 }
 
 void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,
-                             const Twine &Msg, ArrayRef<SMRange> Ranges,
-                             bool ShowLine) const {
-  SMDiagnostic Diagnostic = GetMessage(Loc, Kind, Msg, Ranges, ShowLine);
+                             const Twine &Msg, ArrayRef<SMRange> Ranges) const {
+  SMDiagnostic Diagnostic = GetMessage(Loc, Kind, Msg, Ranges);
   
   // Report the message with the diagnostic handler if present.
   if (DiagHandler) {
@@ -220,11 +219,9 @@
                            int Line, int Col, SourceMgr::DiagKind Kind,
                            const std::string &Msg,
                            const std::string &LineStr,
-                           ArrayRef<std::pair<unsigned,unsigned> > Ranges,
-                           bool showline)
+                           ArrayRef<std::pair<unsigned,unsigned> > Ranges)
   : SM(&sm), Loc(L), Filename(FN), LineNo(Line), ColumnNo(Col), Kind(Kind),
-    Message(Msg), LineContents(LineStr), ShowLine(showline),
-    Ranges(Ranges.vec()) {
+    Message(Msg), LineContents(LineStr), Ranges(Ranges.vec()) {
 }
 
 
@@ -255,7 +252,7 @@
   
   S << Message << '\n';
 
-  if (LineNo == -1 || ColumnNo == -1 || !ShowLine)
+  if (LineNo == -1 || ColumnNo == -1)
     return;
 
   // Build the line with the caret and ranges.





More information about the llvm-commits mailing list