================
@@ -471,13 +474,47 @@ class LifetimeSafetySemaHelperImpl : public 
LifetimeSafetySemaHelper {
   }
 
   std::string getDiagSubjectDescription(const Expr *E) {
+    E = E->IgnoreImpCasts();
     if (isa<MaterializeTemporaryExpr>(E))
       return "local temporary object";
 
     if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
       return getDiagSubjectDescription(DRE->getDecl());
     // TODO: Handle other expression types.
-    return "";
+    return "expression";
+  }
+
+  bool shouldShowInAliasChain(const Expr *CurrExpr, const Expr *LastExpr) {
+    CurrExpr = CurrExpr->IgnoreImpCasts();
+    LastExpr = LastExpr->IgnoreImpCasts();
+
+    if (isa<MaterializeTemporaryExpr, ParenExpr>(CurrExpr))
+      return false;
+    // Source ranges can be used to filter out many implicit expressions,
+    // because operations between class objects often involve numerous implicit
+    // conversions, yet they share the same source range.
+    if (CurrExpr->getSourceRange() == LastExpr->getSourceRange())
+      return false;
+
+    return true;
----------------
usx95 wrote:

simplify to `return CurrExpr->getSourceRange() != LastExpr->getSourceRange()`

https://github.com/llvm/llvm-project/pull/199345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to