summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FormattedStream.cpp
AgeCommit message (Collapse)Author
2024-12-02[FormattedStream] Add ASCII fast path (#117892)Nikita Popov
Printing IR spends a large amount of time updating the column count via generic UTF-8 APIs. Speed it up by adding a fast path for the common printable ASCII case. This makes `-print-on-crash -print-module-scope` about two times faster.
2024-03-28[Support] Fix color handling in formatted_raw_ostream (#86700)Andrew Ng
The color methods in formatted_raw_ostream were forwarding directly to the underlying stream without considering existing buffered output. This would cause incorrect colored output for buffered uses of formatted_raw_ostream. Fix this issue by applying the color to the formatted_raw_ostream itself and temporarily disabling scanning of any color related output so as not to affect the position tracking. This fix means that workarounds that forced formatted_raw_ostream buffering to be disabled can be removed. In the case of llvm-objdump, this can improve disassembly performance when redirecting to a file by more than an order of magnitude on both Windows and Linux. This improvement restores the disassembly performance when redirecting to a file to a level similar to before color support was added.
2022-08-08[llvm] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song
With C++17 there is no Clang pedantic warning or MSVC C5051.
2020-07-08[Support] Fix signed/unsigned comparison warningOliver Stannard
2020-07-06[Support] Fix formatted_raw_ostream for UTF-8Oliver Stannard
* The getLine and getColumn functions need to update the position, or they will return stale data for buffered streams. This fixes a bug in the clang -analyzer-checker-option-help option, which was not wrapping the help text correctly when stdout is not a TTY. * If the stream contains multi-byte UTF-8 sequences, then the whole sequence needs to be considered to be a single character. This has the edge case that the buffer might fill up and be flushed part way through a character. * If the stream contains East Asian wide characters, these will be rendered twice as wide as other characters, so we need to increase the column count to match. This doesn't attempt to handle everything unicode can do (combining characters, right-to-left markers, ...), but hopefully covers most things likely to be common in messages and source code we might want to print. Differential revision: https://reviews.llvm.org/D76291
2020-03-16Revert "[llvm-objdump] Display locations of variables alongside disassembly"Nico Weber
Makes tests fail on Windows, see https://reviews.llvm.org/D70720#1924542 This reverts commit 3a5ddedadb671e485ce5c638142817879ac14a8c, and follow-ups: f4cb9c919e28276222873453cf85de9e5a3c7be5 042eb0482aa758057c4f77616a4696cdb21b4fcc c0cf5f5da9a7bf1bdf43ed53287b0f634fc53045 18649f48139932377c2a2909f1fb600bf5cf6e57 f62b898c1f5dd77e68b53570dc2679877bcbe4c2
2020-03-16[llvm-objdump] Display locations of variables alongside disassemblyOliver Stannard
This adds the --debug-vars option to llvm-objdump, which prints locations (registers/memory) of source-level variables alongside the disassembly based on DWARF info. A vertical line is printed for each live-range, with a label at the top giving the variable name and location, and the position and length of the line indicating the program counter range in which it is valid. Currently, this only works for object files, not executables or shared libraries. Differential revision: https://reviews.llvm.org/D70720
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-07-30Remove trailing spaceFangrui Song
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
2017-06-06Sort the remaining #include lines in include/... and lib/....Chandler Carruth
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
2017-05-19Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.Galina Kistanova
llvm-svn: 303457
2015-03-23Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer
llvm-svn: 232998
2014-04-07[C++11] Make use of 'nullptr' in the Support library.Craig Topper
llvm-svn: 205697
2013-05-08Add line tracking support to FormattedStream Daniel Malea
- previously formatted_raw_ostream tracked columns, now it tracks lines too - used by (upcoming) DebugIR pass to know the line number to connect to each IR instruction llvm-svn: 181463
2010-12-19Add missing standard headers. Patch by Joerg Sonnenberger!Nick Lewycky
llvm-svn: 122193
2010-09-01Make tool_output_file's raw_ostream instance a member variable insteadDan Gohman
of a base class. This makes it possible to unregister the file from FilesToRemove when the file is done. Also, this eliminates the need for formatted_tool_output_file. llvm-svn: 112706
2010-08-20Introduce a new tool_output_file class, which extends raw_ostream withDan Gohman
functionality that most command-line tools need: ensuring that the output file gets deleted if the tool is interrupted or encounters an error. llvm-svn: 111595
2010-02-22Fix various doxygen warnings.Dan Gohman
llvm-svn: 96779
2010-02-15make PadToColumn return the stream so you can use:Chris Lattner
OS.PadToColumn(42) << "foo"; llvm-svn: 96208
2010-01-05Change errs() to dbgs().David Greene
llvm-svn: 92641
2009-08-22switch formattedstream to use raw_ostream::indent. This eliminatesChris Lattner
the weird MAX_COLUMN_PAD limitation. llvm-svn: 79785
2009-08-18raw_ostream: Reduce FormattedStream's reliance on raw_ostream's implementation.Daniel Dunbar
- Kill off begin(), end(), and iterator. It isn't clear what these mean. Instead provide getBufferStart(), which can be used with GetNumBytesInBuffer to the same effect. - Update ComputeColumn to take arguments for the buffer to scan, this simplifies the implementation of write_impl substantially. - This should also fix possible problems with the scanning pointer pointing outside of the current raw_ostream buffer. llvm-svn: 79379
2009-08-17the MinPad argument to PadToColumn only really makes sense to be 1,Chris Lattner
just remove the argument and replace it with 1. llvm-svn: 79246
2009-08-15Add support for column computation on unbuffered streams.Dan Gohman
llvm-svn: 79065
2009-08-15Move FormattedStream's write_impl out of line.Dan Gohman
llvm-svn: 79064
2009-08-15Remove an unnecessary #include.Dan Gohman
llvm-svn: 79063
2009-07-29Re-apply previous changes and improve column padding performance some more.David Greene
llvm-svn: 77461
2009-07-29Revert r77397, it causes significant regressions in llc performance.Daniel Dunbar
llvm-svn: 77425
2009-07-28Improve performance of PadToColumn by eliminating flushes.David Greene
llvm-svn: 77397
2009-07-23Write space padding as one string to speed up comment printing.David Greene
llvm-svn: 76910
2009-07-16Use size_t.Dan Gohman
llvm-svn: 76069
2009-07-14minor syntax cleanupChris Lattner
llvm-svn: 75707
2009-07-14Have asm printers use formatted_raw_ostream directly to avoid aDavid Greene
dynamic_cast<>. llvm-svn: 75670
2009-07-13Make some more changes suggested by Chris. Manipulators go away.David Greene
llvm-svn: 75472
2009-07-10Make changes suggested by Chris and eliminate newly-added raw_ostreamDavid Greene
hooks as they're no longer needed. The major change with this patch is to make formatted_raw_ostream usable by any client of raw_ostream. llvm-svn: 75283