[llvm] r227385 - Build fix for Visual Studio. NFC.

Chris Bieneman beanz at apple.com
Wed Jan 28 14:25:00 PST 2015


Author: cbieneman
Date: Wed Jan 28 16:25:00 2015
New Revision: 227385

URL: http://llvm.org/viewvc/llvm-project?rev=227385&view=rev
Log:
Build fix for Visual Studio. NFC.

Modified:
    llvm/trunk/lib/Support/CommandLine.cpp

Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=227385&r1=227384&r2=227385&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Wed Jan 28 16:25:00 2015
@@ -87,7 +87,7 @@ class CommandLineParser {
 public:
   // Globals for name and overview of program.  Program name is not a string to
   // avoid static ctor/dtor issues.
-  char ProgramName[80] = "<premain>";
+  std::string ProgramName;
   const char *ProgramOverview = nullptr;
 
   // This collects additional help to be printed.
@@ -837,10 +837,7 @@ void CommandLineParser::ParseCommandLine
   argc = static_cast<int>(newArgv.size());
 
   // Copy the program name into ProgName, making sure not to overflow it.
-  StringRef ProgName = sys::path::filename(argv[0]);
-  size_t Len = std::min(ProgName.size(), size_t(79));
-  memcpy(ProgramName, ProgName.data(), Len);
-  ProgramName[Len] = '\0';
+  ProgramName = sys::path::filename(argv[0]);
 
   ProgramOverview = Overview;
   bool ErrorParsing = false;





More information about the llvm-commits mailing list