forked from OSchip/llvm-project
Driver: fix an assertion with `-print-prog-name=`
Fix an assertion when -print-prog-name= is invoked without parameter. Returns an empty string. Patch by Christian Bruel! llvm-svn: 331296
This commit is contained in:
parent
e8e95b5b01
commit
e5f3cf824f
|
@ -1594,7 +1594,13 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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:{{.+}}
|
||||
|
Loading…
Reference in New Issue