Commit Graph

481 Commits

Author SHA1 Message Date
Chris Lattner 9c6c94a806 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.

llvm-svn: 29173
2006-07-18 07:07:51 +00:00
Chris Lattner 4a5641525d Remove a dead conditional: info_ can only be allocated if FD is good. Improve
spacing

llvm-svn: 29172
2006-07-18 07:03:14 +00:00
Chris Lattner 7bc8197032 The only entry in the stat buf this code cares about is the size. Keep just
the size, not the whole stat buffer.

llvm-svn: 29171
2006-07-18 07:01:08 +00:00
Chris Lattner fe5b7fe6d9 Reduce code in the error path by only allocating info_ if everything looks
good.

llvm-svn: 29170
2006-07-18 06:57:51 +00:00
Chris Lattner 3eb42b7d14 Unindent some code
llvm-svn: 29169
2006-07-18 06:52:52 +00:00
Chris Lattner 78731ab1b8 Turn an if into an else if.
llvm-svn: 29129
2006-07-12 22:37:18 +00:00
Chris Lattner 0b2890e390 no need to do a stat then an lstat. lstat will tell us if normal files don't exist.
llvm-svn: 29068
2006-07-07 21:21:06 +00:00
Chris Lattner 9d9cd793a9 Move << method out of line.
llvm-svn: 29062
2006-07-07 18:11:32 +00:00
Chris Lattner 5a9d2e5a0a Change AllocateRWX/DeallocateRWX to not throw an exception.
llvm-svn: 29058
2006-07-07 17:32:37 +00:00
Chris Lattner a75df5e22c Fix this impl
llvm-svn: 29055
2006-07-07 17:26:47 +00:00
Chris Lattner 5df249dfea Add a helper function
llvm-svn: 29049
2006-07-07 17:13:10 +00:00
Chris Lattner 8c8858a6c4 Change LoadLibraryPermanently to not throw an exception.
llvm-svn: 29048
2006-07-07 17:12:36 +00:00
Chris Lattner 814744b22c This uses EH extensively
llvm-svn: 29036
2006-07-07 00:47:29 +00:00
Reid Spencer 57e8e38a6f 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.

llvm-svn: 28810
2006-06-16 00:00:57 +00:00
Evan Cheng 09cf82992b 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.

llvm-svn: 28740
2006-06-09 20:43:11 +00:00
Reid Spencer 36bc2b00eb Squelch a warning about signed/unsigned.
llvm-svn: 28729
2006-06-08 18:08:43 +00:00
Reid Spencer 5e91c03fa9 For PR804:
Change the file size field of StatusInfo to be uint64_t instead of size_t
so that we know it is always 64 bits. This prevents some overflow on
systems where size_t is 32 bits when it ought to be 64.

llvm-svn: 28726
2006-06-08 17:00:08 +00:00
Reid Spencer ab97f22ccc 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.

llvm-svn: 28722
2006-06-07 23:18:34 +00:00
Reid Spencer 54cb2d8533 For PR780:
Break the "IncludeFile" mechanism into its own header file and adjust other
files accordingly. Use this facility for the IntrinsicInst problem which
was the subject of PR800.
More to follow on this.

llvm-svn: 28709
2006-06-07 20:00:19 +00:00
Reid Spencer 7c77323e1d For PR798:
Add support for Graphviz. Patch contributed by Anton Korobeynikov.

llvm-svn: 28684
2006-06-05 15:44:46 +00:00
Reid Spencer 187b4adcfe Provide configuration support and usage for MINGW32 platform
llvm-svn: 28639
2006-06-01 19:03:21 +00:00
Reid Spencer a62f097c96 For PR786:
Turn -pedantic and -Wno-long-long compile flags on by default. In a few
places, avoid the warnings by removing these options in the local makefile.
One notable exception: lib/Target/CBackend/Writer.cpp. These warnings are
left on as a reminder to developers to clean them up.

llvm-svn: 28614
2006-06-01 01:55:21 +00:00
Chris Lattner 78b8e977b2 Bug noticed, by inspection. Filename can be null.
llvm-svn: 28292
2006-05-14 19:00:53 +00:00
Chris Lattner f64397ba1a This function is not documented as throwing an exception and callers don't
handle it.  Just silently fail.

llvm-svn: 28291
2006-05-14 18:53:09 +00:00
Chris Lattner 227d442d01 Fix accidentally committed patch.
llvm-svn: 28260
2006-05-12 18:20:39 +00:00
Chris Lattner 1971e8a77b Fix iterator invalidation bug, identified by Coverity.
llvm-svn: 28257
2006-05-12 18:13:11 +00:00
Jeff Cohen 04196acdcb Unlike Unix, Windows won't let a file be implicitly replaced via renaming without explicit permission.
llvm-svn: 28157
2006-05-07 02:51:51 +00:00
Jeff Cohen 71c2e0f262 Mingw32 patches supplied by Anton Korobeynikov.
llvm-svn: 28023
2006-04-29 18:41:44 +00:00
Jeff Cohen e3955a05e4 Add checks for __OpenBSD__.
llvm-svn: 27761
2006-04-17 17:55:41 +00:00
Reid Spencer 9857229aba Add the README files to the distribution.
llvm-svn: 27651
2006-04-13 06:39:24 +00:00
Reid Spencer c67a060a51 Convert llvm.cs.uiuc.edu -> llvm.org
llvm-svn: 26748
2006-03-14 05:54:52 +00:00
Jeff Cohen baeb39c969 Add AddSymbol() method to DynamicLibrary to work around Windows limitation
of being unable to search for symbols in an EXE.  It will also allow other
existing hacks to be improved.

