History log of /llvm-project/llvm/unittests/ADT/StringExtrasTest.cpp (Results 1 – 25 of 30)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# 37e5319a 20-Sep-2024 Nikita Popov <npopov@redhat.com>

[UnitTests] Fix APInt signed flags (NFC)

This makes unit tests compatible with the assertion added in
https://github.com/llvm/llvm-project/pull/106524, by setting the
isSigned flag to the correct va

[UnitTests] Fix APInt signed flags (NFC)

This makes unit tests compatible with the assertion added in
https://github.com/llvm/llvm-project/pull/106524, by setting the
isSigned flag to the correct value or changing how the value is
constructed.

show more ...


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4
# b03b170d 21-Aug-2024 Rahul Joshi <rjoshi@nvidia.com>

[ADT] Add `isPunct` to StringExtras (#105461)

- Add `isPunct` to StringExtras.h.
- Add unit test for `isPunct` to StringExtrasTest.


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3
# 767dcc5f 06-Oct-2023 Maksim Levental <maksim.levental@gmail.com>

[llvm][Support] fix convertToSnakeFromCamelCase (#68375)

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 discus

[llvm][Support] fix convertToSnakeFromCamelCase (#68375)

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)).

show more ...


# 4c94aff5 04-Oct-2023 Steven Wu <stevenwu@apple.com>

[ADT] Add more ArrayRef <-> StringRef conversion functions

Add new functions in StringExtras to convert byte size type array to
StringRef and vice versa.

Reviewed By: benlangmuir, dexonsmith

Diffe

[ADT] Add more ArrayRef <-> StringRef conversion functions

Add new functions in StringExtras to convert byte size type array to
StringRef and vice versa.

Reviewed By: benlangmuir, dexonsmith

Differential Revision: https://reviews.llvm.org/D139035

show more ...


Revision tags: llvmorg-17.0.2
# 898b9618 28-Sep-2023 Sam McCall <sam.mccall@gmail.com>

[ADT] Fix llvm::join on containers of char*s (#67113)

Currently it tries to call S.size() when preallocating the target
string,
which doesn't compile.
vector<const char*> is used a bunch in e.g. cla

[ADT] Fix llvm::join on containers of char*s (#67113)

Currently it tries to call S.size() when preallocating the target
string,
which doesn't compile.
vector<const char*> is used a bunch in e.g. clang driver.

show more ...


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2
# fd5ca374 01-Aug-2023 Jacek Caban <jacek@codeweavers.com>

[ADT] [NFC] Introduce isLower and isUpper helpers.

Reviewed By: MaskRay, jhenderson
Differential Revision: https://reviews.llvm.org/D156796


Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init
# a41c8b8f 28-Jan-2022 Yuanfang Chen <yuanfang.chen@sony.com>

[ADT] support fixed-width output with `utohexstr`

Will use it to output a hash value that needs fixed-width.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D118427


Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1
# 2fcffcd0 04-Nov-2021 Ben Vanik <benvanik@google.com>

[ADT] Simplifying hex string parsing so it runs faster in debug modes.

This expands the lookup table statically and avoids routing through methods that
contain asserts (like StringRef/std::string el

[ADT] Simplifying hex string parsing so it runs faster in debug modes.

This expands the lookup table statically and avoids routing through methods that
contain asserts (like StringRef/std::string element accessors and drop_front)
such that performance is more predictable across compilation environments. This
was primarily driven by slow debug mode performance but has a large benefit in
release builds as well.

```
ssd_mobilenet_v2_face_float (42MB .mlir)
Debug/MSVC (old): 5.22s
Debug/MSVC (new): 0.16s
Release/MSVC (old): 0.81s
Release/MSVC (new): 0.02s

huggingface_minilm (536MB .mlir)
Debug/MSVC (old): 65.31s
Debug/MSVC (new): 2.03s
Release/MSVC (old): 9.93s
Release/MSVC (new): 0.27s
```

Now in debug the time is split evenly between lexString, tryGetFromHex, and
element attrs hashing, with the next step to making it faster being to combine
the work (incremental hashing during conversion, etc) - but this is at least in
the right order of magnitude and retains the original API surface.

I have not profiled a build with clang but this is strictly less code and simpler
data structures so I'd expect improvements there as well.

This also fixes a bug where 0xFF bytes in the input would read out of bounds.

Reviewed By: dblaikie, stellaraccident

Differential Revision: https://reviews.llvm.org/D112105

show more ...


# 66e06cc8 27-Sep-2021 Michał Górny <mgorny@moritz.systems>

[llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

Optimize the iterator comparison logic to compare Current.data()
pointers. Use std::tie for assignments from std::pair. Replace
the

[llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

Optimize the iterator comparison logic to compare Current.data()
pointers. Use std::tie for assignments from std::pair. Replace
the custom class with a function returning iterator_range.

Differential Revision: https://reviews.llvm.org/D110535

show more ...


# f4b71e34 26-Sep-2021 Michał Górny <mgorny@moritz.systems>

[llvm] [ADT] Add a range/iterator-based Split()

Add a llvm::Split() implementation that can be used via range-for loop,
e.g.:

for (StringRef x : llvm::Split("foo,bar,baz", ','))
...

The

[llvm] [ADT] Add a range/iterator-based Split()

Add a llvm::Split() implementation that can be used via range-for loop,
e.g.:

for (StringRef x : llvm::Split("foo,bar,baz", ','))
...

The implementation uses an additional SplittingIterator class that
uses StringRef::split() internally.

Differential Revision: https://reviews.llvm.org/D110496

show more ...


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2
# 4295c222 11-Jun-2021 Simon Pilgrim <llvm-dev@redking.me.uk>

StringExtrasTest.cpp - add missing newline at the end of file. NFCI.


# 61cdaf66 11-Jun-2021 Simon Pilgrim <llvm-dev@redking.me.uk>

[ADT] Remove APInt/APSInt toString() std::string variants

<string> is currently the highest impact header in a clang+llvm build:

https://commondatastorage.googleapis.com/chromium-browser-clang/llvm

[ADT] Remove APInt/APSInt toString() std::string variants

<string> is currently the highest impact header in a clang+llvm build:

https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html

One of the most common places this is being included is the APInt.h header, which needs it for an old toString() implementation that returns std::string - an inefficient method compared to the SmallString versions that it actually wraps.

This patch replaces these APInt/APSInt methods with a pair of llvm::toString() helpers inside StringExtras.h, adjusts users accordingly and removes the <string> from APInt.h - I was hoping that more of these users could be converted to use the SmallString methods, but it appears that most end up creating a std::string anyhow. I avoided trying to use the raw_ostream << operators as well as I didn't want to lose having the integer radix explicit in the code.

Differential Revision: https://reviews.llvm.org/D103888

show more ...


# 955d8899 11-Jun-2021 Simon Pilgrim <llvm-dev@redking.me.uk>

[ADT] Consistently use StringExtrasTest for the test suite filter. NFCI.

Noticed while updating D103888 - some of the tests were using "StringExtras" for the test_suite_name instead of the expected

[ADT] Consistently use StringExtrasTest for the test suite filter. NFCI.

Noticed while updating D103888 - some of the tests were using "StringExtras" for the test_suite_name instead of the expected "StringExtrasTest"

show more ...


Revision tags: llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2
# 8fd8ff1f 16-Jan-2021 Kazu Hirata <kazu@google.com>

[StringExtras] Rename SubsequentDelim to ListSeparator

This patch renames SubsequentDelim to ListSeparator to clarify the
purpose of the class.

Differential Revision: https://reviews.llvm.org/D94649


Revision tags: llvmorg-11.1.0-rc1
# 407b1e65 10-Jan-2021 Kazu Hirata <kazu@google.com>

[StringExtras] Add a helper class for comma-separated lists

This patch introduces a helper class SubsequentDelim to simplify loops
that generate a comma-separated lists.

For example, consider the f

[StringExtras] Add a helper class for comma-separated lists

This patch introduces a helper class SubsequentDelim to simplify loops
that generate a comma-separated lists.

For example, consider the following loop, taken from
llvm/lib/CodeGen/MachineBasicBlock.cpp:

for (auto I = pred_begin(), E = pred_end(); I != E; ++I) {
if (I != pred_begin())
OS << ", ";
OS << printMBBReference(**I);
}

The new class allows us to rewrite the loop as:

SubsequentDelim SD;
for (auto I = pred_begin(), E = pred_end(); I != E; ++I)
OS << SD << printMBBReference(**I);

where SD evaluates to the empty string for the first time and ", " for
subsequent iterations.

Unlike interleaveComma, defined in llvm/include/llvm/ADT/STLExtras.h,
SubsequentDelim can accommodate a wider variety of loops, including:

- those that conditionally skip certain items,
- those that need iterators to call getSuccProbability(I), and
- those that iterate over integer ranges.

As an example, this patch cleans up MachineBasicBlock::print.

Differential Revision: https://reviews.llvm.org/D94377

show more ...


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1
# 1095419b 28-Oct-2020 River Riddle <riddleriver@gmail.com>

[llvm][StringExtras] Add a fail-able version of `fromHex`

This revision adds a fail-able/checked version of `fromHex` that fails when the input string contains a non-hex character. This removes the

[llvm][StringExtras] Add a fail-able version of `fromHex`

This revision adds a fail-able/checked version of `fromHex` that fails when the input string contains a non-hex character. This removes the need for users to have a separate check for if the string contains all hex digits. This becomes very costly for large hex strings given that checking if a string contains only hex digits is effectively the same as just converting it in the first place.

Context: In MLIR we use hex strings to represent very large constants in the textual format of the IR. These changes lead to a large decrease in compile time when parsing these constants (2 seconds -> 1 second).

Differential Revision: https://reviews.llvm.org/D90265

show more ...


Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2
# 8ca7d2a1 22-Jun-2020 Thomas Preud'homme <thomasp@graphcore.ai>

[unittest, ADT] Add unit tests for itostr & utostr

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D82300


Revision tags: llvmorg-10.0.1-rc1
# b283ae7a 02-May-2020 Sam McCall <sam.mccall@gmail.com>

[ADT] Add locale-independent isSpace() to StringExtras. NFC

Use this in clangd, will follow up with replacements for isspace where
locale-dependent is clearly not intended.


# 229e392b 15-Apr-2020 River Riddle <riddleriver@gmail.com>

[llvm][StringExtras] Merge StringExtras from MLIR into LLVM

Summary:
This revision adds two utilities currently present in MLIR to LLVM StringExtras:

* convertToSnakeFromCamelCase
Convert a string

[llvm][StringExtras] Merge StringExtras from MLIR into LLVM

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

show more ...


Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1
# 67d440b9 10-Oct-2019 Reid Kleckner <rnk@google.com>

Print quoted backslashes in LLVM IR as \\ instead of \5C

This improves readability of Windows path string literals in LLVM IR.
The LLVM assembler has supported \\ in IR strings for a long time, but

Print quoted backslashes in LLVM IR as \\ instead of \5C

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

show more ...


Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1
# 2946cd70 19-Jan-2019 Chandler Carruth <chandlerc@gmail.com>

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the ne

Update the file headers across all of the LLVM projects in the monorepo
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

show more ...


Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0
# 72dc29a8 10-Sep-2018 Petr Hosek <phosek@chromium.org>

[ADT] Support converting to lowercase string in toHex

This is useful in certain use-cases such as D51833.

Differential Revision: https://reviews.llvm.org/D51835

llvm-svn: 341852


Revision tags: llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1
# 6f1da6e3 26-Jul-2018 Michael Kruse <llvm@meinersbur.de>

[ADT] Replace std::isprint by llvm::isPrint.

The standard library functions ::isprint/std::isprint have platform-
and locale-dependent behavior which makes LLVM's output less
predictable. In particu

[ADT] Replace std::isprint by llvm::isPrint.

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

show more ...


Revision tags: llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2
# 745918ff 31-May-2018 Jonas Devlieghere <jonas@devlieghere.com>

[ADT] Make escaping fn conform to coding guidelines

As noted by Adrian on llvm-commits, PrintHTMLEscaped and PrintEscaped in
StringExtras did not conform to the LLVM coding guidelines. This commit
r

[ADT] Make escaping fn conform to coding guidelines

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

show more ...


# 50603518 30-May-2018 Jonas Devlieghere <jonas@devlieghere.com>

[ADT] Add unit test for PrintHTMLEscaped

Add unit tests for PrintHTMLEscaped which was added in r333565.

llvm-svn: 333590


12