HomePhabricator

Rework __builtin_classify_type support to better match GCC and to not assert on…

Authored by Richard Smith <richard-llvm@metafoo.co.uk> on May 23 2018, 2:18 PM.

Description

Rework __builtin_classify_type support to better match GCC and to not assert on unusual types.

Following the observed behavior of GCC, we now return -1 for vector types
(along with all of our extensions that GCC doesn't support), and for atomic
types we classify the underlying type.

GCC appears to have changed its classification for function and array arguments
between version 5 and version 6. Previously it would classify them as pointers
in C and as functions or arrays in C++, but from version 6 onwards, it
classifies them as pointers. We now follow the more recent GCC behavior rather
than emulating what I can only assume to be a historical bug in their C++
support for this builtin.

Finally, no version of GCC that I can find has ever used the "method"
classification for C++ pointers to member functions. Instead, GCC classifies
them as record types, presumably reflecting an internal implementation detail,
but whatever the reason we now produce compatible results.

llvm-svn: 333126

Details

Event Timeline

Richard Smith <richard-llvm@metafoo.co.uk> committed rG08b682bec1ee: Rework __builtin_classify_type support to better match GCC and to not assert on… (authored by Richard Smith <richard-llvm@metafoo.co.uk>).May 23 2018, 2:18 PM