This is an archive of the discontinued LLVM Phabricator instance.

[clang][feature] Add cxx_abi_relative_vtable feature
ClosedPublic

Authored by leonardchan on Aug 13 2020, 12:30 PM.

Details

Summary

This will be enabled if relative vtables are enabled.

Diff Detail

Event Timeline

leonardchan created this revision.Aug 13 2020, 12:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 12:31 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
leonardchan requested review of this revision.Aug 13 2020, 12:31 PM
leonardchan added a reviewer: ldionne.
ldionne added inline comments.Aug 13 2020, 1:48 PM
clang/lib/Frontend/InitPreprocessor.cpp
1127 ↗(On Diff #285464)

Should we be using some __has_feature(...) instead?

mcgrathr added inline comments.Aug 13 2020, 1:49 PM
clang/lib/Frontend/InitPreprocessor.cpp
1127 ↗(On Diff #285464)

This should also test LangOpts.CplusPlus so it's never defined in C compilation.

I don't know what precedents there are to follow for how to choose the exact name here.
Having something like __CXX_ABI_ be a prefix for all such things seems wise.

mcgrathr added inline comments.Aug 13 2020, 2:03 PM
clang/lib/Frontend/InitPreprocessor.cpp
1127 ↗(On Diff #285464)

That does seem like a very good fit here, and really easy to use with just one line in Features.def AFAICT.
Maybe __has_feature(cxx_abi_relative_vtable) and in future add more cxx_abi_foo ones?

leonardchan retitled this revision from [clang] Add __RELATIVE_CXX_ABI_VTABLES predefine macro to [clang][feature] Add cxx_abi_relative_vtable feature.
leonardchan edited the summary of this revision. (Show Details)
mcgrathr accepted this revision.Aug 14 2020, 1:05 PM

LGTM but I'm not sure who should sign off on new __has_feature symbols.

This revision is now accepted and ready to land.Aug 14 2020, 1:05 PM

CC @aaron.ballman who committed Features.def for signing off or knowing someone who can sign off.

*ping* @aaron.ballman. Would you be able to sign off on this? Otherwise, I'll probably commit this in the next few days.

ldionne accepted this revision.Sep 1 2020, 7:48 AM

This LGTM, but I agree someone should sign off on whether __has_feature is the right approach here. @aaron.ballman ?

This revision was automatically updated to reflect the committed changes.