Page MenuHomePhabricator

[ADT] Allow IsSizeLessThanThresholdT for incomplete types. NFC

Authored by yrouban on Jun 10 2020, 5:21 AM.



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;

Diff Detail

Event Timeline

yrouban created this revision.Jun 10 2020, 5:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2020, 5:21 AM
Herald added a subscriber: dexonsmith. · View Herald Transcript

@chandlerc, @fedor.sergeev, @vvereschaka, @DaniilSuchkov, please review or suggest who can review.

@chandlerc could you please review or suggest someone who can do it.
This patch is needed for D81555 and D81558.

DaniilSuchkov resigned from this revision.Jul 22 2020, 10:43 PM
DaniilSuchkov accepted this revision.Aug 11 2020, 4:23 AM
DaniilSuchkov added a subscriber: DaniilSuchkov.

I checked it and it looks like if it compiles, everything should work just fine in presence of incomplete types.

This revision is now accepted and ready to land.Aug 11 2020, 4:23 AM
vvereschaka accepted this revision.Aug 13 2020, 10:08 PM

I have tested the patch with VS2017/cl 19.16 build + clang/llvm tests and clang/llvm unit tests.
It looks fine.

Used the same build configurations as for the following builders: