To avoid doing extra work of processing headers in the preamble
mutilple times in parallel.
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
Event Timeline
Nice fix!
Possible test: add a file with complicated preamble (billion laughs?) and immediately schedule 5 preamble actions. They should all get a non-null preamble and the pointers should all be the same.
clangd/TUScheduler.cpp | ||
---|---|---|
408 | inline? should fit on one line... | |
clangd/TUScheduler.h | ||
104 | Not sure what "however" is contrasting with. Could be just: "If there's no preamble yet (because the file was just opened), we'll wait for it to build. The preamble may still be null if it fails to build or is empty." |
The most trivial test that updates a file and immediately schedules a few preamble actions failed without this change for me. I have added it to the patch.
clangd/TUScheduler.cpp | ||
---|---|---|
408 | This is used in TUScheduler, where we don't have access to the fields of ASTWorker. |
Not sure what "however" is contrasting with.
Could be just: "If there's no preamble yet (because the file was just opened), we'll wait for it to build. The preamble may still be null if it fails to build or is empty."