llvm-svn: 25805
2006-01-30 04:33:51 +00:00
Jeff Cohen 8ee89c774b Fix indentation.
llvm-svn: 25795
2006-01-29 22:02:52 +00:00
Reid Spencer ccd5b90f58 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.

llvm-svn: 24960
2005-12-22 20:00:16 +00:00
Reid Spencer 3493dab23b 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.

llvm-svn: 24937
2005-12-22 03:23:46 +00:00
Chris Lattner 16cbc6a177 instead of using mstats, use malloc_zone_statistics which returns numbers
that actually make sense.

llvm-svn: 24352
2005-11-14 07:27:56 +00:00
Chris Lattner 698fa760f4 Teach -track-memory to work on darwin. Looking at sbrk doesn't work because
the default allocator uses mmap.

llvm-svn: 24349
2005-11-14 07:00:29 +00:00
Chris Lattner bde3845548 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
llvm-svn: 23940
2005-10-24 02:26:13 +00:00
Chris Lattner f07e354d8c Only build .a file versions of these libraries, instead of .a and .o versions.
This should speed up build times.

llvm-svn: 23937
2005-10-24 02:11:51 +00:00
Reid Spencer f85fabeb71 For PR616:
These patches make threading optional in LLVM. The configuration scripts are now
modified to accept a --disable-threads switch. If this is used, the Mutex class
will be implemented with all functions as no-op. Furthermore, linking against
libpthread will not be done. Finally, the ParallelJIT example needs libpthread
so its makefile was changed to always add -lpthread to the link line.

llvm-svn: 23003
2005-08-24 10:07:20 +00:00
Misha Brukman c9076e0acf Fix grammar: it's == "it is".
llvm-svn: 22587
2005-08-02 16:04:59 +00:00
Jeff Cohen 9aafa06bef It's dangerous coding on Mondays.
llvm-svn: 22585
2005-08-02 03:26:32 +00:00
Jeff Cohen ba7cc68594 Implement SetInterruptFunction for Windows.
llvm-svn: 22582
2005-08-02 03:04:47 +00:00
Chris Lattner 6a5d6ecd09 Implement sys::SetInterruptFunction on Unix, stub it on win32 so that the
build will not fail

llvm-svn: 22578
2005-08-02 02:14:22 +00:00
Andrew Lenharth 0940218cca support near allocations for the JIT
llvm-svn: 22554
2005-07-29 23:40:16 +00:00
Reid Spencer 29f83e0997 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.

llvm-svn: 22539
2005-07-28 16:25:57 +00:00
Jeff Cohen 5f4ef3c5a8 Eliminate all remaining tabs and trailing spaces.
llvm-svn: 22523
2005-07-27 06:12:32 +00:00
Jeff Cohen 33a030e36c Eliminate tabs and trailing spaces.
llvm-svn: 22520
2005-07-27 05:53:44 +00:00
Reid Spencer 86df93a216 Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation
of pthreads is missing that call (despite it violating the spec).

llvm-svn: 22423
2005-07-13 03:02:06 +00:00
Jeff Cohen 65806e62b1 Note to self: don't introduce memory leaks.
llvm-svn: 22422
2005-07-13 02:58:04 +00:00
Jeff Cohen 3800a28d46 Win32 support for Mutex class.
llvm-svn: 22420
2005-07-13 02:15:18 +00:00
Reid Spencer f404981bf2 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.

llvm-svn: 22403
2005-07-12 15:37:43 +00:00
Jeff Cohen 0aad91acfe Fix bugs also fixed in Unix version, plus other general cleanup.
llvm-svn: 22363
2005-07-09 18:42:49 +00:00
Jeff Cohen 5b106d0fed 1. Fix bug in getBaseName where it mishandles suffixes
2. Fix bug in eraseSuffix where it allows /path/.suffix to become /path/

llvm-svn: 22362
2005-07-09 18:42:02 +00:00
Reid Spencer 2d85f5697d Ensure that functions like isDirectory don't fail if the file doesn't
exist but just return false instead.

llvm-svn: 22361
2005-07-08 17:46:10 +00:00
Reid Spencer d28e432c36 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.

llvm-svn: 22359
2005-07-08 06:53:26 +00:00
Jeff Cohen f50677610f Stamp out tabs
llvm-svn: 22357
2005-07-08 05:02:13 +00:00
Jeff Cohen 0e1d7354b7 Make Win32 implementation conform to new paradigm
llvm-svn: 22356
2005-07-08 04:50:08 +00:00
Jeff Cohen 4c24144ddf Fix eraseSuffix()
llvm-svn: 22355
2005-07-08 04:49:16 +00:00
Reid Spencer af48d8643d 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.

llvm-svn: 22354
2005-07-08 03:08:58 +00:00
Jeff Cohen 215db9041b Fix VC++ breakage
llvm-svn: 22353
2005-07-08 02:48:42 +00:00
Reid Spencer 17c1bd372a Changes to mimic those in Unix/Path.inc in support of PR495. This hasn't
been compiled or tested.

llvm-svn: 22350
2005-07-07 23:35:23 +00:00
Reid Spencer c9c0473fa5 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.

llvm-svn: 22349
2005-07-07 23:21:43 +00:00
Reid Spencer 5b891e9847 For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.

llvm-svn: 22345
2005-07-07 18:21:42 +00:00
Reid Spencer d1ef1df103 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.

