summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
Commit message (Collapse)AuthorAgeFilesLines
...
* [Modules] Add some missing includes to make files compile stand-alone.Benjamin Kramer2014-10-121-0/+3
| | | | llvm-svn: 219592
* Guard the definition of the stack tracing function with the same macrosChandler Carruth2014-10-111-0/+2
| | | | | | | that guard its usage. Without this, we can get unused function warnings when backtraces are disabled. llvm-svn: 219558
* Follow-up to r219534 to make symbolization more robust.Alexey Samsonov2014-10-101-2/+7
| | | | | | | | | | 1) Explicitly provide important arguments to llvm-symbolizer, not relying on defaults. 2) Be more defensive about symbolizer output. This might fix weird failures on ninja-x64-msvc-RA-centos6 buildbot. llvm-svn: 219541
* Re-land r219354: Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.Alexey Samsonov2014-10-101-1/+140
| | | | | | | | | | | | In fact, symbolization is now expected to work only on Linux and FreeBSD/NetBSD, where we have dl_iterate_phdr and can learn the main executable name without argv0 (it will be possible on BSD systems after http://reviews.llvm.org/D5693 lands). #ifdef-out the code for all the rest Unix systems. Reviewed in http://reviews.llvm.org/D5610 llvm-svn: 219534
* Revert r219354. It seems to break some buildbots.Alexey Samsonov2014-10-081-139/+1
| | | | llvm-svn: 219355
* Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.Alexey Samsonov2014-10-081-1/+139
| | | | | | | | | | | | | | | | This change modifies fatal signal handler used in LLVM tools. Now it attempts to find llvm-symbolizer binary and communicates with it in order to turn instruction addresses into function/file/line info entries. This should significantly improve stack traces readability in Debug builds. This feature only works on selected platforms (including Darwin and Linux). If the symbolization fails for some reason, signal handler will fallback to the original behavior. Reviewed in http://reviews.llvm.org/D5610 llvm-svn: 219354
* Unix/Process: Don't use pthread_sigmask if we aren't built with threadsDavid Majnemer2014-10-081-1/+12
| | | | | | | | We won't link in pthreads if we weren't built with LLVM_ENABLE_THREADS which means we won't get access to pthread_sigmask. Use sigprocmask instead. llvm-svn: 219288
* Attempt to calm down buildbotsDavid Majnemer2014-10-071-0/+3
| | | | llvm-svn: 219190
* Support: Don't call close again if we get EINTRDavid Majnemer2014-10-071-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Most Unix-like operating systems guarantee that the file descriptor is closed after a call to close(2), even if close comes back with EINTR. For these systems, calling close _again_ will either do nothing or close some other file descriptor open(2)'d by another thread. (Linux) However, some operating systems do not have this behavior. They require at least another call to close(2) before guaranteeing that the descriptor is closed. (HP-UX) And some operating systems have an unpredictable blend of the two behaviors! (xnu) Avoid this disaster by blocking all signals before we call close(2). This ensures that a signal will not be delivered to the thread and close(2) will not give us back EINTR. We restore the signal mask once the operation is done. N.B. This isn't a problem on Windows, it doesn't have a notion of EINTR because signals always get delivered to dedicated signal handling threads. llvm-svn: 219189
* Support: Add a utility to remap std{in,out,err} to /dev/null if closedDavid Majnemer2014-10-061-0/+59
| | | | | | | | | | | | | | | It's possible to start a program with one (or all) of the standard file descriptors closed. Subsequent open system calls will give the program a low-numbered file descriptor. This is problematic because we may believe we are writing to standard out instead of a file. Introduce Process::FixupStandardFileDescriptors, a helper function to remap standard file descriptors to /dev/null if they were closed before the program started. llvm-svn: 219170
* Adding #ifdef around TermColorMutex based on feedback from Craig Topper.Chris Bieneman2014-09-241-0/+2
| | | | llvm-svn: 218401
* Unix/Host.inc: Remove <cstdlib>. It has been unused for a long time.NAKAMURA Takumi2014-09-241-1/+0
| | | | llvm-svn: 218373
* Unix/Host.inc: Wrap a comment line in 80-col.NAKAMURA Takumi2014-09-241-1/+2
| | | | llvm-svn: 218371
* Unix/Host.inc: Remove leading whitespace. It had been here since r56942!NAKAMURA Takumi2014-09-241-1/+1
| | | | llvm-svn: 218370
* Converting terminalHasColors mutex to a global ManagedStatic to avoid the ↵Chris Bieneman2014-09-221-2/+4
| | | | | | static destructor. llvm-svn: 218283
* Misc cleanups to the FileSytem api.Rafael Espindola2014-09-111-26/+23
| | | | | | | | | | | | | | | | The main difference is the removal of std::error_code exists(const Twine &path, bool &result); It was an horribly redundant interface since a file not existing is also a valid error_code. Now we have an access function that returns just an error_code. This is the only function that has to be implemented for Unix and Windows. The functions can_write, exists and can_execute an now just wrappers. One still has to be very careful using these function to avoid introducing race conditions (Time of check to time of use). llvm-svn: 217625
* Add writeFileWithSystemEncoding to LibLLVMSuppor.Rafael Espindola2014-09-031-0/+18
| | | | | | | | | | | | | | | | | | | | This patch adds to LLVMSupport the capability of writing files with international characters encoded in the current system encoding. This is relevant for Windows, where we can either use UTF16 or the current code page (the legacy Windows international characters). On UNIX, the file is always saved in UTF8. This will be used in a patch for clang to thoroughly support response files creation when calling other tools, addressing PR15171. On Windows, to correctly support internationalization, we need the ability to write response files both in UTF16 or the current code page, depending on the tool we will call. GCC for mingw, for instance, requires files to be encoded in the current code page. MSVC tools requires files to be encoded in UTF16. Patch by Rafael Auler! llvm-svn: 217068
* Cleaning up remaining static initializers in Signals.incChris Bieneman2014-09-021-24/+31
| | | | llvm-svn: 216996
* Cleaning up static initializers in Signals.incChris Bieneman2014-08-291-5/+4
| | | | | | Reviewed by: Chandlerc llvm-svn: 216704
* Cleaning up static initializers in TimeValue.Chris Bieneman2014-08-291-1/+1
| | | | | | Code reviewed by Chandlerc llvm-svn: 216703
* Add an explicit cast to pacify implicit boolean conversion warnings.Benjamin Kramer2014-08-271-1/+1
| | | | llvm-svn: 216539
* Merge TempDir and system_temp_directory.Rafael Espindola2014-08-261-16/+60
| | | | | | | | | We had two functions for finding the temp or cache directory. Each had a different set of smarts about OS specific APIs. With this patch system_temp_directory becomes the only way to do it. llvm-svn: 216460
* Fix bug in llvm::sys::argumentsFitWithinSystemLimits().Rafael Espindola2014-08-251-2/+2
| | | | | | | | | | | | | This patch fixes a subtle bug in the UNIX implementation of llvm::sys::argumentsFitWithinSystemLimits() regarding the misuse of a static variable. This bug causes our cached number that stores the system command line maximum length to be halved after each call to the function. With a sufficient number of calls to this function, it will eventually report any given command line string to be over system limits. Patch by Rafael Auler. llvm-svn: 216415
* Support: add llvm::unique_lockDylan Noblesmith2014-08-231-16/+17
| | | | | | | | | | | | | | | Based on the STL class of the same name, it guards a mutex while also allowing it to be unlocked conditionally before destruction. This eliminates the last naked usages of mutexes in LLVM and clang. It also uncovered and fixed a bug in callExternalFunction() when compiled without USE_LIBFFI, where the mutex would never be unlocked if the end of the function was reached. llvm-svn: 216338
* Support: make LLVM Mutexes STL-compatibleDylan Noblesmith2014-08-231-4/+4
| | | | | | Use lock/unlock() convention instead of acquire/release(). llvm-svn: 216336
* Support/Unix: use ScopedLock wherever possibleDylan Noblesmith2014-08-231-24/+22
| | | | | | | Only one function remains a bit too complicated for a simple mutex guard. No functionality change. llvm-svn: 216335
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* Remove dead code. Fixes pr20544.Rafael Espindola2014-08-081-13/+0
| | | | llvm-svn: 215243
* Build fix for systems without futimes/futimensAlp Toker2014-06-301-1/+1
| | | | | | | | | Some versions of Android don't have futimes/futimens and this code wasn't updated during the recent errc refactoring. Patch by Luqman Aden! llvm-svn: 212055
* lldb can interrupt waitpid, so EINTR shouldn't be an error. This fixes the caseJulien Lerouge2014-06-271-1/+5
| | | | | | | | | | where there is no timeout. In the case where there is a timeout though, the code is still wrong since it doesn't check that the alarm really went off. Without this patch, I cannot debug a program that forks itself using sys::ExecuteAndWait with lldb. llvm-svn: 211918
* Revert: r211588 - [mips] Use __clear_cache builtin instead of cacheflush() ↵Daniel Sanders2014-06-241-2/+10
| | | | | | | | | | | | in Unix Memory::InvalidateInstructionCache() Buildbot reports a test failure on the llvm-mips-linux builder and blames r211588. Although it doesn't appear in the blamelist, it seems it could also be r211587 (because it's committed to compiler-rt?) since they were tested together. Reverting the most likely suspect (r211588) to confirm one way or the other. llvm-svn: 211594
* [mips] Use __clear_cache builtin instead of cacheflush() in Unix ↵Daniel Sanders2014-06-241-10/+2
| | | | | | | | | | Memory::InvalidateInstructionCache() MIPS64 Android bionic has removed cacheflush(). Use __clear_cache() instead for 32-bit and 64-bit MIPS Patch by Duane Sand <Duane.Sand@imgtec.com> llvm-svn: 211588
* Finishing touch for the std::error_code transition.Rafael Espindola2014-06-131-5/+5
| | | | | | | | | | | While std::error_code itself seems to work OK in all platforms, there are few annoying differences with regards to the std::errc enumeration. This patch adds a simple llvm enumeration, which will hopefully avoid build breakages in other platforms and surprises as we get more uses of std::error_code. llvm-svn: 210920
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-134-87/+87
| | | | llvm-svn: 210871
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-123-1/+4
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Don't put generic_category in the llvm namespace.Rafael Espindola2014-06-122-24/+24
| | | | llvm-svn: 210737
* Implement get_magic with generic tools and inline it.Rafael Espindola2014-06-111-31/+0
| | | | llvm-svn: 210716
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-112-40/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea of this patch is to turn llvm/Support/system_error.h into a transitional header that just brings in the erorr_code api to the llvm namespace. I will remove it shortly afterwards. The cases where the general idea needed some tweaking: * std::errc is a namespace in msvc, so we cannot use "using std::errc". I could add an #ifdef, but there were not that many uses, so I just added std:: to them in this patch. * Template specialization had to be moved to the std namespace in this patch set already. * The msvc implementation of default_error_condition doesn't seem to provide the same transformations as we need. Not too surprising since the standard doesn't actually say what "equivalent" means. I fixed the problem by keeping our old mapping and using it at error_code construction time. Despite these shortcomings I think this is still a good thing. Some reasons: * The different implementations of system_error might improve over time. * It removes 925 lines of code from llvm already. * It removes 6313 bytes from the text segment of the clang binary when it is built with gcc and 2816 bytes when building with clang and libstdc++. llvm-svn: 210687
* Uses generic_category instead of system_category.Rafael Espindola2014-06-112-25/+25
| | | | | | | Some c++ libraries (libstdc++ at least) don't seem to map to the generic category in in the system_category's default_error_condition. llvm-svn: 210635
* There is no std::errc::success, remove the llvm one.Rafael Espindola2014-05-311-2/+2
| | | | llvm-svn: 209960
* Turn errc and windows_error into enum classes.Rafael Espindola2014-05-311-5/+5
| | | | llvm-svn: 209957
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-313-27/+27
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209952
* delete dead code.Rafael Espindola2014-05-311-29/+0
| | | | llvm-svn: 209938
* [C++] Use 'nullptr'.Craig Topper2014-04-286-46/+47
| | | | llvm-svn: 207394
* Teach the pass manager's execution dump to print the current time beforeChandler Carruth2014-04-271-3/+5
| | | | | | | | | | | | | | | each line. This is particularly nice for tracking which run of a particular pass over a particular function was slow. This also required making the TimeValue string much more useful. First, there is a standard format for writing out a date and time. Let's use that rather than strings that would have to be parsed. Second, actually output the nanosecond resolution that timevalue claims to have. This is proving useful working on PR19499, so I figured it would be generally useful to commit. llvm-svn: 207385
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-121-2/+2
| | | | | | While there make array_lengthof constexpr if we have support for it. llvm-svn: 206112
* Support: normalize the default triple on UnixSaleem Abdulrasool2014-03-301-1/+1
| | | | | | | | | | This will fix cross-compiling buildbots (e.g. cygwin). This is in the same vein as SVN r205070. Apply this to fix the cross-compiling scenario, even though the preferred solution is to update the build system to normalize the embedded triple rather than perform this at runtime every time. This is meant to tide us over until that approach is fleshed out and applied. llvm-svn: 205120
* ARM64: initial backend importTim Northover2014-03-291-7/+8
| | | | | | | | | | | | This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. llvm-svn: 205090
* [Support] Make sure sys::fs::remove can remove symbolic links and make sure ↵Argyrios Kyrtzidis2014-03-211-2/+2
| | | | | | LockFileManager can handle a symbolic link that points nowhere. llvm-svn: 204422
* support: add a utility function to normalise path separatorsSaleem Abdulrasool2014-03-111-0/+13
| | | | | | | | Add a utility function to convert the Windows path separator to Unix style path separators. This is used by a subsequent change in clang to enable the use of Windows SDK headers on Linux. llvm-svn: 203611
OpenPOWER on IntegriCloud