[clang] [analyzer] Switch to PostStmt callbacks in ArrayBoundV2 (PR #72107)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 12:03:24 PST 2023


https://github.com/Xazax-hun approved this pull request.

I wish we could clean up `checkLocation` to work as expected for all cases. It is more future proof in the sense that if C++ introduces new kinds of statements or expressions that could index into something (like multi-dimensional `operator[]`), checks continue to work without change after the analysis engine is updated. 

It is a higher-level abstraction that lets checker authors focus on the semantics without having to enumerate all the patterns the check might be interested in which is often impossible in C++, let alone considering all the extensions implemented by Clang. So, these high-level abstractions supposed to deduplicate a lot of work by doing all the pattern matching once and for all in the engine, so checkers could benefit from this work without duplicating some of that pattern matching in every checker.

All that being said, I understand that it is more practical to just work these engine problems around in this check for now as we do not have a volunteer to revamp `checkLocation` at the moment. I know @steakhal looked into it, but it turned out to be a bigger fish than we expected.  So, I'd say let's land this as a practical middle-term solution on the hope that we will be able to come back and clean this up at some point using something that is more future proof. 

https://github.com/llvm/llvm-project/pull/72107


More information about the cfe-commits mailing list