summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
Commit message (Collapse)AuthorAgeFilesLines
...
* [Windows] Symbolize with llvm-symbolizer instead of dbghelp in a self-hostReid Kleckner2015-11-051-87/+2
| | | | | | | | | | | | | | | | Summary: llvm-symbolizer understands both PDBs and DWARF, so it is more likely to succeed at symbolization. If llvm-symbolizer is unavailable, we will fall back to dbghelp. This also makes our crash traces more similar between Windows and Linux. Reviewers: Bigcheese, zturner, chapuni Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12884 llvm-svn: 252118
* Use static instead of anonymous namespace for helper functions. NFC.Pawel Bylica2015-11-021-5/+2
| | | | llvm-svn: 251801
* [Support] Extend sys::path with user_cache_directory function.Pawel Bylica2015-11-021-21/+53
| | | | | | | | | | | | | | | | | | | | Summary: The new function sys::path::user_cache_directory tries to discover a directory suitable for cache storage for current system user. On Windows and Darwin it returns a path to system-specific user cache directory. On Linux it follows XDG Base Directory Specification, what is: - use non-empty $XDG_CACHE_HOME env var, - use $HOME/.cache. Reviewers: chapuni, aaron.ballman, rafael Subscribers: rafael, aaron.ballman, llvm-commits Differential Revision: http://reviews.llvm.org/D13801 llvm-svn: 251784
* Fix Clang-tidy modernize-use-nullptr warnings in source directories and ↵Hans Wennborg2015-10-061-20/+20
| | | | | | | | | | generated files; other minor cleanups. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13321 llvm-svn: 249482
* Untabify.NAKAMURA Takumi2015-09-221-3/+2
| | | | llvm-svn: 248264
* ScanDirForExecutable on Windows fails to find executables with the "exe" ↵Reid Kleckner2015-09-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | extension in name When the driver tries to locate a program by its name, e.g. a linker, it scans the paths provided by the toolchain using the ScanDirForExecutable function. If the lookup fails, the driver uses llvm::sys::findProgramByName. Unlike llvm::sys::findProgramByName, ScanDirForExecutable is not aware of file extensions. If the program has the "exe" extension in its name, which is very common on Windows, ScanDirForExecutable won't find it under the toolchain-provided paths. This patch changes the Windows version of the "`can_execute`" function called by ScanDirForExecutable to respect file extensions, similarly to llvm::sys::findProgramByName. Patch by Oleg Ranevskyy Reviewers: rnk Differential Revision: http://reviews.llvm.org/D12711 llvm-svn: 247358
* Thread premissions through sys::fs::create_director{y|ies}Frederic Riss2015-08-061-2/+3
| | | | llvm-svn: 244268
* Remove the configure and cmake checks for sys/wait.hJustin Bogner2015-08-042-19/+1
| | | | | | | | | | If we don't have sys/wait.h and we're on a unix system there's no way that several of the llvm tools work at all. This includes clang. Just remove the configure and cmake checks entirely - we'll get a build error instead of building something broken now. llvm-svn: 243957
* Remove unnecessary in C++11 c_str() callsYaron Keren2015-07-231-18/+1
| | | | | | | | While theoratically required in pre-C++11 to avoid re-allocation upon call, C++11 guarantees that c_str() returns a pointer to the internal array so pre-calling c_str() is no longer required. llvm-svn: 242983
* Rename RunCallBacksToRun to llvm::sys::RunSignalHandlersYaron Keren2015-07-221-1/+1
| | | | | | | | | | | | And expose it in Signals.h, allowing clients to call it directly, possibly LLVMErrorHandler which currently calls RunInterruptHandlers but not RunSignalHandlers, thus for example not printing the stack backtrace on Unixish OSes. On Windows it does happen because RunInterruptHandlers ends up calling the callbacks as well via Cleanup(). This difference in behaviour and code structures in */Signals.inc should be patched in the future. llvm-svn: 242936
* De-duplicate Unix & Windows CallBacksToRunYaron Keren2015-07-221-9/+1
| | | | | | | | | Move CallBacksToRun into the common Signals.cpp, create RunCallBacksToRun() and use these in both Unix/Signals.inc and Windows/Signals.inc. Lots of potential code to be merged here. llvm-svn: 242925
* Remove C++98 workaround in llvm::sys::DontRemoveFileOnSignal()Yaron Keren2015-07-221-7/+0
| | | | llvm-svn: 242920
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-235-7/+7
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-195-7/+7
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* Don't use std::errc.Rafael Espindola2015-06-131-2/+3
| | | | | | | | | | | | | | | | | | | | | As noted on Errc.h: // * std::errc is just marked with is_error_condition_enum. This means that // common patters like AnErrorCode == errc::no_such_file_or_directory take // 4 virtual calls instead of two comparisons. And on some libstdc++ those virtual functions conclude that ------------------------ int main() { std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory); return foo == std::errc::no_such_file_or_directory; } ------------------------- should exit with 0. llvm-svn: 239683
* Use auto instead of the long type name. NFC.Steven Wu2015-05-071-2/+1
| | | | llvm-svn: 236768
* Fix another hang caused by ManagedStatic in SignalHandlerSteven Wu2015-05-071-4/+11
| | | | | | | | | Fix two other variables that might cause the same hang fixed in r235914. The hang is caused by constructing ManagedStatic in signalhandler. In this case, if FileToRemove or CallBacksToRun is not contructed, it means there is no work to do. llvm-svn: 236741
* Fixes a hang that can occur if a signal comes in during malloc calls.Chris Bieneman2015-04-271-0/+6
| | | | | | We need to dereference the signals mutex during handler registration so that we force its construction. This is to prevent the first use being during handling an actual signal because you can't safely allocate memory in a signal handler. llvm-svn: 235914
* Fix build broken by incorrect class name.Zachary Turner2015-04-271-3/+3
| | | | llvm-svn: 235901
* Make an RAII com initializer.Zachary Turner2015-04-271-0/+27
| | | | | | | Differential Revision: http://reviews.llvm.org/D9267 Reviewed By: Aaron Ballman, David Majnemer llvm-svn: 235898
* Add boolean to PrintStackTraceOnErrorSignal to disable crash reporting.Pete Cooper2015-04-071-2/+2
| | | | | | | | | | | | | | | | | | | The current crash reporting on Mac OS is only disabled via an environment variable. This adds a boolean (default false) which can also disable crash reporting. The only client right now is the unittests which don't ever want crash reporting, but do want to detect killed programs. Reduces the time to run the APFloat unittests on my machine from [----------] 47 tests from APFloatTest (51250 ms total) to [----------] 47 tests from APFloatTest (765 ms total) Reviewed by Reid Kleckner and Justin Bogner llvm-svn: 234353
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-1/+2
| | | | | | NFC. llvm-svn: 232976
* Replace PrintStackTrace(FILE*) with PrintStackTrace(raw_ostream&)Zachary Turner2015-03-051-21/+23
| | | | | | | | | | This will be followed by a change on the clang side to update the only user of this function with the new version. Differential Revision: http://reviews.llvm.org/D8074 Reviewed By: Reid Kleckner llvm-svn: 231392
* Small cleanup. Don't use else when not needed.Davide Italiano2015-02-211-4/+2
| | | | | | Pointed out by David Majnemer. llvm-svn: 230122
* Checking if TARGET_OS_IPHONE is defined isn't good enough for 10.7 and earlier.Chris Bieneman2015-02-191-2/+10
| | | | | | | | Older versions of the TargetConditionals header always defined TARGET_OS_IPHONE to something (0 or 1), so we need to test not only for the existence but also if it is 1. This resolves PR22631. llvm-svn: 229904
* [Support/Timer] Make GetMallocUsage() aware of jemalloc.Davide Italiano2015-02-191-0/+10
| | | | | | | Differential Revision: D7657 Reviewed by: shankarke, majnemer llvm-svn: 229824
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-2/+2
| | | | | | requiring the macro. NFC; LLVM edition. llvm-svn: 229340
* Triple: refactor redundant code.Tim Northover2015-02-121-19/+5
| | | | | | | | | | Should be no functional change, since most of the logic removed was completely pointless (after some previous refactoring) and the rest duplicated elsewhere. Patch by Kamil Rytarowski. llvm-svn: 228926
* iOS doesn't have crt_externs.h available, so we fall back to the posix method.Chris Bieneman2015-01-301-2/+5
| | | | llvm-svn: 227521
* [Support][Windows] Unify dialog box suppression and print stack traces on abort.Michael J. Spencer2015-01-291-0/+2
| | | | llvm-svn: 227470
* [mips] Use __clear_cache builtin instead of cacheflush()Petar Jovanovic2015-01-271-13/+2
| | | | | | | | | Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache(). Differential Revision: http://reviews.llvm.org/D7198 llvm-svn: 227269
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-3/+3
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Remove unnecessary StringRef->std::string conversion.Alexey Samsonov2014-12-291-1/+1
| | | | llvm-svn: 224953
* ThreadLocal: Move Unix-specific code out of Support/ThreadLocal.cppDavid Majnemer2014-12-151-0/+43
| | | | | | Just a cleanup, no functionality change is intended. llvm-svn: 224227
* ThreadLocal: Return a mutable pointer if templated with a non-const typeDavid Majnemer2014-12-151-1/+1
| | | | | | | It makes more sense for ThreadLocal<const T>::get to return a const T* and ThreadLocal<T>::get to return a T*. llvm-svn: 224225
* MAP_FILE is the default. We don't need to add it.Rafael Espindola2014-12-121-3/+0
| | | | llvm-svn: 224144
* Move the resize file feature from mapped_file_region to the only user.Rafael Espindola2014-12-121-13/+1
| | | | | | This removes a duplicated stat on every file that llvm-ar looks at. llvm-svn: 224138
* Pass a FD to resise_file and add a testcase.Rafael Espindola2014-12-121-5/+2
| | | | | | I will add a real use in another commit. llvm-svn: 224136
* Remove a convoluted way of calling close by moving the call to the only caller.Rafael Espindola2014-12-111-46/+6
| | | | | | As a bonus we can actually check the return value. llvm-svn: 224046
* Remove dead code. NFC.Rafael Espindola2014-12-111-33/+0
| | | | llvm-svn: 224029
* Remove dead code. NFC.Rafael Espindola2014-12-043-34/+6
| | | | | | This interface was added 2 years ago but users never developed. llvm-svn: 223368
* Fix several bugs in r221220's new program finding code.Chandler Carruth2014-12-021-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | In both the Unix and Windows variants, std::getenv was called and the result passed directly to a function accepting a StringRef. This isn't OK because it might return a null pointer and that causes the StringRef constructor to assert (and generally produces crash-prone code if asserts are disabled). Fix this by independently testing the result as non-null prior to splitting things. This in turn uncovered another bug in the Unix variant where it would infinitely recurse if PATH="", or after this fix if PATH isn't set. There is no need to recurse at all. Slightly re-arrange the code to make it clear that we can just fixup the Paths argument based on the environment if we find anything. I don't know of a particularly useful way to test these routines in LLVM. I'll commit a test to Clang that ensures that its driver correctly handles various settings of PATH. However, I have no idea how to correctly write a Windows test for the PATHEXT change. Any Windows developers who could provide such a test, please have at. =D Many thanks to Nick Lewycky and others for helping debug this. =/ It was quite nasty for us to track down. llvm-svn: 223099
* Revert 220932.Jiangning Liu2014-11-051-5/+0
| | | | | | | | | Commit 220932 caused crash when building clang-tblgen on aarch64 debian target, so it's blocking all daily tests. The std::call_once implementation in pthread has bug for aarch64 debian. llvm-svn: 221331
* Remove FindProgramByName. NFC.Rafael Espindola2014-11-042-48/+4
| | | | llvm-svn: 221258
* [Support][Program] Add findProgramByName(Name, OptionalPaths)Michael J. Spencer2014-11-041-0/+28
| | | | llvm-svn: 221220
* Update the non-pthreads fallback for RWMutex on UnixDavid Blaikie2014-10-311-6/+6
| | | | | | | | | | Tested this by #if 0'ing out the pthreads implementation, which indicated that this fallback was not currently compiling successfully and applying this patch resolves that. Patch by Andy Chien. llvm-svn: 220969
* Removing the static initializer in ManagedStatic.cpp by using llvm_call_once ↵Chris Bieneman2014-10-301-0/+5
| | | | | | | | | | | | | | | | | | | to initialize the ManagedStatic mutex. Summary: This patch adds an llvm_call_once which is a wrapper around std::call_once on platforms where it is available and devoid of bugs. The patch also migrates the ManagedStatic mutex to be allocated using llvm_call_once. These changes are philosophically equivalent to the changes added in r219638, which were reverted due to a hang on Win32 which was the result of a bug in the Windows implementation of std::call_once. Reviewers: aaron.ballman, chapuni, chandlerc, rnk Reviewed By: rnk Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D5922 llvm-svn: 220932
* Fix bug where sys::Wait could wait on wrong pid.Rafael Espindola2014-10-271-1/+0
| | | | | | | | Setting ChildPid to -1 would cause waitpid to wait for any child process. Patch by Daniel Reynaud! llvm-svn: 220717
* Strength reduce constant-sized vectors into arrays. No functionality change.Benjamin Kramer2014-10-221-8/+6
| | | | llvm-svn: 220412
* Unix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding ↵NAKAMURA Takumi2014-10-131-2/+3
| | | | | | to (defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)). [-Wunused-function] llvm-svn: 219596
OpenPOWER on IntegriCloud