steakhal added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1649-1653
+ // NOTE: `VD` is always non-null if `Init` is non-null, so we can check for
+ // null only one of them.
+ const Expr *Init = VD->getAnyInitializer(VD);
if (!Init)
return None;
----------------
Wait. But if `VD` is null, you get a null-dereference.
But you already dereferenced `VD` multiple times, so it cannot be null.
Oh, but the `getAnyInitializer()` will overwrite it! That's a surprise.
TBH I would rather pass a fresh uninitialized pointer if you really need the
exact decl which actually provided the initialized expression to make this
behavior explicit.
That way, with a properly chosen name you could spare the NOTE comment as well.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111542/new/
https://reviews.llvm.org/D111542
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits