Commit Graph

289 Commits

Author SHA1 Message Date
Rafael Espindola
b6df0bc95a Fix the build when __APPLE__ is defined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184917 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:25:44 +00:00
Rafael Espindola
bdfe4399db Remove sys::GetMainExecutable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184916 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:05:37 +00:00
Rafael Espindola
50188c1f42 Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184914 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:01:35 +00:00
Rafael Espindola
2c63b27e9f Remove PathWithStatus.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184910 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 04:15:55 +00:00
Rafael Espindola
46fa7cf91a Move GetEXESuffix to the one place it is used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184853 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-25 14:42:30 +00:00
Rafael Espindola
deeb5724b8 Remove sys::PathSeparator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184852 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-25 14:32:45 +00:00
Rafael Espindola
1c97082f53 Add another fixme.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184488 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 22:07:53 +00:00
Rafael Espindola
bdae6fa82c Remove last use of PathV1.h from Archive.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184484 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 22:02:10 +00:00
Rafael Espindola
b0bdcb5f8a make getLastModificationTime const. Move it with the other getters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184478 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 21:51:49 +00:00
Rafael Espindola
11ca2e508c Add a setLastModificationAndAccessTime to PathV2.
With this we can remove the last use of PathV1 from llvm-ar.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184464 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 20:56:14 +00:00
Rafael Espindola
29c17db650 Add support for getting the last modification time from a file_status.
Use that in llvm-ar.cpp to replace a use of sys::PathWithStatus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184450 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:42:04 +00:00
Evgeniy Stepanov
4828eacaf3 Fix get_magic() handling of short reads.
PR16389


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184434 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 15:56:05 +00:00
Rafael Espindola
9aa3365426 Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 15:06:35 +00:00
Evgeniy Stepanov
dd1b7c9685 Remove MSan hack that is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184428 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 14:19:10 +00:00
Rafael Espindola
7c8397081c Remove Path::getDirectoryContents.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184311 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 15:32:37 +00:00
Rafael Espindola
f6f3be69d8 Remove Path::canExecute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184298 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 13:25:31 +00:00
Rafael Espindola
1fbf3a3aca Remove Path::canWrite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184235 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 21:10:03 +00:00
Rafael Espindola
68ba1825fc Add a can_write function to PathV2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184233 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 20:56:38 +00:00
Rafael Espindola
f3426a482e Remove unused Path::canRead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184229 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 20:42:25 +00:00
Rafael Espindola
2e0f70bdd8 Remove uniqueID from PathV1.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184219 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 19:46:19 +00:00
Rafael Espindola
605510d16e Add a GetUniqueID that will replace the uniqueID of PathV1.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184217 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-18 19:34:49 +00:00
Rafael Espindola
87bec915f1 Only delete regular files and directories.
This ports a missing feature from PathV1.h. I am not sure how to test this
with the regular infrastructure, but an Apple bot should check this when
r183985 is reapplied.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184119 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 20:35:51 +00:00
Manuel Klimek
b30614a1de Fix incorrectly finding 'executable' directories instead of files.
This broke for example the 'not' utility, if a directory called
'FileCheck' is executable and in the path before the actual 'FileCheck'.

This patch steals the implementation of the "old" PathV1 canExecute
implementation:
- checks for R_OK (file readable): this is necessary for executing
  scripts; we should not regress here unless we have good reasons
- checks for S_ISREG; if we want to get rid of this, we'd need to
  change all callers who already made the assumption when depending
  on Path V1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184074 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-17 10:48:34 +00:00
Rafael Espindola
9e89fe77ce Add GetCurrentDirectory back.
It looks like clang-tools-extra/unittests/cpp11-migrate/TransformTest.cpp
depends on the behaviour of the old one on Windows. Maybe a difference
between GetCurrentDirectoryA and GetCurrentDirectoryW?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184009 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 21:41:33 +00:00
Rafael Espindola
76858a7abd Replace use of PathV1.h in MCContext.cpp.
GetCurrentDirectory is now unused. Remove it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184003 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 20:26:58 +00:00
Rafael Espindola
fcba9c56a2 Replace use of PathV1.h in Program.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183996 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14 19:38:45 +00:00
Rafael Espindola
b7e2188f7f Don't use PathV1.h in Signals.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183947 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-13 21:16:58 +00:00
Rafael Espindola
6585b388cb Have sys::FindProgramByName return a std::string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183928 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-13 19:25:37 +00:00
Reid Kleckner
62d124a1fa [Support] Fix handle and memory leak for processes that are not waited for
Execute's Data parameter is now optional, so we won't allocate memory
for it on Windows and we'll close the process handle.

