[PATCH] D77722: [analyzer] Do not report NSError null dereference for _Nonnull params
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 8 06:28:03 PDT 2020
vsavchenko marked 2 inline comments as done.
vsavchenko added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:521
+ // Annotations that we want to consider make sense only for types.
+ auto Region = dyn_cast_or_null<TypedValueRegion>(Location.getAsRegion());
+ if (!Region)
----------------
NoQ wrote:
> [[ https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable | Too much `auto` ]]!
But this auto is also fine IMO as you can clearly see the actual type in the RHS. Mb `const auto *Region` at least?
================
Comment at: clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:537
+ // be considered non-null as annotated by the developer.
+ if (auto NewState = State->assume(*StoredVal, true)) {
+ Context.addTransition(NewState);
----------------
NoQ wrote:
> Ok, so we're continuing normally if the value is already known to have been assigned to null. We could sink the analysis instead but presumably it's not our job as another checker must have warned before we get there (let's comment about this maybe).
Sure!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77722/new/
https://reviews.llvm.org/D77722
More information about the cfe-commits
mailing list