[cfe-commits] r59491 - /cfe/trunk/lib/Analysis/PathDiagnostic.cpp

Chris Lattner sabre at nondot.org
Mon Nov 17 20:44:59 PST 2008


Author: lattner
Date: Mon Nov 17 22:44:58 2008
New Revision: 59491

URL: http://llvm.org/viewvc/llvm-project?rev=59491&view=rev
Log:
cleanups and simplifications.

Modified:
    cfe/trunk/lib/Analysis/PathDiagnostic.cpp

Modified: cfe/trunk/lib/Analysis/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PathDiagnostic.cpp?rev=59491&r1=59490&r2=59491&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/Analysis/PathDiagnostic.cpp Mon Nov 17 22:44:58 2008
@@ -33,22 +33,18 @@
   
   PathDiagnostic* D = new PathDiagnostic();
   
-  std::ostringstream os;
-  
+  const char *LevelStr;
   switch (DiagLevel) {
-    default: assert(0 && "Unknown diagnostic type!");
-    case Diagnostic::Note:    os << "note: "; break;
-    case Diagnostic::Warning: os << "warning: "; break;
-    case Diagnostic::Error:   os << "error: "; break;
-    case Diagnostic::Fatal:   os << "fatal error: "; break;
-      break;
+  default: assert(0 && "Unknown diagnostic type!");
+  case Diagnostic::Note:    LevelStr = "note: "; break;
+  case Diagnostic::Warning: LevelStr = "warning: "; break;
+  case Diagnostic::Error:   LevelStr = "error: "; break;
+  case Diagnostic::Fatal:   LevelStr = "fatal error: "; break;
   }
 
   std::string Msg = FormatDiagnostic(Diags, DiagLevel, ID, Strs, NumStrs);
   
-  os << Msg;
-  
-  PathDiagnosticPiece* P = new PathDiagnosticPiece(Pos, os.str());
+  PathDiagnosticPiece* P = new PathDiagnosticPiece(Pos, LevelStr+Msg);
   
   while (NumRanges) {
     P->addRange(*Ranges);





More information about the cfe-commits mailing list