When indexing a file which contains an uncompilable error, we will
trigger an assertion failure -- the IndexFileIn data is not set, but we
access them in the backgound index.
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
- Build Status
Buildable 26023 Build 26022: arc lint + arc unit
Event Timeline
I think the description is misleading, you are saying that we were triggering an assertion and you are fixing that. But in reality, we were not triggering any assertions, this patch is adding the assertions right?
clangd/index/Background.cpp | ||
---|---|---|
393 | I don't think it is a good idea to assert and die just for one file, since we are actually trying to index all the files. We should rather check these exists and propagate the error in case of failure. You can have a look at https://reviews.llvm.org/D55224, same lines. Also with your changes in the endsourcefileaction this assertion is not possible to be triggered, since you will fill them with "empty" versions. | |
clangd/index/IndexAction.cpp | ||
144 ↗ | (On Diff #178036) | I think this is same as if (!HasUncompilableErrors) so you can keep the old one just by negating it. |
150 ↗ | (On Diff #178036) | I don't think it is a good idea to respond with an "empty" symbol slab rather than not replying. They have different semantics. The former implies everything went well, just couldn't find any symbols in the file, whereas the latter implies there was an error. So I believe we should keep this code as it was. |
Ah, sorry for the confusion caused by the assertion I added. The description is correct, and this patch is trying to fix an assertion (not the assertion I added, it is the assertion in llvm::Optional, we are accessing an empty Optional).
clangd/index/Background.cpp | ||
---|---|---|
393 | check these exists seems a wired way to me, We should explicitly check the error here. The assertion I added here is to guarantee that we have all the data when indexing a file successfully. | |
clangd/index/IndexAction.cpp | ||
150 ↗ | (On Diff #178036) | Sounds fair, I kept the old behavior. |
Ah you are right, the Optional.. Thanks!
clangd/index/Background.cpp | ||
---|---|---|
384 | Then don't need to keep these checks anymore in the endsourcefileaction of indexingaction right? |
clangd/index/Background.cpp | ||
---|---|---|
384 | We need indeed. We have other clients (clangd-indexer, and our internal indexer) using the IndexingAction -- we don't want symbols from broken TUs because they causes many troublesomes. |
Then don't need to keep these checks anymore in the endsourcefileaction of indexingaction right?