[PATCH] D155321: [clang][Analysis] ExprMutationAnalyzer: break infinite recursion on recursive function call
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 22 01:22:04 PDT 2023
PiotrZSL added inline comments.
================
Comment at: clang/include/clang/Analysis/Analyses/ExprMutationAnalyzer.h:31
+ if (nullptr == DeclAnalyzed) {
+ OwningDeclAnalyzed = std::make_unique<DeclSet>();
+ this->DeclAnalyzed = OwningDeclAnalyzed.get();
----------------
NOTE: This memory allocation could be removed by creating class ExprMutationAnalyzerWithHistory that could keep DeclSet as private object and use ExprMutationAnalyzer as base class.
================
Comment at: clang/lib/Analysis/ExprMutationAnalyzer.cpp:574
+ }
+ DeclAnalyzed->insert(Func);
+
----------------
I would assume that Func should be removed from DeclAnalyzed when leaving scope. Otherwise it may not work to good when for example same function would be called twice.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155321/new/
https://reviews.llvm.org/D155321
More information about the cfe-commits
mailing list