diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-05-01 08:48:21 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-05-01 08:48:21 +0000 |
commit | c5276e584e08f7929fe64a06fb3c8d5b2be2e73a (patch) | |
tree | 21449fdeb4cb0dc6db5447ec72cf34b9a8916475 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | f57eba3b202e7abab9ce96025a5deb388ccb24ec (diff) | |
download | bcm5719-llvm-c5276e584e08f7929fe64a06fb3c8d5b2be2e73a.tar.gz bcm5719-llvm-c5276e584e08f7929fe64a06fb3c8d5b2be2e73a.zip |
Have the array type traits build an expression with type 'size_t'
instead of 'int'.
The Embarcadero spec says 'unsigned int', not 'int'. That's what
'size_t' is on Windows, but for Clang using a 'size_t' that can be
larger than int seems more appropriate.
llvm-svn: 130653
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 2ad59e74f29..0f715f0b8f3 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2987,13 +2987,20 @@ ExprResult Sema::BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation RParen) { QualType T = TSInfo->getType(); + // FIXME: This should likely be tracked as an APInt to remove any host + // assumptions about the width of size_t on the target. uint64_t Value = 0; if (!T->isDependentType()) Value = EvaluateArrayTypeTrait(*this, ATT, T, DimExpr, KWLoc); + // While the specification for these traits from the Embarcadero C++ + // compiler's documentation says the return type is 'unsigned int', Clang + // returns 'size_t'. On Windows, the primary platform for the Embarcadero + // compiler, there is no difference. On several other platforms this is an + // important distinction. return Owned(new (Context) ArrayTypeTraitExpr(KWLoc, ATT, TSInfo, Value, DimExpr, RParen, - Context.IntTy)); + Context.getSizeType())); } ExprResult Sema::ActOnExpressionTrait(ExpressionTrait ET, |