[llvm-branch-commits] [llvm-branch] r142161 - in /llvm/branches/release_30: ./ include/llvm/Support/SourceMgr.h lib/MC/MCParser/AsmParser.cpp

Bill Wendling isanbard at gmail.com
Sun Oct 16 14:58:10 PDT 2011


Author: void
Date: Sun Oct 16 16:58:10 2011
New Revision: 142161

URL: http://llvm.org/viewvc/llvm-project?rev=142161&view=rev
Log:
This patch relies upon non-incorporated patches.

--- Reverse-merging r142156 into '.':
U    include/llvm/Support/SourceMgr.h
U    lib/MC/MCParser/AsmParser.cpp


Modified:
    llvm/branches/release_30/   (props changed)
    llvm/branches/release_30/include/llvm/Support/SourceMgr.h
    llvm/branches/release_30/lib/MC/MCParser/AsmParser.cpp

Propchange: llvm/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 16 16:58:10 2011
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:142039,142055,142058,142112,142123,142125,142132
+/llvm/trunk:142039,142055,142058,142112,142123,142125

Modified: llvm/branches/release_30/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_30/include/llvm/Support/SourceMgr.h?rev=142161&r1=142160&r2=142161&view=diff
==============================================================================
--- llvm/branches/release_30/include/llvm/Support/SourceMgr.h (original)
+++ llvm/branches/release_30/include/llvm/Support/SourceMgr.h Sun Oct 16 16:58:10 2011
@@ -78,9 +78,6 @@
     DiagContext = Ctx;
   }
 
-  DiagHandlerTy getDiagHandler() const { return DiagHandler; }
-  void *getDiagContext() const { return DiagContext; }
-
   const SrcBuffer &getBufferInfo(unsigned i) const {
     assert(i < Buffers.size() && "Invalid Buffer ID!");
     return Buffers[i];

Modified: llvm/branches/release_30/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_30/lib/MC/MCParser/AsmParser.cpp?rev=142161&r1=142160&r2=142161&view=diff
==============================================================================
--- llvm/branches/release_30/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/branches/release_30/lib/MC/MCParser/AsmParser.cpp Sun Oct 16 16:58:10 2011
@@ -87,8 +87,6 @@
   MCStreamer &Out;
   const MCAsmInfo &MAI;
   SourceMgr &SrcMgr;
-  SourceMgr::DiagHandlerTy SavedDiagHandler;
-  void *SavedDiagContext;
   MCAsmParserExtension *GenericParser;
   MCAsmParserExtension *PlatformParser;
 
@@ -144,10 +142,8 @@
   virtual MCContext &getContext() { return Ctx; }
   virtual MCStreamer &getStreamer() { return Out; }
 
-  virtual bool Warning(SMLoc L, const Twine &Msg,
-                       ArrayRef<SMRange> Ranges = ArrayRef<SMRange>());
-  virtual bool Error(SMLoc L, const Twine &Msg,
-                     ArrayRef<SMRange> Ranges = ArrayRef<SMRange>());
+  virtual bool Warning(SMLoc L, const Twine &Msg);
+  virtual bool Error(SMLoc L, const Twine &Msg);
 
   const AsmToken &Lex();
 
@@ -173,9 +169,9 @@
   void HandleMacroExit();
 
   void PrintMacroInstantiations();
-  void PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg,
-                    ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) const {
-    SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges);
+  void PrintMessage(SMLoc Loc, const Twine &Msg, const char *Type,
+                    bool ShowLine = true) const {
+    SrcMgr.PrintMessage(Loc, Msg, Type, ShowLine);
   }
   static void DiagHandler(const SMDiagnostic &Diag, void *Context);
 
@@ -355,10 +351,6 @@
   : Lexer(_MAI), Ctx(_Ctx), Out(_Out), MAI(_MAI), SrcMgr(_SM),
     GenericParser(new GenericAsmParser), PlatformParser(0),
     CurBuffer(0), MacrosEnabled(true), CppHashLineNumber(0) {
-  // Save the old handler.
-  SavedDiagHandler = SrcMgr.getDiagHandler();
-  SavedDiagContext = SrcMgr.getDiagContext();
-  // Set our own handler which calls the saved handler.
   SrcMgr.setDiagHandler(DiagHandler, this);
   Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer));
 
