================
@@ -316,31 +330,42 @@ void FactsGenerator::VisitReturnStmt(const ReturnStmt
*RS) {
if (const Expr *RetExpr = RS->getRetValue()) {
if (OriginList *List = getOriginsList(*RetExpr))
for (OriginList *L = List; L != nullptr; L = L->peelOuterOrigin())
- EscapesInCurrentBlock.push_back(FactMgr.createFact<OriginEscapesFact>(
+ EscapesInCurrentBlock.push_back(FactMgr.createFact<ReturnEscapeFact>(
L->getOuterOriginID(), RetExpr));
}
}
void FactsGenerator::handleAssignment(const Expr *LHSExpr,
const Expr *RHSExpr) {
- if (const auto *DRE_LHS =
- dyn_cast<DeclRefExpr>(LHSExpr->IgnoreParenImpCasts())) {
- OriginList *LHSList = getOriginsList(*DRE_LHS);
- assert(LHSList && "LHS is a DRE and should have an origin list");
- OriginList *RHSList = getOriginsList(*RHSExpr);
-
- // For operator= with reference parameters (e.g.,
- // `View& operator=(const View&)`), the RHS argument stays an lvalue,
- // unlike built-in assignment where LValueToRValue cast strips the outer
- // lvalue origin. Strip it manually to get the actual value origins being
- // assigned.
- RHSList = getRValueOrigins(RHSExpr, RHSList);
+ LHSExpr = LHSExpr->IgnoreParenImpCasts();
----------------
Xazax-hun wrote:
Not for this PR, but I am wondering if it is actually safe to ignore all the
implicit casts. Some of them like conversion between lvalues and rvalues are
quite important. Although maybe when we get here we already processed those
conversions.
https://github.com/llvm/llvm-project/pull/177363
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits