r184123 - Fix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204.
Eli Friedman
eli.friedman at gmail.com
Mon Jun 17 14:09:57 PDT 2013
Author: efriedma
Date: Mon Jun 17 16:09:57 2013
New Revision: 184123
URL: http://llvm.org/viewvc/llvm-project?rev=184123&view=rev
Log:
Fix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204.
Modified:
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/test/SemaCXX/vector.cpp
Modified: cfe/trunk/lib/AST/ExprClassification.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprClassification.cpp?rev=184123&r1=184122&r2=184123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprClassification.cpp (original)
+++ cfe/trunk/lib/AST/ExprClassification.cpp Mon Jun 17 16:09:57 2013
@@ -291,8 +291,11 @@ static Cl::Kinds ClassifyInternal(ASTCon
// Extended vector element access is an lvalue unless there are duplicates
// in the shuffle expression.
case Expr::ExtVectorElementExprClass:
- return cast<ExtVectorElementExpr>(E)->containsDuplicateElements() ?
- Cl::CL_DuplicateVectorComponents : Cl::CL_LValue;
+ if (cast<ExtVectorElementExpr>(E)->containsDuplicateElements())
+ return Cl::CL_DuplicateVectorComponents;
+ if (cast<ExtVectorElementExpr>(E)->isArrow())
+ return Cl::CL_LValue;
+ return ClassifyInternal(Ctx, cast<ExtVectorElementExpr>(E)->getBase());
// Simply look at the actual default argument.
case Expr::CXXDefaultArgExprClass:
Modified: cfe/trunk/test/SemaCXX/vector.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/vector.cpp?rev=184123&r1=184122&r2=184123&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/vector.cpp (original)
+++ cfe/trunk/test/SemaCXX/vector.cpp Mon Jun 17 16:09:57 2013
@@ -278,3 +278,7 @@ void test_pseudo_dtor(fltx4 *f) {
(*f).~fltx4();
test_pseudo_dtor_tmpl(f);
}
+
+// PR16204
+typedef __attribute__((ext_vector_type(4))) int vi4;
+const int &reference_to_vec_element = vi4(1).x;
More information about the cfe-commits
mailing list