summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-03-07 22:20:39 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-03-07 22:20:39 +0000
commit8e3a659105fc0934841d857193bc1521ae070b39 (patch)
treedac096742e67415be0560a4e2ec7f6eda953b029 /clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
parent065962375dbdabd9d6250f5f1b29915b74682417 (diff)
downloadbcm5719-llvm-8e3a659105fc0934841d857193bc1521ae070b39.tar.gz
bcm5719-llvm-8e3a659105fc0934841d857193bc1521ae070b39.zip
[analyzer] [PointerArithChecker] do not warn on indexes into vector types
rdar://35041502 Differential Revision: https://reviews.llvm.org/D44172 llvm-svn: 326952
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
index 4c4a8e3f0d0..63f82b275ba 100644
--- a/clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
@@ -308,6 +308,10 @@ void PointerArithChecker::checkPreStmt(const ArraySubscriptExpr *SubsExpr,
// Indexing with 0 is OK.
if (Idx.isZeroConstant())
return;
+
+ // Indexing vector-type expressions is also OK.
+ if (SubsExpr->getBase()->getType()->isVectorType())
+ return;
reportPointerArithMisuse(SubsExpr->getBase(), C);
}
OpenPOWER on IntegriCloud