This is an archive of the discontinued LLVM Phabricator instance.

[clang] makes `__is_destructible` KEYALL instead of KEYMS
ClosedPublic

Authored by cjdb on Oct 5 2022, 6:55 PM.

Details

Summary

This makes it possible to be used in all modes, instead of just when
-fms-extensions is enabled. Also moves the -fms-extensions-exclusive
traits into their own file so we can check the others aren't dependent
on this flag.

This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.

This was originally a part of D116280.

Depends on D135177.

Diff Detail

Event Timeline

cjdb created this revision.Oct 5 2022, 6:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 6:55 PM
cjdb requested review of this revision.Oct 5 2022, 6:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 6:55 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This doesn't cause us to lose this in Microsoft C mode, does it? Otherwise, LGTM.

cjdb added a comment.Oct 6 2022, 9:15 AM

This doesn't cause us to lose this in Microsoft C mode, does it? Otherwise, LGTM.

Why is destructibility necessary in C?

This doesn't cause us to lose this in Microsoft C mode, does it? Otherwise, LGTM.

Why is destructibility necessary in C?

It isn't particularly? But I don't want to change our behavior and break code if:

// foo.h
struct S{};
bool get_thing() {
return __is_destructible(S);
}

someone runs that in C mode, expecting it to work.

cjdb added a comment.Oct 6 2022, 9:39 AM

This doesn't cause us to lose this in Microsoft C mode, does it? Otherwise, LGTM.

Why is destructibility necessary in C?

It isn't particularly? But I don't want to change our behavior and break code if:

// foo.h
struct S{};
bool get_thing() {
return __is_destructible(S);
}

someone runs that in C mode, expecting it to work.

Right, I can add a C test if it passed in C mode before. Do you want that in a separate file, or can I get away with doing it in type-traits-ms.cpp?

This doesn't cause us to lose this in Microsoft C mode, does it? Otherwise, LGTM.

Why is destructibility necessary in C?

It isn't particularly? But I don't want to change our behavior and break code if:

// foo.h
struct S{};
bool get_thing() {
return __is_destructible(S);
}

someone runs that in C mode, expecting it to work.

Right, I can add a C test if it passed in C mode before. Do you want that in a separate file, or can I get away with doing it in type-traits-ms.cpp?

No need for a separate file, just the -x c sorta flag is fine for me.

cjdb updated this revision to Diff 466316.Oct 8 2022, 4:46 PM
cjdb retitled this revision from [clang] makes `__is_destructible` KEYCXX instead of KEYMS to [clang] makes `__is_destructible` KEYALL instead of KEYMS.
cjdb edited the summary of this revision. (Show Details)

applies feedback, rebases

erichkeane accepted this revision.Oct 10 2022, 6:02 AM
This revision is now accepted and ready to land.Oct 10 2022, 6:02 AM
This revision was landed with ongoing or failed builds.Oct 10 2022, 5:39 PM
This revision was automatically updated to reflect the committed changes.