The Unix code should probably do something similar to avoid accumulation
of zombie children that haven't been waited on.

Tested on Linux and Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183906 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-13 15:27:17 +00:00
Rafael Espindola
9f1d9fd196 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 20:58:35 +00:00
Rafael Espindola
2a4005688c Remove Path::getMagicNumber.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183839 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 15:07:11 +00:00
Rafael Espindola
fa2bbb31fa Remove Path::isAbsolute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183836 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 15:02:39 +00:00
Rafael Espindola
5475e2b01e Remove Path::isAbsolute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183835 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 14:47:33 +00:00
Rafael Espindola
55d529fd8a Remove Path::getSuffix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183833 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 14:32:51 +00:00
Rafael Espindola
36782c514a Remove sys::CopyFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183831 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 14:16:52 +00:00
Rafael Espindola
2e0372d69a Remove the old file memory mapping functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183828 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 14:11:15 +00:00
Rafael Espindola
ddee9b4691 Remove Path::createFileOnDisk.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183827 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 13:59:17 +00:00
Rafael Espindola
f90690f202 Remove Path::makeExecutableOnDisk.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183826 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 13:55:07 +00:00
Rafael Espindola
715a1be51f Remove Path::getDirname.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183780 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 19:32:57 +00:00
Rafael Espindola
b4d07b770c Remove Path::getBasename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183779 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 19:29:48 +00:00
Rafael Espindola
aab313f80b Remove Path::getLast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183778 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 19:25:17 +00:00
Rafael Espindola
6cbae01606 Remove GetRootDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183775 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 19:13:52 +00:00
Rafael Espindola
6438fd54ac Remove GetUserHomeDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183773 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 19:08:15 +00:00
Rafael Espindola
40de55a556 Remove GetSystemLibraryPaths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183770 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 18:58:47 +00:00
Rafael Espindola
0e33231d55 Remove Path::GetBitcodeLibraryPaths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183765 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 18:45:35 +00:00
Bob Wilson
2ed2ad00f9 Remove declaration of __clear_cache for __APPLE__. <rdar://problem/13924072>
This fixes a bootstrapping problem with builds for Apple ARM targets.
Clang had the wrong prototype for __clear_cache with ARM targets.  Rafael
fixed that in clang svn r181784 and r181810, but without those changes,
we can't build this code for ARM because clang reports an error about the
declaration in Memory.inc not matching the builtin declaration. Some of our
buildbots need to use an older compiler that doesn't have the clang fix.
Since __clear_cache is never used here when __APPLE__ is defined, I'm just
conditionalizing the declaration to match that. I also moved the declaration
of sys_icache_invalidate inside the conditional for __APPLE__ while I was at
it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182223 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-19 20:33:51 +00:00
Tim Northover
820b147493 Invalidate instruction cache when setting memory to be executable.
lli's remote MCJIT code calls setExecutable just prior to running
code. In line with Darwin behaviour this seems to be the place to
invalidate any caches needed so that relocations can take effect
properly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182213 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-19 15:28:16 +00:00
Rafael Espindola
d1bf52275d Fix __clear_cache declaration.
This fixes the build with gcc in gnu++98 and gnu++11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181811 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14 18:06:14 +00:00
Rafael Espindola
15cf700b41 Declare __clear_cache.
GCC declares __clear_cache in the gnu modes (-std=gnu++98,
-std=gnu++11), but not in the strict modes (-std=c++98, -std=c++11). This patch
declares it and therefore fixes the build when using one of the strict modes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181785 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14 13:02:37 +00:00
Tim Northover
9a29cf281e AArch64: use __clear_cache under GCCish environments
AArch64 is going to need some kind of cache-invalidation in order to
successfully JIT since it has a weak memory-model. This is provided by
a __clear_cache builtin in libgcc, which acts very much like the
32-bit ARM equivalent (on platforms where it exists).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181129 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04 18:52:44 +00:00
Ulrich Weigand
3ea50a69d7 [SystemZ] Support System Z as host architecture
The llvm::sys::AddSignalHandler function (as well as related routines) in
lib/Support/Unix/Signals.inc currently registers a signal handler routine
via "sigaction".  When this handler is called due to a SIGSEGV, SIGILL or
similar signal, it will show a stack backtrace, deactivate the handler,
and then simply return to the operating system.  The intent is that the
OS will now retry execution at the same location as before, which ought
to again trigger the same error condition and cause the same signal to be
delivered again.  Since the hander is now deactivated, the OS will take
its default action (usually, terminate the program and possibly create
a core dump).

