NoQ added inline comments.
================ 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(); ---------------- leanil wrote: > 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! > > Whoops, yeah, right, array types are the rare exception. It should be `ASTContext.getAsConstantArrayType()`, see the docs for `getAsArrayType()` for some explanation of why it was made this way. I guess we don't really care about these aspects, so your code is fine :) https://reviews.llvm.org/D41384 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits