Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1589,7 +1589,13 @@
   }
 
   if (Arg *A = C.getArgs().getLastArg(options::OPT_print_prog_name_EQ)) {
-    llvm::outs() << GetProgramPath(A->getValue(), TC) << "\n";
+    StringRef ProgName = A->getValue();
+
+    // Null program name cannot have a path.
+    if (! ProgName.empty())
+      llvm::outs() << GetProgramPath(ProgName, TC);
+
+    llvm::outs() << "\n";
     return false;
   }
 
@@ -4053,6 +4059,7 @@
 }
 
 std::string Driver::GetProgramPath(StringRef Name, const ToolChain &TC) const {
+
   SmallVector<std::string, 2> TargetSpecificExecutables;
   generatePrefixedToolNames(Name, TC, TargetSpecificExecutables);
 
Index: test/Driver/print-empty-prog-name.c
===================================================================
--- /dev/null
+++ test/Driver/print-empty-prog-name.c
@@ -0,0 +1,5 @@
+// Test that -print-prog-name= correctly returns an empty string
+
+// RUN: %clang -print-prog-name= 2>&1 | FileCheck %s
+// CHECK-NOT:{{.+}}
+