However, this method doesn't work reliably on System Z:  With certain
signals (namely SIGILL, SIGFPE, and SIGTRAP), the program counter stored
by the kernel on the signal stack frame (which is the location where
execution will resume) is not the instruction that triggered the fault,
but then instruction *after it*.  When the LLVM signal handler simply
returns to the kernel, execution will then resume at *that* address,
which will not trigger the problem again, but simply go on and execute
potentially unrelated code leading to random errors afterwards.

To fix this, the patch simply goes and re-raises the signal in question
directly from the handler instead of returning from it.  This is done
only on System Z and only for those signals that have this particular
problem.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181010 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03 12:22:11 +00:00
Benjamin Kramer
d922518844 Inline variable into the #ifdef block where it's used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180688 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-28 07:47:04 +00:00
Joerg Sonnenberger
78a9b434e1 Fix typo. Stupid me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180686 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 22:32:54 +00:00
Joerg Sonnenberger
dfa0e92fa0 Only use cxxabi.h's demangler, if it is actually available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180684 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 22:12:32 +00:00
Rafael Espindola
845a932af7 Add a function to check if an argument list is too long.
This will be used in clang to decide if it should create an @file or not. It
will be tested on the clang side.

Patch by Nathan Froyd.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179285 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11 14:06:34 +00:00
Douglas Gregor
0591f19c8b <rdar://problem/13551789> Fix yet another race in unique_file.
If the directory that will contain the unique file doesn't exist when
we tried to create the file, but another process creates it before we
get a chance to try creating it, we would bail out rather than try to
create the unique file.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178908 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 20:48:36 +00:00
Nick Lewycky
d5e1be03ed Add a new watchdog timer interface. The interface does not permit handling timeouts, so
it's only really useful if you're going to crash anyways. Use it in the pretty stack trace
printer to kill the compiler if we hang while printing the stack trace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177962 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 01:27:52 +00:00
Akira Hatanaka
21eecf4384 Android uses cacheflush(long start, long end, long flags) for MIPS.
Patch by Stephen Hines.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177101 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 19:01:00 +00:00
Michael J. Spencer
cc3a595ab9 [Support] Fix lifetime of file descriptors when using MemoryBuffer.
Clients of MemoryBuffer::getOpenFile expect it not to take ownership of the file
descriptor passed in. So don't.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176995 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 00:20:10 +00:00
Argyrios Kyrtzidis
2b9a946f98 [PathV2] In llvm::sys::fs::unique_file, make sure it doesn't fall into an infinite loop by constantly trying
to create the parent path.

This can happen if the path is a relative filename and the current directory was removed.
Thanks to Daniel D. for the hint in fixing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176226 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 00:38:19 +00:00
Dan Gohman
7afb104ed5 Rewrite comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175651 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 19:28:46 +00:00
Krzysztof Parzyszek
033ee0f111 Add comment in Memory.inc explaining r175646.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175650 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 19:25:09 +00:00
Dan Gohman
09adcf7dca SIGQUIT is a "kill" signal, rather than an "int" signal, in this context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175648 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 19:15:01 +00:00
Krzysztof Parzyszek
0464565bae On PowerPC, the cache-flush instructions dcbf and icbi are treated as
loads. On FreeBSD, add PROT_READ page protection flag before flushing
cache.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175646 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 18:24:30 +00:00
Alexey Samsonov
9f306bdc70 Fix initialization-order bug in llvm::Support::TimeValue. TimeValue::now() is explicitly called during module initialization of lib/Support/Process.cpp. It reads the field of global object PosixZeroTime, which is not guaranteed to be initialized at this point. Found by AddressSanitizer with -fsanitize=init-order option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175509 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 11:35:39 +00:00
Evgeniy Stepanov
79e8429e41 Workaround an MSan false positive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175156 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-14 12:18:32 +00:00
Evgeniy Stepanov
9c02a27604 More MSan/ASan annotations.
This change lets us bootstrap LLVM/Clang under ASan and MSan. It contains
fixes for 2 issues:

