Commit Graph

141 Commits

Author SHA1 Message Date
Reid Spencer
d8509c95b8 Don't throw needlessly. Failure of gettimeofday is *very* unlinkely so
just return MinTime if that should ever happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29826 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-22 17:38:44 +00:00
Reid Spencer
6d045fcdcd For PR797:
Make MappedFile not throw any exceptions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29816 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-22 16:04:22 +00:00
Reid Spencer
ad42ea7356 For PR797:
Fix a bug in my last patch that botched file redirection by using explicit
scoping of if statements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29815 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-22 15:56:52 +00:00
Reid Spencer
76b08d84c5 Make an error message a little more intelligible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29808 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-22 05:28:38 +00:00
Reid Spencer
4ce5dc6377 For PR797:
Remove all exception code from Program.inc and implement its new interface
with an ErrMsg string argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29790 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-21 06:02:44 +00:00
Reid Spencer
023fcf9776 For PR797:
Make sys::Program::ExecuteAndWait not throw exceptions and update any
affected code. It now return -9999 to signal that the program couldn't be
executed. Only one case (in bugpoint) actually examines the result code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29785 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-21 02:04:43 +00:00
Reid Spencer
25259a3149 Remove extraneous #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29541 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-07 05:36:24 +00:00
Reid Spencer
a8e80c5188 Make the removal of files use Path::eraseFromDisk just like it does for
the removal of directories. Using std::remove is indiscriminate and can
lead to the removal of things like /dev/null if run as root. The
Path::eraseFromDisk method ensures that we only ever remove regular files
or directories, but never character or block special nodes.  This should
clear up the problem with usage like: llvm-as -o /dev/null which is used
in the llvm-test makefiles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29540 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-07 05:34:08 +00:00
Reid Spencer
bffdc36c38 Add a note about how the "isFile" check in Path::eraseFromDisk prevents
the erasure of non-file paths like /dev/null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29539 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-07 05:20:05 +00:00
Chris Lattner
0d167276dd Remove some now-dead methods. Use getFileStatus instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29447 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 18:16:02 +00:00
Chris Lattner
8961501c9b Use getFileStatus instead of Path::isDirectory().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29443 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 17:59:14 +00:00
Chris Lattner
c7c453a845 elimiante some syscalls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29442 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 17:51:09 +00:00
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