[cfe-dev] Pointer Arithmetic

Steve Naroff snaroff at apple.com
Thu Jul 12 07:17:07 PDT 2007

+    // How does one find the size of a QualType, or the llvm::Type it
+    // corresponds to?


Currently, clang::BuiltinType is the only type that knows it's size  
(see getSize()).

Eventually, getSize() will be implemented by clang::Type (the root of  
the type hierarchy).

The main "gotcha" (with implementing it in Type) is struct layout  
(which is none trivial and target specific).


On Jul 12, 2007, at 2:25 AM, Keith Bauer wrote:

> I've been working on pointer arithmetic.  Attached is a patch which
> seems to correctly implement (pointer + int), (int + pointer) and
> (pointer - int).  (pointer - pointer) doesn't seem to be possible
> within the infrastructure that exists, though I'd like confirmation of
> this.  See my comments in the patch.
> Obviously, since this is my first effort, I'd like comments on what
> I've done well and what I've (inevitably) done poorly.  I'm not really
> sure of the design or coding conventions of the project.
> Also, there's no test-cases.  I haven't figured out how they're
> supposed to work yet.
> -Keith
> <PointerMath.diff>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list