Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: lib/Support/Unix/Path.inc

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Support/Unix/Memory.inc ('k') | lib/Support/Unix/Process.inc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Support/Unix/Path.inc
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 634d4049d7decbeadefcb6ccabaaa208e8f189bc..d2f11b6f04f9f76168fc1508ab65246d64b65061 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -193,6 +193,10 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
char link_path[MAXPATHLEN];
if (realpath(DLInfo.dli_fname, link_path))
return link_path;
+ // @LOCALMOD-BEGIN
+#elif defined(__native_client__)
+ // Nothing.
+ // @LOCALMOD-END
#else
#error GetMainExecutable is not implemented on this host yet.
#endif
@@ -211,7 +215,16 @@ UniqueID file_status::getUniqueID() const {
std::error_code current_path(SmallVectorImpl<char> &result) {
result.clear();
-
+ // @LOCALMOD-START NaCl doesn't have paths, and the translator returns an
+ // error for getcwd below. Return a dummy path instead.
+#if defined(__native_client__)
+ result.reserve(2);
+ result.set_size(2);
+ result[0] = '/';
+ result[1] = '\0';
+ return std::error_code();
+#else // !defined(__native_client__)
+ // @LOCALMOD-END
const char *pwd = ::getenv("PWD");
llvm::sys::fs::file_status PWDStatus, DotStatus;
if (pwd && llvm::sys::path::is_absolute(pwd) &&
@@ -242,6 +255,9 @@ std::error_code current_path(SmallVectorImpl<char> &result) {
result.set_size(strlen(result.data()));
return std::error_code();
+ // @LOCALMOD-START
+#endif // defined(__native_client__)
+ // @LOCALMOD-END
}
std::error_code create_directory(const Twine &path, bool IgnoreExisting) {
« no previous file with comments | « lib/Support/Unix/Memory.inc ('k') | lib/Support/Unix/Process.inc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698