summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/raw_ostream_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Silence some MSVC warnings about zero extending unsigned to void*Reid Kleckner2016-02-101-4/+4
| | | | llvm-svn: 260413
* Teach raw_ostream to support hex formatting without a prefix '0x'.Zachary Turner2015-01-261-0/+2
| | | | | | | | | | Previously using format_hex() would always print a 0x prior to the hex characters. This allows this to be optional, so that one can choose to print (e.g.) 255 as either 0xFF or just FF. Differential Revision: http://reviews.llvm.org/D7151 llvm-svn: 227108
* [Support] Add type-safe alternative to llvm::format()Nick Kledzik2014-09-251-0/+37
| | | | | | | | | | | | | | | | | | | | | llvm::format() is somewhat unsafe. The compiler does not check that integer parameter size matches the %x or %d size and it does not complain when a StringRef is passed for a %s. And correctly using a StringRef with format() is ugly because you have to convert it to a std::string then call c_str(). The cases where llvm::format() is useful is controlling how numbers and strings are printed, especially when you want fixed width output. This patch adds some new formatting functions to raw_streams to format numbers and StringRefs in a type safe manner. Some examples: OS << format_hex(255, 6) => "0x00ff" OS << format_hex(255, 4) => "0xff" OS << format_decimal(0, 5) => " 0" OS << format_decimal(255, 5) => " 255" OS << right_justify(Str, 5) => " foo" OS << left_justify(Str, 5) => "foo " llvm-svn: 218463
* [C++11] Use 'nullptr'.Craig Topper2014-06-081-2/+2
| | | | llvm-svn: 210442
* Add raw_ostream::write_escaped, for writing escaped strings.Daniel Dunbar2009-10-171-0/+16
| | | | llvm-svn: 84355
* Drop the raw_ostream required buffer size to 1.Daniel Dunbar2009-09-151-0/+10
| | | | | | | - As best I can tell, we have eliminated all the code which used to require a larger buffer size. llvm-svn: 81912
* Fix off-by-one in llvm::Format::print.Daniel Dunbar2009-08-231-0/+27
| | | | | | | | | | | | | - This also shortens the Format.h implementation, and uses the print buffer fully (it was wasting a character). - This manifested as llvm-test failures, because one side effect was that raw_ostream would write garbage '\x00' values into the output stream if it happened that the string was at the end of the buffer. This meant that grep would report 'Binary file matches', which meant the silly pattern matching llvm-test eventually does would fail. Cute. :) llvm-svn: 79862
* Add min and max tests.Daniel Dunbar2009-08-191-0/+8
| | | | llvm-svn: 79454
* Added tests for math utility functions; fixed another test's header comment.Misha Brukman2009-04-011-1/+1
| | | | llvm-svn: 68249
* Renamed unittest files to have a consistent {Tt}est suffix.Misha Brukman2009-03-191-0/+85
llvm-svn: 67326
OpenPOWER on IntegriCloud