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
Edward O'Callaghan
746782dde5
API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
...
llvm-svn: 89848
2009-11-25 06:32:19 +00:00
Daniel Dunbar
7402c472c3
Remove bogus error handling code.
...
llvm-svn: 89786
2009-11-24 19:03:33 +00:00
Edward O'Callaghan
dddf134a3c
Provide Path::isSpecialFile interface for PR5568.
...
llvm-svn: 89765
2009-11-24 15:19:10 +00:00
Duncan Sands
fec62f0ef5
Revert commit 81144, and add a comment. It caused bugpoint timeouts
...
not to work any more on linux.
llvm-svn: 86481
2009-11-08 20:55:48 +00:00
Edward O'Callaghan
2c7457c0f1
Fix malloc.h is deprecated warning on DragonFly BSD.
...
llvm-svn: 85782
2009-11-02 03:20:57 +00:00
Dan Gohman
b0cad70c24
Most stack straces don't need 3 digits worth of levels.
...
llvm-svn: 85575
2009-10-30 02:45:10 +00:00
Chandler Carruth
56869f22c4
Move DataTypes.h to include/llvm/System, update all users. This breaks the last
...
direct inclusion edge from System to Support.
llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Ted Kremenek
b5cd6233b1
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.
llvm-svn: 84903
2009-10-22 22:16:17 +00:00
Edward O'Callaghan
8227b0512f
Haiku porting patches, Credit to Paul Davey.
...
llvm-svn: 83823
2009-10-12 04:57:20 +00:00
Daniel Dunbar
7b446a001d
Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
...
ExecuteAndWait.
llvm-svn: 82522
2009-09-22 04:44:56 +00:00
Mikhail Glushenkov
0adf07eb9e
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.
llvm-svn: 81826
2009-09-15 03:39:45 +00:00
Dan Gohman
e592923603
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.
llvm-svn: 81568
2009-09-11 20:46:33 +00:00
Benjamin Kramer
2a1131a42f
Add a shortcut for OS X to Path::GetMainExecutable. This gives a nice speedup on
...
clang's testsuite.
llvm-svn: 81333
2009-09-09 12:09:08 +00:00
Mikhail Glushenkov
d2f8a111cd
Check that the 'kill' call succeeded.
...
Thanks to Duncan Sands for spotting this.
llvm-svn: 81328
2009-09-09 09:51:47 +00:00
Mikhail Glushenkov
a3fbf36004
This should unbreak the build on 64-bit Linux.
...
llvm-svn: 81252
2009-09-08 20:31:27 +00:00
Mikhail Glushenkov
29b5d3012b
Const-correctness.
...
llvm-svn: 81249
2009-09-08 19:51:39 +00:00
Mikhail Glushenkov
f9e2f241df
Get rid of the Pid_ member in the Program class.
...
llvm-svn: 81247
2009-09-08 19:50:55 +00:00
Mikhail Glushenkov
4a91b7605b
Add a Kill() function to the Program class.
...
llvm-svn: 81246
2009-09-08 19:50:27 +00:00
Duncan Sands
cd32ecf44f
Using a signal handler that does nothing should be
...
equivalent to SIG_IGN.
llvm-svn: 81144
2009-09-07 05:58:25 +00:00
Duncan Sands
89720bbd11
Remove some not-really-used variables, as warned
...
about by icc (#593 , partial). Patch by Erick Tryzelaar.
llvm-svn: 81115
2009-09-06 12:41:19 +00:00
Duncan Sands
44d423ac93
Tweak code into an equivalent form for which icc
...
doesn't warn about unreachable instructions. Patch
by Erick Tryzelaar (#111 ).
llvm-svn: 81110
2009-09-06 10:53:22 +00:00
Daniel Dunbar
18d6959f39
Improve llvm::getHostTriple for some cases where the LLVM_HOSTTRIPLE is not
...
reliable.
llvm-svn: 80863
2009-09-03 01:10:13 +00:00
Chris Lattner
30ebdc4311
remove the last uses of Config/alloca.h
...
llvm-svn: 79873
2009-08-23 22:57:38 +00:00
Chris Lattner
c521f54198
Prune #includes from llvm/Linker.h and llvm/System/Path.h,
...
forcing them down into various .cpp files.
This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
instead.
4. Weans llvm-db off <iostream>
sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.
llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Owen Anderson
a83e868078
Get rid of a helgrind warning. If this is _actually_ a performance problem,
...
we can find a way to cache the answer that isn't racy.
llvm-svn: 79472
2009-08-19 21:48:34 +00:00
Owen Anderson
820739dccc
Add locking around signal handler registration.
...
llvm-svn: 79254
2009-08-17 17:07:22 +00:00
Dan Gohman
a6d0afcb74
Fix a bunch of namespace pollution.
...
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Dan Gohman
798ae47b59
Minor code simplification.
...
llvm-svn: 78239
2009-08-05 20:16:55 +00:00
Dan Gohman
4cf97dddea
Update a comment to reflect the current code.
...
llvm-svn: 78215
2009-08-05 17:32:39 +00:00
Dan Gohman
7ce1fe2d04
Remove needless uses of std::flush in the parent process after a
...
fork call. This eliminates a need for <iostream>. Also remove
needless fsync calls.
llvm-svn: 78131
2009-08-05 00:17:00 +00:00
Dan Gohman
23a419f361
Use _exit rather than exit in the child process after a failed exec.
...
Add a comment explaining why.
llvm-svn: 78128
2009-08-05 00:09:12 +00:00
Dan Gohman
6faa1d2f8f
Follow Unix behavior and return 127 if the command is not found,
...
and 126 if it is not executable.
llvm-svn: 78120
2009-08-04 23:15:49 +00:00
Daniel Dunbar
8b6be17777
When exec() fails, return 127 instead of errno; the parent process has no way to
...
distinguish that the result is errno, so it can't use it to provide more
information about the error (it also exposes the numeric value of errno).
llvm-svn: 78098
2009-08-04 20:32:25 +00:00
Daniel Dunbar
1a6a39eb46
Fix a race condition in getting the process exit code on Win32.
...
llvm-svn: 77953
2009-08-03 05:02:46 +00:00
Dan Gohman
4723c103e3
Remove another F_OK.
...
llvm-svn: 77405
2009-07-29 00:02:58 +00:00
Dan Gohman
0c96daabad
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.
llvm-svn: 77396
2009-07-28 23:25:18 +00:00
Dan Gohman
367006523a
It isn't necessary to use F_OK when using R_OK or similar.
...
llvm-svn: 77392
2009-07-28 23:22:01 +00:00