[PATCH] D45814: Fix an assertion when -print-prog-name= is invoked without parameter. Returns an empty string.

Christian Bruel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 19 06:18:24 PDT 2018


chrib created this revision.
Herald added a subscriber: cfe-commits.

Fix an assertion when -print-prog-name=


Repository:
  rC Clang

https://reviews.llvm.org/D45814

Files:
  lib/Driver/Driver.cpp


Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -4053,6 +4053,11 @@
 }
 
 std::string Driver::GetProgramPath(StringRef Name, const ToolChain &TC) const {
+
+  // Null program name cannot have a path.
+  if (Name.empty())
+    return Name.str();
+
   SmallVector<std::string, 2> TargetSpecificExecutables;
   generatePrefixedToolNames(Name, TC, TargetSpecificExecutables);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45814.143082.patch
Type: text/x-patch
Size: 478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180419/346782a2/attachment.bin>


More information about the cfe-commits mailing list