This patch builds on top of D42672 to add construction contexts for constructors that are initializing CXXCtorInitializer nodes (C::C(int x, struct S s): x(x), s(s) /* <== these little thingines */ {}). Because CXXCtorInitializer is not a Stmt, ConstructionContext needs to be extended to support such contexts. This patch refactors ConstructionContext into a "proper" class with fancy getters (we'd most likely need setters later as well).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/clang/Analysis/CFG.h | ||
---|---|---|
167 ↗ | (On Diff #132015) | I think we should get<> here instead, to clearly crash on incorrect operations. |
lib/Analysis/CFG.cpp | ||
1262 ↗ | (On Diff #132015) | auto *CE? |
1263 ↗ | (On Diff #132015) | Could we have an explicit constructor call here? |
include/clang/Analysis/CFG.h | ||
---|---|---|
167 ↗ | (On Diff #132015) |
Yeah, i guess, it'd eventually evolve into a whole class hierarchy of construction contexts with RTTI and stuff. I'm trying to grow it slowly because for now i don't foresee exactly how much of this we'd need. Still, to me it seems more natural to ask "hey does this thing have a trigger statement", "oh, so maybe it has an initializer", than to enumerate all possible reasons why it may have a trigger statement or an initializer and match for those. It seems easier for callers to use.
This is an empty constructor for T, where T is in our case CXXCtorInitializer *, so it boils down to returning nullptr. |
Remove the stack of contexts for now. Which, by the way, i forgot to pop in this patch.
Add an assertion to see if we can always print the construction trigger.
lib/Analysis/CFG.cpp | ||
---|---|---|
4649 ↗ | (On Diff #132056) | Yep, this is indeed likely that i'd end up adding a whole RTTI of construction contexts. |