llvm-svn: 22189
2005-06-02 05:38:20 +00:00
Duraid Madina 3dbbc88f52 comment the hpux bit
llvm-svn: 22081
2005-05-16 06:59:53 +00:00
Misha Brukman 291f6b7223 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
llvm-svn: 21704
2005-05-05 22:33:09 +00:00
Alkis Evlogimenos 7afc9558e0 Silence gcc-4.0.0 warnings.
llvm-svn: 21453
2005-04-22 17:56:01 +00:00
Misha Brukman 10468d8a3c Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Reid Spencer 2d45e25125 Provide an implementation of the GetCurrentUserId and GetCurrentGroupId
methods that were recently added to the interface.

llvm-svn: 21401
2005-04-21 16:12:57 +00:00
Reid Spencer 8424ba373e 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.

llvm-svn: 21385
2005-04-21 02:50:10 +00:00
Reid Spencer b02566dc1c 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.

llvm-svn: 21384
2005-04-21 02:30:32 +00:00
Misha Brukman 5e7bac21d5 Add FIXME by Markus Oberhumer from bug 545: not checking for "." in $PATH may
result in returning executable files that won't be runnable.

llvm-svn: 21378
2005-04-20 15:42:11 +00:00
Misha Brukman a9a8c1b65b Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer.

llvm-svn: 21377
2005-04-20 15:33:22 +00:00
Misha Brukman 1001aea4d3 Ignore dangling symlinks in getDirectoryContents()
Thanks to Markus Oberhumer for the patch!

llvm-svn: 21370
2005-04-20 04:04:07 +00:00
Jeff Cohen a3b1458175 Eliminate tabs
llvm-svn: 21216
2005-04-11 03:44:22 +00:00
Reid Spencer a556669219 Be slightly more accurate in an error message.
llvm-svn: 20397
2005-03-02 05:45:56 +00:00
Jeff Cohen 18cf7ebcee Fix silly mistake.
llvm-svn: 20256
2005-02-20 02:48:51 +00:00
Jeff Cohen 4220bf5726 Implement standard I/O redirection in ExecuteAndWait().
llvm-svn: 20255
2005-02-20 02:43:04 +00:00
Jeff Cohen 07e22ba2c7 Change __MINGW to __MINGW32__. Patch submitted by Henrik Bach.
llvm-svn: 20243
2005-02-19 03:01:13 +00:00
Jeff Cohen 81549a57b8 Make PreventCoreFiles() do the right thing on Windows.
llvm-svn: 20237
2005-02-18 07:05:18 +00:00
Jeff Cohen 97a41e238e Arg list already has program name in it.
llvm-svn: 20208
2005-02-16 04:43:45 +00:00
Chris Lattner 6e528dce90 Fix a bug in my previous change to this, which broke the build on sparcs.
llvm-svn: 20184
2005-02-14 21:42:10 +00:00
Chris Lattner 259df2bf3c Fix the llvm bootstrap
llvm-svn: 20170
2005-02-13 23:37:09 +00:00
Chris Lattner 743dd2cd80 If errno is zero strerror_r does not modify the buffer, leaving it unterminated.
This causes garbage to be printed out after error messages.

llvm-svn: 20165
2005-02-13 22:46:37 +00:00
Jeff Cohen 9671b213b6 Fix some Path bugs
llvm-svn: 19852
2005-01-27 03:49:03 +00:00
Jeff Cohen ccbd3f0d57 Fix destroyDirectory bug
llvm-svn: 19746
2005-01-22 16:28:33 +00:00
Chris Lattner 8bdd0fc7aa Fix bugpoint
llvm-svn: 19605
2005-01-16 04:23:22 +00:00
Reid Spencer 730e7cb048 We don't distribute the operating system specific directories any more.
llvm-svn: 19563
2005-01-14 22:43:01 +00:00
Jeff Cohen e246cdc946 Fix and improve win32 path validation.
llvm-svn: 19545
2005-01-14 04:09:39 +00:00
Reid Spencer cbeed3571a Make asctime_r work for HP/UX.
llvm-svn: 19544
2005-01-14 00:50:50 +00:00
Reid Spencer c892a0db9f 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})

llvm-svn: 19426
2005-01-09 23:29:00 +00:00
Jeff Cohen 1a26d15c80 Use size_t instead of long to represent memory usage. long is 32 bits
on 64-bit Windows.

llvm-svn: 19393
2005-01-08 20:15:57 +00:00
Reid Spencer 862ebf5277 Correct the case of a #include directory name, just in case.
llvm-svn: 19254
2005-01-02 09:45:04 +00:00
Jeff Cohen b90c31fb49 Add functions for determining if the stdin/out/err is connected to a
console or not.

llvm-svn: 19236
2005-01-01 22:54:05 +00:00
Reid Spencer 6f802ba876 Add functions for determining if the stdin/out/err is connected to a
console or not.

llvm-svn: 19233
2005-01-01 22:29:26 +00:00
Jeff Cohen b6ecaa2d1c Where do these tabs keep coming from???
llvm-svn: 19203
2004-12-31 19:03:31 +00:00
Jeff Cohen 25dcdcc973 Mostly cleanup, but also some bug fixes, for win32/Path.cpp
llvm-svn: 19202
2004-12-31 19:01:08 +00:00
Reid Spencer 0f371a1637 Fix a compilation error for the case where mallinfo() is not available.
llvm-svn: 19201
2004-12-31 05:53:27 +00:00
Jeff Cohen 63f13c4cbc Get rid of those nasty tabs...
llvm-svn: 19199
2004-12-31 05:07:26 +00:00
Jeff Cohen 98aff88c9b Bring win32/Path.cpp up to date with respect to Unix/Path.cpp
llvm-svn: 19198
2004-12-31 04:39:07 +00:00
Jeff Cohen a6d9c1415c Fix MINGW compilation errors
llvm-svn: 19190
2004-12-30 03:02:31 +00:00
Reid Spencer e925d8b8b2 For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Account for variations in time.h and sys/time.h inclusion.
* Add macros for getting wait(2) exit status correctly (per autoconf sugg.)
* Implement ThrowErrno in terms of strerror_r, strerror or none based on
  what is available on the platform.

