[clang] [analyzer] Fix crash in Stream checker when using void pointers (PR #97199)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 1 07:59:42 PDT 2024
================
@@ -1034,16 +1034,16 @@ void StreamChecker::preWrite(const FnDescription *Desc, const CallEvent &Call,
C.addTransition(State);
}
-static std::optional<QualType> getPointeeType(const MemRegion *R) {
+static QualType getPointeeType(const MemRegion *R) {
if (!R)
- return std::nullopt;
+ return {};
if (const auto *ER = dyn_cast<ElementRegion>(R))
- return ER->getElementType();
+ return ER->getElementType()->getCanonicalTypeUnqualified();
----------------
NagyDonat wrote:
Consider moving the `->getCanonicalTypeUnqualified()` calls into `escapeByStartIndexAndCount()` because that's the only place where it will be relevant. (This would eliminate the code duplication.)
https://github.com/llvm/llvm-project/pull/97199
More information about the cfe-commits
mailing list