[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 4 inline comments as done. balazske added inline comments. Comment at: clang/test/Analysis/global-region-invalidation.c:6 // Note, we do need to include headers here, since the analyzer checks if the function declaration is located in a system header. +#include

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 411131. balazske added a comment. Improved the tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120310/new/ https://reviews.llvm.org/D120310 Files: clang/include/clang/StaticAnalyzer/Checkers/Checkers.t

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:767-768 s->getType()->isBlockPointerType()); -assert(isa(sreg) || isa(sreg)); +assert(isa(sreg) || isa(sreg) || + isa(sreg)); } -

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-23 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:351-353 +def ErrnoChecker : Checker<"Errno">, + HelpText<"Make the special value 'errno' available to other checkers.">, + Documentation; I think `ErrnoModeling`

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-23 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Errno.h:22 +namespace ento { +namespace errno_check { + steakhal wrote: > I think we can settle on something better. What about calling it simply > `errno`? Just `errno` may not work b

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-23 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 410824. balazske marked 7 inline comments as done. balazske added a comment. Addressed a part of the review comments. The test checker is now a separate checker. Initialization is simplified, `checkASTDecl` is used. Repository: rG LLVM Github Monorepo CH

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-23 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:767-768 s->getType()->isBlockPointerType()); -assert(isa(sreg) || isa(sreg)); +assert(isa(sreg) || isa(sreg) || + isa(sreg)); }

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:767-768 s->getType()->isBlockPointerType()); -assert(isa(sreg) || isa(sreg)); +assert(isa(sreg) || isa(sreg) || + isa(sreg)); } -

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-22 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Good start! However, I'm not a big fan of coupling the testing checker with the actual modeling checker. IMO we should have a distinct checker, similarly to `TaintTester`. That way you could do even fancier things like: define `mylib_may_fail()`, bifurcate and return `

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-22 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added reviewers: NoQ, steakhal, martong. balazske added a comment. Herald added subscribers: ormris, rnkovacs. Documentation not added yet. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120310/new/ https://reviews.llvm.org/D120310 ___

[PATCH] D120310: [clang][analyzer] Add modeling of 'errno' (work-in-progress).

2022-02-22 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: steakhal, ASDenysPetrov, martong, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun, mgorny. Herald added a reviewer: Szelethus. balazske requested review of this revision. Herald a