The original code appears to be OK per the spec, but we've had 3 reports of
crashes with certain unofficial builds of clangd that look a lot like old
compilers (GCC 5.4?) getting lifetime rules wrong.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
thanks! it is unfortunate that history won't remember what an adventure it was to figure out the issue :D
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp | ||
---|---|---|
292 | nit: I'd make it static const just to make sure they are not going away this time + it will save up some stack space. nit: Maybe also get rid of the struct's name ? (static const struct { ... } Files[] = { ... };) |
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp | ||
---|---|---|
292 | as discussed, CachedFile entries are actually pointers to members, so NVM the static. |
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp | ||
---|---|---|
292 | There are pointers to members in here! The fact that static const even compiles is a massive footgun :-( |
nit: I'd make it static const just to make sure they are not going away this time + it will save up some stack space.
nit: Maybe also get rid of the struct's name ? (static const struct { ... } Files[] = { ... };)