[clang] [clang-tools-extra] [clang analysis] ExprMutationAnalyzer avoid infinite recursion for recursive forwarding reference (PR #87954)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 8 02:31:56 PDT 2024


================
@@ -45,6 +51,19 @@ class ExprMutationAnalyzer {
   using MutationFinder = const Stmt *(ExprMutationAnalyzer::*)(const Expr *);
   using ResultMap = llvm::DenseMap<const Expr *, const Stmt *>;
 
+  ExprMutationAnalyzer(const Stmt &Stm, ASTContext &Context, Cache *ParentCache)
+      : Stm(Stm), Context(Context) {
+    if (ParentCache != nullptr) {
+      CrossAnalysisCache = ParentCache;
+    } else {
+      CrossAnalysisCache = std::make_unique<Cache>();
+    }
----------------
PiotrZSL wrote:

maybe better use shared_ptr instead of this mess with variant.

https://github.com/llvm/llvm-project/pull/87954


More information about the cfe-commits mailing list