================
@@ -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();
----------------
usx95 wrote:
I think we handle these conversions. It's this specifc case (LHS of an
assignment) where we are doing this. If these appear as sub-expression at other
places, we should be doing the correct thing there.
https://github.com/llvm/llvm-project/pull/177363
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits