Commit Graph

319 Commits

Author SHA1 Message Date
Dan Gohman
39f76bb6c8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 23:11:55 +00:00
Dan Gohman
02d5824266 Don't bother clearing the Magic string when the magic number
can't be read, since it isn't cleared on other error paths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 17:14:10 +00:00
Daniel Dunbar
fb89e08413 Add llvm::sys::RunInterruptHandlers(), which runs the registered SIGINT cleanup
stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 02:10:34 +00:00
Dan Gohman
023f8aaa16 This doesn't need SmallVector.h anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 17:51:31 +00:00
Dan Gohman
17192a1dd8 Fix this for std::vectors which don't have .data().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 16:33:28 +00:00
Dan Gohman
985744ecc6 Fix -Wcast-qual warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101782 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 15:55:10 +00:00
Dan Gohman
72bdd4ca07 Revert 91528 and use a std::vector instead, fixing an abuse of std::string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 15:54:44 +00:00
Chris Lattner
d65077a509 avoid temporary std::string in non posix_spawn path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101723 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 17:34:10 +00:00
Benjamin Kramer
d7aef9b440 Eliminate temporary string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101711 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 09:19:41 +00:00
Benjamin Kramer
bceaffc7cc Properly inherit the environment on darwin where environ is not available for shared libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 09:16:04 +00:00
Nick Lewycky
6523803203 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101703 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 07:07:48 +00:00
Nick Lewycky
1a3eb953cc Revert r101701, Darwin doesn't have 'environ'. Go figure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101702 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 06:44:21 +00:00
Nick Lewycky
b7dfca9778 Fix linux build. posix_spawn doesn't inherit the environment by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101701 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 06:22:26 +00:00
Chris Lattner
4f098b68a5 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-18 04:14:37 +00:00
Chris Lattner
47e476609b improve haiku portability, patch by Paul Davey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 17:54:51 +00:00
Dan Gohman
4bb31bfaa3 Fix a grammaro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 20:04:57 +00:00
Chris Lattner
f35d88f439 remove a constructor implementation that isn't declared
in the header.  How can both clang and gcc accept this?

PR6703


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99658 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-26 22:17:24 +00:00
Jeffrey Yasskin
b7ccf75de5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 07:08:12 +00:00
Chris Lattner
cdff5f7787 don't forget to close a FD on an error condition, found by
cppcheck, PR6617.  Patch by Ettl Martin!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 23:16:45 +00:00
Chris Lattner
782ab584e5 follow-on to PR6280
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96172 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 18:20:09 +00:00
Chris Lattner
6ae7bbb5ea improve support for minix, PR6280, patch by
Kees van Reeuwijk!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 00:37:46 +00:00
Douglas Gregor
21569cddc1 Add llvm::Program::ChangeStderrToBinary().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94743 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 06:42:08 +00:00
Torok Edwin
b0a5baefaa 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 15:51:31 +00:00
Nuno Lopes
ec9d8b0047 move a few more symbols to .rodata
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 17:48:10 +00:00
Jeffrey Yasskin
88cd3582b6 Make Path use StringRef instead of std::string where possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91620 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 21:02:39 +00:00
Chris Lattner
dc5138d81f remove use of SmallVector from Path::makeUnique. Path::makeUnique
is not used by anything performance sensitive, so just use std::string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 08:40:44 +00:00
Chris Lattner
e4b0cd2856 eliminate an extraneous use of SmallVector in a case where
a fixed size buffer is perfectly fine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 08:35:54 +00:00
Daniel Dunbar
164c7ba0ef Remove spurious extern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:26:33 +00:00
Benjamin Kramer
18eaefd25e Remove dead returns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 17:42:58 +00:00
Kovarththanan Rajaratnam
d614673bb8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 17:19:48 +00:00
Edward O'Callaghan
e49a8e4db9 API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 06:32:19 +00:00
Daniel Dunbar
98e46d81c4 Remove bogus error handling code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 19:03:33 +00:00
Edward O'Callaghan
d41e944501 Provide Path::isSpecialFile interface for PR5568.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 15:19:10 +00:00
Duncan Sands
68d29d09c6 Revert commit 81144, and add a comment. It caused bugpoint timeouts
not to work any more on linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 20:55:48 +00:00
Edward O'Callaghan
bd5dc45296 Fix malloc.h is deprecated warning on DragonFly BSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-02 03:20:57 +00:00
Dan Gohman
0b81e19d19 Most stack straces don't need 3 digits worth of levels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 02:45:10 +00:00
Chandler Carruth
8b67f774e9 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Ted Kremenek
8201ebd40b Use 'waitpid' instead of 'wait'. Basing Program::Wait() on 'wait()' prevents it being correct within a multithreaded context.
This address: PR 5277 (Program::Wait is unsafe to call from multiple threads).

Note: If waitpid() turns out to be non-portable, we can add more autoconf magic, or look into
another solution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:16:17 +00:00
Edward O'Callaghan
df40664a63 Haiku porting patches, Credit to Paul Davey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 04:57:20 +00:00
Daniel Dunbar
57d6903dea Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 04:44:56 +00:00
Mikhail Glushenkov
6db0e3a981 Get rid of GetProcessId in Win32/Program.inc.
GetProcessId was introduced only in XP. As a bonus, this change makes Program
objects copyable, since Program is now basically a PID.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 03:39:45 +00:00
Dan Gohman
ec080467f5 Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn't
working. To support this, add an is_displayed() function to raw_ostream,
and generalize Process::StandardOutIsDisplayed and friends in order to
support it.

Also, call RemoveFileOnSignal before creating a file instead of after, so
that the file isn't left behind if the program is interrupted between when
the file is created and RemoveFileOnSignal is called.

While here, add a -S to llvm-extract and port it to IRReader so that it
supports assembly input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 20:46:33 +00:00
Benjamin Kramer
d8b0630027 Add a shortcut for OS X to Path::GetMainExecutable. This gives a nice speedup on
clang's testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 12:09:08 +00:00
Mikhail Glushenkov
8add26934a Check that the 'kill' call succeeded.
Thanks to Duncan Sands for spotting this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 09:51:47 +00:00
Mikhail Glushenkov
f1c3d5010f This should unbreak the build on 64-bit Linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 20:31:27 +00:00
Mikhail Glushenkov
c22675b542 Const-correctness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 19:51:39 +00:00
Mikhail Glushenkov
edf8e48c21 Get rid of the Pid_ member in the Program class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 19:50:55 +00:00
Mikhail Glushenkov
a607202a68 Add a Kill() function to the Program class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 19:50:27 +00:00
Duncan Sands
3429c5e153 Using a signal handler that does nothing should be
equivalent to SIG_IGN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-07 05:58:25 +00:00
Duncan Sands
c2d98bc0d6 Remove some not-really-used variables, as warned
about by icc (#593, partial).  Patch by Erick Tryzelaar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 12:41:19 +00:00