llvm-svn: 19161
2004-12-27 06:17:50 +00:00
Reid Spencer efda887fe2 For PR351:
* Remove redundant #includes that are now in Unix.h

llvm-svn: 19160
2004-12-27 06:17:39 +00:00
Reid Spencer cf15b874e8 For PR351:
* Move implementation of sys::PreventCoreFiles function to this file from
  the now defunct SysConfig abstraction.

llvm-svn: 19159
2004-12-27 06:17:27 +00:00
Reid Spencer d103e0851c For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Ensure variations in "dirent" structure are accounted for.

llvm-svn: 19158
2004-12-27 06:17:15 +00:00
Reid Spencer 47cd653411 For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Consolidate implementation from operating system specific directory.

llvm-svn: 19157
2004-12-27 06:17:03 +00:00
Reid Spencer d554bbcefd For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards

llvm-svn: 19156
2004-12-27 06:16:52 +00:00
Reid Spencer af6d3d5c8f For PR351:
* Consolidate implementation for Unix systems into Unix/TimeValue.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19155
2004-12-27 06:16:38 +00:00
Reid Spencer 51ea06abf8 For PR351:
* Consolidate implementation for Unix systems into Unix/Program.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19154
2004-12-27 06:16:25 +00:00
Reid Spencer 844f3fec49 For PR351:
* Consolidate implementation for Unix systems into Unix/Signals.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19153
2004-12-27 06:16:11 +00:00
Reid Spencer 71383fb646 For PR351:
* Consolidate implementation for Unix systems into Unix/Memory.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19152
2004-12-27 06:15:57 +00:00
Reid Spencer 1a7a435b49 For PR351:
* Consolidate implementation for Unix systems into Unix/MappedFile.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19151
2004-12-27 06:15:43 +00:00
Reid Spencer 97d4a17f04 For PR351:
* Consolidate implementation for Unix systems into Unix/Process.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19150
2004-12-27 06:15:29 +00:00
Reid Spencer 0d1ad6ac34 For PR351:
SysConf abstraction was pointless because it had a single function in it that
pertained only to the current process. So merge it into the Process abstraction
and remove the files completely.

llvm-svn: 19149
2004-12-27 06:15:14 +00:00
Jeff Cohen f365c33b62 mingw doesn't support the official debug API.
Old versions of the C runtime somehow get loaded into the process.  Make
sure they aren't searched for symbols.

llvm-svn: 19141
2004-12-25 04:50:17 +00:00
Jeff Cohen 683b1a5e3c Get VC++ building again
llvm-svn: 19140
2004-12-24 16:26:47 +00:00
Jeff Cohen 039b4abf6c Eliminate use of ltdl.c when doing a VC++ build. Because libtool isn't used,
ltdl's LGPL license would infect all of LLVM.

llvm-svn: 19137
2004-12-24 07:57:09 +00:00
Reid Spencer 20540311e1 For PR351:
Merge implementations of isValid and GetTemporaryDirectory into this file. There
is not any point having the operating system specific files for such little
variation between the Unix family of systems.

llvm-svn: 19134
2004-12-24 06:29:42 +00:00
Reid Spencer e7c870364f For PR351:
This implementation is no longer needed, its been merged to Unix/Path.cpp since
there is such little variation between the platforms.

llvm-svn: 19133
2004-12-24 06:29:28 +00:00
Reid Spencer 328ee53573 For PR351:
Use the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines to include the implementation
instead of relying upon the "platform" link

llvm-svn: 19132
2004-12-24 06:29:17 +00:00
Reid Spencer 4befbf3f14 Resurrect this file.
llvm-svn: 19130
2004-12-24 06:03:31 +00:00
Reid Spencer 265b02ed3a Remove these files as they are not being included any more. DynamicLibrary
is now implemented via ltdl.cpp which has its own way of dealing with
the different platforms.

llvm-svn: 19129
2004-12-24 03:59:46 +00:00
Jeff Cohen d567bb6af6 Fix VC++ compilation error
llvm-svn: 19124
2004-12-24 02:38:34 +00:00
Reid Spencer c84ee1aee0 Put CopyFile in the sys namespace.
llvm-svn: 19122
2004-12-23 22:14:32 +00:00
Jeff Cohen 53fbecce6e Patch to fix mingw compilation problem contributed by Henrik.
llvm-svn: 19112
2004-12-23 03:44:40 +00:00
Reid Spencer 107410613b Put the CopyFile function explicitly in the sys namespace.
llvm-svn: 19079
2004-12-21 03:27:08 +00:00
Reid Spencer 22dd8b15c0 Cygwin doesn't like .. through a link, so drop the ..
llvm-svn: 19076
2004-12-20 22:21:41 +00:00
Reid Spencer d4c6988809 Implement GetTimeUsage correctly.
llvm-svn: 19074
2004-12-20 21:43:33 +00:00
Reid Spencer 8005e66f0a Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation.

