baloghadamsoftware added a comment.
In D77229#2005033 <https://reviews.llvm.org/D77229#2005033>, @NoQ wrote:
> > How do we calculate the type then?
>
> Argument expression type + account for value kind (lvalue argument expression
> means reference parameter, xvalue argument expression mean rvalue reference
> parameter).
OK, I reid this piece of code instead of storing the type explicitly:
QualType ParamRegion::getValueType() const {
const Expr *Arg = nullptr;
if (const auto *CE = dyn_cast<CallExpr>(OriginExpr)) {
Arg = CE->getArg(Index);
} else if (const auto *CCE = dyn_cast<CXXConstructExpr>(OriginExpr)) {
Arg = CCE->getArg(Index);
} else if (const auto *OCME = dyn_cast<ObjCMessageExpr>(OriginExpr)) {
Arg = OCME->getArg(Index);
} else if (const auto *CNE = dyn_cast<CXXNewExpr>(OriginExpr)) {
Arg = CNE->getPlacementArg(Index);
} else {
// FIXME: Any other kind of `Expr`?
llvm_unreachable("Maybe we forgot something...");
}
assert(Arg);
switch (Arg->getValueKind()) {
case VK_RValue:
return Arg->getType();
case VK_LValue:
return getContext().getLValueReferenceType(Arg->getType());
case VK_XValue:
return getContext().getRValueReferenceType(Arg->getType());
default:
llvm_unreachable("Invalid value kind.");
}
}
This results in the following assertion:
llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:333:
clang::ento::ProgramStateRef
clang::ento::ExprEngine::createTemporaryRegionIfNeeded(clang::ento::ProgramStateRef,
const clang::LocationContext*, const clang::Expr*, const clang::Expr*, const
clang::ento::SubRegion**): Assertion `!InitValWithAdjustments.getAs<Loc>() ||
Loc::isLocType(Result->getType()) || Result->getType()->isMemberPointerType()'
failed.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77229/new/
https://reviews.llvm.org/D77229
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits