[cfe-commits] Patch - Fix range-based for-loop so that it forms proper integer literals
rtrieu at google.com
Mon May 2 16:07:18 PDT 2011
Committed as revision 130739.
On Mon, May 2, 2011 at 3:27 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> Hi Richard,
> On Mon, May 2, 2011 22:22, Richard Trieu wrote:
> >> Index: lib/Sema/SemaStmt.cpp
> >> ===================================================================
> >> --- lib/Sema/SemaStmt.cpp (revision 129825)
> >> +++ lib/Sema/SemaStmt.cpp (working copy)
> >> @@ -1257,7 +1257,8 @@
> >> ExprResult BoundExpr;
> >> if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(UnqAT))
> >> BoundExpr = Owned(IntegerLiteral::Create(Context, CAT->getSize(),
> >> - Context.IntTy,
> >> RangeLoc));
> >> +
> >> Context.getPointerDiffType(),
> >> + RangeLoc));
> >> This should be the pointer difference type for the right address space.
> >> You could add an accessor to ASTContext to get the corresponding type
> >> for the array's address space from the target info (perhaps
> >> ASTContext::getArrayBoundType(QualType ArrayType)).
> > I am not sure I understand. I thought that there's only one pointer
> > difference type?
> In C and C++, there is, but TargetInfo provides the possibility of
> different PtrDiffTypes for each address space. However, looking a little
> deeper it seems that clang doesn't actually use those other types yet, so
> I think your latest patch is fine for now. Feel free to check it in!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits