Make sure we don't error out if an invalid path is used, just simply
exit from isBytecodeLPath with "false".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22360 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp
index f6a08ce..56aaf7d 100644
--- a/tools/gccld/GenerateCode.cpp
+++ b/tools/gccld/GenerateCode.cpp
@@ -154,10 +154,21 @@
sys::Path LPath(LibPath);
- // Make sure its a directory
- if (!LPath.isDirectory())
+ // Make sure it exists
+ if (!LPath.exists())
return isBytecodeLPath;
+ // Make sure its a directory
+ try
+ {
+ if (!LPath.isDirectory())
+ return isBytecodeLPath;
+ }
+ catch (std::string& xcptn)
+ {
+ return isBytecodeLPath;
+ }
+
// Grab the contents of the -L path
std::set<sys::Path> Files;
LPath.getDirectoryContents(Files);