summaryrefslogtreecommitdiff
path: root/lib/Support/Windows/Process.inc
Commit message (Collapse)AuthorAge
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210871 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-12
| | | | | | This should make sure that most new uses use the std prefix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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++. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210687 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove windows_error.Rafael Espindola2014-06-11
| | | | | | | | | | MSVC doesn't seem to provide any is_error_code_enum enumeration for the windows errors. Fortunately very few places in llvm have to handle raw windows errors, so we can just construct the corresponding error_code directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210631 91177308-0d34-0410-b5e6-96231b3b80d8
* Process::GetRandomNumber(): fix insecure RNGAlp Toker2014-06-03
| | | | | | | This could have generated non-random output under error conditions in release builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210065 91177308-0d34-0410-b5e6-96231b3b80d8
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-31
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209952 91177308-0d34-0410-b5e6-96231b3b80d8
* MemoryBuffer: Use GetNativeSystemInfo()Alp Toker2014-05-19
| | | | | | | Removes old 4096 byte workaround. This functionality has been available since Windows XP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209137 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary variables.Ahmed Charles2014-03-05
| | | | | | Found self-hosting clang-cl on windows. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202935 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename Windows.h to WindowsSupport.h to avoid ambiguityReid Kleckner2014-02-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201258 91177308-0d34-0410-b5e6-96231b3b80d8
* Hopefully fixing the MinGW 32 build, which was broken by r200767. Not using ↵Aaron Ballman2014-02-11
| | | | | | rand_s() since MinGW does not have an implementation for it, but instead using the underlying CryptGenRandom APIs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201124 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to unbreak the mingw32 build.Benjamin Kramer2014-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200973 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented support for Process::GetRandomNumber on Windows.Aaron Ballman2014-02-04
| | | | | | Patch thanks to Stephan Tolksdorf! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200767 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to fix the windows build. The comments in other files don't seem toChandler Carruth2014-01-07
| | | | | | be quite accurate. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198690 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-07
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
* Windows: Avoiding resizing, use uninitialized data() insteadDavid Majnemer2013-10-07
| | | | | | | This is ever-so faster but more importantly matches what we have elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192137 91177308-0d34-0410-b5e6-96231b3b80d8
* Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is ↵NAKAMURA Takumi2013-10-07
| | | | | | zero. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192103 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Windows: Add support for unicode command lines""David Majnemer2013-10-07
| | | | | | | | This reverts commit r192070 which reverted r192069, I forgot to regenerate the configure scripts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192079 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Windows: Add support for unicode command lines"David Majnemer2013-10-06
| | | | | | | | This is causing MinGW bots to fail. This reverts commit r192069. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192070 91177308-0d34-0410-b5e6-96231b3b80d8
* Windows: Add support for unicode command linesDavid Majnemer2013-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192069 91177308-0d34-0410-b5e6-96231b3b80d8
* Support ANSI escape code on WindowsNico Rieck2013-09-11
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190460 91177308-0d34-0410-b5e6-96231b3b80d8
* Add getenv() wrapper that works on multibyte environment variable.Rui Ueyama2013-09-10
| | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190423 91177308-0d34-0410-b5e6-96231b3b80d8
* Support/Process: Add comments about PageSize and AllocationGranularity on ↵NAKAMURA Takumi2013-09-04
| | | | | | Cygwin and Win32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189940 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing unused functionality.Aaron Ballman2013-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188565 91177308-0d34-0410-b5e6-96231b3b80d8
* Updating function comments; no functional changes intended.Aaron Ballman2013-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188554 91177308-0d34-0410-b5e6-96231b3b80d8
* sys::process::get_id() now returns the process ID instead of a process ↵Aaron Ballman2013-06-08
| | | | | | handle on Windows. Patch thanks to Kim Gräsman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an obvious typo spotted by Reid Kleckner, and breaking windows builds.Chandler Carruth2013-01-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171559 91177308-0d34-0410-b5e6-96231b3b80d8
* Add time getters to the process interface for requesting the elapsedChandler Carruth2013-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wall time, user time, and system time since a process started. For walltime, we currently use TimeValue's interface and a global initializer to compute a close approximation of total process runtime. For user time, this adds support for an somewhat more precise timing mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock selected. For system time, we have to do a full getrusage call to extract the system time from the OS. This is expensive but unavoidable. In passing, clean up the implementation of the old APIs and fix some latent bugs in the Windows code. This might have manifested on Windows ARM systems or other systems with strange 64-bit integer behavior. The old API for this both user time and system time simultaneously from a single getrusage call. While this results in fewer system calls, it also results in a lower precision user time and if only user time is desired, it introduces a higher overhead. It may be worthwhile to switch some of the pass timers to not track system time and directly track user and wall time. The old API also tracked walltime in a confusing way -- it just set it to the current walltime rather than providing any measure of wall time since the process started the way buth user and system time are tracked. The new API is more consistent here. The plan is to eventually implement these methods for a *child* process by using the wait3(2) system call to populate an rusage struct representing the whole subprocess execution. That way, after waiting on a child process its stats will become accurate and cheap to query. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171551 91177308-0d34-0410-b5e6-96231b3b80d8
* Flesh out a page size accessor in the new API.Chandler Carruth2012-12-31
| | | | | | | | Implement the old API in terms of the new one. This simplifies the implementation on Windows which can now re-use the self_process's once initialization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171330 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused function in the old Process interface.Chandler Carruth2012-12-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171327 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch this code to a more idiomatic double using namespace directive.Chandler Carruth2012-12-31
| | | | | | | | Fix a truly odd namespace qualifier that was flat out wrong in the process. The fully qualified namespace would have been llvm::sys::TimeValue, llvm::TimeValue makes no sense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171292 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin sketching out the process interface.Chandler Carruth2012-12-31
| | | | | | | | | | | | | | | | | | | | | | | The coding style used here is not LLVM's style because this is modeled after a Boost interface and thus done in the style of a candidate C++ standard library interface. I'll probably end up proposing it as a standard C++ library if it proves to be reasonably portable and useful. This is just the most basic parts of the interface -- getting the process ID out of it. However, it helps sketch out some of the boiler plate such as the base class, derived class, shared code, and static factory function. It also introduces a unittest so that I can incrementally ensure this stuff works. However, I've not even compiled this code for Windows yet. I'll try to fix any Windows fallout from the bots, and if I can't fix it I'll revert and get someone on Windows to help out. There isn't a lot more that is mandatory, so soon I'll switch to just stubbing out the Windows side and get Michael Spencer to help with implementation as he can test it directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171289 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to unbreak the windows build.Benjamin Kramer2012-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160567 91177308-0d34-0410-b5e6-96231b3b80d8
* Process: Add sys::Process::FileDescriptorHasColors().Daniel Dunbar2012-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160557 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tabs.Bill Wendling2012-07-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160476 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 'Add reverseColor to raw_ostream'.Benjamin Kramer2012-04-16
| | | | | | | To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell, with a minor fix for mingw by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154805 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r154800 which breaks windows builders.Argyrios Kyrtzidis2012-04-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154802 91177308-0d34-0410-b5e6-96231b3b80d8
* Add reverseColor to raw_ostream.Argyrios Kyrtzidis2012-04-16
| | | | | | | To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154800 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove SetWorkingDirectory from the Process interface. Nothing in LLVMChandler Carruth2012-01-15
| | | | | | | | | | | | or Clang is using this, and it would be hard to use it correctly given the thread hostility of the function. Also, it never checked the return which is rather dangerous with chdir. If someone was in fact using this, please let me know, as well as what the usecase actually is so that I can add it back and make it more correct and secure to use. (That said, it's never going to be "safe" per-se, but we could at least document the risks...) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148211 91177308-0d34-0410-b5e6-96231b3b80d8
* sys::Process: Add a SetWorkingDirectory method.Daniel Dunbar2011-09-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140433 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge System into Support.Michael J. Spencer2010-11-29
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8