aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2011-05-02 23:00:27 +0000
committerRichard Trieu <rtrieu@google.com>2011-05-02 23:00:27 +0000
commit1dd986dff9ddfbec687975700770bb377988e9ed (patch)
tree1eca5884c15a9a79939344e626686b10d47eb295 /lib/Sema/SemaStmt.cpp
parenta87a2b2d18b7482f91994e2bba769cddea8bd0ee (diff)
Added an assert to IntegerLiteral to ensure that the integer type passed in has the same size as the APInt passed in. Also, updated the comments around IntegerLiteral.
Changed the integer type that range-based for-loops used. Switched to pointer difference type, which satisfies the new assert in IntegerLiteral. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 65cea7a69d..a60fcb7097 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -1252,7 +1252,8 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc,
ExprResult BoundExpr;
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(UnqAT))
BoundExpr = Owned(IntegerLiteral::Create(Context, CAT->getSize(),
- Context.IntTy, RangeLoc));
+ Context.getPointerDiffType(),
+ RangeLoc));
else if (const VariableArrayType *VAT =
dyn_cast<VariableArrayType>(UnqAT))
BoundExpr = VAT->getSizeExpr();