Commit Graph

81 Commits

Author SHA1 Message Date
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
Jakob Stoklund Olesen
4b0e1f1278 Revert r127409 which broke all the Windows bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:01:43 +00:00
Rafael Espindola
7deb187736 Add support for MemoryBuffers that are not null terminated and add
support for creating buffers that cover only a part of a file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127409 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 16:10:30 +00:00
Chris Lattner
6309b3e9be improve support for OpenBSD, patch by Amit Kulkarni!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 17:04:56 +00:00
Douglas Gregor
f3e3f21db1 Rip out realpath() support. It's expensive, and often a bad idea, and
I have another way to achieve the same goal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125239 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:33:15 +00:00
Cameron Zwarich
0bef1f3d1b Attempt to fix the build after r125228.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125236 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:02:14 +00:00
Douglas Gregor
025feadb97 Add llvm::sys::path::canonical(), which provides the canonicalized
name of a path, after resolving symbolic links and eliminating excess
path elements such as "foo/../" and "./".

This routine still needs a Windows implementation, but I don't have a
Windows machine available. Help? Please?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125228 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 22:11:23 +00:00
Michael J. Spencer
283d49c766 Fix rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123604 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 22:18:41 +00:00
Michael J. Spencer
d6cdf1d3cb Support/PathV2: Implement get_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123544 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:52:33 +00:00