[PATCH] D116022: [clang][dataflow] Add support for terminating virtual destructors
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 21 12:30:27 PST 2021
gribozavr2 added inline comments.
================
Comment at: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h:50
+ std::unique_ptr<CFG> Cfg;
+ llvm::DenseMap<const Stmt *, const CFGBlock *> StmtToBlock;
+};
----------------
xazax.hun wrote:
> There is a special class for this at `clang/lib/Analysis/CFGStmtMap.cpp`. That also does some special handling of the terminators. I wonder if we need to do something similar here (or just use that class as is?).
The only downside I see is that CFGStmtMap needs a ParentMap, which is not cheap to make, but we don't need. Maybe we need to make it optional in CFGStmtMap?
================
Comment at: clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h:103
std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>>
-runTypeErasedDataflowAnalysis(const CFG &Cfg,
+runTypeErasedDataflowAnalysis(const ControlFlowContext &Ctx,
TypeErasedDataflowAnalysis &Analysis,
----------------
I'd suggest a more verbose name like `CFCtx`, since `Ctx` is most often used in Clang for `ASTContext`. (Here and elsewhere in the patch.)
================
Comment at: clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp:1
+#include "clang/Analysis/FlowSensitive/ControlFlowContext.h"
+#include "clang/AST/ASTContext.h"
----------------
Please add a license comment.
================
Comment at: clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp:47
+ auto Ctx = ControlFlowContext::build(nullptr, Body, Result.Context);
+ assert(Ctx);
----------------
Use `llvm::cantFail` to unwrap the `Expected`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116022/new/
https://reviews.llvm.org/D116022
More information about the cfe-commits
mailing list