ahatanak created this revision. ahatanak added a reviewer: rsmith. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous.
This patch attempts to fix the bug introduced in r360308, which is causing clang to reject the following piece of code: typedef __attribute__((__ext_vector_type__(2))) float vector_float2; bool foo123(vector_float2 &A, vector_float2 &B) { return A.x < B.x && B.y > A.y; } The patch sets `ObjectType` to the type of the extended vector in `Sema::ActOnStartCXXMemberReference` so that `Sema::isTemplateName`, which is called later ,returns false. rdar://problem/52619956 Repository: rC Clang https://reviews.llvm.org/D65407 Files: lib/Sema/SemaExprCXX.cpp test/SemaCXX/vector.cpp Index: test/SemaCXX/vector.cpp =================================================================== --- test/SemaCXX/vector.cpp +++ test/SemaCXX/vector.cpp @@ -333,4 +333,10 @@ const PR15730<8, char>::type2 PR15730_2 = {}; } +// This used to be rejected because the name lookup determined 'x' in 'a.x' was +// a template name. +bool templateName(char16_e a, char16_e b) { + return a.x < b.x && b.y > a.y; +} + } // namespace Templates Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -6798,7 +6798,15 @@ ObjectType = ParsedType::make(BaseType); MayBePseudoDestructor = true; return Base; - } else if (!BaseType->isRecordType()) { + } + + if (BaseType->isExtVectorType()) { + ObjectType = ParsedType::make(BaseType); + MayBePseudoDestructor = true; + return Base; + } + + if (!BaseType->isRecordType()) { ObjectType = nullptr; MayBePseudoDestructor = true; return Base;
Index: test/SemaCXX/vector.cpp =================================================================== --- test/SemaCXX/vector.cpp +++ test/SemaCXX/vector.cpp @@ -333,4 +333,10 @@ const PR15730<8, char>::type2 PR15730_2 = {}; } +// This used to be rejected because the name lookup determined 'x' in 'a.x' was +// a template name. +bool templateName(char16_e a, char16_e b) { + return a.x < b.x && b.y > a.y; +} + } // namespace Templates Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -6798,7 +6798,15 @@ ObjectType = ParsedType::make(BaseType); MayBePseudoDestructor = true; return Base; - } else if (!BaseType->isRecordType()) { + } + + if (BaseType->isExtVectorType()) { + ObjectType = ParsedType::make(BaseType); + MayBePseudoDestructor = true; + return Base; + } + + if (!BaseType->isRecordType()) { ObjectType = nullptr; MayBePseudoDestructor = true; return Base;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits