[PATCH] D151183: [clang][dataflow] Add a `ControlFlowContext::build()` overload taking a `FunctionDecl`.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 25 00:02:45 PDT 2023
mboehme marked an inline comment as done.
mboehme added inline comments.
================
Comment at: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h:39
+
/// Builds a ControlFlowContext from an AST node. `D` is the function in which
/// `S` resides. `D.isTemplated()` must be false.
----------------
xazax.hun wrote:
> I was wondering if there is a plan to make the framework work for non-functions, like global initializers.
I believe there may be? I remember talking to someone who mentioned this -- I don't know, it might have been you?
This is, really, the only reason I can see for having an overload that takes a separate `Stmt`. It doesn't really make sense (I think) to pass a `FunctionDecl` to this overload and then pass some `Stmt` that isn't the complete function body. (I can't think of any good scenarios where the control flow wouldn't escape that `Stmt`, and I don't see any good use cases anyway.) So I've been assuming that this overload is there for global initializers. Confusingly, the comment says that `D` should be a function, but notably, `D` is a `Decl`, not a `FunctionDecl` -- so I think the comment is wrong here.
Anyway, I'll try and get some more insights into this, but until then, I'll certainly keep this overload in place.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151183/new/
https://reviews.llvm.org/D151183
More information about the cfe-commits
mailing list