@@ -397,21 +389,21 @@
   // Print the active macro instantiation stack.
   for (std::vector<MacroInstantiation*>::const_reverse_iterator
          it = ActiveMacros.rbegin(), ie = ActiveMacros.rend(); it != ie; ++it)
-    PrintMessage((*it)->InstantiationLoc, SourceMgr::DK_Note,
-                 "while in macro instantiation");
+    PrintMessage((*it)->InstantiationLoc, "while in macro instantiation",
+                 "note");
 }
 
-bool AsmParser::Warning(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) {
+bool AsmParser::Warning(SMLoc L, const Twine &Msg) {
   if (FatalAssemblerWarnings)
-    return Error(L, Msg, Ranges);
-  PrintMessage(L, SourceMgr::DK_Warning, Msg, Ranges);
+    return Error(L, Msg);
+  PrintMessage(L, Msg, "warning");
   PrintMacroInstantiations();
   return false;
 }
 
-bool AsmParser::Error(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges) {
+bool AsmParser::Error(SMLoc L, const Twine &Msg) {
   HadError = true;
-  PrintMessage(L, SourceMgr::DK_Error, Msg, Ranges);
+  PrintMessage(L, Msg, "error");
   PrintMacroInstantiations();
   return true;
 }
@@ -503,9 +495,8 @@
         // FIXME: We would really like to refer back to where the symbol was
         // first referenced for a source location. We need to add something
         // to track that. Currently, we just point to the end of the file.
-        PrintMessage(getLexer().getLoc(), SourceMgr::DK_Error,
-                     "assembler local symbol '" + Sym->getName() +
-                     "' not defined");
+        PrintMessage(getLexer().getLoc(), "assembler local symbol '" +
+                     Sym->getName() + "' not defined", "error", false);
     }
   }
 
@@ -1208,7 +1199,7 @@
     }
     OS << "]";
 
-    PrintMessage(IDLoc, SourceMgr::DK_Note, OS.str());
+    PrintMessage(IDLoc, OS.str(), "note");
   }
 
   // If parsing succeeded, match the instruction.
@@ -1282,7 +1273,7 @@
   // Like SourceMgr::PrintMessage() we need to print the include stack if any
   // before printing the message.
   int DiagCurBuffer = DiagSrcMgr.FindBufferContainingLoc(DiagLoc);
-  if (!Parser->SavedDiagHandler && DiagCurBuffer > 0) {
+  if (DiagCurBuffer > 0) {
      SMLoc ParentIncludeLoc = DiagSrcMgr.getParentIncludeLoc(DiagCurBuffer);
      DiagSrcMgr.PrintIncludeStack(ParentIncludeLoc, OS);
   }
@@ -1293,10 +1284,7 @@
   if (!Parser->CppHashLineNumber ||
       &DiagSrcMgr != &Parser->SrcMgr ||
       DiagBuf != CppHashBuf) {
-    if (Parser->SavedDiagHandler)
-      Parser->SavedDiagHandler(Diag, Parser->SavedDiagContext);
-    else
-      Diag.print(0, OS);
+    Diag.Print(0, OS);
     return;
   }
 
@@ -1311,15 +1299,16 @@
   int LineNo = Parser->CppHashLineNumber - 1 +
                (DiagLocLineNo - CppHashLocLineNo);
 
-  SMDiagnostic NewDiag(*Diag.getSourceMgr(), Diag.getLoc(),
-                       Filename, LineNo, Diag.getColumnNo(),
-                       Diag.getKind(), Diag.getMessage(),
-                       Diag.getLineContents(), Diag.getRanges());
+  SMDiagnostic NewDiag(*Diag.getSourceMgr(),
+                       Diag.getLoc(),
+                       Filename,
+                       LineNo,
+                       Diag.getColumnNo(),
+                       Diag.getMessage(),
+                       Diag.getLineContents(),
+                       Diag.getShowLine());
 
-  if (Parser->SavedDiagHandler)
-    Parser->SavedDiagHandler(NewDiag, Parser->SavedDiagContext);
-  else
-    NewDiag.print(0, OS);
+  NewDiag.Print(0, OS);
 }
 
 bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body,





More information about the llvm-branch-commits mailing list