summaryrefslogtreecommitdiff
path: root/lib/Support
Commit message (Collapse)AuthorAge
...
* 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
* raw_fd_ostream: Be more verbose about the reason when opening a file fails.Benjamin Kramer2013-10-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191911 91177308-0d34-0410-b5e6-96231b3b80d8
* Add non-blocking Wait() for launched processesTareq A. Siraj2013-10-01
| | | | | | | | | | | | | | | | | | - 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191763 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove several unused variables.Rafael Espindola2013-10-01
| | | | | | Patch by Alp Toker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191757 91177308-0d34-0410-b5e6-96231b3b80d8
* SourceMgr diagnotics printing: fix a bug where printing a fixit for a sourceDmitri Gribenko2013-09-27
| | | | | | | | range that includes a tab character will cause out-of-bounds access to the fixit string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191563 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SourceMgr::PrintMessage() testable and add unit testsDmitri Gribenko2013-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191558 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide basic type safety for array_pod_sort comparators.Benjamin Kramer2013-09-22
| | | | | | | | This makes using array_pod_sort significantly safer. The implementation relies on function pointer casting but that should be safe as we're dealing with void* here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191175 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: GDBIndexEntry*String conversion functions now return const char* ↵David Blaikie2013-09-20
| | | | | | | | | for easy llvm::formating This was previously invoking UB by passing a user-defined type to format. Thanks to Jordan Rose for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191060 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Improve IR annotation comments for GNU pubthings.David Blaikie2013-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191043 91177308-0d34-0410-b5e6-96231b3b80d8
* Unshift the GDB index/GNU pubnames constants modified in r191025David Blaikie2013-09-19
| | | | | | | | | | | | Based on code review feedback from Eric Christopher, unshifting these constants as they can appear in the gdb_index itself, shifted a further 24 bits. This means that keeping them preshifted is a bit inflexible, so let's not do that. Given the motivation, wrap up some nicer enums, more type safety, and some utility functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191035 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DynamicLibrary use ManagedStatic. This is pretty simple and should just ↵Filip Pizlo2013-09-18
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190946 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r190921. It broke Windows.Filip Pizlo2013-09-18
| | | | | | | | | I'll roll it back in when I have a chance to look at it in detail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190923 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DynamicLibrary use ManagedStatic. This is pretty simple and should just ↵Filip Pizlo2013-09-18
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190921 91177308-0d34-0410-b5e6-96231b3b80d8
* Make PrettyStackTraceEntry use ManagedStatic for its ThreadLocal.Filip Pizlo2013-09-13
| | | | | | | | | | | | This was somewhat tricky because ~PrettyStackTraceEntry() may run after llvm_shutdown() has been called. This is rare and only happens for a common idiom used in the main() functions of command-line tools. This works around the idiom by skipping the stack clean-up if the PrettyStackTraceHead ManagedStatic is not constructed (i.e. llvm_shutdown() has been called). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190730 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds support for Atom Silvermont (SLM) - -march=slmPreston Gurd2013-09-13
| | | | | | | | | | | | | | Implements Instruction scheduler latencies for Silvermont, using latencies from the Intel Silvermont Optimization Guide. Auto detects SLM. Turns on post RA scheduler when generating code for SLM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190717 91177308-0d34-0410-b5e6-96231b3b80d8
* This switches CrashRecoveryContext to using ManagedStatic for its global ↵Filip Pizlo2013-09-12
| | | | | | | | | | | | Mutex and global ThreadLocals, thereby getting rid of the load-time initialization of those objects and also getting rid of their destruction unless the LLVM client calls llvm_shutdown. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190617 91177308-0d34-0410-b5e6-96231b3b80d8
* Path: Add an in-place version of path::native.Benjamin Kramer2013-09-11
| | | | | | | | This reflects the common use case of nativizing a prepared path. The existing version invokes undefined behavior if input = output, add an assert to catch that case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190510 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-submit r190469: YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190485 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "YAMLIO: Fix string quoting logic." (r190469)Hans Wennborg2013-09-11
| | | | | | It was turning the buildbots red. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190480 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing whitespaceRui Ueyama2013-09-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190472 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-11
| | | | | | | | YAMLIO printed a string as is without quotes unless it contains a newline character. That did not suffice. We also need to quote a string if it starts with a backquote, quote, double quote or atsign, or it's the empty string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190469 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
* Fix typoMatt Arsenault2013-09-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190424 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
* Add constant defines for gnu pubnames and gnu pubtypes - they're usedEric Christopher2013-09-09
| | | | | | for the gdb index as the names convey. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190343 91177308-0d34-0410-b5e6-96231b3b80d8
* Move accelerator table defines and constants to Dwarf.h sinceEric Christopher2013-09-05
| | | | | | | | we're proposing it for DWARF5. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190074 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting.Eric Christopher2013-09-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190019 91177308-0d34-0410-b5e6-96231b3b80d8
* Move generic isPrint and columnWidth implementations to a separate ↵Alexander Kornienko2013-09-04
| | | | | | | | | | | | | | | | | | | | | header/source to allow using both generic and system-dependent versions on win32. Summary: This is needed so we can use generic columnWidthUTF8 in clang-format on win32 simultaneously with a separate system-dependent implementations of isPrint/columnWidth in TextDiagnostic.cpp to avoid attempts to print Unicode characters using narrow-character interfaces (which is not supported on Windows, and we'll have to figure out how to handle this). Reviewers: jordan_rose Reviewed By: jordan_rose CC: llvm-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1559 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189952 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
* MemoryBuffer.cpp: Don't peek the next page if file is multiple of *physical* ↵NAKAMURA Takumi2013-09-04
| | | | | | | | | | pagesize(4k) but is not multiple of AllocationGranularity(64k), when a null terminator is required, on cygwin and win32. For example, r189780's SparcISelLowering.cpp has the size 98304. It crashed clang to touch a null terminator on cygwin. FIXME: It's not good to hardcode 4096 here. dwPageSize shows 4096. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189939 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace.NAKAMURA Takumi2013-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189938 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some rather confusing indentation and control flow in the errnoChandler Carruth2013-09-02
| | | | | | | | | | | | | printing routine. This is made harder to see due to the surprising formatting, inconsistent brace usage, and repeated conditions that all test the same thing. The only "consequence" of this bug is re-assigning 'str' to an empty string when computing the error string for an error number of 0 in the event of a non-GNU strerror_r routine. So, nothing to see here other than cleanup. It did help me find PR17055 in clang-format though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189734 91177308-0d34-0410-b5e6-96231b3b80d8
* [conf] Add config variable to disable crash related overrides.Daniel Dunbar2013-08-30
| | | | | | | | | | | | | | | | | | | | | - We do some nasty things w.r.t. installing or overriding signal handlers in order to improve our crash recovery support or interaction with crash reporting software, and those things are not necessarily appropriate when LLVM is being linked into a client application that has its own ideas about how to do things. This gives those clients a way to disable that handling at build time. - Currently, the code this guards is all Apple specific, but other platforms might have the same concerns so I went for a more generic configure name. Someone who is more familiar with library embedding on Windows can handle choosing which of the Windows/Signals.inc behaviors might make sense to go under this flag. - This also fixes the proper autoconf'ing of ENABLE_BACKTRACES. The code expects it to be undefined when disabled, but the autoconf check was just defining it to 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189694 91177308-0d34-0410-b5e6-96231b3b80d8
* X86: Add a description of the Intel Atom Silvermont CPU.Benjamin Kramer2013-08-30
| | | | | | Currently this is just the atom model with SSE4.2 enabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189669 91177308-0d34-0410-b5e6-96231b3b80d8
* Change default # of digits for APFloat::toStringEli Friedman2013-08-29
| | | | | | | | | | | | | | | | | This is a re-commit of r189442; I'll follow up with clang changes. The previous default was almost, but not quite enough digits to represent a floating-point value in a manner which preserves the representation when it's read back in. The larger default is much less confusing. I spent some time looking into printing exactly the right number of digits if a precision isn't specified, but it's kind of complicated, and I'm not really sure I understand what APFloat::toString is supposed to output for FormatPrecision != 0 (or maybe the current API specification is just silly, not sure which). I have a WIP patch if anyone is interested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189624 91177308-0d34-0410-b5e6-96231b3b80d8
* isCharInSet refactoring.Alexander Kornienko2013-08-29
| | | | | | | | | | | | | | | | | | Summary: Made UnicodeCharSet a class, perform validity checking inside its constructor instead of each isCharInSet call, use std::binary_search instead of own implementation. This patch comes with a necessary change in clang (sent separately). Reviewers: jordan_rose, klimek Reviewed By: klimek CC: cfe-commits, rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1534 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189582 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r189442 "Change default # of digits for APFloat::toString"Ted Kremenek2013-08-28
| | | | | | This is breaking numerous Clang tests on the buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189447 91177308-0d34-0410-b5e6-96231b3b80d8
* Change default # of digits for APFloat::toStringEli Friedman2013-08-28
| | | | | | | | | | | | | | | The previous default was almost, but not quite enough digits to represent a floating-point value in a manner which preserves the representation when it's read back in. The larger default is much less confusing. I spent some time looking into printing exactly the right number of digits if a precision isn't specified, but it's kind of complicated, and I'm not really sure I understand what APFloat::toString is supposed to output for FormatPrecision != 0 (or maybe the current API specification is just silly, not sure which). I have a WIP patch if anyone is interested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189442 91177308-0d34-0410-b5e6-96231b3b80d8
* [BumpPtrAllocator] Move DefaultSlabAllocator to a member of ↵Argyrios Kyrtzidis2013-08-28
| | | | | | | | | | BumpPtrAllocator, instead of a static variable. The problem with having DefaultSlabAllocator being a global static is that it is undefined if BumpPtrAllocator will be usable during global initialization because it is not guaranteed that DefaultSlabAllocator will be initialized before BumpPtrAllocator is created and used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189433 91177308-0d34-0410-b5e6-96231b3b80d8
* Added const qualifier to StringRef::edit_distance member functionDmitri Gribenko2013-08-24
| | | | | | | Patch by Ismail Pazarbasi. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189162 91177308-0d34-0410-b5e6-96231b3b80d8
* [Win32] mapped_file_region: Fix a bug in CreateFileMapping() that Size must ↵NAKAMURA Takumi2013-08-22
| | | | | | contain Offset when Offset >= 65536. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189021 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace.NAKAMURA Takumi2013-08-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189020 91177308-0d34-0410-b5e6-96231b3b80d8
* MemoryBuffer.cpp: Consider if PageSize were not 4096 in shouldUseMmap(). ↵NAKAMURA Takumi2013-08-22
| | | | | | | | Follow-up to r188903. The AllocationGranularity can be 65536 on Win32, even on Cygwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188998 91177308-0d34-0410-b5e6-96231b3b80d8
* Unix/Process.inc: Revert r72332, "Work around a page size issue on Cygwin."NAKAMURA Takumi2013-08-21
| | | | | | | | Offset in mmap(3) should be aligned to gepagesize(), 64k, or mmap(3) would fail. TODO: Invetigate places where 4096 would be required as pagesize, or 4096 would satisfy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188903 91177308-0d34-0410-b5e6-96231b3b80d8
* Go through the really awkward dance required to delete the memoryChandler Carruth2013-08-18
| | | | | | | | allocated by setupterm. Without this, some folks are seeing leaked memory whenever this routine is called more than once. Thanks to Craig Topper for the report. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188615 91177308-0d34-0410-b5e6-96231b3b80d8
* Actually, use GNU inline asm for cpuid with clangReid Kleckner2013-08-16
| | | | | | | Clang doesn't support the MSVC __cpuid intrinsic yet, and fixing that is blocked on some fairly complicated issues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188584 91177308-0d34-0410-b5e6-96231b3b80d8
* Switching to using a helper function instead of manually converting the ↵Aaron Ballman2013-08-16
| | | | | | string to UTF-8. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188566 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