HomePhabricator

Only use argv[0] as the main executable name if it exists.

Authored by silvas on Apr 15 2019, 3:07 PM.

Description

Only use argv[0] as the main executable name if it exists.

Under some environments, argv[0] doesn't hold a valid file name, but
sys::fs::getMainExecutable will find the main executable properly.

This patch tweaks the logic to fall back to sys::fs::getMainExecutable
in more situations.

Differential Revision: https://reviews.llvm.org/D60730

llvm-svn: 358455