llvm-svn: 19072
2004-12-20 16:33:37 +00:00
Reid Spencer 1cf74cee21 Consistently use the same #if style. Also, fix a bug testing for sbrk(3)
llvm-svn: 19071
2004-12-20 16:06:44 +00:00
Jeff Cohen 7ae0bc7111 Keep up with lib/System changes
llvm-svn: 19057
2004-12-20 03:24:56 +00:00
Reid Spencer ac38f3a028 For PR351:
* Implement GetMallocUsage to get usage of malloc heap
* Implement GetMemoryUsage to get total memory usage of process
* Implement GetTimeUsage to get elapsed/user/system time

llvm-svn: 19055
2004-12-20 00:59:28 +00:00
Reid Spencer 27fa6c6d49 For PR351:
No need for Unix/SUS/Process.cpp any more, just ifdef it.

llvm-svn: 19054
2004-12-20 00:59:16 +00:00
Misha Brukman f06cb1db24 * Use "" for LLVM include files, not <>
* llvm/Config/alloca.h already #includes config.h
* Minor readability/stylistic changes

llvm-svn: 19048
2004-12-20 00:16:38 +00:00
Misha Brukman 0eb431c04c Use <> for system #include files
llvm-svn: 19046
2004-12-19 19:27:11 +00:00
Brian Gaeke 8062bde121 Make references to 'struct sigaction' compile under Solaris.
llvm-svn: 19045
2004-12-19 18:58:11 +00:00
Reid Spencer 6cb551b279 For PR351:
Move the functionality of RunProgramWithTimeout into the ExecuteAndWait
function: support a timeout and I/O redirects

llvm-svn: 19043
2004-12-19 18:00:44 +00:00
Reid Spencer 72d1627d16 For PR351:
Add a needed include.

llvm-svn: 19042
2004-12-19 18:00:32 +00:00
Jeff Cohen 81184bb528 Fix win32 breakage
llvm-svn: 19028
2004-12-18 06:42:15 +00:00
Jeff Cohen fc6ebc9cb7 Expository comment submitted by Henrik Bach
llvm-svn: 18976
2004-12-16 04:06:56 +00:00
Reid Spencer e56242780c Change the signatures of the destroyFile and destroyDirectory methods to
const because they affect the file system, not the Path object.

llvm-svn: 18973
2004-12-15 23:02:10 +00:00
Reid Spencer 35d15bdf52 Remove the CFE's lib directory from the bytecode path because LLVM should
be agnostic to the needs of any specific FE.

llvm-svn: 18969
2004-12-15 22:22:51 +00:00
Reid Spencer 879f11df3d Remove automatic insertion of CFE's lib directory into the bytecode path
because LLVM should be agnostic to the needs of specific front ends.

llvm-svn: 18968
2004-12-15 22:21:42 +00:00
Reid Spencer 98ce23ffb0 Fix a file overwrite bug in llvm-ar introduced by changes to
createTemporaryFile semantics where it doesn't create a fully unique name
if the basename doesn't exist. This functionality is now optionally
provided by the boolean reuse_current parameter to createTemporaryFile and
makeUnique. The default values differ because of the way these functions
are used in LLVM.

llvm-svn: 18961
2004-12-15 08:32:45 +00:00
Jeff Cohen 92e02d40cb Make Win32 TimeValue::toString() re-entrant and work with mingw
llvm-svn: 18954
2004-12-15 04:28:44 +00:00
Jeff Cohen e408341854 Fix VC++ compilation errors
llvm-svn: 18953
2004-12-15 04:08:15 +00:00
Reid Spencer f66d93239e For PR351:
* Fix implementation and documentation about LLVMGCCDIR/bytecode-libs
* Add the makeUnique method, replacement for getUniqueFilename in Support.
* Add the sys::CopyFile function, replacement for CopyFile in Support.
* Move GetLLVMConfigDir() into generic code area since its generic.

llvm-svn: 18947
2004-12-15 01:50:13 +00:00
Reid Spencer c936ad1208 Add the getMagicNumber method.
Patch contributed by Henrik Bach. Thanks Henrik!

llvm-svn: 18933
2004-12-14 18:42:13 +00:00
Jeff Cohen 2b60d39499 Implement Win32 Path::getStatusInfo(), TimeValue::toString()
llvm-svn: 18930
2004-12-14 05:26:43 +00:00
Reid Spencer cdefe0aebc For PR351:
Implement the new environment pointer for ExecuteAndWait

llvm-svn: 18928
2004-12-14 04:18:51 +00:00
Reid Spencer 94bf2265df For PR351:
Implement three new functions to allow setting access/permission bits on
the file referenced by a path. The makeReadable and makeExecutable methods
replace the FileUtilities MakeFileReadable and MakeFileExecutable
functions. The makeWritable function is new and provided for consistency
since Path has a writable() method.

llvm-svn: 18907
2004-12-13 19:59:50 +00:00
Reid Spencer e05ab4a1ec Genericize implementation of GetDLLSuffix now that we have LTDL_SHLIB_EXT
available.

llvm-svn: 18904
2004-12-13 18:41:28 +00:00
Reid Spencer 790100674a Fix a bug where "." or any single character file name doesn't get the
terminating / when setDirectory is called.

llvm-svn: 18886
2004-12-13 07:51:52 +00:00
Reid Spencer a85abc23d5 Remove an always false clause from an if statement.
llvm-svn: 18885
2004-12-13 07:51:07 +00:00
Alkis Evlogimenos 5b1a05fb7c Fix a bug where directory names of length one or less where not set
properly (examples: "", ".", "a").

llvm-svn: 18883
2004-12-13 07:41:35 +00:00
Reid Spencer 0230a5eead * Add a std::ostream inserter for sys::Path
* Correct the std::string constructor to take a const reference.

