summaryrefslogtreecommitdiff
path: root/lib/Support
AgeCommit message (Collapse)AuthorFilesLines
2013-04-15Make the host endianness check an integer constant expression.Rafael Espindola2-3/+3
I will remove the isBigEndianHost function once I update clang. The ifdef logic is designed to * not use configure/cmake to avoid breaking -arch i686 -arch ppc. * default to little endian * be as small as possible It looks like sys/endian.h is the preferred header on most modern BSD systems, but it is better to change this in a followup patch as machine/endian.h is available on FreeBSD, OpenBSD, NetBSD and OS X. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179527 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11Add a function to check if an argument list is too long.Rafael Espindola2-0/+40
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-05<rdar://problem/13551789> Fix a race in the LockFileManager.Douglas Gregor1-5/+32
It's possible for the lock file to disappear and the owning process to return before we're able to see the generated file. Spin for a little while to see if it shows up before failing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178909 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05<rdar://problem/13551789> Fix yet another race in unique_file.Douglas Gregor1-3/+1
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[Support][FileSystem] Fix identify_magic for big endian ELF.Michael J. Spencer1-2/+5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178905 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05[Support] Disable assertion dialogs from the MSVC debug CRTReid Kleckner1-0/+22
Summary: Sets a report hook that emulates pressing "retry" in the "abort, retry, ignore" dialog box that _CrtDbgReport normally raises. There are many other ways to disable assertion reports, but this was the only way I could find that still calls our exception handler. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D625 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178880 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03Ensuring that both bits are set, and not just a combination of one or the other.Aaron Ballman1-1/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178674 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03Testing for Visual Studio 2010 SP1 or greater before calling the _xgetbv ↵Aaron Ballman1-2/+2
intrinsic. This also fixes a minor code formatting issue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178666 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03Second pass at addressing PR15351 by explicitly checking for AVX supportAaron Ballman1-2/+25
when getting the host processor information. It emits a .byte sequence on GNUC compilers to work around lack of xgetbv support with older assemblers, and resolves a comment typo found in the previous patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178636 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03Rolling back the AVX support patch due to breaking a gcc 4.6 build bot that ↵Aaron Ballman1-23/+2
doesn't understand the xgetbv instruction for some reason. Will revisit when time permits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03Attempting to fix the build on older GCC versions.Aaron Ballman1-1/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178604 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03This patch addresses PR15351 by explicitly checking for AVX supportAaron Ballman1-2/+22
when getting the host processor information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178598 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-30Put private class into an anonmyous namespace.Benjamin Kramer1-0/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178420 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29SmallVector and SmallPtrSet allocations now power-of-two aligned.Jean-Luc Duprat1-16/+8
This time tested on both OSX and Linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178377 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29Revert "Fix allocations of SmallVector and SmallPtrSet so they are more ↵Rafael Espindola1-8/+16
prone to" This reverts commit 617330909f0c26a3f2ab8601a029b9bdca48aa61. It broke the bots: /home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:150: PushPopTest /home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:118: Failure Value of: v[i].getValue() Actual: 0 Expected: value Which is: 2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178334 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29Fix allocations of SmallVector and SmallPtrSet so they are more prone toJean-Luc Duprat1-16/+8
being power-of-two sized. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178332 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27Don't try to generate crash diagnostics if we had an I/O failure. It's veryChad Rosier1-1/+1
likely the crash diagnostics generation will fail as well. Part of rdar://13296693 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178163 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27Add a boolean parameter to the llvm::report_fatal_error() function to indicatedChad Rosier1-8/+8
if crash diagnostics should be generated. By default this is enabled. Part of rdar://13296693 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178161 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26Add a boolean parameter to the ExecuteAndWait static function to indicatedChad Rosier1-4/+7
if execution failed. ExecuteAndWait returns -1 upon an execution failure, but checking the return value isn't sufficient because the wait command may return -1 as well. This new parameter is to be used by the clang driver in a subsequent commit. Part of rdar://13362359 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178087 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26Add missing file to cmake build.Nick Lewycky1-0/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177963 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26Add a new watchdog timer interface. The interface does not permit handling ↵Nick Lewycky5-1/+86
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-22Revert r177543: Add timing of the IR parsing code with a newChandler Carruth2-22/+0
-time-ir-parsing flag This breaks the layering of the Support library. We can't add an implementation side to IRReader because it refers directly to entities only accessible as part of the IR, AsmParser, and BitcodeReader libraries. It can only be used in a context where all of those libraries will be available. We'll need to find some other way to get this functionality, and hopefully solve the long-standing layering problem of IRReader.h... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177695 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-21<rdar://problem/13477190> On Darwin, use DARWIN_USER_TEMP_DIR or ↵Douglas Gregor1-0/+24
DARWIN_USER_CACHE_DIR for the system temporary directory. The DARWIN_USER_TEMP_DIR and DARWIN_USER_CACHE_DIR configuration settings are more idiomatic for Darwin than the TMPDIR environment variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177669 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20Use pre-inc, pre-dec when possible.Jakub Staszak1-4/+4
They are generally faster (at least not slower) than post-inc, post-dec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177608 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20Add timing of the IR parsing code with a new -time-ir-parsing flagEli Bendersky2-0/+22
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177543 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20Fix AsmPrinter crashes with assertion. Bug 15318 in BugzillaHao Liu1-4/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177472 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[Support][Path][Windows] Fix dangling else. Don't call CloseHandle when ↵Michael J. Spencer1-10/+10
CloseFD is false. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177175 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14Android uses cacheflush(long start, long end, long flags) for MIPS.Akira Hatanaka1-0/+9
Patch by Stephen Hines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177101 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14[Support] Fix lifetime of file descriptors when using MemoryBuffer.Michael J. Spencer4-24/+37
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-12Don't crash if write_impl() leaves less buffer space available than expected.Matt Beaumont-Gay1-1/+6
This was tickled by a Clang diagnostic; Clang test case to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176911 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12[Support][Path] Don't inf loop if creating the parent directory fails.Michael J. Spencer1-1/+7
Patch by Paul Robinson. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176908 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12[Support][MemoryBuffer] Use sys::fs::mapped_file_region instead of ↵Michael J. Spencer1-35/+44
sys::Path::MapInFilePages. This gives us memory mapped file I/O on Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176886 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-09Remove an unused member variable from HelpPrinter. Move another member ↵Craig Topper1-6/+2
variable to be a local variable in the only method that uses it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176778 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08Disable statistics on Release builds and move tests that depend on -stats.Jan Wen Voung1-1/+17
Summary: Statistics are still available in Release+Asserts (any +Asserts builds), and stats can also be turned on with LLVM_ENABLE_STATS. Move some of the FastISel stats that were moved under DEBUG() back out of DEBUG(), since stats are disabled across the board now. Many tests depend on grepping "-stats" output. Move those into a orig_dir/Stats/. so that they can be marked as unsupported when building without statistics. Differential Revision: http://llvm-reviews.chandlerc.com/D486 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176733 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-01In llvm::MemoryBuffer::getFile() remove an unnecessary stat call check.Argyrios Kyrtzidis1-0/+3
The sys::fs::is_directory() check is unnecessary because, if the filename is a directory, the function will fail anyway with the same error code returned. Remove the check to avoid an unnecessary stat call. Someone needs to review on windows and see if the check is necessary there or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176386 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28[PathV2] In llvm::sys::fs::unique_file, make sure it doesn't fall into an ↵Argyrios Kyrtzidis1-1/+7
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-26Add support for autodetection of ADM bdver2.Roman Divacky1-1/+4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176130 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21Previously, parsing capability of the .debug_frame section was addedEli Bendersky1-0/+1
to lib/DebugInfo, with dumping in llvm-dwarfdump. This patch adds initial ability to parse and dump CFA instructions contained in entries. To keep it manageable, the patch omits some more advanced capabilities (accounted in TODOs): * Parsing of instructions with BLOCK arguments (expression lists) * Dumping of actual instruction arguments (currently only names are dumped). This is quite tricky since the dumper has to effectively "interpret" the instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175820 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21Provide a "None" value for convenience when using Optional<T>()David Blaikie1-2/+2
This implementation of NoneType/None does have some holes but I haven't found one that doesn't - open to improvement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175696 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20as the allocator is reset zero out the number of bytes allocated, this was justPedro Artigas1-0/+1
missed before but probably what was intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175687 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Fix accidental concatenation for "outputuntil" in the -debug-buffer-size ↵Erik Verbruggen1-1/+1
option description. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175682 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Rewrite comments.Dan Gohman1-3/+5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175651 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Add comment in Memory.inc explaining r175646.Krzysztof Parzyszek1-0/+7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175650 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20SIGQUIT is a "kill" signal, rather than an "int" signal, in this context.Dan Gohman1-2/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175648 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20On PowerPC, the cache-flush instructions dcbf and icbi are treated asKrzysztof Parzyszek1-0/+4
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-20Move part of APInt implementation from header to cpp file. These methodsJakub Staszak1-0/+40
require call cpp file anyway, so we wouldn't gain anything by keeping them inline. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175579 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19Update a portability kludge to keep it in sync with changes in the codeDan Gohman1-2/+7
which uses it. This is not ideal, but it ought to at least restore the behavior to what it was before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175571 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19Whitelist files and block devices instead of blacklisting fifos andDan Gohman1-3/+4
character devices. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175549 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19Don't trust st_size of a character device. This fixes usingDan Gohman1-3/+3
/dev/stdin as an input when stdin is connected to a tty, for example. No test, because it's difficult to write a reasonably portable test for this. /dev/stdin isn't a character device when stdin is redirected from a file or connected to a pipe. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19Fix initialization-order bug in llvm::Support::TimeValue. TimeValue::now() ↵Alexey Samsonov2-3/+9
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