summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows
Commit message (Collapse)AuthorAgeFilesLines
...
* [Windows] Follow-up r254363, remove return.Davide Italiano2015-12-011-3/+1
| | | | llvm-svn: 254364
* [Windows] Simplify assertion code. NFC.Davide Italiano2015-12-012-8/+3
| | | | llvm-svn: 254363
* Add Windows error code and tidy formatting for system errors.Paul Robinson2015-11-234-11/+15
| | | | | | Differential Revision: http://reviews.llvm.org/D14892 llvm-svn: 253888
* [Support] Tweak path::system_temp_directory() on Windows.Pawel Bylica2015-11-171-16/+15
| | | | | | | | | | | | | | | | | Summary: This patch changes the behavior of path::system_temp_directory() on Windows to be closer to GetTempPath Windows API call. Enforces path separator to be the native one, makes path absolute, etc. GetTempPath is not used directly because of limitations/implementation bugs on Windows 7. Windows specific unit tests are added. Most of them runs in separated process with modified environment variables. This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables). Reviewers: chapuni, rafael, aaron.ballman Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D14231 llvm-svn: 253345
* Report Windows error code in a fatal error after a system call.Paul Robinson2015-11-111-2/+9
| | | | llvm-svn: 252800
* Revert r252366: [Support] Use GetTempDir to get the temporary dir path on ↵Pawel Bylica2015-11-061-10/+37
| | | | | | Windows. llvm-svn: 252367
* [Support] Use GetTempDir to get the temporary dir path on Windows.Pawel Bylica2015-11-061-37/+10
| | | | | | | | | | | | | | | Summary: In general GetTempDir follows the same logic as the replaced code: checks env variables TMP, TEMP, USERPROFILE in order. However, it also perform other checks like making separators native (\), making the path absolute, etc. This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables). Reviewers: chapuni, rafael, aaron.ballman Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D14231 llvm-svn: 252366
* Fix a signed/unsigned mismatch warning; NFC.Aaron Ballman2015-11-051-1/+1
| | | | llvm-svn: 252164
* [Windows] Symbolize with llvm-symbolizer instead of dbghelp in a self-hostReid Kleckner2015-11-051-9/+102
| | | | | | | | | | | | | | | | 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-4/+2
| | | | llvm-svn: 251801
* [Support] Extend sys::path with user_cache_directory function.Pawel Bylica2015-11-021-0/+4
| | | | | | | | | | | | | | | | | | | | 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
* Make a bunch of static arrays const.Craig Topper2015-10-181-4/+6
| | | | llvm-svn: 250642
* Use Windows Vista API to get the user's home directoryPawel Bylica2015-10-161-7/+11
| | | | | | | | | | | | Summary: This patch replaces usage of deprecated SHGetFolderPathW with SHGetKnownFolderPath. The usage of SHGetKnownFolderPath is wrapped to allow queries for other "known" folders in the near future. Reviewers: aaron.ballman, gbedwell Subscribers: chapuni, llvm-commits Differential Revision: http://reviews.llvm.org/D13753 llvm-svn: 250501
* Require Windows API of version 6.1 (Windows 7).Pawel Bylica2015-10-151-3/+3
| | | | llvm-svn: 250413
* Fix rename() sometimes failing if another process uses openFileForRead()Greg Bedwell2015-10-121-10/+28
| | | | | | | | | | | | | | | | | | | On Windows, fs::rename() could fail is another process was reading the file at the same time using fs::openFileForRead(). In most cases the user wouldn't notice as fs::rename() will continue to retry for 2000ms. Typically this is enough for the read to complete and a retry to succeed, but if the disk is being it too hard then the response time might be longer than the retry time and the rename would fail with a permission error. Add FILE_SHARE_DELETE to the sharing flags for CreateFileW() in fs::openFileForRead() and try ReplaceFileW() prior to MoveFileExW() in fs::rename(). Based on an initial patch by Edd Dawson! Differential Revision: http://reviews.llvm.org/D13647 llvm-svn: 250046
* Windows: Fixed sys::findProgramByName to work with files containing dot in ↵George Rimar2015-10-081-2/+9
| | | | | | | | | | | | their name. Problem was in SearchPathW function that does not attach an extension if file already has one. That does not work for executables like ld.lld2 for example which require to have .exe extension but SearchPath thinks that its "lld2". Solution was to add the extension manually. Differential Revision: http://reviews.llvm.org/D13536 llvm-svn: 249696
* Add .exe check to Execute to fix clang-modernize tests broken in r247358Reid Kleckner2015-09-101-0/+8
| | | | llvm-svn: 247361
* ScanDirForExecutable on Windows fails to find executables with the "exe" ↵Reid Kleckner2015-09-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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-1/+2
| | | | llvm-svn: 244268
* Windows/COM.inc: Fix emacs mode in the first line.NAKAMURA Takumi2015-08-051-1/+1
| | | | llvm-svn: 244016
* 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-10/+3
| | | | | | | | | 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
* [Support] Lazy load of dbghlp.dll on WindowsLeny Kholodov2015-07-022-40/+53
| | | | | | | | | | | | | This patch changes linkage with dbghlp.dll for clang from static (at load time) to on demand (at the first use of required functions). Clang uses dbghlp.dll only in minor use-cases. First of all in case of crash and in case of plugin load. The dbghlp.dll library can be absent on system. In this case clang will fail to load. With lazy load of dbghlp.dll clang can work even if dbghlp.dll is not available. Differential Revision: http://reviews.llvm.org/D10737 llvm-svn: 241271
* Don't use std::errc.Rafael Espindola2015-06-131-1/+2
| | | | | | | | | | | | | | | | | | | | | 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
* [Support] Fix a race initializing a static local in MSVCReid Kleckner2015-06-111-1/+9
| | | | | | | | | static local initialization isn't thread safe with MSVC and a race was reported in PR23817. We can't use std::atomic because it's not trivially constructible, so instead do some lame volatile global integer manipulation. llvm-svn: 239566
* Rangify for loop in Cleanup(), NFC.Yaron Keren2015-05-191-2/+2
| | | | llvm-svn: 237695
* Prevent Cleanup() from running more than once.Yaron Keren2015-05-191-0/+3
| | | | llvm-svn: 237694
* Replace windows_error calls with mapWindowsError.Yaron Keren2015-05-042-34/+26
| | | | | | | | After r210687, windows_error does nothing but call mapWindowsError. Other Windows/*.inc files directly call mapWindowsError. This patch updates Path.inc and Process.inc to do the same. llvm-svn: 236409
* Make an RAII com initializer.Zachary Turner2015-04-271-0/+37
| | | | | | | Differential Revision: http://reviews.llvm.org/D9267 Reviewed By: Aaron Ballman, David Majnemer llvm-svn: 235898
* Use the cleaner syntx value initialization to zero initialize POD structs.Yaron Keren2015-04-241-6/+3
| | | | | | Suggestion from David Blaikie! llvm-svn: 235721
* Silence clang warning: missing field 'Dr0' initializer.Yaron Keren2015-04-241-1/+2
| | | | llvm-svn: 235719
* Remove FilesToRemove->push_back(Filename) from sys::DontRemoveFileOnSignal.Yaron Keren2015-04-211-1/+0
| | | | llvm-svn: 235408
* Revert r235177 as the Handle is used to fail GetExitCodeProcess on purpose.Yaron Keren2015-04-171-1/+3
| | | | | | | Avoid double closing of the handle by testing GetLastErr for ERROR_INVALID_HANDLE and not calling CloseHandle(PI.ProcessHandle) then. llvm-svn: 235184
* Eliminate superfluous CloseHandle(PI.ProcessHandle).Yaron Keren2015-04-171-1/+0
| | | | | | | This handle will always be closed few lines later, resulting in an error for the second CloseHandle. llvm-svn: 235177
* Fix lib\support\Windows/TimeValue.inc(48): warning C4189:Yaron Keren2015-04-151-0/+1
| | | | | | 'Error' : local variable is initialized but not referenced. llvm-svn: 234982
* [FS] Report errors from llvm::sys::fs::rename on WindowsReid Kleckner2015-04-101-0/+1
| | | | | | | | | | Previously we would always report success, which is pretty bogus. I'm too lazy to write a test where rename will portably fail on all platforms. I'm just trying to fix breakage introduced by r234597, which happened to tickle this. llvm-svn: 234611
* Add boolean to PrintStackTraceOnErrorSignal to disable crash reporting.Pete Cooper2015-04-071-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Sometimes report_fatal_error is called when there is not a handler function ↵Aaron Ballman2015-03-261-3/+17
| | | | | | used to fail gracefully. In that case, RunInterruptHandlers is called, which attempts to enter a critical section object. Ensure that the critical section is properly initialized so that this code functions properly, and tools like clang-tidy do not crash in Debug builds. llvm-svn: 233282
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-2/+2
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* No need to prototype RtlCaptureContext with mingw-w64.Yaron Keren2015-03-141-2/+3
| | | | llvm-svn: 232269
* Wrap in __MINGW32__ to avoid warnings from msvc.Benjamin Kramer2015-03-111-1/+3
| | | | llvm-svn: 231933
* Add missing namespace specifier for MSVC.Benjamin Kramer2015-03-111-1/+1
| | | | llvm-svn: 231930
* RtlCaptureContext is absent from the mingw32 headers, provide a prototype.Benjamin Kramer2015-03-111-1/+4
| | | | llvm-svn: 231929
* Replace PrintStackTrace(FILE*) with PrintStackTrace(raw_ostream&)Zachary Turner2015-03-051-15/+20
| | | | | | | | | | 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
* Silence -Wmissing-braces warning from clang-clReid Kleckner2015-03-051-1/+1
| | | | | | | | The first element of STACKFRAME64 is a struct and Clang wants us to put braces around it's initialization. Instead, drop the zero. The result should be the same. llvm-svn: 231387
* [Windows] Implement PrintStackTrace(FILE*)Zachary Turner2015-03-051-81/+104
| | | | | | | | | | | | | | | | | | | llvm::sys::PrintBacktrace(FILE*) is supposed to print a backtrace of the current thread given the current PC. This function was unimplemented on Windows, and instead the only time we could print a backtrace was as the result of an exception through LLVMUnhandledExceptionFilter. This patch implements backtracing of self by using RtlCaptureContext to get a CONTEXT for the current thread, and moving the printing and StackWalk64 code to a common method that printing own stack trace and printing stack trace of an exception can use. Differential Revision: http://reviews.llvm.org/D8068 Reviewed by: Reid Kleckner llvm-svn: 231382
* [raw_ostream] When printing color on Windows, use correct bg color.Zachary Turner2015-02-281-0/+13
| | | | | | | | | | | | | | | | | | | When using SetConsoleTextAttribute() to set the foreground or background color, if you don't explicitly set both colors, then a default value of black will be chosen for whichever you don't specify a value for. This is annoying when you have a non default console background color, for example, and you try to set the foreground color. This patch gets the existing fg/bg color and when you set one attribute, sets the opposite attribute to its existing color prior to comitting the update. Reviewed by: Aaron Ballman Differential Revision: http://reviews.llvm.org/D7967 llvm-svn: 230859
* Silence some Win64 clang-cl warnings about unused stuff due to ifdefsReid Kleckner2015-02-261-1/+2
| | | | llvm-svn: 230685
* Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the ↵Aaron Ballman2015-02-151-1/+1
| | | | | | macro. NFC; LLVM edition. llvm-svn: 229335
* [Cygming] Seek also chkstk_ms, or JIT fails with DLL builds. It is fixup for ↵NAKAMURA Takumi2015-01-301-0/+6
| | | | | | r227519. llvm-svn: 227574
OpenPOWER on IntegriCloud