llvm-svn: 18877
2004-12-13 06:57:15 +00:00
Jeff Cohen ccd99b9b61 Fix recent breakage of win32 build
llvm-svn: 18876
2004-12-13 06:26:35 +00:00
Reid Spencer 0a0d582719 Implement new functions per new interface
llvm-svn: 18866
2004-12-13 03:03:42 +00:00
Reid Spencer 9b155dc4c0 For PR351: \
* Remove IsLibrary and GetLibraryPath, replaced by FindLibrary in ../Path.cpp \
* Implement GetSystemLibraryPaths and GetBytecodeLibraryPaths, instead of the \
  GetSystemLibraryPath1 and GetSystemLibraryPath2 methods

llvm-svn: 18862
2004-12-13 03:00:51 +00:00
Reid Spencer 66b8182866 For PR351: \
* Move generic isArchive method here from Unix/Path.cpp \
* Implement isDynamicLibrary \
* Implement FindLibrary for Linker

llvm-svn: 18861
2004-12-13 03:00:39 +00:00
Reid Spencer 35f16dd40b Make the size() method const
llvm-svn: 18852
2004-12-13 02:58:51 +00:00
Reid Spencer 5625dec232 Rename Path::get -> Path::toString
llvm-svn: 18802
2004-12-11 17:37:01 +00:00
Reid Spencer 5ccfd5a48b Path::get -> Path::toString
llvm-svn: 18785
2004-12-11 00:14:15 +00:00
Jeff Cohen 07a900f0b7 Fix residual Visual Studio build problems
llvm-svn: 18688
2004-12-09 05:51:11 +00:00
Chris Lattner 6ef473f53c Make this work with the ICC compiler, contributed by Bjørn Wennberg
llvm-svn: 18626
2004-12-08 16:10:52 +00:00
Chris Lattner 73a1914131 Fix compilation error on Darwin.
llvm-svn: 18485
2004-12-04 04:17:20 +00:00
Chris Lattner 4cf8b36469 Move darwin-specific majik here.
llvm-svn: 18466
2004-12-03 23:02:42 +00:00
Reid Spencer f473185cbc Fix seriously broken implementation of GetMagicNumber.
llvm-svn: 18422
2004-12-02 09:09:48 +00:00
Reid Spencer 0e6a4fc448 Implement two new functions: LoadLibraryPermanently and
SearchForAddressOfSymbol.

llvm-svn: 18355
2004-11-29 13:33:28 +00:00
Reid Spencer 3468ae1a87 We just use ltdl's implementation for this abstraction now. Its portable to
more platforms than LLVM supports.

llvm-svn: 18352
2004-11-29 12:39:10 +00:00
Reid Spencer 47430cf2a5 Mods for compilation with llvm.
llvm-svn: 18346
2004-11-29 12:04:27 +00:00
Reid Spencer 11ba920d55 Original version of ltdl.h from libtool 1.5.10
llvm-svn: 18345
2004-11-29 12:02:48 +00:00
Reid Spencer 6717b80ba2 Original version of ltdl.c from libtool 1.5.10
llvm-svn: 18344
2004-11-29 12:02:25 +00:00
Reid Spencer 72a7457a90 Implement the default constructor which causes the current program to be
opened as if it was a dynamic library so its symbols can be searched too.

llvm-svn: 18341
2004-11-29 10:39:46 +00:00
Reid Spencer 9afecaf4ff Cast the void* handle data member to HMODULE* to keep the VC++ compiler
happy. Thanks to Henrik Bach for pointing this out.

llvm-svn: 18056
2004-11-20 23:30:55 +00:00
Reid Spencer 4a763ca854 Dynamic Library abstraction. This makes the abstraction of a single dynamic
library (shared library/shared object) whose symbols can be looked up
dynamically. Used for plug-ins.

llvm-svn: 17940
2004-11-18 04:33:39 +00:00
Reid Spencer 1b13a7cdb8 * Use low-level unix I/O interface since we're on Unix.
* Don't use variable length arrays (replaced with alloca)

llvm-svn: 17901
2004-11-16 17:14:08 +00:00
Misha Brukman c356686749 Erase non-applicable Unix comment, this is Win32
llvm-svn: 17896
2004-11-16 07:35:32 +00:00
Reid Spencer 7cdcb2b0cb Remove useless #include.
Patch contributed by Jeff Cohen.

llvm-svn: 17891
2004-11-16 07:00:23 +00:00
Reid Spencer f070b6c4ac Simplify code.
Patch contributed by Jeff Cohen.

llvm-svn: 17890
2004-11-16 06:59:53 +00:00
Reid Spencer 09e9f2a37b Per code review:
* get rid of (void) construct in function declarations
* make toString a const member
* add a default implementation of toString for Win32

llvm-svn: 17873
2004-11-16 06:22:17 +00:00
Reid Spencer 91f505eae9 Per code review:
* Clean up the StatusInfo constructor to construct all members and give
  them reasonable values.
* Get rid of the Vector typedef and make the interface to
  getDirectoryContent use a std::set instead of a std::vector so the dir
  content is sorted.
* Make the getStatusInfo method const and not return a useless boolean.

llvm-svn: 17872
2004-11-16 06:15:19 +00:00
Reid Spencer 1ae1656363 Provide the ThrowErrno utility.
Patch contributed by Morten Ofstad

llvm-svn: 17827
2004-11-15 17:21:57 +00:00
Reid Spencer b96afe4b7e Adjust implementation to match new interface.
Patch provided by Morten Ofstad

