Open 2over12 opened 1 year ago
@llvm/issue-subscribers-clang-frontend
I'm also experiencing this bug when using clangd with the following file content:
typedef whatever_it_is_it_must_be_undefined features_array_t[10];
typedef struct
{
features_array_t features;
} state_t;
void my_func()
{
state_t *state;
state->features[1];
}
cross reference: https://github.com/clangd/clangd/issues/1806
CC @AaronBallman
Minimal reproducing example:
isFlexibleArrayMemberLike
uses the source type info to attempt to determine if the size is the result of a macro. This behavior can lead to anullptr
being passed todyn_cast
if the source range associated with the type info is an empty location.Unfortunately,
CheckArrayAccess
usesignoreTemplate
meaning in cases where the API is used for code generation (ie. when source locs will not exist) a crash will occur.An example patch that treats type info without a location as a non-macro size is available here