summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
* Make PrettyStackTraceEntry use ManagedStatic for its ThreadLocal.Filip Pizlo2013-09-131-8/+20
| | | | | | | | | | 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). llvm-svn: 190730
* Adds support for Atom Silvermont (SLM) - -march=slmPreston Gurd2013-09-131-1/+2
| | | | | | | | | | | 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. llvm-svn: 190717
* This switches CrashRecoveryContext to using ManagedStatic for its global ↵Filip Pizlo2013-09-121-16/+17
| | | | | | | | | | 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. llvm-svn: 190617
* Path: Add an in-place version of path::native.Benjamin Kramer2013-09-111-14/+9
| | | | | | | | 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. llvm-svn: 190510
* Re-submit r190469: YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-111-2/+14
| | | | llvm-svn: 190485
* Revert "YAMLIO: Fix string quoting logic." (r190469)Hans Wennborg2013-09-111-10/+2
| | | | | | It was turning the buildbots red. llvm-svn: 190480
* Remove trailing whitespaceRui Ueyama2013-09-111-5/+4
| | | | llvm-svn: 190472
* YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-111-2/+10
| | | | | | | | 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. llvm-svn: 190469
* Support ANSI escape code on WindowsNico Rieck2013-09-113-19/+35
| | | | | | | | 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
* Fix typoMatt Arsenault2013-09-101-1/+1
| | | | llvm-svn: 190424
* Add getenv() wrapper that works on multibyte environment variable.Rui Ueyama2013-09-104-56/+113
| | | | | | | | | | | | | | | | | | 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
* Add constant defines for gnu pubnames and gnu pubtypes - they're usedEric Christopher2013-09-091-0/+23
| | | | | | for the gdb index as the names convey. llvm-svn: 190343
* Move accelerator table defines and constants to Dwarf.h sinceEric Christopher2013-09-051-0/+16
| | | | | | | | we're proposing it for DWARF5. No functional change intended. llvm-svn: 190074
* Formatting.Eric Christopher2013-09-051-2/+2
| | | | llvm-svn: 190019
* Move generic isPrint and columnWidth implementations to a separate ↵Alexander Kornienko2013-09-045-115/+41
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 189952
* Support/Process: Add comments about PageSize and AllocationGranularity on ↵NAKAMURA Takumi2013-09-042-2/+4
| | | | | | Cygwin and Win32. llvm-svn: 189940
* MemoryBuffer.cpp: Don't peek the next page if file is multiple of *physical* ↵NAKAMURA Takumi2013-09-041-0/+9
| | | | | | | | | 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. llvm-svn: 189939
* Whitespace.NAKAMURA Takumi2013-09-041-1/+1
| | | | llvm-svn: 189938
* Fix some rather confusing indentation and control flow in the errnoChandler Carruth2013-09-021-15/+14
| | | | | | | | | | | | | 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. llvm-svn: 189734
* [conf] Add config variable to disable crash related overrides.Daniel Dunbar2013-08-301-2/+2
| | | | | | | | | | | | | | | | | | | | | - 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. llvm-svn: 189694
* X86: Add a description of the Intel Atom Silvermont CPU.Benjamin Kramer2013-08-301-0/+5
| | | | | | Currently this is just the atom model with SSE4.2 enabled. llvm-svn: 189669
* Change default # of digits for APFloat::toStringEli Friedman2013-08-291-5/+8
| | | | | | | | | | | | | | | | | 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. llvm-svn: 189624
* isCharInSet refactoring.Alexander Kornienko2013-08-291-5/+8
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 189582
* Revert r189442 "Change default # of digits for APFloat::toString"Ted Kremenek2013-08-281-8/+5
| | | | | | This is breaking numerous Clang tests on the buildbot. llvm-svn: 189447
* Change default # of digits for APFloat::toStringEli Friedman2013-08-281-5/+8
| | | | | | | | | | | | | | | 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. llvm-svn: 189442
* [BumpPtrAllocator] Move DefaultSlabAllocator to a member of ↵Argyrios Kyrtzidis2013-08-281-3/+4
| | | | | | | | | | 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. llvm-svn: 189433
* Added const qualifier to StringRef::edit_distance member functionDmitri Gribenko2013-08-241-1/+1
| | | | | | Patch by Ismail Pazarbasi. llvm-svn: 189162
* [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
* MemoryBuffer.cpp: Consider if PageSize were not 4096 in shouldUseMmap(). ↵NAKAMURA Takumi2013-08-221-1/+1
| | | | | | | | Follow-up to r188903. The AllocationGranularity can be 65536 on Win32, even on Cygwin. llvm-svn: 188998
* Unix/Process.inc: Revert r72332, "Work around a page size issue on Cygwin."NAKAMURA Takumi2013-08-211-6/+3
| | | | | | | 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. llvm-svn: 188903
* Go through the really awkward dance required to delete the memoryChandler Carruth2013-08-181-2/+12
| | | | | | | | 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. llvm-svn: 188615
* Actually, use GNU inline asm for cpuid with clangReid Kleckner2013-08-161-10/+10
| | | | | | | Clang doesn't support the MSVC __cpuid intrinsic yet, and fixing that is blocked on some fairly complicated issues. llvm-svn: 188584
* 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-162-18/+0
| | | | llvm-svn: 188565
* Updating function comments; no functional changes intended.Aaron Ballman2013-08-161-5/+12
| | | | llvm-svn: 188554
* Tighten up the yamilizer so it stops eliding empty sequences if the embedded ↵Aaron Ballman2013-08-151-0/+17
| | | | | | | | empty sequence is the first key/value in a map which is itself in a sequence. Patch with help from Nick Kledzik. llvm-svn: 188508
* Use the MSVC __cpuid intrinsic instead of inline asmReid Kleckner2013-08-141-31/+14
| | | | | | This works around PR16830 in LLVM when self-hosting clang on Windows. llvm-svn: 188397
* Expose CRC-32 implementation from zlibAlexey Samsonov2013-08-141-0/+7
| | | | llvm-svn: 188380
* GCC warns about removing const with a c-style cast.Benjamin Kramer2013-08-131-1/+1
| | | | llvm-svn: 188259
* Fixes a bug when iterating on pathsTareq A. Siraj2013-08-121-1/+1
| | | | | | | | | This fixes the incorrect implementation of iterating on file/directory paths. Differential Review: http://llvm-reviews.chandlerc.com/D1277 llvm-svn: 188183
* Remove all checking for the various terminfo headers (term.h andChandler Carruth2013-08-121-24/+10
| | | | | | | | | | | | | | | | curses.h). Finding these headers is next to impossible. For example, on Debian systems libtinfo-dev provides the terminfo reading library we want, but *not* term.h. For the header, you have to use libncurses-dev. And libncursesw-dev provides a *different* term.h in a different location! These headers aren't worth it. We want two functions the signatures of which are clearly spec'ed in sys-v and other documentation. Just declare them ourselves and call them. This should fix some debian builders and provide better support for "minimal" debian systems that do want color autodetection. llvm-svn: 188165
* Target a minimal terminfo library rather than necessarily a full cursesChandler Carruth2013-08-121-11/+25
| | | | | | | | | | | | | | | | | | | | library for color support detection. This still will use a curses library if that is all we have available on the system. This change tries to use a smaller subset of the curses library, specifically the subset that is on some systems split off into a separate library. For example, if you install ncurses configured --with-tinfo, a 'libtinfo' is install that provides just the terminfo querying functionality. That library is now used instead of curses when it is available. This happens to fix a build error on systems with that library because when we tried to link ncurses into the binary, we didn't pull tinfo in as well. =] It should also provide an easy path for supporting the NetBSD libterminfo library, but as I don't have access to a NetBSD system I'm leaving adding that support to those folks. llvm-svn: 188160
* Check for $PWD in llvm::sys::current_path.Rafael Espindola2013-08-101-0/+12
| | | | | | | Some users (clang, libTooling) require this. After this patch we can remove the calls to getenv("PWD") from clang. llvm-svn: 188125
* Fix off-by-one error in Regex::isValidAlexey Samsonov2013-08-081-1/+1
| | | | llvm-svn: 187992
* Changed isPrint for U+00AD SOFT HYPHEN to return true.Alexander Kornienko2013-08-081-183/+185
| | | | | | | | | | | | | | | | | Summary: This is consistent with MacOSX implementation, and most terminals actually display this character (checked on gnome-terminal, lxterminal, lxterm, Terminal.app, iterm2). Actually, this is in line with the ISO Latin 1 standard (ISO 8859-1), which defines it differently from the Unicode Standard. More information here: http://www.cs.tut.fi/~jkorpela/shy.html Reviewers: gribozavr, jordan_rose CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1310 llvm-svn: 187949
* 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
* Add support for linking against a curses library when available andChandler Carruth2013-08-071-10/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | using it to detect whether or not a terminal supports colors. This replaces a particularly egregious hack that merely compared the TERM environment variable to "dumb". That doesn't really translate to a reasonable experience for users that have actually ensured their terminal's capabilities are accurately reflected. This makes testing a terminal for color support somewhat more expensive, but it is called very rarely anyways. The important fast path when the output is being piped somewhere is already in place. The global lock may seem excessive, but the spec for calling into curses is *terrible*. The whole library is terrible, and I spent quite a bit of time looking for a better way of doing this before convincing myself that this was the fundamentally correct way to behave. The damage of the curses library is very narrowly confined, and we continue to use raw escape codes for actually manipulating the colors which is a much sane system than directly using curses here (IMO). If this causes trouble for folks, please let me know. I've tested it on Linux and will watch the bots carefully. I've also worked to account for the variances of curses interfaces that I could finde documentation for, but that may not have been sufficient. llvm-svn: 187874
* YAMLTraits.h: replace DenseMap that used a bad implementation of DenseMapInfoDmitri Gribenko2013-08-071-2/+2
| | | | | | | | | | for StringRef with a StringMap The bug is that the empty key compares equal to the tombstone key. Also added an assertion to DenseMap to catch similar bugs in future. llvm-svn: 187866
* Fix boolean logic in LockFileManager and test itReid Kleckner2013-08-071-8/+10
| | | | | | | | | | This fixes a bug from r187826. Reviewers: hans Differential Revision: http://llvm-reviews.chandlerc.com/D1304 llvm-svn: 187846
OpenPOWER on IntegriCloud