This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix PR23589: std::function doesn't recognize null pointer to varargs function.
ClosedPublic

Authored by EricWF on Jul 10 2015, 3:30 PM.

Details

Summary

This patch fixes __not_null's detection of nullptr by breaking it down into 4 cases.

  1. __not_null(Tp const&): Default case. Tp is not null.
  2. __not_null(Tp* __ptr); Case for pointers to functions.
  3. __not_null(_Ret _Class::* __ptr); Case for pointers to members.
  4. __not_null(function<Tp> const&);: Cases for other std::functions.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 29499.Jul 10 2015, 3:30 PM
EricWF retitled this revision from to [libcxx] Fix PR23589: std::function doesn't recognize null pointer to varargs function..
EricWF updated this object.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.
mclow.lists edited edge metadata.Jul 21 2015, 8:11 AM

This looks like a nice simplification, and the test is great.

However, I have some concerns about where the pieces live - see inline comments.

include/__functional_03
207

It's not clear to me that removing this declaration is correct. There are specializations of function in this file.

761

Where is __functional_03 getting the definition of __not_null from?

It doesn't include any other headers.

Respond to @mclow.lists inline comments. No change is needed to address the concerns.

include/__functional_03
207

It should be getting the declaration from <functional> before functional includes <__functional_03> inline.

761

<__functional_03> in included inline by <functional> *after* the definition of __not_null.

include/functional
1259

Here in the inline <__functional_03> include. You'll notice the foward declaration of function and the definitions of __not_null.

EricWF updated this revision to Diff 30320.Jul 21 2015, 9:25 PM
EricWF edited edge metadata.

Re-merge work after cleaning up <__functional_03>.

EricWF updated this revision to Diff 30418.Jul 22 2015, 3:58 PM

Remerged after more changes to <functional>.

@mclow.lists: ping. Anything more to say on this?

mclow.lists accepted this revision.Aug 3 2015, 10:45 AM
mclow.lists edited edge metadata.

LGTM now.

This revision is now accepted and ready to land.Aug 3 2015, 10:45 AM
EricWF closed this revision.Aug 18 2015, 12:42 PM