]> granicus.if.org Git - clang/commitdiff
Allow ArraySubscriptExpr to be a base node for vector dereference. This
authorNate Begeman <natebegeman@mac.com>
Tue, 19 Feb 2008 01:11:03 +0000 (01:11 +0000)
committerNate Begeman <natebegeman@mac.com>
Tue, 19 Feb 2008 01:11:03 +0000 (01:11 +0000)
allows you to do things like
typedef __attribute__(( ocu_vector_type(4))) float float4;
float4 *x;
float y = x[0][2];

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47295 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaExpr.cpp

index 0d48ad7aa520d99274a0033c476e0a231f741045..31cdc5947f49d9c1f562449709360cafeef82c20 100644 (file)
@@ -414,7 +414,7 @@ ActOnArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
     IndexExpr = RHSExp;
     
     // Component access limited to variables (reject vec4.rg[1]).
-    if (!isa<DeclRefExpr>(BaseExpr)) 
+    if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr)
       return Diag(LLoc, diag::err_ocuvector_component_access, 
                   SourceRange(LLoc, RLoc));
     // FIXME: need to deal with const...