llvm-svn: 17826
2004-11-15 17:20:28 +00:00
Reid Spencer dacbf466c8 Actually get the #include correct so it compiles .. duh.
llvm-svn: 17817
2004-11-15 04:47:22 +00:00
Reid Spencer 315efa1a84 Make it actually compile on Solaris.
llvm-svn: 17815
2004-11-15 04:42:44 +00:00
Reid Spencer bfb7b3eb68 Consolidate the implementation of TimeValue::now() for Unix to use the
seemingly ubiquitous gettimeofday(3) call.

llvm-svn: 17813
2004-11-15 04:36:35 +00:00
Reid Spencer 7705ec231c Implement functionality suggested from code review: getStatusInfo should
returnn false if the file doesn't exist rather than throw ane exception.

llvm-svn: 17809
2004-11-14 23:30:38 +00:00
Reid Spencer 6881623775 Make sure IdentifyFileType is in the sys namespace.
llvm-svn: 17806
2004-11-14 23:26:18 +00:00
Alkis Evlogimenos 55117fa471 Add missing include.
llvm-svn: 17799
2004-11-14 22:37:42 +00:00
Reid Spencer 2dd5e71836 Forget strerror_r, it causes problems. Fix later when threading matters
llvm-svn: 17783
2004-11-14 22:10:54 +00:00
Reid Spencer 0d455997f8 Implement the toString method
llvm-svn: 17782
2004-11-14 22:10:08 +00:00
Reid Spencer 26e2bd44f2 Update for prototype changes
llvm-svn: 17781
2004-11-14 22:09:22 +00:00
Reid Spencer c1d474f069 * Implement getDirectoryContents * Implement getStatusInfo * Implement setStatusInfo * Implement renameFile
llvm-svn: 17780
2004-11-14 22:08:36 +00:00
Reid Spencer 60c72a339b Fix bugs in class invariant
llvm-svn: 17779
2004-11-14 22:07:50 +00:00
Reid Spencer 8b89b8333e Include the correct implementation file
llvm-svn: 17778
2004-11-14 22:07:04 +00:00
Reid Spencer 05be57b518 Don't exceed 80 columns.
llvm-svn: 17777
2004-11-14 22:06:18 +00:00
Reid Spencer 0d0d07e0f0 Implement IdentifyFileType function
llvm-svn: 17776
2004-11-14 22:05:32 +00:00
Reid Spencer 202eaeb272 Fix isBytecodeFile to correctly recognized compressed bytecode too.
llvm-svn: 17655
2004-11-09 20:27:23 +00:00
Reid Spencer fb1f7357c2 * Implement getStatusInfo for getting stat(2) like information
* Implement createTemporaryFile for mkstemp(3) functionality
* Fix isBytecodeFile to accept llvc magic # (compressed) as bytecode.

llvm-svn: 17654
2004-11-09 20:26:31 +00:00
Reid Spencer e7d98cccd9 Fix a typo: isvalid -> isValid
llvm-svn: 17621
2004-11-08 08:27:51 +00:00
Misha Brukman 7ee6c5525e Consistently use llvm.cs.uiuc.edu instead of llvm.org
llvm-svn: 17548
2004-11-07 00:58:20 +00:00
Reid Spencer 0c6a283b2a Stop propagating method names that violate the coding standard
llvm-svn: 17498
2004-11-05 22:15:36 +00:00
Reid Spencer 57cbe39d1e Change Library Names Not To Conflict With Others When Installed
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Reid Spencer aa4887b482 Add EXTRA_DIST for additional files to be distributed.
llvm-svn: 17233
2004-10-26 03:12:11 +00:00
Reid Spencer c1c320c335 We won't use automake
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Misha Brukman 648ad57b85 Fix some grammar
llvm-svn: 17141
2004-10-19 05:55:54 +00:00
Reid Spencer 6a11a75f31 Initial automake generated Makefile template
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Misha Brukman 22cf52374e AIX does not have mkdtemp() so emulate its behavior using mktemp() and mkdir()
llvm-svn: 17131
2004-10-18 17:39:45 +00:00
Reid Spencer 69812714cd Allow this file to compile on Darwin.
llvm-svn: 16971
2004-10-14 03:33:25 +00:00
Reid Spencer 37d4d6b2a2 Use __MINGW instead of __MING. Patch contributed by Henrik Bach.
llvm-svn: 16970
2004-10-14 03:09:02 +00:00
Reid Spencer 2f5fd88036 Get proper BSD #includes for MappedFile implementation.
llvm-svn: 16969
2004-10-14 03:06:59 +00:00
Reid Spencer 9cb9354d17 Implementation of MappedFile for Win32. Patch provided by Jeff Cohen.
llvm-svn: 16968
2004-10-14 03:05:59 +00:00
Reid Spencer ace94df71f Update to reflect changes in Makefile rules.
llvm-svn: 16950
2004-10-13 11:46:52 +00:00
Reid Spencer b84cbf2725 Initial version of automake Makefile.am file.
llvm-svn: 16885
2004-10-10 20:43:57 +00:00
Brian Gaeke c5a630bd3c Must include sys/stat.h before declaring a 'struct stat'
llvm-svn: 16728
2004-10-05 18:46:59 +00:00
Reid Spencer abb04cfc79 Adjust sys/stat.h inclusion so its only for SunOS.
llvm-svn: 16686
2004-10-05 00:56:46 +00:00
Tanya Lattner c3ef3cc7e5 Added a couple of includes to get this to compile on Sparc.
llvm-svn: 16685
2004-10-05 00:51:26 +00:00
Chris Lattner 9895937618 Solaris doesn't have MAP_FILE.
llvm-svn: 16682
2004-10-05 00:46:21 +00:00
Reid Spencer 161a459d42 First version of the MappedFile abstraction for operating system idependent
mapping of files. This first version uses mmap where its available. The
class needs to implement an alternate mechanism based on malloc'd memory
and file reading/writing for platforms without virtual memory.