- X86JIT reads return address from stack, which MSan does not know is
  initialized.
- bugpoint tests run binaries with RLIMIT_AS. This does not work with certain
  Sanitizers.

We are no longer including config.h in Compiler.h with this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174306 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-04 07:03:24 +00:00
Edwin Vane
3c1c042a64 Fix gcc/printf/ISO C++ warning
Remove the use of the 't' length modifier to avoid a gcc warning. Based
on usage, 32 bits of precision is good enough for printing a stack
offset for a stack trace.

't' length modifier isn't in C++03 but it *is* in C++11. Added a FIXME
to reintroduce once LLVM makes the switch to C++11.

Reviewer: gribozavr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173711 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 19:34:42 +00:00
Douglas Gregor
06c7008e30 Fix a race condition in llvm::sys::path::unique_file: when we end up
failing to create the unique file because the path doesn't exist,
don't fail if someone else manages to create the path before we do.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172032 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10 01:58:46 +00:00
Argyrios Kyrtzidis
f48acd5ecd Move the internal PrintStackTrace function that is used for llvm::sys::PrintStackTraceOnErrorSignal(),
into a new function llvm::sys::PrintStackTrace, so that it's available to clients for logging purposes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171989 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 19:42:40 +00:00
Chandler Carruth
6a40db40ee Eric thought that Darwin was right to use -1 consistently rather than
leaving this undefined, and despite the sentence in the standard that
seems to require it, I'll cede the point and assume its a bug in the
wording. Other parts of POSIX regularly allow for things to be -1
instead of undefined, this should too. Makes things more consistent too.

This should have to real impact for folks though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171574 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 00:42:50 +00:00
Chandler Carruth
4cff412ecc Try to suppress the use of clock_gettime on Darwin which apparantly
defines _POSIX_CPUTIME but doesn't support the clock_* functions.

I don't test the value of _POSIX_CPUTIME because the spec merely says
that if it is defined, the CPU-specific timers are available, whereas it
says that _POSIX_TIMERS must be defined and defined to a value greater
than zero. However, this may not work, as the POSIX spec clearly states:

  "If the symbolic constant _POSIX_CPUTIME is defined, then the symbolic
  constant _POSIX_TIMERS shall also be defined by the implementation to
  have the value 200112L."

If this doesn't work, I'll add more hacks for Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171565 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 00:11:21 +00:00
Chandler Carruth
73c35d86b9 Add time getters to the process interface for requesting the elapsed
wall time, user time, and system time since a process started.

For walltime, we currently use TimeValue's interface and a global
initializer to compute a close approximation of total process runtime.

For user time, this adds support for an somewhat more precise timing
mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock
selected.

For system time, we have to do a full getrusage call to extract the
system time from the OS. This is expensive but unavoidable.

In passing, clean up the implementation of the old APIs and fix some
latent bugs in the Windows code. This might have manifested on Windows
ARM systems or other systems with strange 64-bit integer behavior.

The old API for this both user time and system time simultaneously from
a single getrusage call. While this results in fewer system calls, it
also results in a lower precision user time and if only user time is
desired, it introduces a higher overhead. It may be worthwhile to switch
some of the pass timers to not track system time and directly track user
and wall time. The old API also tracked walltime in a confusing way --
it just set it to the current walltime rather than providing any measure
of wall time since the process started the way buth user and system time
are tracked. The new API is more consistent here.

The plan is to eventually implement these methods for a *child* process
by using the wait3(2) system call to populate an rusage struct
representing the whole subprocess execution. That way, after waiting on
a child process its stats will become accurate and cheap to query.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171551 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 23:19:55 +00:00
Chandler Carruth
a0d8f28a9c Remove an unused method on Program.
I'm simplifying this interface as much as I can before merging it with
the new process interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171334 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 23:44:47 +00:00
Chandler Carruth
2bbe466475 Remove an unused method on the Program class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171332 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 23:38:28 +00:00
Chandler Carruth
f5867ab717 Go ahead and get rid of the old page size interface and convert all the
users over to the new one. No sense maintaining this "compatibility"
layer it seems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 23:31:56 +00:00
Chandler Carruth
814afe91cc Flesh out a page size accessor in the new API.
Implement the old API in terms of the new one. This simplifies the
implementation on Windows which can now re-use the self_process's once
initialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 23:23:35 +00:00
Chandler Carruth
e0e1985b3b Remove an unused function in the old Process interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171327 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 22:17:59 +00:00
Chandler Carruth
9b4aba85a8 Switch this code to a more idiomatic double using namespace directive.
Fix a truly odd namespace qualifier that was flat out wrong in the
process. The fully qualified namespace would have been
llvm::sys::TimeValue, llvm::TimeValue makes no sense.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171292 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 11:45:20 +00:00
Chandler Carruth
0184a841d3 Begin sketching out the process interface.
The coding style used here is not LLVM's style because this is modeled
after a Boost interface and thus done in the style of a candidate C++
standard library interface. I'll probably end up proposing it as
a standard C++ library if it proves to be reasonably portable and
useful.

