[clang-tools-extra] r321526 - Avoid int to string conversion in Twine or raw_ostream contexts.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 08:58:55 PST 2017


Author: d0k
Date: Thu Dec 28 08:58:54 2017
New Revision: 321526

URL: http://llvm.org/viewvc/llvm-project?rev=321526&view=rev
Log:
Avoid int to string conversion in Twine or raw_ostream contexts.

Some output changes from uppercase hex to lowercase hex, no other functionality change intended.

Modified:
    clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp

Modified: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp?rev=321526&r1=321525&r2=321526&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp Thu Dec 28 08:58:54 2017
@@ -196,7 +196,7 @@ void clangd::runLanguageServerLoop(std::
           log(Context::empty(),
               "Warning: Duplicate Content-Length header received. "
               "The previous value for this message (" +
-                  std::to_string(ContentLength) + ") was ignored.\n");
+                  llvm::Twine(ContentLength) + ") was ignored.\n");
         }
 
         llvm::getAsUnsignedInteger(LineRef.trim(), 0, ContentLength);
@@ -230,10 +230,9 @@ void clangd::runLanguageServerLoop(std::
         // If the stream is aborted before we read ContentLength bytes, In
         // will have eofbit and failbit set.
         if (!In) {
-          log(Context::empty(), "Input was aborted. Read only " +
-                                    std::to_string(In.gcount()) +
-                                    " bytes of expected " +
-                                    std::to_string(ContentLength) + ".\n");
+          log(Context::empty(),
+              "Input was aborted. Read only " + llvm::Twine(In.gcount()) +
+                  " bytes of expected " + llvm::Twine(ContentLength) + ".\n");
           break;
         }
 




More information about the cfe-commits mailing list