This is an archive of the discontinued LLVM Phabricator instance.

[C++4OpenCL] NULL redefined as nullptr
ClosedPublic

Authored by Topotuna on Jul 14 2021, 8:08 AM.

Details

Summary

Redefines NULL as nullptr instead of ((void*)0) in C++ for OpenCL.

Such internal representation of NULL provides compatibility with
C++11 and later language standards.

Fixes llvm.org/PR48098

Diff Detail

Event Timeline

Topotuna created this revision.Jul 14 2021, 8:08 AM
Topotuna requested review of this revision.Jul 14 2021, 8:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2021, 8:08 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Anastasia added inline comments.Jul 15 2021, 3:43 AM
clang/test/SemaOpenCL/null_literal.cl
2

I think these lines here are from another patch.

12

hmm, you should not get those errors though https://godbolt.org/z/qvr7x11TM

Topotuna updated this revision to Diff 359256.Jul 16 2021, 2:23 AM

Patch made compatible with changes to D105988

Topotuna marked an inline comment as done.Jul 16 2021, 2:24 AM
Topotuna added inline comments.
clang/test/SemaOpenCL/null_literal.cl
12

The expected-error here refers to line 15 which displays an error: https://godbolt.org/z/zYzGedzv4

Anastasia added inline comments.Jul 16 2021, 9:45 AM
clang/test/SemaOpenCL/null_literal.cl
12

Makes sense. Sorry I didn't notice.

25

while we are at it, do you mind changing this check into

__OPENCL_CPP_VERSION__ == 200

and then we can remove -DCL20 from the run line

Topotuna updated this revision to Diff 359702.Jul 19 2021, 2:21 AM

Separate NFC performed in D106254

Topotuna marked an inline comment as done.Jul 19 2021, 2:23 AM
Topotuna added inline comments.
clang/test/SemaOpenCL/null_literal.cl
25

Done in a separate patch D106254 because it is unrelated to this change.

Anastasia accepted this revision.Jul 19 2021, 2:48 PM

LGTM! Thanks

This revision is now accepted and ready to land.Jul 19 2021, 2:48 PM
This revision was landed with ongoing or failed builds.Jul 27 2021, 8:34 AM
This revision was automatically updated to reflect the committed changes.