This is the most common use case, so it makes sense to have a specific overload for it.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h | ||
---|---|---|
39 | I was wondering if there is a plan to make the framework work for non-functions, like global initializers. |
clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h | ||
---|---|---|
39 | 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. |
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp | ||
---|---|---|
71 | This was the only user of Body in -Asserts |
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp | ||
---|---|---|
71 | Thanks for pointing this out. Fixed in https://reviews.llvm.org/D151430. |
I was wondering if there is a plan to make the framework work for non-functions, like global initializers.