summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/StringExtras.cpp
AgeCommit message (Collapse)Author
2023-10-06[llvm][Support] fix convertToSnakeFromCamelCase (#68375)Maksim Levental
Currently runs of caps aren't handled correctly so e.g. something like `Intel_OCL_BI` is snake cased to `intel_o_c_l_b_i` (previously discussed on this [phabricator patch](https://reviews.llvm.org/rG92233062c17590d3157bdc6db430fcdfc54312fe)).
2021-12-02[llvm] Use range-based for loops (NFC)Kazu Hirata
2021-06-25[llvm] Rename StringRef _lower() method calls to _insensitive()Martin Storsjö
This is a mechanical change. This actually also renames the similarly named methods in the SmallString class, however these methods don't seem to be used outside of the llvm subproject, so this doesn't break building of the rest of the monorepo.
2020-04-14[llvm][StringExtras] Add missing include of cctypeRiver Riddle
This fixes build breakages on windows.
2020-04-14[llvm][StringExtras] Merge StringExtras from MLIR into LLVMRiver Riddle
Summary: This revision adds two utilities currently present in MLIR to LLVM StringExtras: * convertToSnakeFromCamelCase Convert a string from a camel case naming scheme, to a snake case scheme * convertToCamelFromSnakeCase Convert a string from a snake case naming scheme, to a camel case scheme Differential Revision: https://reviews.llvm.org/D78167
2019-10-10Print quoted backslashes in LLVM IR as \\ instead of \5CReid Kleckner
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
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-26[ADT] Replace std::isprint by llvm::isPrint.Michael Kruse
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
2018-05-31[ADT] Make escaping fn conform to coding guidelinesJonas Devlieghere
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
2018-05-30[dsymutil] Escape HTML special characters in plist.Jonas Devlieghere
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
2018-01-26[Support] Move PrintEscapedString into the library its declaration is inBenjamin Kramer
llvm-svn: 323558
2017-11-28[Support] Merge toLower / toUpper implementationsFrancis Visoiu Mistrih
Merge the ones from StringRef and StringExtras. llvm-svn: 319171
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
2015-03-23Purge unused includes throughout libSupport.Benjamin Kramer
NFC. llvm-svn: 232976
2012-02-21Move the implementation of StringRef::split out of StringExtras.cppDuncan Sands
and into StringRef.cpp, which is where the other StringRef stuff is. llvm-svn: 151054
2011-07-21move tier out of an anonymous namespace, it doesn't make senseChris Lattner
to for it to be an an anon namespace and be in a header. Eliminate some extraenous uses of tie. llvm-svn: 135669
2010-01-18Fix refacto reported by Nicolas Geoffray.Benjamin Kramer
llvm-svn: 93723
2010-01-11Remove unused string functions.Benjamin Kramer
llvm-svn: 93183
2010-01-11Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.Benjamin Kramer
llvm-svn: 93174
2010-01-11Turns out llvm-gcc still uses SplitString with a vector. Add it back until IBenjamin Kramer
have a fix. llvm-svn: 93163
2010-01-11Reimplement getToken and SplitString as "StringRef helper functions"Benjamin Kramer
- 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
2009-11-13Distinguish "a," from "a". The first one splits into "a" + "" and the second ↵Rafael Espindola
one into "a" + 0. llvm-svn: 87084
2009-11-13Switch to smallvector. Also fix issue with using unsigend for MaxSplit.Rafael Espindola
llvm-svn: 87068
2009-11-13Add a new split method to StringRef that puts the substrings in a vector.Rafael Espindola
llvm-svn: 87058
2009-10-17Move UnescapeString to a static function for its sole client; its ↵Daniel Dunbar
inefficient and broken. llvm-svn: 84358
2009-10-17Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.Daniel Dunbar
llvm-svn: 84357
2009-04-15teach EscapeString and UnescapeString to handle ".Chris Lattner
llvm-svn: 69211
2008-05-05Fix more -Wshorten-64-to-32 warnings.Evan Cheng
llvm-svn: 50659
2008-02-20Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov
annoying warnings. llvm-svn: 47367
2007-12-29Remove attribution from file headers, per discussion on llvmdev.Chris Lattner
llvm-svn: 45418
2007-08-05Escape some escapes that confuse doxygen.Reid Spencer
llvm-svn: 40850
2006-11-28Add a helper functionChris Lattner
llvm-svn: 31981
2006-07-14Add two helpers for escaping and unescaping strings.Chris Lattner
llvm-svn: 29151
2005-04-21Remove trailing whitespaceMisha Brukman
llvm-svn: 21422
2004-09-01Changes For Bug 352Reid Spencer
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
2003-12-29implement new getToken functionChris Lattner
llvm-svn: 10639