This is just the most basic parts of the interface -- getting the
process ID out of it. However, it helps sketch out some of the boiler
plate such as the base class, derived class, shared code, and static
factory function. It also introduces a unittest so that I can
incrementally ensure this stuff works.

However, I've not even compiled this code for Windows yet. I'll try to
fix any Windows fallout from the bots, and if I can't fix it I'll revert
and get someone on Windows to help out. There isn't a lot more that is
mandatory, so soon I'll switch to just stubbing out the Windows side and
get Michael Spencer to help with implementation as he can test it
directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 11:17:50 +00:00
Chandler Carruth
a1514e24cc Sort includes for all of the .h files under the 'lib' tree. These were
missed in the first pass because the script didn't yet handle include
guards.

Note that the script is now able to handle all of these headers without
manual edits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169224 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 07:12:27 +00:00
Chandler Carruth
d04a8d4b33 Use the new script to sort the includes of every file under lib.
Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 16:50:05 +00:00
Chandler Carruth
4334dd96a9 Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.
Rationale:
1) This was the name in the comment block. ;]
2) It matches Clang's __has_feature naming convention.
3) It matches other compiler-feature-test conventions.

Sorry for the noise. =]

I've also switch the comment block to use a \brief tag and not duplicate
the name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168996 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 11:45:22 +00:00
Daniel Dunbar
71e5ea8860 PathV2: Fix a possible infinite loop.
- The code could infinite loop trying to create unique files, if the directory
   containing the unique file exists, but open() calls on non-existent files in
   the path return ENOENT. This is true on the /dev/fd filesystem, for example.

 - Will add a clang side test case for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168081 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 20:24:52 +00:00
Daniel Dunbar
81e35ff722 Support: Don't remove special files on signals.
- Similar to Path::eraseFromDisk(), we don't want LLVM to remove things like
   /dev/null, even if it has the permission.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166105 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 16:30:54 +00:00
Benjamin Kramer
53347ed2f8 Make backtraces work again with both the configure and cmake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164817 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-28 10:10:46 +00:00
Sylvestre Ledru
bec3ce0cb5 The assumption that /proc/self/exe always exists is incorrect.
For example, under a Linux chroot, /proc/ might not be mounted.
Therefor, we test if this file exist. If it is the case, use it (the current
behavior). Otherwise, we fall back to the detection used by *BSD.

The issue has been reported initially on the Debian bug tracker:
http://bugs.debian.org/674588



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 08:30:35 +00:00
Eric Christopher
c69bdadac9 Add an --enable-backtraces option to configure to determine
whether or not we want to print out backtrace information. Useful
for libraries that don't need backtrace information on a crash.

