History log of /llvm-project/llvm/include/llvm/ADT/FunctionExtras.h (Results 1 – 25 of 39)
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, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# e8ca306f 19-Aug-2024 Dmitry Yanovsky <kerambyte@gmail.com>

[ADT] Add a missing call to a unique_function destructor after move (#98747)

Right now immediately after moving the captured state, we 'disarm' the
moved-from object's destructor by resetting the

[ADT] Add a missing call to a unique_function destructor after move (#98747)

Right now immediately after moving the captured state, we 'disarm' the
moved-from object's destructor by resetting the
`RHS.CallbackAndInlineFlag`. This means that we never properly destroy
the RHS object's captured state.

show more ...


# 22b4496e 19-Aug-2024 Dmitry Yanovsky <kerambyte@gmail.com>

[ADT] Fix alignment check in unique_function constructor (#99403)

Right now the check fails for any state-capturing lambda since this
expression - `alignof(decltype(StorageUnion.InlineStorage))` -

[ADT] Fix alignment check in unique_function constructor (#99403)

Right now the check fails for any state-capturing lambda since this
expression - `alignof(decltype(StorageUnion.InlineStorage))` - returns 1
for the alignment value and not 4/8 as expected
([MSVC|Clang|GCC](https://godbolt.org/z/eTEdq4xjM)). So this check fails
for pretty much any state-capturing callable we try to store into a
`unique_function` and we take the out-of-line storage path:

\llvm-project\llvm\include\llvm\ADT\FunctionExtras.h,
`UniqueFunctionBase` constructor (line ~266):

```
if (sizeof(CallableT) > InlineStorageSize ||
alignof(CallableT) > alignof(decltype(StorageUnion.InlineStorage))) {
// ...
}
```

The fix is simply to use an explicit const variable to store the
alignment value.

There is no easy way to unit-test the fix since inline storage is
considered to be an implementation detail so we shouldn't assume how the
lambda ends up being stored.

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7
# bf4eaec4 03-Jun-2024 Marc Auberer <marc.auberer@chillibits.com>

[llvm] Replace deprecated aligned_storage with aligned byte array (#94169)

`std::aligned_storage` is deprecated with C++23, see
[here](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1413

[llvm] Replace deprecated aligned_storage with aligned byte array (#94169)

`std::aligned_storage` is deprecated with C++23, see
[here](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1413r3.pdf).

This replaces the usages of `std::aligned_storage` within llvm (only one
in ADT and one in Support) with an aligned `std::byte` array.
I will provide patches for other subcomponents as well.

show more ...


Revision tags: 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
# 51a11f1c 23-Jan-2024 Tacet <advenam.tacet@trailofbits.com>

[ASan][ADT] Don't scribble with ASan (#79066)

With this commit, scribbling under AddressSanitizer (ASan) is disabled to prevent overwriting poisoned objects (e.g., annotated short strings).
Needed

[ASan][ADT] Don't scribble with ASan (#79066)

With this commit, scribbling under AddressSanitizer (ASan) is disabled to prevent overwriting poisoned objects (e.g., annotated short strings).
Needed by https://github.com/llvm/llvm-project/pull/79049

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1
# 6a684dbc 26-Jul-2023 Fangrui Song <i@maskray.me>

[Support] Remove llvm::is_trivially_{copy/move}_constructible

This restores D132311, which was reverted in
29c841ce93e087fa4e0c5f3abae94edd460bc24a (Sep 2022) due to certain files
not buildable with

[Support] Remove llvm::is_trivially_{copy/move}_constructible

This restores D132311, which was reverted in
29c841ce93e087fa4e0c5f3abae94edd460bc24a (Sep 2022) due to certain files
not buildable with GCC 7.3.0. The previous attempt was reverted by
6cd9608fb37ca2418fb44b57ec955bb5efe10689 (Dec 2020).

This time, GCC 7.3.0 has existing build errors for a long time due to
structured bindings for many files, e.g.

```
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9098:13: error: cannot decompose class type ‘std::pair<llvm::Value*, const llvm::SCEV*>’: both it and it
s base class ‘std::pair<llvm::Value*, const llvm::SCEV*>’ have non-static data members
for (auto [_, Stride] : Legal->getLAI()->getSymbolicStrides()) {
^~~~~~~~~~~
```

... and also some `error: duplicate initialization of` instances due to llvm/Transforms/IPO/Attributor.h.

---

GCC 7.5.0 has a bug that, without this change, certain `SmallVector` with a `std::pair` element type like `SmallVector<std::pair<Instruction * const, Info>, 0> X;` lead to spurious

```
/tmp/opt/gcc-7.5.0/include/c++/7.5.0/type_traits:878:48: error: constructor required before non-static data member for ‘...’ has been parsed
```

Switching to std::is_trivially_{copy/move}_constructible fixes the error.

show more ...


Revision tags: llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2
# 7021182d 16-Apr-2023 Shraiysh Vaishay <shraiysh@gmail.com>

[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.

This patch replaces the uses of PointerUnion.is function by llvm::isa,
PointerUnion.get function by llvm::cast,

[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.

This patch replaces the uses of PointerUnion.is function by llvm::isa,
PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by
llvm::dyn_cast_if_present. This is according to the FIXME in
the definition of the class PointerUnion.

This patch does not remove them as they are being used in other
subprojects.

Reviewed By: mehdi_amini

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

show more ...


# 6b6a542c 17-Apr-2023 Jonas Devlieghere <jonas@devlieghere.com>

Revert "[ADT] Apply fixes from modernize-type-traits (NFC)"

This reverts commit 9395cf063a013003704118deccf7633533170a5b because it
breaks the modules build:

STLFunctionalExtras.h:54:3: error:

Revert "[ADT] Apply fixes from modernize-type-traits (NFC)"

This reverts commit 9395cf063a013003704118deccf7633533170a5b because it
breaks the modules build:

STLFunctionalExtras.h:54:3: error:
'llvm::function_ref<std::__1::optional<std::__1::basic_string<char>>
(llvm::StringRef, llvm::StringRef)>::function_ref' from module
'LLVM_Utils.ADT.STLFunctionalExtras' is not present in definition of
'llvm::function_ref<std::__1::optional<std::__1::basic_string<char>>
(llvm::StringRef, llvm::StringRef)>' in module
'LLVM_Utils.ADT.STLFunctionalExtras'

https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/53806/

show more ...


# 9395cf06 16-Apr-2023 Kazu Hirata <kazu@google.com>

[ADT] Apply fixes from modernize-type-traits (NFC)


Revision tags: 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
# 5e5a6c5b 18-Sep-2022 Kazu Hirata <kazu@google.com>

Use std::conditional_t (NFC)


# 29c841ce 17-Sep-2022 Kazu Hirata <kazu@google.com>

Revert "[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)"

This reverts commit 01ffe31cbb54bfd8e38e71b3cf804a1d67ebf9c1.

A build breakage with GCC 7.3 has been reported:

https://rev

Revert "[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)"

This reverts commit 01ffe31cbb54bfd8e38e71b3cf804a1d67ebf9c1.

A build breakage with GCC 7.3 has been reported:

https://reviews.llvm.org/D132311#3797053

FWIW, GCC 7.5 is OK according to Pavel Chupin. I also personally
tested GCC 8.4.0.

show more ...


# a21c8be1 11-Sep-2022 Kazu Hirata <kazu@google.com>

[llvm] Use std::aligned_storage_t (NFC)


Revision tags: llvmorg-15.0.0, llvmorg-15.0.0-rc3
# 8b1b0d1d 21-Aug-2022 Kazu Hirata <kazu@google.com>

Revert "Use std::is_same_v instead of std::is_same (NFC)"

This reverts commit c5da37e42d388947a40654b7011f2a820ec51601.

This patch seems to break builds with some versions of MSVC.


# c5da37e4 21-Aug-2022 Kazu Hirata <kazu@google.com>

Use std::is_same_v instead of std::is_same (NFC)


# 01ffe31c 20-Aug-2022 Kazu Hirata <kazu@google.com>

[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)

This patch removes llvm::is_trivially_{copy/move}_constructible in
favor of std::is_trivially_{copy/move}_constructible.

The previou

[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)

This patch removes llvm::is_trivially_{copy/move}_constructible in
favor of std::is_trivially_{copy/move}_constructible.

The previous attempt to remove them in Dec 2020,
c8d406c93c5bb01599990201f78d8428dd29d289, broke builds with "some
versions of GCC" according to
6cd9608fb37ca2418fb44b57ec955bb5efe10689.

It's been 20 months since then, and the minimum requirement for GCC
has been updated to 7.1 from 5.1.

FWIW, I was able to build llvm with gcc 8.4.0.

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

show more ...


# e8578968 11-Aug-2022 Joe Loser <joeloser93@gmail.com>

[ADT] Replace STLForwardCompat.h's C++17 equivalents

STLForwardCompat.h defines several utilities and type traits to mimic that of
the ones in the C++17 standard library. Now that LLVM is built with

[ADT] Replace STLForwardCompat.h's C++17 equivalents

STLForwardCompat.h defines several utilities and type traits to mimic that of
the ones in the C++17 standard library. Now that LLVM is built with the C++17
standards mode, remove use of these equivalents in favor of the ones from the
standard library.

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

show more ...


Revision tags: 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, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1
# cfb53d8e 07-Oct-2021 Nikita Popov <nikita.ppv@gmail.com>

[NFC] Make some includes explicit

Avoid relying on a number of indirect includes that currently
happen through the Hashing.h header in DenseMapInfo.h.


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3
# b39f6a79 13-Sep-2021 Fehr Mathieu <mathieu.fehr@gmail.com>

[ADT] Extend EnableIfCallable for callables with incomplete returns

std::is_convertible has no defined behavior when its arguments
are incomplete, even if they are equal. In practice, it returns fal

[ADT] Extend EnableIfCallable for callables with incomplete returns

std::is_convertible has no defined behavior when its arguments
are incomplete, even if they are equal. In practice, it returns false.
Adding std::is_same allows us to use the constructor using a callable,
even if the return value is incomplete. We also check the case where
we convert a T into a const T.

Reviewed By: DaniilSuchkov

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

Committer: Daniil Suchkov <dsuchkov@azul.com>

show more ...


Revision tags: 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, llvmorg-12.0.1-rc1
# e3eaff10 21-May-2021 Yevgeny Rouban <yrouban@azul.com>

Allow incomplete template types in unique_function arguments

We can't declare unique_function that has in its arguments a reference to
a template type with an incomplete argument.
For instance, we c

Allow incomplete template types in unique_function arguments

We can't declare unique_function that has in its arguments a reference to
a template type with an incomplete argument.
For instance, we can't declare unique_function<void(SmallVectorImpl<A>&)>
when A is forward declared.

This is because SFINAE will trigger a hard error in this case, when instantiating
IsSizeLessThanThresholdT with the incomplete type.

This patch specialize AdjustedParamT for references to remove this error.

Committed on behalf of: @math-fehr (Fehr Mathieu)

Reviewed By: DaniilSuchkov, yrouban

show more ...


# f3026d8b 30-Apr-2021 Scott Linder <Scott.Linder@amd.com>

[ADT] Add llvm::remove_cvref and llvm::remove_cvref_t

Reviewed By: dblaikie

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


Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2
# 9ebc837f 16-Feb-2021 Sam McCall <sam.mccall@gmail.com>

[ADT] Add SFINAE guards to unique_function constructor.

We can't construct a working unique_function from an object that's not callable
with the right types, so don't allow deduction to succeed.
Thi

[ADT] Add SFINAE guards to unique_function constructor.

We can't construct a working unique_function from an object that's not callable
with the right types, so don't allow deduction to succeed.
This avoids some ambiguous conversion cases, e.g. allowing to overload
on different unique_function types, and to conversion operators to
unique_function.

std::function and the any_invocable proposal have these.
This was added to llvm::function_ref in D88901 and followups

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

show more ...


# aa5c09be 06-Feb-2021 Kazu Hirata <kazu@google.com>

[llvm] Fix header guards (NFC)

Identified with llvm-header-guard.


Revision tags: llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2
# 6cd9608f 03-Dec-2020 Mehdi Amini <joker.eph@gmail.com>

Revert "Switch to std::is_trivially_move_constructible and std::is_trivially_copy_constructible"

This reverts commit c8d406c93c5bb01599990201f78d8428dd29d289.

Builds are broken with some versions o

Revert "Switch to std::is_trivially_move_constructible and std::is_trivially_copy_constructible"

This reverts commit c8d406c93c5bb01599990201f78d8428dd29d289.

Builds are broken with some versions of GCC.

show more ...


# c8d406c9 03-Dec-2020 Fangrui Song <i@maskray.me>

Switch to std::is_trivially_move_constructible and std::is_trivially_copy_constructible

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


Revision tags: llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3
# 7d9a1624 21-Aug-2020 Yevgeny Rouban <yrouban@azul.com>

[ADT] Allow IsSizeLessThanThresholdT for incomplete types. NFC

If the type T is incomplete then sizeof(T) results in C++ compilation error at line:
static constexpr bool value = sizeof(T) <= (2 *

[ADT] Allow IsSizeLessThanThresholdT for incomplete types. NFC

If the type T is incomplete then sizeof(T) results in C++ compilation error at line:
static constexpr bool value = sizeof(T) <= (2 * sizeof(void *));

This patch allows incomplete types in parameters of function. Example:
using SomeFunc = void(SomeIncompleteType &);
llvm::unique_function<SomeFuncType> SomeFunc;

Reviewers: DaniilSuchkov, vvereschaka

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

show more ...


Revision tags: 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
# 6f87b99a 29-Jun-2020 Sam McCall <sam.mccall@gmail.com>

[ADT] Use more explicit from to initialize member. Appease MSVC?

Or at least get a clearer error message:
http://lab.llvm.org:8011/builders/mlir-windows/builds/3958/steps/build-unified-tree/logs/std

[ADT] Use more explicit from to initialize member. Appease MSVC?

Or at least get a clearer error message:
http://lab.llvm.org:8011/builders/mlir-windows/builds/3958/steps/build-unified-tree/logs/stdio

show more ...


12