[cfe-commits] r84337 - /cfe/trunk/lib/Basic/Diagnostic.cpp

Daniel Dunbar daniel at zuster.org
Sat Oct 17 11:12:14 PDT 2009


Author: ddunbar
Date: Sat Oct 17 13:12:14 2009
New Revision: 84337

URL: http://llvm.org/viewvc/llvm-project?rev=84337&view=rev
Log:
Use raw_ostream for formatting integers, and use IdentifierInfo::getNameStr
instead of getName.
 - -2 FIXMEs.

Modified:
    cfe/trunk/lib/Basic/Diagnostic.cpp

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=84337&r1=84336&r2=84337&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Sat Oct 17 13:12:14 2009
@@ -25,6 +25,7 @@
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/raw_ostream.h"
 #include <vector>
 #include <map>
 #include <cstring>
@@ -762,9 +763,7 @@
         HandlePluralModifier((unsigned)Val, Argument, ArgumentLen, OutStr);
       } else {
         assert(ModifierLen == 0 && "Unknown integer modifier");
-        // FIXME: Optimize
-        std::string S = llvm::itostr(Val);
-        OutStr.append(S.begin(), S.end());
+        llvm::raw_svector_ostream(OutStr) << Val;
       }
       break;
     }
@@ -779,10 +778,7 @@
         HandlePluralModifier((unsigned)Val, Argument, ArgumentLen, OutStr);
       } else {
         assert(ModifierLen == 0 && "Unknown integer modifier");
-
-        // FIXME: Optimize
-        std::string S = llvm::utostr_32(Val);
-        OutStr.append(S.begin(), S.end());
+        llvm::raw_svector_ostream(OutStr) << Val;
       }
       break;
     }
@@ -798,9 +794,7 @@
         continue;
       }
 
-      OutStr.push_back('\'');
-      OutStr.append(II->getName(), II->getName() + II->getLength());
-      OutStr.push_back('\'');
+      llvm::raw_svector_ostream(OutStr) << '\'' << II->getNameStr() << '\'';
       break;
     }
     case Diagnostic::ak_qualtype:





More information about the cfe-commits mailing list