This revision was automatically updated to reflect the committed changes. Closed by commit rG81e33602f78d: [Sema] Use the value category of the base expression when creating an (authored by ahatanak).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138058/new/ https://reviews.llvm.org/D138058 Files: clang/lib/Sema/SemaExprMember.cpp clang/test/SemaObjC/property-not-lvalue.m Index: clang/test/SemaObjC/property-not-lvalue.m =================================================================== --- clang/test/SemaObjC/property-not-lvalue.m +++ clang/test/SemaObjC/property-not-lvalue.m @@ -7,10 +7,13 @@ } inner; } NSSize; +typedef __attribute__((__ext_vector_type__(2))) float simd_float2; + @interface Foo { NSSize _size; } @property NSSize size; +@property simd_float2 f2; @end void foo(void) { @@ -32,3 +35,8 @@ } - (NSSize)size {} @end + +// clang used to crash compiling this code. +void test(Foo *f) { + simd_float2 *v = &f.f2.xy; // expected-error {{cannot take the address of an rvalue}} +} Index: clang/lib/Sema/SemaExprMember.cpp =================================================================== --- clang/lib/Sema/SemaExprMember.cpp +++ clang/lib/Sema/SemaExprMember.cpp @@ -1621,16 +1621,7 @@ if (BaseType->isExtVectorType()) { // FIXME: this expr should store IsArrow. IdentifierInfo *Member = MemberName.getAsIdentifierInfo(); - ExprValueKind VK; - if (IsArrow) - VK = VK_LValue; - else { - if (PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(BaseExpr.get())) - VK = POE->getSyntacticForm()->getValueKind(); - else - VK = BaseExpr.get()->getValueKind(); - } - + ExprValueKind VK = (IsArrow ? VK_LValue : BaseExpr.get()->getValueKind()); QualType ret = CheckExtVectorComponent(S, BaseType, VK, OpLoc, Member, MemberLoc); if (ret.isNull())
Index: clang/test/SemaObjC/property-not-lvalue.m =================================================================== --- clang/test/SemaObjC/property-not-lvalue.m +++ clang/test/SemaObjC/property-not-lvalue.m @@ -7,10 +7,13 @@ } inner; } NSSize; +typedef __attribute__((__ext_vector_type__(2))) float simd_float2; + @interface Foo { NSSize _size; } @property NSSize size; +@property simd_float2 f2; @end void foo(void) { @@ -32,3 +35,8 @@ } - (NSSize)size {} @end + +// clang used to crash compiling this code. +void test(Foo *f) { + simd_float2 *v = &f.f2.xy; // expected-error {{cannot take the address of an rvalue}} +} Index: clang/lib/Sema/SemaExprMember.cpp =================================================================== --- clang/lib/Sema/SemaExprMember.cpp +++ clang/lib/Sema/SemaExprMember.cpp @@ -1621,16 +1621,7 @@ if (BaseType->isExtVectorType()) { // FIXME: this expr should store IsArrow. IdentifierInfo *Member = MemberName.getAsIdentifierInfo(); - ExprValueKind VK; - if (IsArrow) - VK = VK_LValue; - else { - if (PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(BaseExpr.get())) - VK = POE->getSyntacticForm()->getValueKind(); - else - VK = BaseExpr.get()->getValueKind(); - } - + ExprValueKind VK = (IsArrow ? VK_LValue : BaseExpr.get()->getValueKind()); QualType ret = CheckExtVectorComponent(S, BaseType, VK, OpLoc, Member, MemberLoc); if (ret.isNull())
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits