summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StringExtras.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Print quoted backslashes in LLVM IR as \\ instead of \5CReid Kleckner2019-10-101-1/+3
| | | | | | | | | This improves readability of Windows path string literals in LLVM IR. The LLVM assembler has supported \\ in IR strings for a long time, but the lexer doesn't tolerate escaped quotes, so they have to be printed as \22 for now. llvm-svn: 374415
* 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
* [ADT] Replace std::isprint by llvm::isPrint.Michael Kruse2018-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard library functions ::isprint/std::isprint have platform- and locale-dependent behavior which makes LLVM's output less predictable. In particular, regression tests my fail depending on the implementation of these functions. Implement llvm::isPrint in StringExtras.h with a standard behavior and replace all uses of ::isprint/std::isprint by a call it llvm::isPrint. The function is inlined and does not look up language settings so it should perform better than the standard library's version. Such a replacement has already been done for isdigit, isalpha, isxdigit in r314883. gtest does the same in gtest-printers.cc using the following justification: // Returns true if c is a printable ASCII character. We test the // value of c directly instead of calling isprint(), which is buggy on // Windows Mobile. inline bool IsPrintableAscii(wchar_t c) { return 0x20 <= c && c <= 0x7E; } Similar issues have also been encountered by Julia: https://github.com/JuliaLang/julia/issues/7416 I noticed the problem myself when on Windows isprint('\t') started to evaluate to true (see https://stackoverflow.com/questions/51435249) and thus caused several unit tests to fail. The result of isprint doesn't seem to be well-defined even for ASCII characters. Therefore I suggest to replace isprint by a platform-independent version. Differential Revision: https://reviews.llvm.org/D49680 llvm-svn: 338034
* [ADT] Make escaping fn conform to coding guidelinesJonas Devlieghere2018-05-311-2/+2
| | | | | | | | As noted by Adrian on llvm-commits, PrintHTMLEscaped and PrintEscaped in StringExtras did not conform to the LLVM coding guidelines. This commit rectifies that. llvm-svn: 333669
* [dsymutil] Escape HTML special characters in plist.Jonas Devlieghere2018-05-301-0/+17
| | | | | | | | | | When printing string in the Plist, we weren't escaping the characters which lead to invalid XML. This patch adds the escape logic to StringExtras. rdar://39785334 llvm-svn: 333565
* [Support] Move PrintEscapedString into the library its declaration is inBenjamin Kramer2018-01-261-0/+10
| | | | llvm-svn: 323558
* [Support] Merge toLower / toUpper implementationsFrancis Visoiu Mistrih2017-11-281-0/+6
| | | | | | Merge the ones from StringRef and StringExtras. llvm-svn: 319171
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-1/+0
| | | | | | NFC. llvm-svn: 232976
* Move the implementation of StringRef::split out of StringExtras.cppDuncan Sands2012-02-211-21/+0
| | | | | | and into StringRef.cpp, which is where the other StringRef stuff is. llvm-svn: 151054
* move tier out of an anonymous namespace, it doesn't make senseChris Lattner2011-07-211-5/+4
| | | | | | | | to for it to be an an anon namespace and be in a header. Eliminate some extraenous uses of tie. llvm-svn: 135669
* Fix refacto reported by Nicolas Geoffray.Benjamin Kramer2010-01-181-3/+1
| | | | llvm-svn: 93723
* Remove unused string functions.Benjamin Kramer2010-01-111-12/+0
| | | | llvm-svn: 93183
* Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.Benjamin Kramer2010-01-111-0/+13
| | | | llvm-svn: 93174
* Turns out llvm-gcc still uses SplitString with a vector. Add it back until IBenjamin Kramer2010-01-111-0/+12
| | | | | | have a fix. llvm-svn: 93163
* Reimplement getToken and SplitString as "StringRef helper functions"Benjamin Kramer2010-01-111-28/+18
| | | | | | | | | - getToken is modeled after StringRef::split but it can split on multiple separator chars and skips leading seperators. - SplitString is a StringRef::split variant for more than 2 elements with the same behaviour as getToken. llvm-svn: 93161
* Distinguish "a," from "a". The first one splits into "a" + "" and the second ↵Rafael Espindola2009-11-131-3/+5
| | | | | | | | one into "a" + 0. llvm-svn: 87084
* Switch to smallvector. Also fix issue with using unsigend for MaxSplit.Rafael Espindola2009-11-131-3/+4
| | | | llvm-svn: 87068
* Add a new split method to StringRef that puts the substrings in a vector.Rafael Espindola2009-11-131-0/+19
| | | | llvm-svn: 87058
* Move UnescapeString to a static function for its sole client; its ↵Daniel Dunbar2009-10-171-30/+0
| | | | | | inefficient and broken. llvm-svn: 84358
* Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.Daniel Dunbar2009-10-171-26/+0
| | | | llvm-svn: 84357
* teach EscapeString and UnescapeString to handle ".Chris Lattner2009-04-151-0/+3
| | | | llvm-svn: 69211
* Fix more -Wshorten-64-to-32 warnings.Evan Cheng2008-05-051-1/+1
| | | | llvm-svn: 50659
* Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov2008-02-201-0/+1
| | | | | | annoying warnings. llvm-svn: 47367
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Escape some escapes that confuse doxygen.Reid Spencer2007-08-051-1/+3
| | | | llvm-svn: 40850
* Add a helper functionChris Lattner2006-11-281-0/+15
| | | | llvm-svn: 31981
* Add two helpers for escaping and unescaping strings.Chris Lattner2006-07-141-0/+50
| | | | llvm-svn: 29151
* Remove trailing whitespaceMisha Brukman2005-04-211-4/+4
| | | | llvm-svn: 21422
* Changes For Bug 352Reid Spencer2004-09-011-1/+1
| | | | | | | | Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. llvm-svn: 16137
* implement new getToken functionChris Lattner2003-12-291-0/+43
llvm-svn: 10639
OpenPOWER on IntegriCloud