rdar://11844710

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164426 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21 23:03:29 +00:00
Andrew Kaylor
bbf628b6ce This patch adds memory support functions which will later be used to implement section-specific protection handling in MCJIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164249 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 20:46:12 +00:00
Chandler Carruth
7b617158db Add support for finding cacheflush on OpenBSD/mips64 platforms.
Patch by Brad Smith!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163584 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 01:17:24 +00:00
NAKAMURA Takumi
2de91673ff Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 03:02:56 +00:00
NAKAMURA Takumi
383fb7f026 Unix/Signals.inc: Fix a typo. Thanks to Dani Berg!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163288 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 03:01:43 +00:00
Michael J. Spencer
118f194966 Properly test the LLVM_USE_RVALUE_REFERENCES macro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161978 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15 19:16:27 +00:00
Michael J. Spencer
1ebd25e438 [PathV2] Add mapped_file_region. Implementation for Windows and POSIX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161976 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15 19:05:47 +00:00
Joerg Sonnenberger
c103ede50b stdcxx's cstdio doesn't include stdio.h, but the code using PathV2.inc
includes both. Deal with feof and ferror potentially being macros.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161658 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 10:56:09 +00:00
Eric Christopher
b0f6759ab9 Add support for the OpenBSD for Bitrig.
Patch by David Hill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161344 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-06 20:52:18 +00:00
Daniel Dunbar
7d83658140 Process: Add sys::Process::FileDescriptorHasColors().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160557 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 18:29:38 +00:00
Galina Kistanova
d897599e5b Fixed few warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160142 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 20:45:36 +00:00
Nick Kledzik
ca077ec5ea Add permissions(), map_file_pages(), and unmap_file_pages() to llvm::sys::fs and add unit test. Unix is implemented. Windows side needs to be implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158770 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 00:28:54 +00:00
Chandler Carruth
29436629da Don't call 'FilesToRemove[0]' when the vector is empty, even to compute
the address of it. Found by a checking STL implementation used on
a dragonegg builder. Sorry about this one. =/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-16 00:44:07 +00:00
Chandler Carruth
0b8b3ba21e Harden the Unix signals code to be more async signal safe.
This is likely only the tip of the ice berg, but this particular bug
caused any double-free on a glibc system to turn into a deadlock! It is
not generally safe to either allocate or release heap memory from within
the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting
memory and causing the deadlock. What's worse, eraseFromDisk in PathV1
has lots of allocation and deallocation paths. We even passed 'true' in
a place that would have caused the *signal handler* to try to run the
'system' system call and shell out to 'rm -rf'. That was never going to
work...

This patch switches the file removal to use a vector of strings so that
the exact text needed for the 'unlink' system call can be stored there.
It switches the loop to be a boring indexed loop, and directly calls
unlink without looking at the error. It also works quite hard to ensure
that calling 'c_str()' is safe, by ensuring that the non-signal-handling
code path that manipulates the vector always leaves it in a state where
every element has already had 'c_str()' called at least once.

I dunno exactly how overkill this is, but it fixes the
deadlock-on-double free issue, and seems likely to prevent any other
issues from sneaking up.

Sorry for not having a test case, but I *really* don't know how to test
signal handling code easily....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158580 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-16 00:09:41 +00:00
Benjamin Kramer
1222c5c121 Use access(2) instead of stat(2) to check if a file exists.
Apart from being slightly cheaper, this fixes a real bug that hits 32 bit
linux systems. When passing a file larger than 2G to be linked (which isn't
that uncommon with large projects such as WebKit), clang's driver checks
if the file exists but the file size doesn't fit in an off_t and stat(2)
fails with EOVERFLOW. Clang then says that the file doesn't exist instead
of passing it to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157891 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-02 16:28:09 +00:00
Eric Christopher
61aef8bdf7 Allow unique_file to take a mode for file permissions, but default
to user only read/write.

Part of rdar://11325849

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156591 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-11 00:07:44 +00:00
Daniel Dunbar
2b8f3ba843 [Support] Fix sys::GetRandomNumber() to always use a high quality seed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156414 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08 20:38:00 +00:00
NAKAMURA Takumi
dc736b0a3e Unix/Process.inc: Give more useful random seed to srand. Workaround for PR12743.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156252 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-06 08:24:24 +00:00
NAKAMURA Takumi
24cddd5c9a Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix/Process.inc.
FIXME: GetRandomNumber() is not implemented in Win32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156251 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-06 08:24:18 +00:00
Daniel Dunbar
463a719d36 [Support] Fix up comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156239 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-05 16:39:22 +00:00
Daniel Dunbar
92bb514612 [Support] Rewrite sys::fs::unique_file to not be stupid with /dev/urandom.
- Just use sys::Process::GetRandomNumber instead of having two poor
   implementations.
 - This is ~70 times (!) faster on my OS X machine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156238 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-05 16:36:24 +00:00
Michael J. Spencer
8dab504799 [Support/Unix] Unconditionally include time.h.
When building LLVM on Linux with libc++ with CMake TIME_WITH_SYS_TIME is
undefined, and HAVE_SYS_TIME_H is defined. This ends up including
sys/time.h but not time.h. Unix/TimeValue.inc requires time.h for asctime_r
and localtime. libstdc++ seems to include time.h anyway, but libc++ does
not.

