@@ -2456,67 +2456,6 @@ static bool isTypeSubstitutable(Qualifiers Quals, const Type *Ty,
24562456 return true ;
24572457}
24582458
2459- namespace {
2460- struct DeclContextDesc {
2461- Decl::Kind DeclKind;
2462- StringRef Name;
2463- };
2464- } // namespace
2465-
2466- // For Scopes argument, the only supported Decl::Kind values are:
2467- // - Namespace
2468- // - CXXRecord
2469- // - ClassTemplateSpecialization
2470- static bool matchQualifiedTypeName (const QualType &Ty,
2471- ArrayRef<DeclContextDesc> Scopes) {
2472- // The idea: check the declaration context chain starting from the type
2473- // itself. At each step check the context is of expected kind
2474- // (namespace) and name.
2475- const CXXRecordDecl *RecTy = Ty->getAsCXXRecordDecl ();
2476-
2477- if (!RecTy)
2478- return false ; // only classes/structs supported
2479- const auto *Ctx = dyn_cast<DeclContext>(RecTy);
2480-
2481- for (const auto &Scope : llvm::reverse (Scopes)) {
2482- Decl::Kind DK = Ctx->getDeclKind ();
2483- StringRef Name = " " ;
2484-
2485- if (DK != Scope.DeclKind )
2486- return false ;
2487-
2488- switch (DK) {
2489- case Decl::Kind::ClassTemplateSpecialization:
2490- // ClassTemplateSpecializationDecl inherits from CXXRecordDecl
2491- case Decl::Kind::CXXRecord:
2492- Name = cast<CXXRecordDecl>(Ctx)->getName ();
2493- break ;
2494- case Decl::Kind::Namespace:
2495- Name = cast<NamespaceDecl>(Ctx)->getName ();
2496- break ;
2497- default :
2498- return false ;
2499- }
2500- if (Name != Scope.Name )
2501- return false ;
2502- Ctx = Ctx->getParent ();
2503- }
2504- return Ctx->isTranslationUnit ();
2505- }
2506-
2507- static bool isSYCLHostHalfType (const Type *Ty) {
2508- // FIXME: this is not really portable, since the bunch of namespace below
2509- // is not specified by the SYCL standard and highly depends on particular
2510- // implementation
2511- static const std::array<DeclContextDesc, 5 > Scopes = {
2512- DeclContextDesc{Decl::Kind::Namespace, " cl" },
2513- DeclContextDesc{Decl::Kind::Namespace, " sycl" },
2514- DeclContextDesc{Decl::Kind::Namespace, " detail" },
2515- DeclContextDesc{Decl::Kind::Namespace, " half_impl" },
2516- DeclContextDesc{Decl::Kind::CXXRecord, " half" }};
2517- return matchQualifiedTypeName (QualType (Ty, 0 ), Scopes);
2518- }
2519-
25202459void CXXNameMangler::mangleType (QualType T) {
25212460 // If our type is instantiation-dependent but not dependent, we mangle
25222461 // it as it was written in the source, removing any top-level sugar.
@@ -2576,11 +2515,6 @@ void CXXNameMangler::mangleType(QualType T) {
25762515
25772516 bool isSubstitutable =
25782517 isTypeSubstitutable (quals, ty, Context.getASTContext ());
2579- if (Context.isUniqueNameMangler () && isSYCLHostHalfType (ty)) {
2580- // Set isSubstitutable to false for cl::sycl::detail::half_impl::half
2581- // to achieve the same mangling for other components
2582- isSubstitutable = false ;
2583- }
25842518 if (isSubstitutable && mangleSubstitution (T))
25852519 return ;
25862520
@@ -3057,11 +2991,6 @@ void CXXNameMangler::mangleType(const RecordType *T) {
30572991 mangleType (static_cast <const TagType*>(T));
30582992}
30592993void CXXNameMangler::mangleType (const TagType *T) {
3060- if (Context.isUniqueNameMangler () && isSYCLHostHalfType (T)) {
3061- // Mangle cl::sycl::detail::half_imple::half as _Float16
3062- mangleType (Context.getASTContext ().Float16Ty );
3063- return ;
3064- }
30652994 mangleName (T->getDecl ());
30662995}
30672996
0 commit comments