[cfe-commits] r86829 - /cfe/trunk/tools/driver/driver.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 11 02:10:26 PST 2009


Author: ddunbar
Date: Wed Nov 11 04:10:25 2009
New Revision: 86829

URL: http://llvm.org/viewvc/llvm-project?rev=86829&view=rev
Log:
Fix unsafe use of StringRef I introduced.

Modified:
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=86829&r1=86828&r2=86829&view=diff

==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Wed Nov 11 04:10:25 2009
@@ -202,8 +202,9 @@
   //
   // Note that we intentionally want to use argv[0] here, to support "clang++"
   // being a symlink.
-  llvm::StringRef ProgName(llvm::sys::Path(argv[0]).getBasename());
-  if (ProgName.endswith("++") || ProgName.rsplit('-').first.endswith("++"))
+  std::string ProgName(llvm::sys::Path(argv[0]).getBasename());
+  if (llvm::StringRef(ProgName).endswith("++") ||
+      llvm::StringRef(ProgName).rsplit('-').first.endswith("++"))
     TheDriver.CCCIsCXX = true;
 
   llvm::OwningPtr<Compilation> C;





More information about the cfe-commits mailing list