This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Introduce `_LIBCPP_OVERRIDABLE_FUNC_VIS`
ClosedPublic

Authored by smeenai on Nov 15 2016, 2:48 PM.

Details

Summary

This is a generalization of _LIBCPP_NEW_DELETE_VIS; the new macro name
captures the semantics better, and also allows us to get rid of the
_WIN32 check in include/new. No functional change.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai updated this revision to Diff 78079.Nov 15 2016, 2:48 PM
smeenai retitled this revision from to [libc++] Introduce `_LIBCPP_OVERRIDABLE_FUNC_VIS`.
smeenai updated this object.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.
EricWF edited edge metadata.Nov 16 2016, 7:07 AM

What happens on windows when operator new isn't overridden and has to be imported from the DLL? Does that work?

EricWF accepted this revision.Nov 16 2016, 7:10 AM
EricWF edited edge metadata.
EricWF added inline comments.
src/new.cpp
163 ↗(On Diff #78079)

You should be able to remove the macro on the definitions since they're redundant.

This revision is now accepted and ready to land.Nov 16 2016, 7:10 AM

What happens on windows when operator new isn't overridden and has to be imported from the DLL? Does that work?

Yup. If you have a function that isn't marked dllimport and it's not found locally, the linker will look for it in the libraries being linked to. dllimport just allows the function call to be more efficient (if a function is marked dllimport, the compiler can call the imported function directly, whereas if it isn't, the linker has to emit a fixup thunk and you end up with an extra function call for each call to the imported function). dllimport is necessary for data symbols though, but fortunately we're not dealing with any of those here.

src/new.cpp
163 ↗(On Diff #78079)

Good point. Will do that before committing.

This revision was automatically updated to reflect the committed changes.