[cfe-commits] r170428 [1/3] - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Sema/ include/clang/Serialization/ lib/AST/ lib/CodeGen/ lib/Parse/ lib/Sema/ lib/Serialization/ test/CodeGenOpenCL/ test/PCH/ test/Parser/ tools/li...

Benyei, Guy via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 3 01:04:42 PST 2016


Hi Richard,
Since these are OpenCL specific types, I think you are right,  these types shouldn't be part of the C++ ABI library.

Thanks
     Guy

-----Original Message-----
From: metafoo at gmail.com [mailto:metafoo at gmail.com] On Behalf Of Richard Smith
Sent: Wednesday, February 03, 2016 02:46
To: Benyei, Guy <guy.benyei at intel.com>; cfe-commits <cfe-commits at lists.llvm.org>
Subject: Fwd: [cfe-commits] r170428 [1/3] - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Sema/ include/clang/Serialization/ lib/AST/ lib/CodeGen/ lib/Parse/ lib/Sema/ lib/Serialization/ test/CodeGenOpenCL/ test/PCH/ test/Parser/ tools/li...

Hi Guy,

> Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?r
> ev=170428&r1=170427&r2=170428&view=diff
> ======================================================================
> ========
> --- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Tue Dec 18 06:30:03 2012
> @@ -1,1011 +1,1017 @@
[...]
> -/// TypeInfoIsInStandardLibrary - Given a builtin type, returns 
> whether the type -/// info for that type is defined in the standard library.
> -static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
> -  // Itanium C++ ABI 2.9.2:
> -  //   Basic type information (e.g. for "int", "bool", etc.) will be kept in
> -  //   the run-time support library. Specifically, the run-time support
> -  //   library should contain type_info objects for the types X, X* and
> -  //   X const*, for every X in: void, std::nullptr_t, bool, wchar_t, char,
> -  //   unsigned char, signed char, short, unsigned short, int, unsigned int,
> -  //   long, unsigned long, long long, unsigned long long, float, double,
> -  //   long double, char16_t, char32_t, and the IEEE 754r decimal and
> -  //   half-precision floating point types.
> -  switch (Ty->getKind()) {
> -    case BuiltinType::Void:
> -    case BuiltinType::NullPtr:
> -    case BuiltinType::Bool:
> -    case BuiltinType::WChar_S:
> -    case BuiltinType::WChar_U:
> -    case BuiltinType::Char_U:
> -    case BuiltinType::Char_S:
> -    case BuiltinType::UChar:
> -    case BuiltinType::SChar:
> -    case BuiltinType::Short:
> -    case BuiltinType::UShort:
> -    case BuiltinType::Int:
> -    case BuiltinType::UInt:
> -    case BuiltinType::Long:
> -    case BuiltinType::ULong:
> -    case BuiltinType::LongLong:
> -    case BuiltinType::ULongLong:
> -    case BuiltinType::Half:
> -    case BuiltinType::Float:
> -    case BuiltinType::Double:
> -    case BuiltinType::LongDouble:
> -    case BuiltinType::Char16:
> -    case BuiltinType::Char32:
> -    case BuiltinType::Int128:
> -    case BuiltinType::UInt128:
> -      return true;
> +/// TypeInfoIsInStandardLibrary - Given a builtin type, returns 
> +whether the type /// info for that type is defined in the standard library.
> +static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
> +  // Itanium C++ ABI 2.9.2:
> +  //   Basic type information (e.g. for "int", "bool", etc.) will be kept in
> +  //   the run-time support library. Specifically, the run-time support
> +  //   library should contain type_info objects for the types X, X* and
> +  //   X const*, for every X in: void, std::nullptr_t, bool, wchar_t, char,
> +  //   unsigned char, signed char, short, unsigned short, int, unsigned int,
> +  //   long, unsigned long, long long, unsigned long long, float, double,
> +  //   long double, char16_t, char32_t, and the IEEE 754r decimal and
> +  //   half-precision floating point types.
> +  switch (Ty->getKind()) {
> +    case BuiltinType::Void:
> +    case BuiltinType::NullPtr:
> +    case BuiltinType::Bool:
> +    case BuiltinType::WChar_S:
> +    case BuiltinType::WChar_U:
> +    case BuiltinType::Char_U:
> +    case BuiltinType::Char_S:
> +    case BuiltinType::UChar:
> +    case BuiltinType::SChar:
> +    case BuiltinType::Short:
> +    case BuiltinType::UShort:
> +    case BuiltinType::Int:
> +    case BuiltinType::UInt:
> +    case BuiltinType::Long:
> +    case BuiltinType::ULong:
> +    case BuiltinType::LongLong:
> +    case BuiltinType::ULongLong:
> +    case BuiltinType::Half:
> +    case BuiltinType::Float:
> +    case BuiltinType::Double:
> +    case BuiltinType::LongDouble:
> +    case BuiltinType::Char16:
> +    case BuiltinType::Char32:
> +    case BuiltinType::Int128:
> +    case BuiltinType::UInt128:
> +    case BuiltinType::OCLImage1d:
> +    case BuiltinType::OCLImage1dArray:
> +    case BuiltinType::OCLImage1dBuffer:
> +    case BuiltinType::OCLImage2d:
> +    case BuiltinType::OCLImage2dArray:
> +    case BuiltinType::OCLImage3d:
> +      return true;

This change is wrong. If you add types here, you must also add them to
EmitFundamentalRTTIDescriptor:

[...]
> -void CodeGenModule::EmitFundamentalRTTIDescriptor(QualType Type) {
> -  QualType PointerType = Context.getPointerType(Type);
> -  QualType PointerTypeConst = 
> Context.getPointerType(Type.withConst());
> -  RTTIBuilder(*this).BuildTypeInfo(Type, true);
> -  RTTIBuilder(*this).BuildTypeInfo(PointerType, true);
> -  RTTIBuilder(*this).BuildTypeInfo(PointerTypeConst, true); -}
> -
> -void CodeGenModule::EmitFundamentalRTTIDescriptors() {
> -  QualType FundamentalTypes[] = { Context.VoidTy, Context.NullPtrTy,
> -                                  Context.BoolTy, Context.WCharTy,
> -                                  Context.CharTy, Context.UnsignedCharTy,
> -                                  Context.SignedCharTy, Context.ShortTy,
> -                                  Context.UnsignedShortTy, Context.IntTy,
> -                                  Context.UnsignedIntTy, Context.LongTy,
> -                                  Context.UnsignedLongTy, Context.LongLongTy,
> -                                  Context.UnsignedLongLongTy, Context.FloatTy,
> -                                  Context.DoubleTy, Context.LongDoubleTy,
> -                                  Context.Char16Ty, Context.Char32Ty };
> -  for (unsigned i = 0; i < sizeof(FundamentalTypes)/sizeof(QualType); ++i)
> -    EmitFundamentalRTTIDescriptor(FundamentalTypes[i]);
> -}

Should these type descriptors be part of the C++ ABI library or not? I would suspect not, as GCC does not do so.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the cfe-commits mailing list