After implementation of "[Clang] Implement P2741R3 - user-generated static_assert messages" (47ccfd7a89e2a9a747a7114db18db1376324799c) the c indexer crashes when handling a static_assert w/o any message.
This is caused by using dyn_cast to get the literal string, which isn't working on nullptr.
Details
Diff Detail
Unit Tests
Event Timeline
clang/tools/libclang/CIndex.cpp | ||
---|---|---|
1297 | It's probably better to cast to Expr and visit it unconditionally. But it could always be null, so dyn_cast_if_present is probably correct. |
Yes, that's a good idea. Now kdevelop also highlights the message-expression properly.
Sorry... forgot formatting... removed commented code... changed "Hallo Welt!" to english
clang/unittests/libclang/LibclangTest.cpp | ||
---|---|---|
1201 | This is going to be testing whatever STL headers are installed on the developer's machine; instead of including the STL header, you should mock up the std::string_view class so we're always testing something consistently. |
The test is no more using any includes now. Hopefully this fixes it, otherwise I will have to add something that prints the diagnostic.
I don't have write permissions on the repository. Please commit it when OK.
Please use Kai Stierand <kai.stierand@swplusplus.de> as in 5d859a1cdee3c15dce692767ee3e9ad03a8c4c1b
It's probably better to cast to Expr and visit it unconditionally. But it could always be null, so dyn_cast_if_present is probably correct.
dyn_cast_if_present<Expr> should be what we want then