llvm-svn: 16649
2004-10-04 11:08:32 +00:00
Misha Brukman a468200286 That should actually be __MING, not __MINGW.
llvm-svn: 16617
2004-09-30 18:28:07 +00:00
Misha Brukman ba94e672c3 Check for __MINGW define instead of __MINGW_H, patch by Henrik Bach.
llvm-svn: 16615
2004-09-30 18:24:58 +00:00
Reid Spencer 7aed44892c Improve validity checking of windows path names and fix file creation
problems.

Patch contributed by Jeff Cohen. Thanks Jeff!

llvm-svn: 16565
2004-09-29 00:01:17 +00:00
Reid Spencer 70b6835853 Use llvm::sys::Path to destroy the file.
Patch contributed by Jeff Cohen. Thanks Jeff!

llvm-svn: 16564
2004-09-28 23:58:03 +00:00
Reid Spencer 364cce404a Win32 implementation of TimeValue::now().
Patch contributed by Jeff Cohen. Thanks Jeff!

llvm-svn: 16563
2004-09-28 23:56:20 +00:00
Reid Spencer 5d98fe9ef8 FreeBSD implementation of the TimeValue::now() method.
Patch kindly contributed by Jeff Cohen. Thanks Jeff!

llvm-svn: 16562
2004-09-28 23:54:12 +00:00
Reid Spencer f71143c3e5 Updated to reflect changes in the interface of TimeValue::now().
llvm-svn: 16515
2004-09-25 08:32:37 +00:00
Reid Spencer 1cc1994edf Added stub implementations of TimeValue concept for remaining platforms.
llvm-svn: 16513
2004-09-25 05:03:54 +00:00
Reid Spencer 8b2f9a298d Wrap to 80 cols.
llvm-svn: 16512
2004-09-25 05:03:22 +00:00
Reid Spencer ca141a5b28 Initial implementation of the TimeValue abstraction.
llvm-svn: 16511
2004-09-24 23:25:19 +00:00
Reid Spencer 9904928ea3 Patch for MINGW. Patch provided by Henrik Bach.
llvm-svn: 16495
2004-09-23 14:47:10 +00:00
Reid Spencer 1bdd0f0a08 Minor correction to Signals implementation.
Patch submitted by Jeff Cohen. Thanks Jeff!

llvm-svn: 16401
2004-09-19 05:37:39 +00:00
Reid Spencer 91e6f5e975 Use the /dev/zero device as the device on which the pages are mapped.
Patch contributed by Henrik Bach. Thanks Henrik!

llvm-svn: 16397
2004-09-18 19:34:09 +00:00
Reid Spencer 0e86336edc Porting of Unix implementation to Win32.
Patch contributed by Jeff Cohen. Thanks Jeff!

llvm-svn: 16396
2004-09-18 19:29:16 +00:00
Reid Spencer 36e3cbfd3b Get rid of file descriptor leak in create_file.
llvm-svn: 16395
2004-09-18 19:25:11 +00:00
Reid Spencer 90debc5e2e Make sure critical sections are entered before trying to leave them.
Add some additional commentary about the workings of this module.

Patch contributed by Jeff Cohen. Thanks Jeff!

llvm-svn: 16383
2004-09-17 03:02:27 +00:00
Reid Spencer 16b7bad55e Allow "bc" as suffix for bytecode files.
llvm-svn: 16381
2004-09-16 16:36:10 +00:00
Reid Spencer 4aff78acbb Implement the signals interface for Win32.
Patch provided by Jeff Cohen. Thanks Jeff!

llvm-svn: 16380
2004-09-16 15:53:16 +00:00
Reid Spencer b88212ee1b Patches to make this file actually compile under windows.
Patches submitted by Jeff Cohen. Thanks Jeff!

llvm-svn: 16362
2004-09-15 05:49:50 +00:00
Reid Spencer 7e2c236fcd Initial version of the SysConfig abstraction for Win32.
llvm-svn: 16361
2004-09-15 05:48:49 +00:00
Reid Spencer 0f0c5cfb19 First version of a common header file for Win32 implementations.
llvm-svn: 16360
2004-09-15 05:48:11 +00:00
Reid Spencer 91886b791f Initial implementation of the Process abstraction for Win32.
llvm-svn: 16359
2004-09-15 05:47:40 +00:00
Reid Spencer 0de7bc1c3d Fix the interface to ReleaseRWX to take MemoryBlock& not Memory&
llvm-svn: 16356
2004-09-15 03:55:45 +00:00
Reid Spencer 853d250b0a Fix a compilation error.
llvm-svn: 16335
2004-09-14 15:42:11 +00:00
Reid Spencer df05ec7e0d Implement the GetLibraryPath function.
llvm-svn: 16323
2004-09-14 00:16:39 +00:00
Reid Spencer f7948483d2 Simplify the sys::Memory interface per Chris' request.
llvm-svn: 16318
2004-09-13 22:38:11 +00:00
Reid Spencer 07369430c4 Clean up the interface and implementation of sys::Program so that it is
cleanly dissociated from the sys::Path class.

llvm-svn: 16315
2004-09-13 21:48:44 +00:00
Reid Spencer 55a96ee8f5 Fix typo: sterror -> strerror
llvm-svn: 16294
2004-09-11 20:18:08 +00:00
Reid Spencer fda2fe9f1e Correct the dynamic lib suffix on Darwin.
llvm-svn: 16293
2004-09-11 07:35:01 +00:00