Fix this by always including time.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155382 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-23 19:00:27 +00:00
Sylvestre Ledru
9dc06bd431 Conflict with st_dev/st_ino identifiers under Debian GNU/Hurd
The problem is that the struct file_status on UNIX systems has two
members called st_dev and st_ino; those are also members of the
struct stat, and they are reserved identifiers which can also be
provided as #define (and this is the case for st_dev on Hurd).
The solution (attached) is to rename them, for example adding a
"fs_" prefix (= file status) to them.

Patch by Pino Toscano




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-23 16:37:23 +00:00
Benjamin Kramer
246de858e3 Reapply 'Add reverseColor to raw_ostream'.
To be used in printing unprintable source in clang diagnostics.
Patch by Seth Cantrell, with a minor fix for mingw by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154805 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 08:56:50 +00:00
Argyrios Kyrtzidis
c9413c745b Revert r154800 which breaks windows builders.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154802 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 07:59:39 +00:00
Argyrios Kyrtzidis
7d31d75a77 Add reverseColor to raw_ostream.
To be used in printing unprintable source in clang diagnostics.
Patch by Seth Cantrell!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154800 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 07:07:38 +00:00
Sylvestre Ledru
6fc30c26b7 Fix the build under Debian GNU/Hurd.
Thanks to Pino Toscano for the patch



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154500 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 15:35:36 +00:00
Anton Korobeynikov
a3ad585393 Fix GetMainExecutable on kFreeBSD.
Patch by Sylvestre Ledru!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153435 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-26 12:05:51 +00:00
Jean-Daniel Dupas
300361a717 Fix null to integer conversion warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-24 22:17:50 +00:00
David Blaikie
58604cd944 Change default error_code ctor to a 'named ctor' so it's more self-documenting.
Unify default construction of error_code uses on this idiom so that users don't
feel compelled to make static globals for naming convenience. (unfortunately I
couldn't make the original ctor private as some APIs don't return their result,
instead using an out parameter (that makes sense to default construct) - which
is a bit of a pity. I did, however, find/fix some cases of unnecessary default
construction of error_code before I hit the unfixable cases)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150197 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 19:24:12 +00:00
Chandler Carruth
4aab4ab340 Remove SetWorkingDirectory from the Process interface. Nothing in LLVM
or Clang is using this, and it would be hard to use it correctly given
the thread hostility of the function. Also, it never checked the return
which is rather dangerous with chdir. If someone was in fact using this,
please let me know, as well as what the usecase actually is so that
I can add it back and make it more correct and secure to use. (That
said, it's never going to be "safe" per-se, but we could at least
document the risks...)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148211 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-15 08:41:35 +00:00
Argyrios Kyrtzidis
08713b37c3 Disable the crash reporter when running lit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147965 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-11 20:53:25 +00:00
Sebastian Pop
6e9b5eb51b revert r147542 after comments from Joerg Sonnenberger
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-05 18:28:46 +00:00
Sebastian Pop
8a86887ba3 use getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJIT
Get back getHostTriple.

