summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters/StringPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine2019-05-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]] This commit is the result of modernizing the LLDB codebase by using `nullptr` instread of `0` or `NULL`. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html for more information. This is the command I ran and I to fix and format the code base: ``` run-clang-tidy.py \ -header-filter='.*' \ -checks='-*,modernize-use-nullptr' \ -fix ~/dev/llvm-project/lldb/.* \ -format \ -style LLVM \ -p ~/llvm-builds/debug-ninja-gcc ``` NOTE: There were also changes to `llvm/utils/unittest` but I did not include them because I felt that maybe this library shall be updated in isolation somehow. NOTE: I know this is a rather large commit but it is a nobrainer in most parts. Reviewers: martong, espindola, shafik, #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D61847 llvm-svn: 361484
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-111-1/+3
| | | | | | | | | | | Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* Simplify Boolean expressionsJonas Devlieghere2018-12-151-1/+1
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
* Reflow paragraphs in comments.Adrian Prantl2018-04-301-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Rename Error -> Status.Zachary Turner2017-05-121-3/+3
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Move classes from Core -> Utility.Zachary Turner2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* Make lldb -Werror clean on Windows.Zachary Turner2016-10-051-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D25247 llvm-svn: 283344
* Move UTF functions into namespace llvm.Justin Lebar2016-09-301-25/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This lets people link against LLVM and their own version of the UTF library. I determined this only affects llvm, clang, lld, and lldb by running $ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq clang lld lldb llvm Tested with ninja lldb ninja check-clang check-llvm check-lld (ninja check-lldb doesn't complete for me with or without this patch.) Reviewers: rnk Subscribers: klimek, beanz, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D24996 llvm-svn: 282822
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-534/+528
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Fix some compiler warnings with MSVC 2015.Zachary Turner2016-01-131-1/+1
| | | | llvm-svn: 257671
* Fix an issue where LLDB would truncate summaries for string types without ↵Enrico Granata2015-11-041-4/+28
| | | | | | producing any evidence thereof llvm-svn: 252018
* Rationalization of includes in the data formatters codeEnrico Granata2015-10-201-1/+0
| | | | llvm-svn: 250798
* Silence -Wreturn-type with gcc 5.2Saleem Abdulrasool2015-10-181-0/+1
| | | | | | The switch is fully covered, mark "default" as unreachable. NFC. llvm-svn: 250667
* Silence -Wqual-cast warnings from GCC 5.2Saleem Abdulrasool2015-10-181-2/+2
| | | | | | | | There were a number of const qualifiers being cast away which caused warnings. This cluttered the output hiding real errors. Silence them by explicit casting. NFC. llvm-svn: 250662
* Enable the StringPrinter to have prefixes that are strings instead of just a ↵Enrico Granata2015-10-071-5/+12
| | | | | | single character; and also introduce a comparable suffix mechanism llvm-svn: 249506
* Introduce the notion of an escape helper. Different languages have different ↵Enrico Granata2015-09-091-26/+62
| | | | | | | | notion of what to print in a string and how to escape non-printable things. The escape helper is where this notion is provided to LLDB This is NFC, other than a code re-org llvm-svn: 247200
* Preparatory work for letting language plugins help the StringPrinter with ↵Enrico Granata2015-09-091-97/+14
| | | | | | formatting special characters llvm-svn: 247189
* Teach the std::wstring data formatter how to properly display strings with ↵Enrico Granata2015-07-171-0/+2
| | | | | | embedded NUL bytes llvm-svn: 242501
* Add StringPrinter support for printing a std::string with embedded NUL bytesEnrico Granata2015-07-171-36/+55
| | | | llvm-svn: 242496
* Fixed a ton of gcc compile warningsVince Harron2015-05-131-15/+15
| | | | | | | | | | Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
* Fix an issue where the UTF dumper was ignoring the direction to generate ↵Enrico Granata2015-05-011-1/+1
| | | | | | uncapped dumps llvm-svn: 236362
* Fix trivial signed/unsigned comparison warningsAndy Gibbs2014-12-291-2/+2
| | | | llvm-svn: 224932
* We don't really handle printing embedded NULs in strings, but if we were to, ↵Enrico Granata2014-12-181-0/+6
| | | | | | we would need to have this logic inside the StringPrinter. So, add it.. For, you know, one day in the future where we might want to handle embedded NULs in strings... llvm-svn: 224537
* Add the ability for the NSString and libc++ std::string formatters to ↵Enrico Granata2014-11-181-1/+3
| | | | | | retrieve uncapped data llvm-svn: 222277
* Fix a problem where the StringPrinter could be mistaking an empty string for ↵Enrico Granata2014-11-171-1/+1
| | | | | | a read error, and reporting spurious 'unable to read data' messages. rdar://19007243 llvm-svn: 222190
* Add a setting escape-non-printables that drives whether the StringPrinter ↵Enrico Granata2014-11-051-0/+15
| | | | | | | | | | | should or should not escape sequences such as \t, \n, .. and generally any non-printing character The recent StringPrinter changes made this behavior the default, and the setting defaults to yes If you want to change this behavior and see non-printables unescaped (e.g. "a\tb" as "a b"), set it to false Fixes rdar://12969594 llvm-svn: 221399
* for Siva Chandra: Fix compilation of StringPrinter.cpp with GCC. ↵Shawn Best2014-11-041-95/+105
| | | | | | Differential Revision: http://reviews.llvm.org/D6122 llvm-svn: 221310
* Remove #include <codecvt>. It isn't supported on all compilers.Zachary Turner2014-10-301-1/+0
| | | | | | Also it wasn't being used anyway, so it appears to be a dead include. llvm-svn: 220921
* Start adopting the StringPrinter API. The StringPrinter API is the new ↵Enrico Granata2014-10-301-0/+618
blessed way of printing strings that supports escaping non-printables, and has better handling of different UTF encodings llvm-svn: 220894
OpenPOWER on IntegriCloud