summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix initialization order warning in mingw32 buildAlp Toker2013-10-181-1/+1
| | | | | | No change in functionality. llvm-svn: 192953
* Windows: Fix a typo in an assertDavid Majnemer2013-10-141-6/+3
| | | | llvm-svn: 192564
* Windows: Don't bother with pinning Kernel32.dllDavid Majnemer2013-10-141-3/+1
| | | | | | We don't delay load it so it shouldn't be going anywhere. llvm-svn: 192561
* Windows: Use GetModuleHandleEx instead of LoadLibraryDavid Majnemer2013-10-131-2/+2
| | | | | | | | | | | | | | | | | | | We were using an anti-pattern of: - LoadLibrary - GetProcAddress - FreeLibrary This is problematic because of several reasons: - We are holding on to pointers into a library we just unloaded. - Calling LoadLibrary results in an increase in the reference count of the library in question and any libraries that it depends on and so-on and so-forth. This is none too quick. Instead, use GetModuleHandleEx with GET_MODULE_HANDLE_EX_FLAG_PIN. This is done because because we didn't bring the reference for the library into existence and therefor shouldn't count on it being around later. llvm-svn: 192550
* Add missing #include's to cctype when using isdigit/alpha/etc.Will Dietz2013-10-121-0/+1
| | | | llvm-svn: 192519
* Windows: Avoiding resizing, use uninitialized data() insteadDavid Majnemer2013-10-071-4/+5
| | | | | | This is ever-so faster but more importantly matches what we have elsewhere. llvm-svn: 192137
* Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is ↵NAKAMURA Takumi2013-10-071-1/+1
| | | | | | zero. llvm-svn: 192103
* Windows: Be more explicit with Win32 APIsDavid Majnemer2013-10-074-15/+33
| | | | | | | | | | | | This addresses several issues in a similar vein: - Use the Unicode APIs when possible, running nm on clang shows that we only use Unicode APIs except for FormatMessage, CreateSemaphore, and GetModuleHandle. AFAICT, the latter two are coming from MinGW and not LLVM itself. - Make getMainExecutable more resilient. It previously considered return values of zero from ::GetModuleFileNameA to be acceptable. llvm-svn: 192096
* Revert "Revert "Windows: Add support for unicode command lines""David Majnemer2013-10-076-82/+147
| | | | | | | 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-066-148/+83
| | | | | | | This is causing MinGW bots to fail. This reverts commit r192069. llvm-svn: 192070
* Windows: Add support for unicode command linesDavid Majnemer2013-10-066-83/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-61/+52
| | | | | | | | | | | | | | | | | - 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
* Make DynamicLibrary use ManagedStatic. This is pretty simple and should just ↵Filip Pizlo2013-09-181-3/+3
| | | | | | | | | | work as advertised - but it does have the caveat that calls to DynamicLibrary::AddSymbol will "reset" if you shutdown llvm and try to come back for seconds. This is a subtle behavior change, but I'm assuming that nobody is affected by it. llvm-svn: 190946
* Support ANSI escape code on WindowsNico Rieck2013-09-111-1/+13
| | | | | | | | In some cases (e.g. when a build system pipes stderr) the Windows console API cannot be used to color output. For these, provide a way to switch to ANSI escape codes. This is required for Clang's -fansi-escape-codes option. llvm-svn: 190460
* Add getenv() wrapper that works on multibyte environment variable.Rui Ueyama2013-09-103-56/+104
| | | | | | | | | | | | | | | | | | On Windows, character encoding of multibyte environment variable varies depending on settings. The only reliable way to handle it I think is to use GetEnvironmentVariableW(). GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16 string. That's not ideal because we use UTF-8 as the internal encoding in LLVM. This patch defines a wrapper function which takes and returns UTF-8 string for GetEnvironmentVariableW(). The wrapper function does not do any conversion and just forwards the argument to getenv() on Unix. Differential Revision: http://llvm-reviews.chandlerc.com/D1612 llvm-svn: 190423
* Support/Process: Add comments about PageSize and AllocationGranularity on ↵NAKAMURA Takumi2013-09-041-0/+2
| | | | | | Cygwin and Win32. llvm-svn: 189940
* [Win32] mapped_file_region: Fix a bug in CreateFileMapping() that Size must ↵NAKAMURA Takumi2013-08-221-2/+2
| | | | | | contain Offset when Offset >= 65536. llvm-svn: 189021
* Whitespace.NAKAMURA Takumi2013-08-221-3/+3
| | | | llvm-svn: 189020
* Switching to using a helper function instead of manually converting the ↵Aaron Ballman2013-08-161-24/+1
| | | | | | string to UTF-8. llvm-svn: 188566
* Removing unused functionality.Aaron Ballman2013-08-161-10/+0
| | | | llvm-svn: 188565
* Updating function comments; no functional changes intended.Aaron Ballman2013-08-161-5/+12
| | | | llvm-svn: 188554
* On Windows, autolink advapi32 from Path.inc for CryptAcquireContextWReid Kleckner2013-08-071-0/+4
| | | | | | | | | | | This allows llvm-tblgen to link successfully when compiling with clang. Both MSBuild and CMake will automatically add advapi32 as part of a set of other dlls comprising the win32 API to the link line, but CMake doesn't do that when compiling with clang. Until someone adds that info to cmake upstream, this seems like a reasonable work around. llvm-svn: 187907
* Avoid using alloca in Windows/Program.incReid Kleckner2013-08-071-13/+15
| | | | | | | One use needs to copy the alloca into a std::string, and the other use is before calling CreateProcess, which is very heavyweight anyway. llvm-svn: 187845
* Fix windows' implementation of status when a file doesn't exist.Rafael Espindola2013-07-311-6/+11
| | | | | | | | | The unix one was returning no_such_file_or_directory, but the windows one was return success. Update the one one caller that was depending on the old behavior. llvm-svn: 187463
* Implement getUniqueID for directories on windows.Rafael Espindola2013-07-301-18/+14
| | | | llvm-svn: 187441
* Remove dead code.Rafael Espindola2013-07-301-3/+0
| | | | llvm-svn: 187439
* Make file_status::getUniqueID const.Rafael Espindola2013-07-291-1/+1
| | | | llvm-svn: 187383
* Include st_dev to make the result of getUniqueID actually unique.Rafael Espindola2013-07-291-19/+8
| | | | | | This will let us use getUniqueID instead of st_dev directly on clang. llvm-svn: 187378
* Improve our error handling on windows.Rafael Espindola2013-07-261-38/+1
| | | | | | | | | | | | | | * Remove LLVM_ENABLE_CRT_REPORT. LLVM_DISABLE_CRASH_REPORT made it redundant. * set Return to 1, so that we get a stack trace on failure. * don't call _exit, so that we get a negative exit value and "not --crash" correctly differentiates crashes and regular errors. This is a bit experimental since the documentation on this interface is sparse. It doesn't bring up a dialog on my windows setup, but feel free to revert if it causes problem for your setup (and let me know what it is so that I can try to fix this patch). llvm-svn: 187206
* Initialize TempFileHandle.Serge Pavlov2013-07-191-1/+1
| | | | llvm-svn: 186684
* Split openFileForWrite into windows and unix versions.Rafael Espindola2013-07-191-0/+54
| | | | | | It is similar to 186511, but for creating files for writing. llvm-svn: 186679
* Small improvement to the use of GetFileType:Rafael Espindola2013-07-181-1/+8
| | | | | | | | | * assert that the return value is one of the documented values on msdn. * on FILE_TYPE_UNKNOWN, check GetLastError. Unfortunately I can't think of a way to get a FILE_TYPE_UNKNOWN on a test. llvm-svn: 186595
* Windows/Path.inc: Introduce file_type::character_file and ↵NAKAMURA Takumi2013-07-181-0/+13
| | | | | | | | | file_type::fifo_file in sys::fs::getStatus(HANDLE). It fixes llvm/test/Other/close-stderr.ll on msys. FIXME: Provide unittests. llvm-svn: 186588
* Remove dead code.Rafael Espindola2013-07-181-23/+0
| | | | llvm-svn: 186561
* Fix a funny typo. Thanks to Aaron Ballman for noticing.Rafael Espindola2013-07-171-1/+1
| | | | llvm-svn: 186532
* Add FILE_SHARE_WRITE to openFileForRead.Rafael Espindola2013-07-171-1/+1
| | | | | | | | | | | | | | This should fix the windows bots. It looks like the failing tests are of the form prog1 > file prog2 file and prog2 fails trying to read the file. The best fix would probably be to close stdout/stderr in prog1, but it was not the intention of 186511 to change this, so just restore the old behavior for now. llvm-svn: 186530
* Split openFileForRead into Windows and Unix versions.Rafael Espindola2013-07-171-0/+31
| | | | | | | | | | | This has some advantages: * Lets us use native, utf16 windows functions. * Easy to produce good errors on windows about trying to use a directory when we want a file. * Simplifies the unix version a bit. llvm-svn: 186511
* [Support] Fix some warnings when self-hosting clang on WindowsReid Kleckner2013-07-161-2/+0
| | | | llvm-svn: 186413
* Add a version of sys::fs::status that uses fstat.Rafael Espindola2013-07-161-22/+38
| | | | llvm-svn: 186378
* Instead friending status, provide windows and posix constructors to file_status.Rafael Espindola2013-07-161-9/+6
| | | | | | | This opens the way of having static helpers in the .inc files that can construct a file_status. llvm-svn: 186376
* Add include to hopefully fix windows build.Craig Topper2013-07-151-0/+1
| | | | llvm-svn: 186310
* Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).Craig Topper2013-07-151-1/+1
| | | | llvm-svn: 186301
* Windows/TimeValue.inc: Mute prefixed '0' on %d to emulate %e.NAKAMURA Takumi2013-07-121-0/+5
| | | | | | It fixes compatibility in llvm/test/Object/archive-toc.test. llvm-svn: 186142
* Add back code for supporting old mingw versions. Should bring the bots back.Rafael Espindola2013-07-111-3/+13
| | | | llvm-svn: 186096
* Looks like some versions of mingw don't have errno_t. Use int.Rafael Espindola2013-07-111-1/+1
| | | | llvm-svn: 186092
* Fix a FIXME about the format and add a test.Rafael Espindola2013-07-111-14/+9
| | | | | | | While at it, use strftime on Unix too and use the thread safe versions of localtime. llvm-svn: 186090
* Use status to implement file_size.Rafael Espindola2013-07-101-21/+0
| | | | | | | | | | The status function is already using a syscall that returns the file size. Remember it and implement file_size as a simple wrapper. No functionally change, but clients that already use status now can avoid calling file_size. llvm-svn: 186016
* We now always create files with the correct permissions. Simplify the interface.Rafael Espindola2013-07-081-34/+0
| | | | llvm-svn: 185834
* Improvements to unique_file and createUniqueDirectory.Rafael Espindola2013-06-281-135/+134
| | | | | | | | | | | | | | | | | | | * Don't try to create parent directories in unique_file. It had two problem: * It violates the contract that it is atomic. If the directory creation success and the file creation fails, we would return an error but the file system was modified. * When creating a temporary file clang would have to first check if the parent directory existed or not to avoid creating one when it was not supposed to. * More efficient implementations of createUniqueDirectory and the unique_file that produces only the file name. Now all 3 just call into a static function passing what they want (name, file or directory). Clang also has to be updated, so tests might fail if a bot picks up this commit and not the corresponding clang one. llvm-svn: 185126
* Rename PathV2 to just Path now that it is the only one.Rafael Espindola2013-06-261-2/+2
| | | | llvm-svn: 185015
OpenPOWER on IntegriCloud