1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 567377 - Add built-ins for Clang already present in parser for other compilers

These were already there for GCC but not for Clang and they are
supported by Clang:
__is_literal (synonym for __is_literal_type)
__is_standard_layout
__is_trivial
__is_trivially_copyable
__float128
__int128

Change-Id: Iec6151492cd30f17e2a5aa4617f6e88812f0f4cc
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
This commit is contained in:
Marc-Andre Laperle 2020-09-26 01:32:42 -04:00 committed by Marc-André Laperle
parent 90a8376658
commit a6baac7172
2 changed files with 62 additions and 8 deletions

View file

@ -181,28 +181,76 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
// As documented at // As documented at
// http://clang.llvm.org/docs/LanguageExtensions.html#checks-for-type-trait-primitives. // http://clang.llvm.org/docs/LanguageExtensions.html#checks-for-type-trait-primitives.
// For now we don't make it dependent on the version. // For now we don't make it dependent on the version.
// Missing ones are in comments
addKeyword(GCCKeywords.cp__has_nothrow_assign, IGCCToken.tTT_has_nothrow_assign); addKeyword(GCCKeywords.cp__has_nothrow_assign, IGCCToken.tTT_has_nothrow_assign);
addKeyword(GCCKeywords.cp__has_nothrow_constructor, IGCCToken.tTT_has_nothrow_constructor); // __has_nothrow_move_assign
addKeyword(GCCKeywords.cp__has_nothrow_copy, IGCCToken.tTT_has_nothrow_copy); addKeyword(GCCKeywords.cp__has_nothrow_copy, IGCCToken.tTT_has_nothrow_copy);
addKeyword(GCCKeywords.cp__has_nothrow_constructor, IGCCToken.tTT_has_nothrow_constructor);
addKeyword(GCCKeywords.cp__has_trivial_assign, IGCCToken.tTT_has_trivial_assign); addKeyword(GCCKeywords.cp__has_trivial_assign, IGCCToken.tTT_has_trivial_assign);
addKeyword(GCCKeywords.cp__has_trivial_constructor, IGCCToken.tTT_has_trivial_constructor); // __has_trivial_move_assign
addKeyword(GCCKeywords.cp__has_trivial_copy, IGCCToken.tTT_has_trivial_copy); addKeyword(GCCKeywords.cp__has_trivial_copy, IGCCToken.tTT_has_trivial_copy);
addKeyword(GCCKeywords.cp__has_trivial_constructor, IGCCToken.tTT_has_trivial_constructor);
addKeyword(GCCKeywords.cp__has_trivial_destructor, IGCCToken.tTT_has_trivial_destructor); addKeyword(GCCKeywords.cp__has_trivial_destructor, IGCCToken.tTT_has_trivial_destructor);
// __has_unique_object_representations
addKeyword(GCCKeywords.cp__has_virtual_destructor, IGCCToken.tTT_has_virtual_destructor); addKeyword(GCCKeywords.cp__has_virtual_destructor, IGCCToken.tTT_has_virtual_destructor);
addKeyword(GCCKeywords.cp__is_abstract, IGCCToken.tTT_is_abstract); addKeyword(GCCKeywords.cp__is_abstract, IGCCToken.tTT_is_abstract);
// __is_aggregate
// __is_arithmetic
// __is_array
// __is_assignable
addKeyword(GCCKeywords.cp__is_base_of, IGCCToken.tTT_is_base_of); addKeyword(GCCKeywords.cp__is_base_of, IGCCToken.tTT_is_base_of);
addKeyword(GCCKeywords.cp__is_class, IGCCToken.tTT_is_class); addKeyword(GCCKeywords.cp__is_class, IGCCToken.tTT_is_class);
// __is_complete_type
// __is_compound
// __is_const
addKeyword(GCCKeywords.cp__is_constructible, IGCCToken.tTT_is_constructible);
// __is_convertible
// __is_convertible_to
// __is_destructible
addKeyword(GCCKeywords.cp__is_empty, IGCCToken.tTT_is_empty); addKeyword(GCCKeywords.cp__is_empty, IGCCToken.tTT_is_empty);
addKeyword(GCCKeywords.cp__is_enum, IGCCToken.tTT_is_enum); addKeyword(GCCKeywords.cp__is_enum, IGCCToken.tTT_is_enum);
addKeyword(GCCKeywords.cp__is_pod, IGCCToken.tTT_is_pod);
addKeyword(GCCKeywords.cp__is_polymorphic, IGCCToken.tTT_is_polymorphic);
addKeyword(GCCKeywords.cp__is_union, IGCCToken.tTT_is_union);
addKeyword(GCCKeywords.cp__is_final, IGCCToken.tTT_is_final); addKeyword(GCCKeywords.cp__is_final, IGCCToken.tTT_is_final);
addKeyword(GCCKeywords.cp__underlying_type, IGCCToken.tTT_underlying_type); // __is_floating_point
addKeyword(GCCKeywords.cp__is_trivially_constructible, IGCCToken.tTT_is_trivially_constructible); // __is_function
// __is_fundamental
// __is_integral
// __is_interface_class
addKeyword(GCCKeywords.cp__is_literal, IGCCToken.tTT_is_literal_type);
addKeyword(GCCKeywords.cp__is_literal_type, IGCCToken.tTT_is_literal_type);
// __is_lvalue_reference
// __is_member_object_pointer
// __is_member_function_pointer
// __is_member_pointer
// __is_nothrow_assignable
// __is_nothrow_constructible
// __is_nothrow_destructible
// __is_object
addKeyword(GCCKeywords.cp__is_pod, IGCCToken.tTT_is_pod);
// __is_pointer
addKeyword(GCCKeywords.cp__is_polymorphic, IGCCToken.tTT_is_polymorphic);
// __is_reference
// __is_rvalue_reference
// __is_same
// __is_same_as
// __is_scalar
// __is_sealed
// __is_signed
addKeyword(GCCKeywords.cp__is_standard_layout, IGCCToken.tTT_is_standard_layout);
addKeyword(GCCKeywords.cp__is_trivial, IGCCToken.tTT_is_trivial);
addKeyword(GCCKeywords.cp__is_trivially_assignable, IGCCToken.tTT_is_trivially_assignable); addKeyword(GCCKeywords.cp__is_trivially_assignable, IGCCToken.tTT_is_trivially_assignable);
addKeyword(GCCKeywords.cp__is_constructible, IGCCToken.tTT_is_constructible); addKeyword(GCCKeywords.cp__is_trivially_constructible, IGCCToken.tTT_is_trivially_constructible);
addKeyword(GCCKeywords.cp__is_trivially_copyable, IGCCToken.tTT_is_trivially_copyable);
// __is_trivially_destructible
addKeyword(GCCKeywords.cp__is_union, IGCCToken.tTT_is_union);
// __is_unsigned
// __is_void
// __reference_binds_to_temporary
addKeyword(GCCKeywords.cp__underlying_type, IGCCToken.tTT_underlying_type);
addKeyword(GCCKeywords.cp__integer_pack, IGCCToken.tTT_integer_pack); addKeyword(GCCKeywords.cp__integer_pack, IGCCToken.tTT_integer_pack);
addKeyword(GCCKeywords.cp__float128, IGCCToken.t__float128);
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);
//TODO verify other gcc ones
} else if (compiler == CompilerType.MSVC) { } else if (compiler == CompilerType.MSVC) {
// As documented at // As documented at
// https://docs.microsoft.com/en-us/cpp/extensions/compiler-support-for-type-traits-cpp-component-extensions?view=vs-2017 // https://docs.microsoft.com/en-us/cpp/extensions/compiler-support-for-type-traits-cpp-component-extensions?view=vs-2017

View file

@ -93,4 +93,10 @@ public class GCCKeywords {
/** @since 6.11*/ /** @since 6.11*/
public static final char[] cp__integer_pack = "__integer_pack".toCharArray(); public static final char[] cp__integer_pack = "__integer_pack".toCharArray();
/**
* This is actually for Clang but we don't maintain separate keywords right now.
* @since 7.1
*/
public static final char[] cp__is_literal = "__is_literal".toCharArray();
} }