[cfe-dev] Pointer Arithmetic

Keith Bauer onesadcookie at gmail.com
Thu Jul 12 16:49:37 PDT 2007


OK, a new patch, with apparently-working (pointer - pointer) too.

I've made getSize virtual in clang::Type (default implementation
asserts, and it should become pure virtual when it's implemented for
all the subclasses) and renamed the conflicting getSize in
clang::ArrayType to getSizeExpr.

I've added a getPointerDiffType alongside getSizeType, and updated
SemaExpr to return that type for (pointer - pointer).

There's a test case which checks that errors are generated or not as
appropriate in all cases (tests/Parser/pointer-arithmetic.c).

Again, criticism is welcome ;)

-Keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PointerArithmetic.diff
Type: application/octet-stream
Size: 12811 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20070713/33b03a4a/attachment.obj>


More information about the cfe-dev mailing list