[cfe-commits] Patch - Fix range-based for-loop so that it forms proper integer literals
Richard Trieu
rtrieu at google.com
Mon May 2 14:22:52 PDT 2011
>
>
> 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?
>
>
> else if (const VariableArrayType *VAT =
> dyn_cast<VariableArrayType>(UnqAT))
> BoundExpr = VAT->getSizeExpr();
>
>
> Thanks again for looking into this!
> Richard
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110502/23f6f5a5/attachment.html>
More information about the cfe-commits
mailing list