Commit Graph

129 Commits

Author SHA1 Message Date
Chris Lattner
1bebfb5ae4 Modify setStatusInfoOnDisk to not throw an exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29402 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 22:36:17 +00:00
Chris Lattner
0c33231eff Modify Path::eraseFromDisk to not throw an exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29400 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 22:29:50 +00:00
Chris Lattner
252ad03d7d Change Path::getStatusInfo to return a boolean and error string on an error
instead of throwing an exception.  This reduces the amount of code that is
exposed to exceptions (e.g. FileUtilities), though it is clearly only one step
along the way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29395 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-28 22:03:44 +00:00
Chris Lattner
ff3d80ff7e simple optimization: don't bother calling "exists" (which calls the syscall
"access").  Instead, just let the open call fail if the file doesn't exist.
This reduces the # syscalls executed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29173 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-18 07:07:51 +00:00
Chris Lattner
84bad2f96c Remove a dead conditional: info_ can only be allocated if FD is good. Improve
spacing


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29172 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-18 07:03:14 +00:00
Chris Lattner
0af7093532 The only entry in the stat buf this code cares about is the size. Keep just
the size, not the whole stat buffer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29171 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-18 07:01:08 +00:00
Chris Lattner
cca68faac2 Reduce code in the error path by only allocating info_ if everything looks
good.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29170 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-18 06:57:51 +00:00
Chris Lattner
c22c7d3cdf Unindent some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29169 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-18 06:52:52 +00:00
Chris Lattner
0228c0fc8d Turn an if into an else if.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29129 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-12 22:37:18 +00:00
Chris Lattner
b14c342bd5 no need to do a stat then an lstat. lstat will tell us if normal files don't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29068 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-07 21:21:06 +00:00
Chris Lattner
bed22d8902 Change AllocateRWX/DeallocateRWX to not throw an exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29058 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-07 17:32:37 +00:00
Reid Spencer
dc6830ff25 Only print the stack trace if it was requested. Previously, any call into
the Signals module that registered the handlers would cause the stack trace
to be generated. Now, you must explicitly call PrintStackTraceOnErrorSignal
in order for that to happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28810 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-16 00:00:57 +00:00
Evan Cheng
2fafaf1b01 Don't pull in environ, not always safe. Global variables are bad anyway.
Use execve when explicit environment variables ptr is available. Otherwise
just use execv.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28740 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-09 20:43:11 +00:00
Reid Spencer
32f5553c03 For PR787:
Provide new llvm::sys::Program facilities for converting the stdout and
stdin to binary mode. There is no standard way to do this and the available
mechanisms are platform specific. Adjust the bytecode reader and writer to
use these methods when their input is stdin or output is stdout. THis avoids
the problem with \n writing CRLF to a bytecode file on windows.

Patch Contributed by Michael Smith.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28722 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-07 23:18:34 +00:00
Chris Lattner
505f9c8839 This function is not documented as throwing an exception and callers don't
handle it.  Just silently fail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28291 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-14 18:53:09 +00:00
Chris Lattner
095cc37e22 Fix accidentally committed patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28260 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-12 18:20:39 +00:00
Chris Lattner
2b80e8d635 Fix iterator invalidation bug, identified by Coverity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28257 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-12 18:13:11 +00:00
Reid Spencer
d555f413cd For PR351:
* Allow the ExecuteAndWait to return negative values if a signal is
  detected as the reason for the child termination. This is needed to
  support bugpoint detecting bad things in its child processes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24960 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-22 20:00:16 +00:00
Reid Spencer
b13cf98e6b Implement a generic polled Alarm function. This merely removes the system
dependent portion of the lib/Support/SlowOperationTimer code into the
lib/System implementation where it can be ported to different platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24937 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-22 03:23:46 +00:00
Chris Lattner
c590e9afc9 instead of using mstats, use malloc_zone_statistics which returns numbers
that actually make sense.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24352 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-14 07:27:56 +00:00
Chris Lattner
513a9547f5 Teach -track-memory to work on darwin. Looking at sbrk doesn't work because
the default allocator uses mmap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-14 07:00:29 +00:00
Chris Lattner
fa8c292ebd Implement sys::SetInterruptFunction on Unix, stub it on win32 so that the
build will not fail


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22578 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-02 02:14:22 +00:00
Andrew Lenharth
a00269bc3e support near allocations for the JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22554 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 23:40:16 +00:00
Reid Spencer
3be872ed59 Fix a problem in getDirectoryContents where sub-directory names were
appended to a path string that didn't end in a slash, yielding invalid
path names.

Path contribute by Nicholas Riley.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22539 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 16:25:57 +00:00
Reid Spencer
b2164e5cb5 For PR540:
Add a Mutex class for thread synchronization in a platform-independent way.
The current implementation only supports pthreads. Win32 use of Critical
Sections will be added later. The design permits other threading models to
be used if (and only if) pthreads is not available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:37:43 +00:00
Jeff Cohen
73f36671b2 1. Fix bug in getBaseName where it mishandles suffixes
2. Fix bug in eraseSuffix where it allows /path/.suffix to become /path/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22362 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-09 18:42:02 +00:00
Reid Spencer
8b2d1aa37b Ensure that functions like isDirectory don't fail if the file doesn't
exist but just return false instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22361 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 17:46:10 +00:00
Reid Spencer
6371ccbd8d Two changes:
1. Use isValid() to check validity of the resulting path name in the
   eraseSuffix even though we can't think of a case where eraseSuffix could
   possibly cause an invalid path name.
2. Rewrite isValid() to not use the deprecated realpath function any more.
   It now just uses isascii to make sure all the characters are legit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22359 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 06:53:26 +00:00
Jeff Cohen
85c716f83d Stamp out tabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22357 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 05:02:13 +00:00
Jeff Cohen
563a17fb35 Fix eraseSuffix()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22355 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 04:49:16 +00:00
Reid Spencer
a229c5cce7 Final Changes For PR495:
This chagne just renames some sys::Path methods to ensure they are not
misused. The Path documentation now divides methods into two dimensions:
Path/Disk and accessor/mutator. Path accessors and mutators only operate
on the Path object itself without making any disk accesses. Disk accessors
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:

makeReadable        -> makeReadableOnDisk
makeWriteable       -> makeWriteableOnDisk
makeExecutable      -> makeExecutableOnDisk
setStatusInfo       -> setStatusInfoOnDisk
createDirectory     -> createDirectoryOnDisk
createFile          -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy             -> eraseFromDisk
rename              -> renamePathOnDisk

These changes pass the Linux Deja Gnu tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 03:08:58 +00:00
Reid Spencer
dd04df0ec3 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:21:43 +00:00
Reid Spencer
c7f083297c For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22345 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 18:21:42 +00:00
Reid Spencer
932e2e33eb Put in a hack for Cygwin that prevents mkdtemp from being used since
configure seems to find it on Cygwin but linking against it fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22189 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-02 05:38:20 +00:00
Duraid Madina
26b1d42c84 comment the hpux bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22081 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-16 06:59:53 +00:00
Misha Brukman
6b8a63ae58 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21704 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:33:09 +00:00
Alkis Evlogimenos
38da41cc44 Silence gcc-4.0.0 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 17:56:01 +00:00
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Reid Spencer
93b3473478 Provide an implementation of the GetCurrentUserId and GetCurrentGroupId
methods that were recently added to the interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21401 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:12:57 +00:00
Reid Spencer
2aafadcc76 For Bug 543:
Standardize the error messages to be in "path: what failed: why" format.
Also attempt to use the correct errno to ThrowErrno in situations where
the errno value is erased by subsequent system calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 02:50:10 +00:00
Reid Spencer
03aee2e3f2 For Bug 543:
Allow the ThrowErrno function to optionally accept an error number
parameter so that callers can specify the error number to be used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21384 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 02:30:32 +00:00
Misha Brukman
22c46da12b Add FIXME by Markus Oberhumer from bug 545: not checking for "." in $PATH may
result in returning executable files that won't be runnable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21378 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 15:42:11 +00:00
Misha Brukman
8177bf8904 Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21377 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 15:33:22 +00:00
Misha Brukman
4619c75f64 Ignore dangling symlinks in getDirectoryContents()
Thanks to Markus Oberhumer for the patch!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 04:04:07 +00:00
Reid Spencer
1af69a8131 Be slightly more accurate in an error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-02 05:45:56 +00:00
Chris Lattner
0798056b28 Fix a bug in my previous change to this, which broke the build on sparcs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20184 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-14 21:42:10 +00:00
Chris Lattner
946af52687 If errno is zero strerror_r does not modify the buffer, leaving it unterminated.
This causes garbage to be printed out after error messages.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20165 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 22:46:37 +00:00
Chris Lattner
8102fcde4c Fix bugpoint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19605 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 04:23:22 +00:00
Reid Spencer
62582720e6 Make asctime_r work for HP/UX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19544 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 00:50:50 +00:00
Reid Spencer
bccc8abc79 Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
gdb debugger doesn't get confused on which file it is reading (the one in
lib/System or the one in lib/System/{Win32,Unix})


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19426 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09 23:29:00 +00:00