[PATCH] D41384: [analyzer] Suppress false positive warnings form security.insecureAPI.strcpy

AndrĂ¡s Leitereg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 12:03:37 PST 2018


leanil marked 2 inline comments as done.
leanil added a comment.

In https://reviews.llvm.org/D41384#973851, @NoQ wrote:

> Do you have commit access or should someone else commit it for you?


I don't have, please commit it.



================
Comment at: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp:517
+    if (const auto *Array = dyn_cast<ConstantArrayType>(
+            DeclRef->getDecl()->getType().getTypePtr())) {
+      unsigned long long ArraySize = Array->getSize().getLimitedValue();
----------------
NoQ wrote:
> This can be simplified to `const auto *Array = DeclRef->getType()->getAs<ConstantArrayType>()`.
> `.getTypePtr()` is almost always redundant because of the fancy `operator->()` on `QualType`.
Using `getAs` yielded: 
> error: static assertion failed: ArrayType cannot be used with getAs!




https://reviews.llvm.org/D41384





More information about the cfe-commits mailing list