[PATCH] D24792: [analyzer] Fix crash in RetainCountChecker::checkEndFunction
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 21 04:03:11 PDT 2016
NoQ added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp:3866
@@ -3865,3 +3865,3 @@
if (LCtx->getAnalysisDeclContext()->isBodyAutosynthesized()) {
- assert(LCtx->getParent());
+ assert(LCtx->inTopFrame() || LCtx->getParent());
return;
----------------
Hmm. This assert is trivially true and can be omitted.
However, the assert here has a reason: we clearly shouldn't be trying to analyze synthesized bodies as top-level functions. Because any errors we find this way would never have any tiniest thing to do with the code we've been asked to analyze by the user.
So i think this problem could use a little bit more attention.
Also, i think the correct way to write this assert would be `!LCtx->inTopFrame()` (which would be compatible with `ScopeContext` whenever we have it).
Repository:
rL LLVM
https://reviews.llvm.org/D24792
More information about the cfe-commits
mailing list