Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
My understanding is that we are not sure of when this assert might be hit. This was probably hit when lambda captures were not handled but not anymore. We want to replace the assert with a debug note to catch cases when we can't find a VarDecl for a declaration statement. @NoQ Could you please confirm if my understanding is correct?
My understanding is that we are not sure of when this assert might be hit.
aha, I cannot think of an example either so I was curious. What you said makes sense to me.
I don't have any test cases in mind immediately. We could try our usual suspects such as globals and DecompositionDecls (they're subclass of VarDecl, unlike BindingDecl). But it could totally be that it dodges them because of other checks we already have.
But I agree that the assertion should be removed: we just no longer believe that it needs to hold!
clang/lib/Analysis/UnsafeBufferUsage.cpp | ||
---|---|---|
2058 | Other notes start with small letter 😅 |
Oo I think I broke it! https://godbolt.org/z/7efM6TvxM
We needed to use the tuple mode of decomposition because it eagerly unpacks the tuple into, in our case, a raw pointer that we can try to analyze.
This, of course, makes it much harder to write the test because you'll need to mock <tuple>. Looks like we have some existing mocks in test/Analysis/uninit-structured-binding-tuple.cpp, they might help.
I suspect it'll be much easier to break this assertion once we start supporting std::array. So it's great that we're removing it.
Yeah nvm that's a different assertion and an unrelated crash. Which we'll also need to fix but not in this patch. LGTM then!
Other notes start with small letter 😅