[llvm] r338737 - Use %.*s instead of %*s when formatting strings with explicit length.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 10:08:24 PDT 2018


Author: zturner
Date: Thu Aug  2 10:08:24 2018
New Revision: 338737

URL: http://llvm.org/viewvc/llvm-project?rev=338737&view=rev
Log:
Use %.*s instead of %*s when formatting strings with explicit length.

Modified:
    llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp

Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=338737&r1=338736&r2=338737&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Thu Aug  2 10:08:24 2018
@@ -2081,7 +2081,7 @@ void Demangler::dumpBackReferences() {
     Type::outputPre(OS, *T, *this);
     Type::outputPost(OS, *T, *this);
 
-    std::printf("  [%d] - %*s\n", (int)I, (int)OS.getCurrentPosition(),
+    std::printf("  [%d] - %.*s\n", (int)I, (int)OS.getCurrentPosition(),
                 OS.getBuffer());
   }
   std::free(OS.getBuffer());
@@ -2090,7 +2090,7 @@ void Demangler::dumpBackReferences() {
     std::printf("\n");
   std::printf("%d name backreferences\n", (int)BackRefCount);
   for (size_t I = 0; I < BackRefCount; ++I) {
-    std::printf("  [%d] - %*s\n", (int)I, (int)BackReferences[I].size(),
+    std::printf("  [%d] - %.*s\n", (int)I, (int)BackReferences[I].size(),
                 BackReferences[I].begin());
   }
   if (BackRefCount > 0)




More information about the llvm-commits mailing list