[PATCH] D122150: [clang][analyzer] Add checker for bad use of 'errno'.
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 22 11:31:12 PDT 2022
steakhal added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoChecker.cpp:68-71
+ if (ErrnoLoc) {
+ ErrnoRegion = ErrnoLoc->getAsRegion();
+ assert(ErrnoRegion && "The 'errno' location should be a memory region.");
+ }
----------------
NoQ wrote:
> steakhal wrote:
> > `Loc` always wrap a memregion of some sort.
> Nope; null pointer is a `Loc` but doesn't correspond to any memory region.
>
> I usually print out doxygen inheritance graphs:
>
> - https://clang.llvm.org/doxygen/classclang_1_1ento_1_1SVal__inherit__graph.png
> - https://clang.llvm.org/doxygen/classclang_1_1ento_1_1SymExpr__inherit__graph.png
> - https://clang.llvm.org/doxygen/classclang_1_1ento_1_1MemRegion__inherit__graph.png
>
> and hang them on the wall near my desk. They're really handy.
>
>
> On a separate note, why not make this assertion part of `getErrnoLoc()`?
ah true
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122150/new/
https://reviews.llvm.org/D122150
More information about the cfe-commits
mailing list