Owen Anderson
f17f6f06fa
Add a class for supporting platform independent thread-local storage.
...
Windows people, please double-check/patch this.
llvm-svn: 74209
2009-06-25 21:58:01 +00:00
Owen Anderson
021c3b0756
Guard dynamic library loading.
...
I did my best at implementing this for Win32, but I don't have a way to test it.
Can someone with access to a Win32 machine test/fix this?
llvm-svn: 74188
2009-06-25 18:12:44 +00:00
Owen Anderson
1fdf01026b
Add atomic multiply and divide operations, built on top of CompareAndSwap.
...
llvm-svn: 74004
2009-06-23 21:19:04 +00:00
Owen Anderson
5cc4131063
Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
...
we care about are capable of supporting it.
llvm-svn: 73993
2009-06-23 20:17:22 +00:00
Owen Anderson
9262d43c5d
Atomic ops that do arithmetic use signed arithmetic.
...
llvm-svn: 73980
2009-06-23 18:30:27 +00:00
Owen Anderson
9e3df5b67f
Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
...
the near future.
llvm-svn: 73971
2009-06-23 18:01:04 +00:00
Owen Anderson
cdf2b2dfea
Add an atomic add operation.
...
llvm-svn: 73964
2009-06-23 17:39:31 +00:00
Owen Anderson
96c51a8de1
Workaround for an... interesting bug in Darwin's pthread_rwlock_init.
...
llvm-svn: 73806
2009-06-20 00:32:27 +00:00
Owen Anderson
ff5f14c15e
Fix bad paste-o in the MSVC atomics.
...
Patch by Ðван СоÑокин.
llvm-svn: 73779
2009-06-19 18:37:50 +00:00
Owen Anderson
1498a7a510
Give RWMutex the SmartRWMutex treatment too.
...
llvm-svn: 73710
2009-06-18 18:26:15 +00:00
Owen Anderson
68f6598c69
Insert a SmartMutex templated class into the class hierarchy, which takes a template parameter specifying whether this mutex
...
should become a no-op when not running in multithreaded mode. Make sys::Mutex a typedef of SmartMutex<false>, to preserve source compatibility.
llvm-svn: 73709
2009-06-18 17:53:17 +00:00
Ted Kremenek
81ef65d491
Update CMake files to account for new location of Threading.cpp.
...
llvm-svn: 73708
2009-06-18 17:47:09 +00:00
Owen Anderson
7d42b95b6c
Move Threading.[h|cpp] from Support to System.
...
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson
6eb4a73633
Fix build when disable thread support.
...
Patch by Howard Su.
llvm-svn: 73680
2009-06-18 04:44:46 +00:00
Douglas Gregor
2761988cfd
Add RWMutex.cpp to the CMake makefiles
...
llvm-svn: 73615
2009-06-17 17:01:30 +00:00
Owen Anderson
74af4ee79d
Improve the Win32 reader-writer lock implementation by making it just a normal
...
lock. This is obviously bad, but at least it's threadsafe! If you know how
to improve this in a pre-Vista friendly well, patches welcome!
Patch by Max Burke.
llvm-svn: 73607
2009-06-17 09:10:42 +00:00
Owen Anderson
82b58a843b
Use atomic increment/decrement for reference counting of Type's.
...
llvm-svn: 73588
2009-06-17 00:28:49 +00:00
Owen Anderson
8d0fe6f0d7
Add an atomic increment and decrement implementation, which will be used for
...
thread-safe reference counting.
llvm-svn: 73587
2009-06-17 00:13:00 +00:00
Owen Anderson
79b76b5bea
Accidentally broke this file.
...
llvm-svn: 73552
2009-06-16 20:57:51 +00:00
Owen Anderson
896cee711f
Remove the Win32 implementation, since it doesn't compile pre-Vista.
...
llvm-svn: 73550
2009-06-16 20:49:20 +00:00
Owen Anderson
372a9289a5
Fix/cleanup trailing newlines.
...
llvm-svn: 73546
2009-06-16 20:23:05 +00:00
Owen Anderson
324f94c317
Add a portable wrapper for reader-writer locks.
...
llvm-svn: 73545
2009-06-16 20:19:28 +00:00
Dan Gohman
970da81e8a
glibc has two versions of strerror_r, a standards compliant one and a GNU
...
specific one. The GNU one is chosen when _GNU_SOURCE is defined. g++ always
defines _GNU_SOURCE on linux platforms because glibc's headers won't compile
in C++ mode without it. The GNU strerror_r doesn't always modify the buffer
which causes empty error messages on linux.
This patch changes MakeErrMsg to use the return value of strerror_r to get
the string instead of assuming the buffer will be modified, on GLIBC.
Patch by Benjamin Kramer!
llvm-svn: 73396
2009-06-15 18:05:46 +00:00
Chris Lattner
7038cd5247
"This patch implements the method with the GetModuleFileName function for windows."
...
Patch by Benjamin Kramer!
llvm-svn: 73379
2009-06-15 05:38:04 +00:00
Chris Lattner
3f556daa6e
add a new static method to portably determine whether a patch is
...
absolute or not, based on a patch by Gregory Curfman!
llvm-svn: 73368
2009-06-15 04:17:07 +00:00
Torok Edwin
63e44bb2a9
Fix comments.
...
llvm-svn: 72858
2009-06-04 08:18:25 +00:00
Torok Edwin
9b5a47fc3c
Add support for outputting ANSI colors to raw_fd_ostream.
...
llvm-svn: 72854
2009-06-04 07:09:50 +00:00
Duncan Sands
06b61a281a
At a newline at the end of this file.
...
llvm-svn: 72767
2009-06-03 11:54:28 +00:00
Owen Anderson
5bd914d0ae
Undef MemoryFence when compiling on MSVC.
...
llvm-svn: 72732
2009-06-02 17:35:55 +00:00
Bill Wendling
09f17a8479
Untabification.
...
llvm-svn: 72604
2009-05-30 01:09:53 +00:00
Jay Foad
c1fca9fb3a
Work around a page size issue on Cygwin.
...
llvm-svn: 72332
2009-05-23 17:57:59 +00:00
Owen Anderson
2ef7cae93b
Add Atomic.cpp to the CMake build system.
...
llvm-svn: 72202
2009-05-21 00:48:56 +00:00
Owen Anderson
76ae5dde51
Tabs, be gone!
...
llvm-svn: 72180
2009-05-20 19:06:49 +00:00
Owen Anderson
5b9400d6bd
I just fail today.
...
Hopefully this fixes the last build errors on systems with GCC < 4.1.
llvm-svn: 72179
2009-05-20 19:01:50 +00:00
Owen Anderson
04911b4fee
Copy-and-paste-o.
...
llvm-svn: 72177
2009-05-20 18:47:53 +00:00
Owen Anderson
e5370f409b
Move atomic operations' definitions out of line. While this seems kind of silly,
...
all kinds of problems caused by including windows.h and/or config.h in an LLVM header.
llvm-svn: 72174
2009-05-20 18:26:15 +00:00
Douglas Gregor
b81294d989
termios.h contains the winsize structure we need to determine the
...
width of a terminal. Don't try to get the width of a terminal if we
don't have this header.
llvm-svn: 72018
2009-05-18 17:21:34 +00:00
Douglas Gregor
15436617f4
Add terminal width detection to llvm::sys::Process. This is needed to
...
fix Clang PRs 4148 and 4183.
llvm-svn: 71448
2009-05-11 18:05:52 +00:00
Stefanus Du Toit
d2b7be6e9b
Fix choice of version of Windows callback to use to consider not only the Visual Studio version, but also the Windows SDK version.
...
Patch by Tareq Siraj.
llvm-svn: 70299
2009-04-28 16:37:58 +00:00
Torok Edwin
c8afb09a3b
Fix g++-4.4.0 warning, it was causing llvm-nm to fail on wrapped BC files:
...
Path.cpp:59: warning: case label value exceeds maximum value for type
magic[0] is a (signed) char, but some case values are unsigned (e.g. 0xde).
When magic[0] was 0xde, the switch has taken the default branch instead of case
0xde branch.
Apparently this was the behaviour with older versions of gcc too, but not with g++.
Now g++-4.4 behaves as gcc, and ignores unsigned case values out of range signed
range.
llvm-svn: 70038
2009-04-25 10:25:12 +00:00
Anton Korobeynikov
f7d0c1a5e6
Silence warnings.
...
Patch by Jay Foad!
llvm-svn: 69679
2009-04-21 16:04:56 +00:00
Anton Korobeynikov
5a4b52dc0c
Drop obsolete reference to __eprintf.
...
Patch by Jay Foad!
llvm-svn: 69678
2009-04-21 16:04:41 +00:00
Daniel Dunbar
3222b9be04
Make Unix.h:MakeErrMsg separate the prefix and errno string, so we get:
...
clang: error: unable to make temporary file: /etc/cc: can't make
unique filename: Permission denied
instead of
clang: error: unable to make temporary file: /etc/cc: can't make
unique filenamePermission denied
for example.
Also, audited the uses of MakeErrMsg to make the prefix strings
consistent (not end with newline/punctuation/space/": ").
llvm-svn: 69626
2009-04-20 20:50:13 +00:00
Mikhail Glushenkov
60cde5ba7c
Call CreateProcess with bInheritHandles = TRUE.
...
Makes llvmc show error messages printed by child processes when run from the
Cygwin/MSYS shell. Since ExecuteAndWait does not return until the child program
has finished execution, this change should be harmless.
llvm-svn: 69082
2009-04-14 21:31:36 +00:00
Mikhail Glushenkov
3a62efb732
Delete trailing whitespace.
...
llvm-svn: 69081
2009-04-14 21:31:14 +00:00
Chris Lattner
ce8b7d2e24
fix PR3965:SIGINT handler not restored after calling ParseAST(),
...
patch by Alexei Svitkine!
llvm-svn: 68929
2009-04-12 23:33:13 +00:00
Daniel Dunbar
3f48987069
Add sys::Path::makeAbsolute().
...
llvm-svn: 68663
2009-04-09 00:33:08 +00:00
Chris Lattner
7e06443d44
hopefully fix an apparent build error on windows.
...
llvm-svn: 68175
2009-04-01 02:03:38 +00:00
Daniel Dunbar
fb1a6eb69b
Add llvm::sys::getHostTriple and remove
...
llvm::sys::getOS{Name,Version}.
Right now the implementation just derives from LLVM_HOSTTRIPLE (which
is wrong, but it doesn't look like we have a define for the target
triple). Ideally this routine would actually be able to compute the
triple for targets we care about.
llvm-svn: 68118
2009-03-31 17:30:15 +00:00
Chris Lattner
f2b60658ef
fix a bug Alexei Svitkine pointed out.
...
llvm-svn: 67510
2009-03-23 06:46:20 +00:00
Chris Lattner
fb95472123
When we restore signal handlers, restore them back to what they
...
were when we came around, not to their default handler. This
should fix PR3848
llvm-svn: 67509
2009-03-23 05:55:36 +00:00
Chris Lattner
f299a68ee0
factorize signal registration, part of PR3848.
...
llvm-svn: 67508
2009-03-23 05:42:29 +00:00
Sebastian Redl
8d5baa09f8
Fix the Win32 VS2008 build:
...
- Make type declarations match the struct/class keyword of the definition.
- Move AddSignalHandler into the namespace where it belongs.
- Correctly call functions from template base.
- Some other small changes.
With this patch, LLVM and Clang should build properly and with far less noise under VS2008.
llvm-svn: 67347
2009-03-19 23:26:52 +00:00
Chris Lattner
bb1ba7b7d3
add some explicit llvm:: qualifiers to the unix side, fix problems on the windows side.
...
llvm-svn: 66386
2009-03-08 19:13:45 +00:00
Chris Lattner
6acb4d6f7e
When a crash signal is delivered do two things: remove all of our
...
signal handlers to prevent reentrance on unrelated things (a sigabort
where the handle bus errors) also, clear the signal mask so that the
signal doesn't infinitely reissue. This fixes rdar://6654827 -
Crash causes clang to loop
llvm-svn: 66330
2009-03-07 08:15:47 +00:00
Chris Lattner
bbbbbf30bd
move some code to gracefully handle the case when a handler crashes.
...
llvm-svn: 66171
2009-03-05 18:22:14 +00:00
Chris Lattner
4fdd042d9e
Add a new 'AddSignalHandler' function to Signals.h that allows
...
arbitrary functions to be run when a crash happens. Delete
RemoveDirectoryOnSignal as it is dead and has never had clients.
Change PrintStackTraceOnErrorSignal to be implemented in terms of
AddSignalHandler.
I updated the Win32 versions of these APIs, but can't test them.
If there are any problems, I'd be happy to fix them as well.
llvm-svn: 66072
2009-03-04 21:21:36 +00:00
Chris Lattner
bab4417e05
Fix main executable path name resolution on FreeBSD, patch by
...
Ed Schouten!
llvm-svn: 65882
2009-03-02 22:17:15 +00:00
Chris Lattner
3c50fdf4ca
If an executable is run through a symlink, dladdr will return the
...
symlink. We really want the ultimate executable being run, not
the symlink. This lets clang find its headers when invoked through
a symlink. rdar://6602012
llvm-svn: 65017
2009-02-19 05:34:35 +00:00
Mikhail Glushenkov
58a1a8e546
Fix warning on gcc 4.3.
...
"system() declared with attribute warn_unused_result."
llvm-svn: 64574
2009-02-15 03:20:32 +00:00
Mikhail Glushenkov
a539836b95
Whitespace fixes.
...
llvm-svn: 64573
2009-02-15 03:20:03 +00:00
Cedric Venet
d1e179d992
Unbreak the build on win32.
...
Cleanup some warning.
Remark: when struct/class are declared differently than they are defined, this make problem for VC++ since it seems to mangle class differently that struct. These error are very hard to understand and find. So please, try to keep your definition/declaration in sync.
Only tested with VS2008. hope it does not break anything. feel free to revert.
llvm-svn: 64554
2009-02-14 16:06:42 +00:00
Julien Lerouge
7682ffdeb9
Fix MingW build, patch by Kenneth Boyd!
...
llvm-svn: 64366
2009-02-12 07:39:10 +00:00
Dan Gohman
1f517dd1c4
Use const, to support platforms where strrchr returns a const char *.
...
This fixes PR3535.
llvm-svn: 64224
2009-02-10 17:56:28 +00:00
Mikhail Glushenkov
8b5bfbfc7a
Add a Sleep() function.
...
llvm-svn: 64101
2009-02-08 22:47:39 +00:00
Mikhail Glushenkov
a6435d48bc
Add Emacs hints to Alarm.inc.
...
Also removes some trailing whitespace and fixes one 80-column violation.
llvm-svn: 64094
2009-02-08 21:10:57 +00:00
Chris Lattner
dfb6735385
Fix windows build, patch by Marius Wachtler!
...
llvm-svn: 63325
2009-01-29 18:53:28 +00:00
Chris Lattner
c0474013cb
Fix PR3424, a static constructor ordering issue. Patch by Robert Schuster!
...
llvm-svn: 63269
2009-01-29 04:43:42 +00:00
Chris Lattner
aa1212271a
rename methods in System/Host to be more consistent.
...
llvm-svn: 62776
2009-01-22 19:53:00 +00:00
Misha Brukman
5cbf223916
Removed trailing whitespace from Makefiles.
...
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Dan Gohman
35e2cfccaf
Don't use plain %x to print pointer values. I had changed it from %p
...
since %p isn't formatted consistently, but obviously plain %x is wrong.
PRIxPTR with a cast to uintptr_t would work here, but that requires
inconvenient build-system changes. %lu works on all current and
foreseable future hosts.
llvm-svn: 60616
2008-12-05 23:39:24 +00:00
Dan Gohman
7f079aabed
Demangle and pretty-print symbols in internal backtraces. Patch by
...
Wesley Peck, with a few fixes by me.
llvm-svn: 60605
2008-12-05 20:12:48 +00:00
Evan Cheng
889b79bb86
ARM / Mac OS X also wants to invalidate icache after jitting.
...
llvm-svn: 59291
2008-11-14 02:33:17 +00:00
Oscar Fuentes
0c6b786ab2
CMake: when bulding shared libraries on non-WIN32 systems, link dl to
...
LLVMSystem.
llvm-svn: 59159
2008-11-12 20:40:56 +00:00
Nuno Lopes
2817338558
plug leakage of mutex data. pthread_mutex_destroy() doesnt free our malloc'ed memory.
...
llvm-svn: 58805
2008-11-06 16:21:49 +00:00
Evan Cheng
c1d10e6b42
hasDisassembler should return false if disassembler isn't available.
...
llvm-svn: 58682
2008-11-04 06:09:38 +00:00
Anton Korobeynikov
1db1b64e6e
Silence a warning
...
llvm-svn: 58563
2008-11-02 11:47:11 +00:00
Jim Grosbach
9396051e3d
Update the stub and callback code to handle lazy compilation. The stub
...
is re-written by the callback to branch directly to the compiled code
in future invocations.
Added back in range-based memory permission functions for the updating of
the stub on Darwin.
llvm-svn: 57846
2008-10-20 21:39:23 +00:00
Duncan Sands
26ff6f9c54
Add <cstdio> include where needed by gcc-4.4.
...
Patch by Samuel Tardieu.
llvm-svn: 57291
2008-10-08 07:23:46 +00:00
Argyrios Kyrtzidis
a6f9bb7905
Add implementations for sys::Memory::setWritable and sys::Memory::setExecutable on Win32 platform.
...
llvm-svn: 57047
2008-10-04 08:15:32 +00:00
Jim Grosbach
b22ef71d46
On Darwin ARM, memory needs special handling to do JIT. This patch expands
...
this handling to work properly for modifying stub functions, relocations
back to entry points after JIT compilation, etc..
llvm-svn: 57013
2008-10-03 16:17:20 +00:00
Oscar Fuentes
e3c43d6279
CMake: Added Host.cpp to lib/System/CMakeLists.txt.
...
llvm-svn: 56957
2008-10-02 17:39:29 +00:00
Daniel Dunbar
e52e6bfd29
Add llvm::sys::{osName,osVersion} for retrieving operating system name
...
& version as strings.
- Win32 code is untested.
llvm-svn: 56942
2008-10-02 01:17:28 +00:00
Oscar Fuentes
a229b3c9a7
Initial support for the CMake build system.
...
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Evan Cheng
5cc53c34c3
Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
...
llvm-svn: 56303
2008-09-18 07:54:21 +00:00
Evan Cheng
7c5dbd95e2
AllocateRWXMemory -> AllocateRWX.
...
llvm-svn: 56244
2008-09-16 17:28:18 +00:00
Chris Lattner
b56e07e736
add a helper method to sys::Path for clang, patch by
...
Kovarththanan Rajaratnam!
llvm-svn: 54655
2008-08-11 23:39:47 +00:00
Devang Patel
cbfc1a4737
Create temp. file in current path.
...
llvm-svn: 53973
2008-07-24 00:35:38 +00:00
Devang Patel
c5552c44a0
While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
...
llvm-svn: 53929
2008-07-22 20:02:39 +00:00
Devang Patel
bd06440440
Handle bitcode wrappers.
...
llvm-svn: 53924
2008-07-22 18:00:36 +00:00
Chris Lattner
2e24e0ca68
open plugins with RTLD_GLOBAL, pointed out by Bram Adams.
...
llvm-svn: 53385
2008-07-10 00:52:20 +00:00
Chris Lattner
a660f4bb07
Add a little wrapper header that is put around bc files when emitting
...
bc files for modules with a target triple that indicates they are for
darwin. The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.
This change has two benefits for darwin:
1) it allows us to encode the cpu type of the file in an easy to read
place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
handling files that are not a multiple of 8 bytes long. BC files
are only guaranteed to be multiples of 4 bytes long.
llvm-svn: 53275
2008-07-09 05:14:23 +00:00
Seo Sanghyeon
8f7291387f
Fix GetMainExecutable. Patch by Sam Bishop.
...
llvm-svn: 52847
2008-06-27 22:55:30 +00:00
Matthijs Kooijman
f61fd54237
Make LLVM compile on DragonFly BSD (PR2499).
...
Patch by Hasso Tepper!
llvm-svn: 52781
2008-06-26 10:36:58 +00:00
Bill Wendling
3fdca23ee1
Cleanup for unitialized types. Patch by Jean-Daniel Dupas!
...
llvm-svn: 52775
2008-06-26 08:32:05 +00:00
Chris Lattner
d4741e803f
"An improved Mach-O file type detection for sys::IdentifyFileType()
...
This patch add supports for single architecture mach-o files (the current implementation only support Universal Binary), and solve the signature conflict between java class and Universal Binary magics.
Note that this function will always returned dynamic library for Universal Binaries (like the current implementation) because the binary type is not include in the file header."
Patch by Jean-Daniel Dupas!
llvm-svn: 52766
2008-06-26 05:17:18 +00:00
Chris Lattner
b4325a8316
fix compilation errors in my previous patch
...
llvm-svn: 52733
2008-06-25 17:17:53 +00:00
Chris Lattner
881d537d2c
Add a new InvalidateInstructionCache method to sys::Memory.
...
llvm-svn: 52731
2008-06-25 17:14:10 +00:00
Dan Gohman
1cf5af9e42
Use static_cast instead of reinterpret_cast for casting void*.
...
llvm-svn: 52592
2008-06-21 20:17:03 +00:00
Argyrios Kyrtzidis
06f0d441f7
Minor comment fix.
...
llvm-svn: 52312
2008-06-16 10:14:09 +00:00
Wojciech Matyjewicz
c6a6618e6a
Add a missing semicolon.
...
llvm-svn: 52290
2008-06-15 18:02:47 +00:00
Argyrios Kyrtzidis
2cc0abf260
Fix the sys::Path::getSuffix() implementation.
...
llvm-svn: 52288
2008-06-15 15:15:19 +00:00
Argyrios Kyrtzidis
24f99985b8
Fix the environment block that is passed to the CreateProcess function.
...
This bug made llvm-ld unable to function with "-native" option, since the process that was used to call 'gcc' was crashing.
llvm-svn: 52284
2008-06-15 03:54:39 +00:00
Matthijs Kooijman
1cc695efd7
Fix redirection of stderr in sys::Program::ExecuteAndWait. There was logic
...
error that caused it to redirect stderr to stdout too often.
This fix is applied identically to the win32 code as well, but that is
untested.
--Thi line, and those below, will be ignored--
M System/Unix/Program.inc
M System/Win32/Program.inc
llvm-svn: 52233
2008-06-12 12:53:35 +00:00
Matthijs Kooijman
616e484be4
Make I/O redirection handling in sys::Program a bit more consistent. No
...
functional changes. Win32 code is untested, but should work fine.
In the unix variant, rename RedirectFD to RedirectIO and let that function
handle empty and null paths instead of doing that in the caller 3 times. This
is the same as win32 already does it.
In the win32 variant, use Path::isEmpty() instead of checking the resulting
c_str() manually. This is the same as unix already does it.
llvm-svn: 52230
2008-06-12 10:47:18 +00:00
Anton Korobeynikov
5e8644071d
Provide hooks for libgcc symbols' address resolution inside lli on mingw32.
...
Patch by Julien Lerouge!
llvm-svn: 52037
2008-06-06 07:20:07 +00:00
Bill Wendling
9cfdac50f1
Unbreak build.
...
llvm-svn: 51709
2008-05-29 22:02:08 +00:00
Bill Wendling
33e396d041
Remove more iostream header includes. Needed to implement a "FlushStream"
...
function to flush a specified std::ostream.
llvm-svn: 51705
2008-05-29 21:46:33 +00:00
Bill Wendling
89c2e3babb
Follow-up to the reverting of r51218. This puts the checks out-of-line. Because
...
they aren't in the header file, systems with a <string> header file that isn't
64-bit clean shouldn't warn if #including Path.h and specifying
-Wshorten-64-to-32.
llvm-svn: 51393
2008-05-21 21:20:07 +00:00
Dan Gohman
4e974ab933
Make PreVerifyID, IntSigsEnd, and KillSigsEnd const.
...
llvm-svn: 51088
2008-05-14 00:42:30 +00:00
Dan Gohman
d78c400b5b
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Nick Lewycky
c38c1712f7
Make constructors target-specific. This fixes problems where the path would
...
include backslashes on Windows. This should fix llvm-ld problems on win32.
llvm-svn: 50960
2008-05-11 17:37:40 +00:00
Nick Lewycky
25f08069ae
Fix renamePathOnDisk on Win32, patch from David Leon. This fixes problems with
...
llvm-ar being unable to rename files.
llvm-svn: 50702
2008-05-06 03:42:21 +00:00
Dan Gohman
a8b7e78f54
Remove uses of llvm/System/IncludeFile.h that are no longer needed.
...
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Evan Cheng
86cb31862f
Fix more -Wshorten-64-to-32 warnings.
...
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Nate Begeman
4840515dff
Restore code to disable crash catcher on older OS X systems
...
llvm-svn: 49568
2008-04-12 00:47:46 +00:00
Dan Gohman
f4bc782495
Make several symbols static.
...
llvm-svn: 49496
2008-04-10 21:11:47 +00:00
Ted Kremenek
a518bb79b1
Make getDirnameSep a static method (not part of Path's interface).
...
llvm-svn: 49354
2008-04-07 22:01:32 +00:00
Ted Kremenek
c042bf1db5
Added method Path::getDirname().
...
llvm-svn: 49352
2008-04-07 21:53:57 +00:00
Ted Kremenek
1d0436cdb0
Re-implemented Path::createDirectoryOnDisk (for Unix).
...
This method allows one to create a directory, and optionally create all parent
directories that do not exist.
The original implementation would require that *all* directories along a path
are writable by the user, including directories that already exist. For example,
suppose we wanted to create the directory "/tmp/foo/bar", and the directory
"/tmp" already exists, but not "/tmp/foo". Since "/tmp" is writable by all
users, the original implementation would work, and create "/tmp/foo", followed
by "/tmp/bar".
A problem occurred, however if one wanted to created the directory
"/Users/myuser/bar" (or equivalently "/home/myuser/bar"), and "/Users/myuser"
already existed and is writable by the current user. The directory
"/User/myuser" is writable by the user, but "/User" is not. The original
implementation of createDirectoryOnDisk would return with failure since "/User"
is not writable, even though "/User/mysuser" is writable.
The new implementation works by recursively creating parents as needed, and thus
doesn't need to check the permissions on every directory in a path.
llvm-svn: 49162
2008-04-03 16:11:31 +00:00
Chris Lattner
ba98fca5e5
add some #includes.
...
llvm-svn: 49036
2008-04-01 06:25:23 +00:00
Chris Lattner
18356d8857
MappedFile is dead, remove it.
...
llvm-svn: 49035
2008-04-01 06:20:44 +00:00
Chris Lattner
4c5e15f7da
Implement Path::MapInFilePages/UnMapFilePages on unix, which
...
provides fast MappedFile::getFile for large files.
llvm-svn: 49034
2008-04-01 06:16:24 +00:00
Chris Lattner
3089e1d82e
Stub out some sys::Path::MapInFilePages/UnMapFilePages methods.
...
llvm-svn: 49030
2008-04-01 06:00:12 +00:00
Chris Lattner
64959dcf03
Make MappedFile::map return a const correct pointer, don't leak address space on Unix platforms.
...
llvm-svn: 49026
2008-04-01 03:49:38 +00:00
Chris Lattner
62385ba3a0
Remove MappedFile support for mapping files for write and exec
...
and shared. This complicates the design, is not used, and probably
doesn't even work.
llvm-svn: 49022
2008-04-01 03:10:22 +00:00
Chris Lattner
efecfbc113
cleanup the MappedFile API and comments. This removes and updates
...
tons of out of date comments (really nothing throws here!) and fixes
some other fairly glaring issues: "size" used to return the size of
the file *and* change it, depending on how you called it.
llvm-svn: 49009
2008-04-01 00:53:25 +00:00
Chris Lattner
1fa4dca692
remove DEFINING_FILE_FOR for MappedFile.h
...
llvm-svn: 49008
2008-04-01 00:35:55 +00:00
Nate Begeman
f8be3836e3
Actually disable crash reporting on Mac OS X, returning bugpoint to speedy
...
crash miscompilations.
llvm-svn: 49000
2008-03-31 22:19:25 +00:00
Owen Anderson
c905fe9407
Revert r48676. I had plans for using it, but now it's just dead code.
...
llvm-svn: 48743
2008-03-24 21:29:58 +00:00
Owen Anderson
5b993fd70d
Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of itself.
...
llvm-svn: 48677
2008-03-22 02:59:54 +00:00
Owen Anderson
c1e4e3e9a1
Add an AllocateRW to match AllocateRWX.
...
llvm-svn: 48676
2008-03-22 02:33:53 +00:00
Dan Gohman
026eed69e7
Avoid calling array_endof in a static initializer, as it incurs
...
dynamic initialization.
llvm-svn: 48666
2008-03-21 23:44:21 +00:00
Dan Gohman
5a6ac79738
Specialize FORCE_DEFINING_FILE_TO_BE_LINKED using a GCC trick
...
to avoid using constructor calls for static objects. This reduces
the number of objects requiring static constructors in a typical
LLVM build by around 20%.
llvm-svn: 48665
2008-03-21 23:38:23 +00:00
Chris Lattner
bb8c2406dc
this was removed from the Unix side.
...
llvm-svn: 48370
2008-03-14 20:41:50 +00:00
Devang Patel
af305d2342
Remove unused GetAddressOfSymbol()
...
Thanks Daniel Dunbar!
llvm-svn: 48340
2008-03-13 16:55:34 +00:00
Chris Lattner
02e727ff88
Fix Path::GetMainExecutable on cygwin, patch by Sam Bishop.
...
llvm-svn: 48328
2008-03-13 05:22:05 +00:00
Chris Lattner
4dec91222a
remove extraneous namespace qualifier, PR2142
...
llvm-svn: 48327
2008-03-13 05:17:59 +00:00
Chris Lattner
1f49988a7a
This is a simple fix for getting error messages from dlerror in
...
LoadLibraryPermanently. The current code modifies the value of a pointer
that is passed by value, so the caller never gets the message.
Patch by Julien Lerouge!
llvm-svn: 48270
2008-03-12 00:50:01 +00:00
Chris Lattner
e209be4985
Stub out a Path::GetMainExecutable call to find the path to the
...
main executable of a program. This needs to be implemented on windows.
llvm-svn: 47835
2008-03-03 02:55:43 +00:00
Chris Lattner
6fca938971
Add path separator support, patch by Sam Bishop.
...
llvm-svn: 47662
2008-02-27 06:17:10 +00:00
Anton Korobeynikov
6636210de7
Provide __main hooks for cygwin & mingw32
...
llvm-svn: 47479
2008-02-22 10:08:31 +00:00
Anton Korobeynikov
1872ad9888
Add convenient helper to get suffix of the file
...
llvm-svn: 47397
2008-02-20 19:41:22 +00:00
Lauro Ramos Venancio
eab51d3a04
It is not safe to call fork in PrintStackTrace. Sometimes it freezes the program.
...
llvm-svn: 47161
2008-02-15 18:05:54 +00:00
Devang Patel
f64f7fb1b6
Remove use of ltdl
...
llvm-svn: 47065
2008-02-13 17:11:39 +00:00
Devang Patel
3d4f1b3695
Set error message.
...
Patch by Shantonu Sen.
llvm-svn: 46715
2008-02-04 20:57:54 +00:00
Dan Gohman
70de4cb1cd
Use empty() instead of comparing size() with zero.
...
llvm-svn: 46514
2008-01-29 13:02:09 +00:00
Anton Korobeynikov
a4f27608bc
Fix potential buffer overflow
...
llvm-svn: 46296
2008-01-24 01:20:48 +00:00
Duncan Sands
48f22f0b80
Fix compile failures with g++-4.3.
...
llvm-svn: 45781
2008-01-09 19:42:09 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
a087a8d2ce
remove attribution from lib Makefiles.
...
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Anton Korobeynikov
2ffb2c9e59
Unbreak mingw build
...
llvm-svn: 45314
2007-12-22 14:26:49 +00:00
Ted Kremenek
14020706d8
Added "GetCurrentDirectory()" to sys::Path.
...
llvm-svn: 45182
2007-12-18 22:07:33 +00:00
Ted Kremenek
74db04261b
Added "isDirectory" method to llvm::sys::Path.
...
llvm-svn: 45168
2007-12-18 19:46:22 +00:00
Chris Lattner
5f47cae3ce
remove obviously dead uses of IncludeFile.
...
llvm-svn: 45165
2007-12-18 19:15:48 +00:00
Chris Lattner
5c62ba5fb8
Remove dead file and directory.
...
llvm-svn: 44720
2007-12-08 22:17:33 +00:00
Anton Korobeynikov
9050bd1f68
Provide hook for _alloca to make JITing on Cygwin slightly happier :)
...
llvm-svn: 44528
2007-12-03 05:30:41 +00:00
Chuck Rose III
07b57d2626
This change does a couple of things. First it gets the Visual Studio builds working.
...
I added the lexing files to the VStudio projects and removed the .l files from the
VStudio projects. There was a problem with use of strtoll in TGLexer.cpp and Chris
suggested switching to strtol, so that's included here.
Additionally, this checkin adds minimal x64 builds to the VStudio builds. Build issues
related to x64 in the windows specific files for DynamicLibrary.inc and Singals.inc
are worked around, but not ultimately solved. Binaries used to be stored in
...\win32\{Debug|Release}
but are now kept in
...\win32\bin\{win32|x64}\{Debug|Release}
intermediate files will continue to be stored in the individual project directories under
win32.
Some names will likely change in the future to reflect that the vstudio projects
are no longer 32-bit only, but I wanted to get things up and running today so kept away
from bigger restructuring.
llvm-svn: 44260
2007-11-21 00:37:56 +00:00
Bill Wendling
87f460f8ba
Silence a warning saying that the variables always resolve to "true" in an
...
expression.
llvm-svn: 43610
2007-11-01 09:38:19 +00:00
Chris Lattner
8861abe6f2
really fix PR1581, thanks to Daniel Dunbar for pointing
...
this out.
llvm-svn: 42448
2007-09-28 20:50:50 +00:00
Dan Gohman
58c468fb09
Remove spurious consts. This fixes warnings with compilers that
...
are strict about such things.
llvm-svn: 41956
2007-09-14 20:08:19 +00:00
Owen Anderson
e2f23a3abf
Add lengthof and endof templates that hide a lot of sizeof computations.
...
Patch by Sterling Stein!
llvm-svn: 41758
2007-09-07 04:06:50 +00:00
Chris Lattner
364439eb15
Fix PR1581, patch by Timo Savola
...
llvm-svn: 40616
2007-07-31 06:00:51 +00:00
Gabor Greif
24027b584f
finishing touches of bytecode -> bitcode changes. also unbreak Windows
...
llvm-svn: 37950
2007-07-06 20:28:40 +00:00
Gabor Greif
3d3fc3296e
eliminate residual cruft related to recognizing bytecode
...
files.
bitcode files are the only LLVM format left.
llvm-svn: 37945
2007-07-06 13:38:17 +00:00
Gabor Greif
0e21980704
Solaris 2.x does not have RLIMIT_RSS, check for this symbol (analog NetBSD below), should subsume Cygwin
...
llvm-svn: 37939
2007-07-06 10:31:27 +00:00
Gabor Greif
e16561cd5d
Here is the bulk of the sanitizing.
...
Almost all occurrences of "bytecode" in the sources have been eliminated.
llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Anton Korobeynikov
ec9038bc69
Provide hook for alloca on VCPP. Patch by Scott Graham
...
llvm-svn: 37715
2007-06-25 07:12:14 +00:00
Devang Patel
d609374ab3
Fix LLVM build on NetBSD. Patch by Neil Booth.
...
llvm-svn: 37410
2007-06-04 15:28:57 +00:00
Chris Lattner
fd96905f12
Fix a bug where the bcreader could crash on .bc files that were an exact
...
multiple of the page size, due to a bug in MappedFile
llvm-svn: 36980
2007-05-11 00:00:27 +00:00
Chris Lattner
4a4499b69e
pull some win32 code into common code, add bitcode identification support.
...
llvm-svn: 36846
2007-05-06 05:32:21 +00:00
Chris Lattner
7de1ebae4a
silence annoying gcc 4.3 warnings
...
llvm-svn: 36681
2007-05-03 18:15:56 +00:00
Reid Spencer
e2e9b37698
Cygwin doesn't have the RSS_LIMIT for get/setrlimit.
...
llvm-svn: 36361
2007-04-23 07:22:51 +00:00
Chris Lattner
098ea183b8
Hack to get sys::Path to recognize macho dylibs.
...
llvm-svn: 35878
2007-04-11 03:15:35 +00:00
Reid Spencer
d3f622e0d5
Teach sys::Path how to recognize different kinds of object files for ELF
...
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.
llvm-svn: 35876
2007-04-11 02:02:09 +00:00
Reid Spencer
ccd4d2c8e4
Make isDynamicLibrary detect more than just an ELF file.
...
llvm-svn: 35874
2007-04-11 00:49:39 +00:00
Jeff Cohen
79582366e5
Unbreak VC++ build.
...
llvm-svn: 35751
2007-04-07 20:47:27 +00:00
Reid Spencer
ceeb918dd1
For PR1291:
...
Implement the PathWithStatus class and its use throughout lib/System.
llvm-svn: 35742
2007-04-07 18:52:17 +00:00
Reid Spencer
4ef4c46c35
For PR1302:
...
Implement recognition of COFF, ELF and Mach-O object/shared lib files.
llvm-svn: 35650
2007-04-04 06:30:26 +00:00
Reid Spencer
c7f485fd71
Use the stat information in the Path object, if it is already obtained. This
...
avoids a call to ::fstat by MappedFile when the file size information was
already obtained by the Path object.
llvm-svn: 35477
2007-03-29 19:11:22 +00:00
Reid Spencer
200c6f9c3d
For PR789:
...
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.
llvm-svn: 35476
2007-03-29 19:05:44 +00:00
Jeff Cohen
60c5522467
Determine absolute paths the correct way :)
...
llvm-svn: 35464
2007-03-29 17:27:38 +00:00
Reid Spencer
d394617a55
Add a uniqueID field to the FileStatus structure for Paths. This will map
...
to the inode number on Unix and something far less unique on Windows. The
windows case needs to be improved.
llvm-svn: 35461
2007-03-29 17:00:31 +00:00
Reid Spencer
0f92f0e519
For PR789:
...
* Add a method: bool isAbsolute() const, which determines if the path name
is absolute or not.
* Implement caching of file status information in the Path object. Allow it
to be updated forcefully or lazily re-fetched from the cached value.
llvm-svn: 35456
2007-03-29 16:43:20 +00:00
Anton Korobeynikov
2946e07557
Fix mingw32 build
...
llvm-svn: 35177
2007-03-19 20:19:08 +00:00
Anton Korobeynikov
2f4ae5306e
Unbreak mingw32 build
...
llvm-svn: 35042
2007-03-09 11:53:34 +00:00
Anton Korobeynikov
666d23d4e6
Implement PR1240
...
llvm-svn: 34959
2007-03-06 05:32:48 +00:00
Jeff Cohen
7157fe3f4b
Ensure 64-bit correctness.
...
llvm-svn: 34923
2007-03-05 05:45:08 +00:00
Jeff Cohen
a531d04b64
Implement memoryLimit on Windows.
...
llvm-svn: 34922
2007-03-05 05:22:08 +00:00
Chris Lattner
1e04147240
fix typo
...
llvm-svn: 34906
2007-03-04 06:36:24 +00:00
Anton Korobeynikov
d01defedf6
Add possibility to set memory limit for binaries run via libSystem. This
...
is especially needed for bugpoint. This partly implements PR688
llvm-svn: 34349
2007-02-16 19:11:07 +00:00
Chris Lattner
104fc7f823
silence warning
...
llvm-svn: 33746
2007-02-01 04:57:00 +00:00
Anton Korobeynikov
a41d9eca96
Moved disassembler to libSystem
...
llvm-svn: 33461
2007-01-23 10:26:08 +00:00
Reid Spencer
181fe4ad09
For PR808:
...
NetBSD also doesn't have pthread_mutexattr_setpshared
llvm-svn: 33406
2007-01-20 20:44:38 +00:00
Reid Spencer
9f900c1f92
Unbreak Darwin.
...
llvm-svn: 33375
2007-01-19 22:04:24 +00:00
Reid Spencer
a96084901c
Help the lli interpreter find the stderr/stdin/stdout symbols. These are
...
needed for output to be generated. On Linux these are both global vars and
macro definitions so we have to special case Linux.
llvm-svn: 33374
2007-01-19 21:41:04 +00:00
Reid Spencer
dcf6f90033
Handle each of stderr/stdin/stdout separately.
...
llvm-svn: 33373
2007-01-19 21:30:39 +00:00
Reid Spencer
750f80e306
Avoid taking the address of a macro by checking to see if stdin is defined
...
or not. This allows DynamicLibrary.cpp to compile on Darwin.
llvm-svn: 33064
2007-01-11 00:35:10 +00:00
Reid Spencer
1b2eeedd85
Allow LLI, in interpreter mode, to find stdin, stdout, and stderr. This is
...
a bit of a hack but it lets some of the llvm-test programs run.
llvm-svn: 33058
2007-01-10 19:50:43 +00:00
Anton Korobeynikov
eef04ba1c2
Partly fixed JITing on mingw32 platform. The support is not full due to
...
absence of dllimport JIT codegen.
llvm-svn: 32673
2006-12-19 15:24:18 +00:00