For JIT compilation, use the host triple instead of the default
target: this fixes some JIT testcases that used to fail when the
compiler has been configured as a cross compiler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147542 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 19:47:22 +00:00
Michael J. Spencer
b92cb30cf5 Support/Program: Make Change<stream>ToBinary return error_code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-13 23:16:49 +00:00
Chad Rosier
7ae606a2a8 Revert r146363 to allow buildbots to make forward progress.
Original commit message:
Support/FileSystem: Implement canonicalize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146378 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 17:58:31 +00:00
Michael J. Spencer
d45fbe6227 Support/FileSystem: Implement bool equivalent(file_status A, file_status B);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146364 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 06:04:28 +00:00
Michael J. Spencer
c3b00e8040 Support/FileSystem: Implement canonicalize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146363 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 06:04:01 +00:00
Michael J. Spencer
a81ac8f2b5 Support/FileSystem: Implement recursive_directory_iterator and make
directory_iterator preserve InputIterator semantics on copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146200 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-08 22:50:09 +00:00
Sebastian Pop
0173864d8a rename getHostTriple into getDefaultTargetTriple
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 21:32:20 +00:00
Sebastian Pop
de2e0b5e6d rename LLVM_HOSTTRIPLE into LLVM_DEFAULT_TARGET_TRIPLE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 21:31:44 +00:00
Eli Friedman
c94792507d Remove a couple unused methods. PR11201.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143452 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 05:11:01 +00:00
Daniel Dunbar
bb0a6126cf sys::Process: Add a SetWorkingDirectory method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 23:23:36 +00:00
Bob Wilson
aabc6a9b79 Remove the hack to check UNAME_RELEASE when identifying the Darwin version.
This was only needed to locate llvm-gcc's installation directory when clang
falls back to run llvm-gcc for i386 kexts.  As of clang svn r140187, we're
now just searching paths with several different Darwin versions on either
side of the current version, so this is no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20 22:05:56 +00:00
Bill Wendling
544e4124fe Include limits.h to make sure PATH_MAX is known on Solaris 10.
Patch by Joakim Johansson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139743 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 21:49:42 +00:00
Bob Wilson
21ab6c066d Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137204 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10 05:02:22 +00:00
Bob Wilson
0dc8b42987 Put Darwin-specific code inside an __APPLE__ ifdef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 19:54:32 +00:00
Bob Wilson
f5b757642d Recognize the UNAME_RELEASE environment variable to match Darwin's uname.
When this variable is set, "uname -r" will return its value instead of the
real OS version.  Make this affect LLVM's triple for consistency.
<rdar://problem/9919167>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137111 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-09 05:13:36 +00:00
Nick Lewycky
2b9c50776a Don't look at $PWD in GetCurrentDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136477 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 18:26:59 +00:00
Nick Lewycky
3c036e520e Teach Path::GetCurrentDirectory to use $PWD, to support users who like to do
screwy things by setting PWD != getcwd(). For example, some developers I know
will use this to control the value in gcc's DW_AT_comp_dir value in debug
output. With this patch, that trick will now work on clang too.

The only other effect of this change is that the static analysis will now
respect $PWD when reporting the directory of the files in its HTML output. I
think that's fine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136459 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 04:42:39 +00:00
Argyrios Kyrtzidis
814450a429 Add an optional 'bool makeAbsolute' in llvm::sys::fs::unique_file function.
If true and 'model' parameter is not an absolute path, a temp directory will be prepended.
Make it true by default to match current behaviour.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136310 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 00:29:20 +00:00
Chad Rosier
338398a288 By default mkstemp() creates a temporary file with mode 0600, but the mode
used for open is 0666.  Therefore, add the necessary permission bits for
consistency.
rdar://8621462

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 18:55:31 +00:00
Andrew Trick
dc5948d472 Have Program::Wait return -2 for crashed and timeouts instead of embedding
info in the error message. Per Dan's request.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131780 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-21 00:56:46 +00:00
Rafael Espindola
ab078f0232 Don't include information about the build into the information returned by
getHostTriple. This fixes a 32 bit clang running on a 64 bit ubuntu.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131463 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 15:26:34 +00:00
Andrew Trick
7c863eb8cc Bugpoint support for miscompilations that result in a crash.
This change allows bugpoint to pinpoint the "opt" pass and bitcode
segment responsible for a crash caused by miscompilation. At least it
works well for me now, without having to create any custom execution
wrappers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131186 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 16:31:24 +00:00
Douglas Gregor
72d30f6950 Include <pthread.h> before we use pthread_self/pthread_kill
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130510 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 16:12:17 +00:00
Daniel Dunbar
88c924c67e sys/Host: Change getHostTriple() to return the full Darwin version on OS X.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-20 15:44:33 +00:00
Chris Lattner
7a2bdde0a0 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
Andrew Trick
0a828fd7ef revert r128199 until it can be made to work with Frontend/dependency-gen.c.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128218 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 16:43:37 +00:00
Michael J. Spencer
e1db1b8d4e Remove all uses of PATH_MAX and MAXPATHLEN from PathV2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128199 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 05:23:40 +00:00
Benjamin Kramer
ed8f9589a8 Avoid initializing posix_spawn_file_actions_t if not used.
- glibc falls back to fork+exec if a file actions object is present.
- On BSDs this saves a malloc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 15:52:24 +00:00
Jim Grosbach
05f98a39e5 setExecutable() should default to success if there's nothing custom for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127891 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 18:51:03 +00:00
Rafael Espindola
f7fdad15d9 Add r127409 back now that the windows file was updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:33:29 +00:00