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

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 15:06:14 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL358455: Only use argv[0] as the main executable name if it exists. (authored by silvas, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60730?vs=195242&id=195257#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60730/new/

https://reviews.llvm.org/D60730

Files:
  llvm/trunk/lib/Support/Signals.cpp


Index: llvm/trunk/lib/Support/Signals.cpp
===================================================================
--- llvm/trunk/lib/Support/Signals.cpp
+++ llvm/trunk/lib/Support/Signals.cpp
@@ -131,8 +131,8 @@
   // If we don't know argv0 or the address of main() at this point, try
   // to guess it anyway (it's possible on some platforms).
   std::string MainExecutableName =
-      Argv0.empty() ? sys::fs::getMainExecutable(nullptr, nullptr)
-                    : (std::string)Argv0;
+      sys::fs::exists(Argv0) ? (std::string)Argv0
+                             : sys::fs::getMainExecutable(nullptr, nullptr);
   BumpPtrAllocator Allocator;
   StringSaver StrPool(Allocator);
   std::vector<const char *> Modules(Depth, nullptr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60730.195257.patch
Type: text/x-patch
Size: 737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190415/6752e28e/attachment-0001.bin>


More information about the llvm-commits mailing list