[PATCH] D69318: [analyzer] Add SufficientSizeArrayIndexingChecker

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 03:17:56 PDT 2019


steakhal added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SufficientSizeArrayIndexingChecker.cpp:75
+  // Should not warn on literal index expressions.
+  if (dyn_cast<IntegerLiteral>(Index->IgnoreParenCasts()))
+    return;
----------------
Shoudn't we use `isa<>` if we don't use the resulting pointer?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SufficientSizeArrayIndexingChecker.cpp:126
+                            C.getASTContext().UnsignedLongLongTy);
+  if (NumArrayElemsMinusOne.isUnknownOrUndef())
+    return;
----------------
I think its better to stay consistent regards naming.
Use either number literals expressing numeric values, or spell out its name.
I would prefer the latter like: `ConstantOne` with type `SVal`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69318/new/

https://reviews.llvm.org/D69318





More information about the cfe-commits mailing list