]> granicus.if.org Git - clang/commit
Rework __builtin_classify_type support to better match GCC and to not assert on
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 23 May 2018 21:18:00 +0000 (21:18 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 23 May 2018 21:18:00 +0000 (21:18 +0000)
commit02f3a0b412a22f6b377fe14ff30b991dba30f06e
treee53486312cb70c36391a4b6b969f608a2b9f4f12
parent54f3f9c02f9c7b4f1d0046584421b08f21367702
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333126 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ExprConstant.cpp
test/Sema/builtin-classify-type.c
test/SemaCXX/builtin-classify-type.cpp