summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Cleanup the interface for creating soft or hard links.Rafael Espindola2014-03-111-2/+4
| | | | | | | | | | | | Before this patch the unix code for creating hardlinks was unused. The code for creating symbolic links was implemented in lib/Support/LockFileManager.cpp and the code for creating hard links in lib/Support/*/Path.inc. The only use we have for these is in LockFileManager.cpp and it can use both soft and hard links. Just have a create_link function that creates one or the other depending on the platform. llvm-svn: 203596
* Revert create_symbolic_link and both depending changesReid Kleckner2014-03-061-13/+0
| | | | | | | | | | This reverts commits r203136, r203137, and r203138. This code doesn't build on Windows. Even on Vista+, Windows requires elevated privileges to create a symlink. Therefore we can't use symlinks in the compiler. We'll have to find another approach. llvm-svn: 203143
* [Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().Argyrios Kyrtzidis2014-03-061-0/+13
| | | | llvm-svn: 203136
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-1/+1
| | | | | | The old implementation is no longer needed in C++11. llvm-svn: 202644
* [C++11] Remove the R-value reference #if usage from the ADT and SupportChandler Carruth2014-03-011-2/+0
| | | | | | libraries. It is now always 1 in LLVM builds. llvm-svn: 202580
* Fix RWMutex to be thread-safe when pthread_rwlock is not availableMark Seaborn2014-03-011-6/+14
| | | | | | | | | | | | | | lib/Support/RWMutex.cpp contains an implementation of RWMutex that uses pthread_rwlock, but when pthread_rwlock is not available (such as under NaCl, when using newlib), it silently falls back to using the no-op definition in lib/Support/Unix/RWMutex.inc, which is not thread-safe. Fix this case to be thread-safe by using a normal mutex. Differential Revision: http://llvm-reviews.chandlerc.com/D2892 llvm-svn: 202570
* Share a createUniqueEntity implementation between unix and windows.Rafael Espindola2014-02-241-71/+6
| | | | | | | The only extra bit of functionality that had to be exposed for this be be implemented in Path.cpp is opening a file in rw mode. llvm-svn: 202005
* Delete dead code.Rafael Espindola2014-02-241-5/+0
| | | | llvm-svn: 202001
* Use static instead of an anonymous namespace.Rafael Espindola2014-02-231-14/+12
| | | | llvm-svn: 201983
* Simplify remove, create_directory and create_directories.Rafael Espindola2014-02-231-17/+11
| | | | | | | | | | | | | | | Before this patch they would take an boolean argument to say if the path already existed. This was redundant with the returned error_code which is able to represent that. This allowed for callers to incorrectly check only the existed flag instead of first checking the error code. Instead, pass in a boolean flag to say if the previous (non-)existence should be an error or not. Callers of the of the old simple versions are not affected. They still ignore the previous (non-)existence as they did before. llvm-svn: 201979
* Remove dead code.Rafael Espindola2014-02-131-13/+0
| | | | llvm-svn: 201327
* Remove TimeValue::toPosixTime() -- it is buggy, semantics are unclear, and itsDmitri Gribenko2014-02-111-2/+2
| | | | | | only current user should be using toEpochTime() instead. llvm-svn: 201136
* Using the helper API for random number generation.Aaron Ballman2014-02-111-1/+0
| | | | llvm-svn: 201125
* Fix configure to find arc4random via header files.Todd Fiala2014-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISSUE: On Ubuntu 12.04 LTS, arc4random is provided by libbsd.so, which is a transitive dependency of libedit. If a system had libedit on it that was implemented in terms of libbsd.so, then the arc4random test, previously implemented as a linker test, would succeed with -ledit. However, on Ubuntu this would also require a #include <bsd/stdlib.h>. This caused a build breakage on configure-based Ubuntu 12.04 with libedit installed. FIX: This fix changes configure to test for arc4random by searching for it in the standard header files. On Ubuntu 12.04, this test now properly fails to find arc4random as it is not defined in the default header locations. It also tweaks the #define names to match the output of the header check command, which is slightly different than the linker function check #defines. I tested the following scenarios: (1) Ubuntu 12.04 without the libedit package [did not find arc4random, as expected] (2) Ubuntu 12.04 with libedit package [properly did not find arc4random, as expected] (3) Ubuntu 12.04 with most recent libedit, custom built, and not dependent on libbsd.so [properly did not find arc4random, as expected]. (4) FreeBSD 10.0B1 [properly found arc4random, as expected] llvm-svn: 200819
* Introduce llvm::sys::path::home_directory.Peter Collingbourne2014-01-311-0/+15
| | | | | | | | | This will be used by the line editor library to derive a default path to the history file. Differential Revision: http://llvm-reviews.chandlerc.com/D2199 llvm-svn: 200594
* Fix the "#ifndef HAVE_SYS_WAIT_H" code path in Program.inc to compileMark Seaborn2014-01-271-0/+1
| | | | | | Without this fix, WaitResult is not defined. llvm-svn: 200259
* Make sys::ThreadLocal<> zero-initialized on non-thread builds (PR18205)Hans Wennborg2013-12-191-1/+1
| | | | | | | | | | | | | According to the docs, ThreadLocal<>::get() should return NULL if no object has been set. This patch makes that the case also for non-thread builds and adds a very basic unit test to check it. (This was causing PR18205 because PrettyStackTraceHead didn't get zero- initialized and we'd crash trying to read past the end of that list. We didn't notice this so much on Linux since we'd crash after printing all the entries, but on Mac we print into a SmallString, and would crash before printing that.) llvm-svn: 197718
* Build fix for Android NDK which has neither futimes nor futimensAlp Toker2013-12-111-3/+6
| | | | | | Based on a patch by Neil Henning! llvm-svn: 197045
* Improve the detection of the pathSylvestre Ledru2013-12-091-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: When clang is used under GNU/Linux in a chroot without /proc mount, it falls back on the BSD method. However, since the buf variable is used twice and fails with snprintf to produce the correct path. When called as relatived (ie ./clang), it was failing with: "" -cc1 [...] -x c++ x.cc error: unable to execute command: Executable "" doesn't exist! I also took the opportunity to simply the code (the first arg of test_dir was useless). Reviewers: rafael Reviewed By: rafael CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2361 llvm-svn: 196791
* Correct word hyphenationsAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities and contractions in nearby lines. llvm-svn: 196471
* Rules adjustments in order to build on DragonFly BSD.Rafael Espindola2013-10-311-2/+3
| | | | | | Patch by Robin Hahling. llvm-svn: 193750
* Fix build on Solaris 11.Rafael Espindola2013-10-082-0/+7
| | | | | | | | | | | | | Patch by Vladimir Voskresensky. The erros were: Path.inc:274:3: error: ‘Dl_info’ was not declared in this scope ... and usr/include/spawn.h:52:14: error: expected ‘,’ or ‘...’ before ‘argv’ llvm-svn: 192185
* Revert "Revert "Windows: Add support for unicode command lines""David Majnemer2013-10-071-0/+8
| | | | | | | This reverts commit r192070 which reverted r192069, I forgot to regenerate the configure scripts. llvm-svn: 192079
* Revert "Windows: Add support for unicode command lines"David Majnemer2013-10-061-8/+0
| | | | | | | This is causing MinGW bots to fail. This reverts commit r192069. llvm-svn: 192070
* Windows: Add support for unicode command linesDavid Majnemer2013-10-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MSVCRT deliberately sends main() code-page specific characters. This isn't too useful to LLVM as we end up converting the arguments to UTF-16 and subsequently attempt to use the result as, for example, a file name. Instead, we need to have the ability to access the Unicode command line and transform it to UTF-8. This has the distinct advantage over using the MSVC-specific wmain() function as our entry point because: - It doesn't work on cygwin. - It only work on MinGW with caveats and only then on certain versions. - We get to keep our entry point as main(). :) N.B. This patch includes fixes to other parts of lib/Support/Windows s.t. we would be able to take advantage of getting the Unicode paths. E.G. clang spawning clang -cc1 would want to give it Unicode arguments. Reviewers: aaron.ballman, Bigcheese, rnk, ruiu Reviewed By: rnk CC: llvm-commits, ygao Differential Revision: http://llvm-reviews.chandlerc.com/D1834 llvm-svn: 192069
* Add non-blocking Wait() for launched processesTareq A. Siraj2013-10-011-54/+70
| | | | | | | | | | | | | | | | | - New ProcessInfo class to encapsulate information about child processes. - Generalized the Wait() to support non-blocking wait on child processes. - ExecuteNoWait() now returns a ProcessInfo object with information about the launched child. Users will be able to use this object to perform non-blocking wait. - ExecuteNoWait() now accepts an ExecutionFailed param that tells if execution failed or not. These changes will allow users to implement basic process parallel tools. Differential Revision: http://llvm-reviews.chandlerc.com/D1728 llvm-svn: 191763
OpenPOWER on IntegriCloud