Dan Gohman
5bc07d2bce
Check if ErrMsg is null. This fixes the "not" command.
...
llvm-svn: 117666
2010-10-29 17:20:42 +00:00
Dan Gohman
fc81579b5e
Make Program::Wait differentiate execution failure due to the file
...
being not found from the file being not executable.
llvm-svn: 117664
2010-10-29 16:54:25 +00:00
Dan Gohman
cae3c53b31
Make Program::Wait provide an error message string for errors
...
executing the child process and abnormal child process termination.
llvm-svn: 117661
2010-10-29 16:39:01 +00:00
Dan Gohman
47215f4e04
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.)
llvm-svn: 117596
2010-10-28 20:34:33 +00:00
Mikhail Glushenkov
d7faab5c95
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).
llvm-svn: 117582
2010-10-28 19:32:58 +00:00
Mikhail Glushenkov
0e9d9b51eb
Trailing whitespace.
...
llvm-svn: 117581
2010-10-28 19:32:53 +00:00
Daniel Dunbar
cc0e18dd4a
CrashRecovery: Fix raise() override to actually send the right signal, *cough*.
...
llvm-svn: 116072
2010-10-08 18:31:34 +00:00
Evan Cheng
139edad73a
Correctly check if a path is a directory. Fix by Brian Korver.
...
llvm-svn: 115991
2010-10-07 22:05:57 +00:00
Daniel Dunbar
31158b583a
Add an explicit initialization to work around what appears to be a valgrind
...
false positive, at least on Darwin. I haven't filed this, but you can feel free.
llvm-svn: 115242
2010-09-30 23:56:49 +00:00
Daniel Dunbar
18456f3d73
CrashRecovery/Darwin: Override raise() as well so that crash recovery doesn't
...
end up altering the thread on which crashes are done because of its use of
Darwin's broken raise() implementation.
llvm-svn: 114558
2010-09-22 17:46:10 +00:00
Dan Gohman
d51b43181e
Issue a #error if the host doesn't have an implementation for
...
GetMainExecutable yet.
llvm-svn: 113240
2010-09-07 18:26:49 +00:00
Dan Gohman
9e857449de
Apply a patch from Kees van Reeuwijk to add support for Minix.
...
Minix apparently doesn't like double-slash separators, and there's
no apparent need for them here.
llvm-svn: 112844
2010-09-02 18:24:46 +00:00
Dan Gohman
e201c07d23
Add an interface for unregistering a file from the FilesToRemove list.
...
llvm-svn: 112705
2010-09-01 14:17:34 +00:00
Anton Korobeynikov
4e7351d2ba
Some fixes for NetBSD
...
llvm-svn: 112662
2010-08-31 22:38:00 +00:00
Daniel Dunbar
f14d946379
CrashRecovery/Darwin: On Darwin, raise sends a signal to the main thread instead
...
of the current thread. This has the unfortunate effect that assert() and abort()
will end up bypassing our crash recovery attempts. We work around this for
anything in the same linkage unit by just defining our own versions of the
assert handler and abort.
llvm-svn: 111583
2010-08-19 23:45:39 +00:00
Dan Gohman
5cae103392
Eliminate unnecessary empty string literals.
...
llvm-svn: 110183
2010-08-04 01:39:08 +00:00
Owen Anderson
cfc2a57fcd
Add an erase() method to llvm::ThreadLocal.
...
llvm-svn: 109686
2010-07-28 22:49:43 +00:00
Duncan Sands
7a68cd094b
Rather than using an ifdef on the target to zero out fields,
...
just use memset to zero the entire struct.
llvm-svn: 108330
2010-07-14 14:32:33 +00:00
Chris Lattner
cda39c4ee4
improve Path::makeUnique when mkstemp/mktemp are not available
...
patch by Lasse Kärkkäinen in PR7404.
llvm-svn: 108110
2010-07-12 00:09:55 +00:00
Chris Lattner
ca97c92eb4
add some triple for minix, patch by Kees van Reeuwijk from PR7582
...
llvm-svn: 107785
2010-07-07 15:52:27 +00:00
Dan Gohman
288999b829
Factor out the handler work from SignalHandler into a helper function,
...
and change llvm::sys::RunInterruptHandlers to call that function directly
instead of calling SignalHandler, because the rest of SignalHandler
invokes side effects which aren't appropriate, including raising the
signal.
llvm-svn: 104896
2010-05-27 23:11:55 +00:00
Dan Gohman
78d1e84521
Don't bother clearing the Magic string when the magic number
...
can't be read, since it isn't cleared on other error paths.
llvm-svn: 104852
2010-05-27 17:14:10 +00:00
Daniel Dunbar
68272566c6
Add llvm::sys::RunInterruptHandlers(), which runs the registered SIGINT cleanup
...
stuff.
llvm-svn: 103333
2010-05-08 02:10:34 +00:00
Dan Gohman
b0071d041f
This doesn't need SmallVector.h anymore.
...
llvm-svn: 101790
2010-04-19 17:51:31 +00:00
Dan Gohman
3457061a66
Fix this for std::vectors which don't have .data().
...
llvm-svn: 101785
2010-04-19 16:33:28 +00:00
Dan Gohman
f656397cc0
Fix -Wcast-qual warnings.
...
llvm-svn: 101782
2010-04-19 15:55:10 +00:00
Dan Gohman
a84dc0cc6e
Revert 91528 and use a std::vector instead, fixing an abuse of std::string.
...
llvm-svn: 101781
2010-04-19 15:54:44 +00:00
Chris Lattner
d3db453d15
avoid temporary std::string in non posix_spawn path.
...
llvm-svn: 101723
2010-04-18 17:34:10 +00:00
Benjamin Kramer
5b4be748cb
Eliminate temporary string.
...
llvm-svn: 101711
2010-04-18 09:19:41 +00:00
Benjamin Kramer
1360e9e270
Properly inherit the environment on darwin where environ is not available for shared libraries.
...
llvm-svn: 101710
2010-04-18 09:16:04 +00:00
Nick Lewycky
554a39889b
This is horrible. Split the difference, and declare 'environ' on all non-Darwin
...
platforms to unbreak the darwin and linux builds. The BSD folks should feel
free to change the #if, if this breaks them.
llvm-svn: 101703
2010-04-18 07:07:48 +00:00
Nick Lewycky
320aa4a493
Revert r101701, Darwin doesn't have 'environ'. Go figure.
...
llvm-svn: 101702
2010-04-18 06:44:21 +00:00
Nick Lewycky
3fdf58800a
Fix linux build. posix_spawn doesn't inherit the environment by default.
...
llvm-svn: 101701
2010-04-18 06:22:26 +00:00
Chris Lattner
a50738abba
make Program::Execute use posix_spawn on systems that support it,
...
as it is more efficient than fork/exec.
Thanks to Eric for adding the autoconf check. It would be nice if
a cmake guru could add a cmake check for posix_spawn as well.
llvm-svn: 101693
2010-04-18 04:14:37 +00:00
Chris Lattner
3a747aef96
improve haiku portability, patch by Paul Davey.
...
llvm-svn: 100933
2010-04-10 17:54:51 +00:00
Dan Gohman
39027c403c
Fix a grammaro.
...
llvm-svn: 99917
2010-03-30 20:04:57 +00:00
Chris Lattner
574907ed88
remove a constructor implementation that isn't declared
...
in the header. How can both clang and gcc accept this?
PR6703
llvm-svn: 99658
2010-03-26 22:17:24 +00:00
Jeffrey Yasskin
c4e3f05380
Fix a false-positive memory leak in code using RemoveFileOnSignal(). Because
...
libstdc++'s std::string class points to the interior of an allocation, valgrind
reports strings still alive at program termination as possible leaks. I didn't
use a ManagedStatic for this because System can't depend on Support.
llvm-svn: 98716
2010-03-17 07:08:12 +00:00
Chris Lattner
65a437fb80
don't forget to close a FD on an error condition, found by
...
cppcheck, PR6617. Patch by Ettl Martin!
llvm-svn: 98525
2010-03-14 23:16:45 +00:00
Chris Lattner
3b38fd6488
follow-on to PR6280
...
llvm-svn: 96172
2010-02-14 18:20:09 +00:00
Chris Lattner
62f50dad8d
improve support for minix, PR6280, patch by
...
Kees van Reeuwijk!
llvm-svn: 95946
2010-02-12 00:37:46 +00:00
Douglas Gregor
1051937c21
Add llvm::Program::ChangeStderrToBinary().
...
llvm-svn: 94743
2010-01-28 06:42:08 +00:00
Torok Edwin
fbcd2c76d5
Fix TimeValue::now() on Unix.
...
TimeValue()::now().toEpochTime() is supposed to be the same as time(),
but it wasn't, because toEpoch subtracted PosixZeroTime, but now()
didn't add PosixZeroTime!
Add a unittest to check this works.
llvm-svn: 94178
2010-01-22 15:51:31 +00:00
Nuno Lopes
129819de71
move a few more symbols to .rodata
...
llvm-svn: 92011
2009-12-23 17:48:10 +00:00
Jeffrey Yasskin
5908f1e27b
Make Path use StringRef instead of std::string where possible.
...
llvm-svn: 91620
2009-12-17 21:02:39 +00:00
Chris Lattner
a6fc9de9fc
remove use of SmallVector from Path::makeUnique. Path::makeUnique
...
is not used by anything performance sensitive, so just use std::string.
llvm-svn: 91528
2009-12-16 08:40:44 +00:00
Chris Lattner
e6be85661d
eliminate an extraneous use of SmallVector in a case where
...
a fixed size buffer is perfectly fine.
llvm-svn: 91527
2009-12-16 08:35:54 +00:00
Daniel Dunbar
5ea6200d06
Remove spurious extern.
...
llvm-svn: 90937
2009-12-09 03:26:33 +00:00
Benjamin Kramer
8cb52c266f
Remove dead returns.
...
llvm-svn: 90083
2009-11-29 17:42:58 +00:00
Kovarththanan Rajaratnam
4b9f0b6720
This patch ensures that Path::GetMainExecutable is able to handle the
...
case where realpath() fails. When this occurs we segfault trying to
create a std::string from a NULL pointer.
Fixes PR5635.
llvm-svn: 90082
2009-11-29 17:19:48 +00:00