aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-06-20 01:23:19 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-06-20 01:23:19 +0000
commitbc8d7f9fd4346cfcc285868be32b74e019a40f01 (patch)
tree84a36df59f9b9cf232b57ebbe842dd42db30088f /lib/Sema/SemaExpr.cpp
parent085d09d14365cef1faa7a376730911227ee39ee3 (diff)
Restructure the API in Type based on a conversation with Richard Smith.
This makes 'isPointerLikeType' a little less confusing, and pulls the decay check into a separate interface that is much more clear and concrete. Also, just implement these as logical wrappers around other predicates. Having a switch based implementation isn't likely to be necessary. We can try to optimize them later if they show up on a profile. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133405 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 15751d078b..42ec82ac4a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -8963,7 +8963,10 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
QualType LeftType = lhs.get()->getType();
QualType RightType = rhs.get()->getType();
if (LeftNull != RightNull &&
- !LeftType->isPointerLikeType() && !RightType->isPointerLikeType()) {
+ !LeftType->isPointerLikeType() &&
+ !LeftType->canDecayToPointerType() &&
+ !RightType->isPointerLikeType() &&
+ !RightType->canDecayToPointerType()) {
Diag(OpLoc, diag::warn_null_in_arithmetic_operation)
<< (LeftNull ? lhs.get()->getSourceRange()
: rhs.get()->getSourceRange());