Commit Graph

751 Commits

Author SHA1 Message Date
Peter Collingbourne
b1a33c4a59 Fix typo: Exectuable -> Executable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:43:43 +00:00
Michael J. Spencer
fae76d0734 This is the first step in adding sane error handling support to LLVMSystem.
The system API's will be shifted over to returning an error_code, and returning
other return values as out parameters to the function.

Code that needs to check error conditions will use the errc enum values which
are the same as the posix_errno defines (EBADF, E2BIG, etc...), and are
compatable with the error codes in WinError.h due to some magic in system_error.

An example would be:

if (error_code ec = KillEvil("Java")) { // error_code can be converted to bool.
  handle_error(ec);
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 18:31:52 +00:00
Michael J. Spencer
6c43de46ff Fix Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 15:06:00 +00:00
Michael J. Spencer
339b9121bd System/Win32/Path: Implement isSymLink.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118681 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 15:05:39 +00:00
NAKAMURA Takumi
46cf7c5fd6 Win32/Process.inc: [PR8527] Process::FileDescriptorIsDisplayed(fd) should not check by FILE_TYPE_CHAR. It must be better to check it with Console API.
The special file "NUL" is FILE_TYPE_CHAR with GetFileType(h). It was treated as display device and discarding output to NUL had failed. (eg. opt -o nul)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118678 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-10 08:37:47 +00:00
Michael J. Spencer
525ba5748c System/Path/Windows: Implement GetLLVMDefaultConfigDir.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:11:42 +00:00
Michael J. Spencer
05283c2a2b System/Path/Windows: Generalize GetUserHomeDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118506 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:11:31 +00:00
Michael J. Spencer
eebe970c36 System/Path/Windows: Make GetSystemLibraryPaths more generic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118505 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:11:19 +00:00
Michael J. Spencer
966023b58a System/Windows: Reduce dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118504 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:11:07 +00:00
Michael J. Spencer
6d99092c13 System/Windows: Use normalized case and include method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118503 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:10:56 +00:00
Michael J. Spencer
87e0697a46 System/Path/Windows: Change GetRootDirectory to return file:/// instead of C:/.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118502 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:10:45 +00:00
Michael J. Spencer
64cf752e9c Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118501 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 15:10:29 +00:00
Owen Anderson
9ac18d562d Fix PR8441, a thread unsafe static variable in our dynamic library loading facilities.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118463 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 00:36:06 +00:00
Michael J. Spencer
23721d5b19 Remove contributor names as per coding statndard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08 20:56:32 +00:00
Rafael Espindola
9e07a149b0 Add method for checking if a path is a symbolic link.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118367 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-07 04:36:50 +00:00
Daniel Dunbar
ea8e20696e System: Add llvm_execute_on_thread, which does what it says.
- Primarily useful for running some code with a specified stack size, when
   pthreads are available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118222 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 01:26:25 +00:00
Dan Gohman
4e0a9c51b4 Delete unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118128 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 00:09:12 +00:00
Dan Gohman
aabb9b67bc Remove several unhelpful checks for isValid from sys::Path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 00:01:23 +00:00
Dan Gohman
ac793822cd Don't try to enforce MAXPATHLEN in sys::Path for Unix. OS's can check
limits on their own.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 23:19:55 +00:00
Dan Gohman
9e2e0c39e7 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118110 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 23:16:26 +00:00
Dan Gohman
6f6021ecfe Fix a copy+pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:56:51 +00:00
Dan Gohman
b48a8fddbf Avoid manipulating paths in fixed-sized arrays.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:55:34 +00:00
Dan Gohman
0803ebe0c8 Simplify this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:50:10 +00:00
Dan Gohman
a0f1a2baee Use '\0' instead of 0 for nul character constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118096 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:41:19 +00:00
Mikhail Glushenkov
bd6e0323b9 appendSuffix: don't append a dot when the suffix is empty.
Additionally, move the implementation of appendSuffix to Path.cpp: it is
platform-independent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:18:37 +00:00
Dan Gohman
8d4fd965d4 Eliminate some temporary std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:07:47 +00:00
Dan Gohman
8eeb5ae31d Micro-optimize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118058 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:52:47 +00:00
Mikhail Glushenkov
c8aef4b2ea GetDLLSuffix: Remove the leading dot from LTDL_SHLIB_EXT.
This allows using GetDLLSuffix() with appendSuffix().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:59 +00:00
Mikhail Glushenkov
9cd5971228 Make FindProgramByName return paths with slashes unmodified on Windows.
This makes its behaviour more consistent across platforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118048 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:39 +00:00
Mikhail Glushenkov
0f2ec15b9e 80-col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:31 +00:00
Mikhail Glushenkov
f5a95ce0d4 Path: Add GetEXESuffix() to complement GetDLLSuffix().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:26 +00:00
Dan Gohman
3545635a60 Check if ErrMsg is null. This fixes the "not" command.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117666 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 17:20:42 +00:00
Dan Gohman
e5f77cda25 Make Program::Wait differentiate execution failure due to the file
being not found from the file being not executable. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117664 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 16:54:25 +00:00
Dan Gohman
695e85d477 Make Program::Wait provide an error message string for errors
executing the child process and abnormal child process termination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 16:39:01 +00:00
Dan Gohman
24a492683c Revert r117582, which reverted r77396. Searching PATH for a string
which contains slashes is inconsistent with the meaning of PATH on
Unix-type platforms, and pretty surprising.

If the user has given a specific path to execute and we can't
execute it, we should fail and say why.  (Apparently the new
posix_spawn code doesn't always say why, but that's a separate
issue.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117596 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 20:34:33 +00:00
Mikhail Glushenkov
c61c7549a8 Revert r77396.
Original commit message:

    On "Unix", if Program::FindProgramByName is given a name containing
    slashes, just go with it, regardless of whether it looks like it will
    be executable. This follows the behavior of sh(1) more closely.

It's better when behaviour is consistent between platforms. This change also
makes FindExecutable() behave as expected on unix-likes (before this commit, it
used to always succeed).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:32:58 +00:00
Mikhail Glushenkov
7289d06e48 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117581 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 19:32:53 +00:00
Mikhail Glushenkov
6d8ac5ac6d Reindent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 08:25:44 +00:00
Mikhail Glushenkov
401b90a4bc 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 09:09:10 +00:00
Mikhail Glushenkov
11d03f690e Remove try/catch(...) from Win32/Signals.inc.
catch(...) is used in Win32/Signals.inc for catching Win32 structured
exceptions, but according to [1], this is wrong.

We can't simply change try/catch to __try/__finally, since this syntax is not
supported by MinGW. We can use __try/__finally on MSVC and __try1/__except1
macros on MinGW [2], but I think that that solution obfuscates the code too
much.

The use of try/catch(...) in Signals.inc makes it impossible to link
MinGW-compiled libSystem with llvm-gcc compiled executables. I propose that we
just remove try/catch(...) from Signals.inc, since the meaning of the code won't
change.

[1] http://members.cox.net/doug_web/eh.htm
[2] http://article.gmane.org/gmane.comp.compilers.llvm.cvs/81315

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 09:09:04 +00:00
Duncan Sands
05897c8f26 ATTRIBUTE_UNUSED has been renamed to LLVM_ATTRIBUTE_UNUSED.
Rather than rename this instance, use the cast-to-void idiom
instead.  This will hopefully fix the windows buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-25 13:10:03 +00:00
NAKAMURA Takumi
2172f3cd97 Win32/Signals.inc: DontRemoveFileOnSignal(): Please acquire the CriticalSection.
It choked BugPoint on Mingw.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 01:23:50 +00:00
Mikhail Glushenkov
84ba14f6d0 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117058 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 20:40:39 +00:00
Michael J. Spencer
9f608b1919 Use C++03...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 16:00:45 +00:00
Michael J. Spencer
a9cf7b8443 System-Win32/Path: Fix incorrect assumption in isValid.
A recent commit to clang exposed a bug in the Win32 Path code. This is a
minimal fix for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 15:23:58 +00:00
Chandler Carruth
1cd9708f5c Remove remaining uses of ATTRIBUTE_UNUSED on variables, and delete three
#includes in the process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116919 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 08:27:02 +00:00
NAKAMURA Takumi
f10c519249 Add ATTRIBUTE_UNUSED for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116909 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 04:05:29 +00:00
NAKAMURA Takumi
5c0db76cf2 lib/System/Win32/ThreadLocal.inc: Suppress "unused" warning on -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 01:22:01 +00:00
Oscar Fuentes
f0c55a9b97 Build with RTTI and exceptions disabled. Only in GCC for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-17 02:26:16 +00:00
Oscar Fuentes
00a9618458 When building shared libraries, link to required system libraries.
PR 8375

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116479 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 15:54:41 +00:00