[cfe-dev] OpenCL vec_step feature implementation - Updated

Anton Lokhmotov Anton.Lokhmotov at arm.com
Wed Feb 16 06:36:21 PST 2011

Hi Guy,

Index: lib/Sema/SemaDeclCXX.cpp
-  } else if (isa<SizeOfAlignOfExpr>(S)) {
+  } else if (isa<UnaryTypePropertyExpr>(S)) {
     // sizeof/alignof doesn't reference contents, do not warn.
     return false;

Index: include/clang/Frontend/StmtXML.def
-NODE_XML(SizeOfAlignOfExpr, "SizeOfAlignOfExpr")        // sizeof(expr) or
+NODE_XML(UnaryTypePropertyExpr, "UnaryTypePropertyExpr")        //
sizeof(expr) or alignof(expr)

Can you please update the comments as well?

Index: test/CodeGenOpenCL/opencl_vecstep.cl
This test is CodeGenOpenCL, so the prefix "opencl_" is superfluous.  Perhaps
call this file  vec_step.cl?

Can you please add invalid test cases verifying that vec_step() cannot be
applied to types other than scalar and vector built-in types, including
pointer types?

> I took care of the rest of your comments, and changed the
> SizeOfAlignOfExpr name to UnaryTypePropertyExpr.
Aside: While I'm not aware of any binary type property expressions, I guess
there could be an operator, say, is_compatible(type1, type2) returning true
if type1 is in some sense "compatible" with type2 and false otherwise.  For
example, if "compatible" would mean "type1 can be implicitly converted to
type2", for OpenCL is_compatible(int4, int4) would return true and
is_compatible(int4, uint4) would return false.  Currently this is only of
theoretical interest of course :).

Many thanks,

More information about the cfe-dev mailing list