[cfe-commits] r47295 - /cfe/trunk/Sema/SemaExpr.cpp

Nate Begeman natebegeman at mac.com
Mon Feb 18 17:11:03 PST 2008


Author: sampo
Date: Mon Feb 18 19:11:03 2008
New Revision: 47295

URL: http://llvm.org/viewvc/llvm-project?rev=47295&view=rev
Log:
Allow ArraySubscriptExpr to be a base node for vector dereference.  This
allows you to do things like 
typedef __attribute__(( ocu_vector_type(4))) float float4;
float4 *x;
float y = x[0][2];

Modified:
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=47295&r1=47294&r2=47295&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Feb 18 19:11:03 2008
@@ -414,7 +414,7 @@
     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...





More information about the cfe-commits mailing list