summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-02-19 04:55:58 +0000
committerAnders Carlsson <andersca@mac.com>2009-02-19 04:55:58 +0000
commitef56fbaa39724b55c085cdaf5572d697e7d029ff (patch)
tree335e10b043d5ae88543fc0dc72f3c0e661a50d00 /clang/lib
parentcb60143ec34520d9e8ef3e5f6c7b279d020550c4 (diff)
downloadbcm5719-llvm-ef56fbaa39724b55c085cdaf5572d697e7d029ff.tar.gz
bcm5719-llvm-ef56fbaa39724b55c085cdaf5572d697e7d029ff.zip
Handle the GNU void* and function pointer arithmetic extensions for constant expressions as well.
llvm-svn: 65013
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ExprConstant.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index d573236783e..da251fcea9a 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -292,7 +292,13 @@ APValue PointerExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
return APValue();
QualType PointeeType = PExp->getType()->getAsPointerType()->getPointeeType();
- uint64_t SizeOfPointee = Info.Ctx.getTypeSize(PointeeType) / 8;
+ uint64_t SizeOfPointee;
+
+ // Explicitly handle GNU void* and function pointer arithmetic extensions.
+ if (PointeeType->isVoidType() || PointeeType->isFunctionType())
+ SizeOfPointee = 1;
+ else
+ SizeOfPointee = Info.Ctx.getTypeSize(PointeeType) / 8;
uint64_t Offset = ResultLValue.getLValueOffset();
OpenPOWER on IntegriCloud