Skip to content

Commit

Permalink
Only fail with IndexFailure on hasUncompilableErrorOccurred.
Browse files Browse the repository at this point in the history
Summary:
There are a bunch of `IndexFailure` facts in the `fbsource` DB where 0 errors are captured. This is because we use the `hasErrorOccurred` as the condition for bailing, but we actually only care about error and fatals. `hasErrorOccurred` is true also for warnings propagated to error, and things like that. This diff uses `hasUncompilableErrorOccurred` instead.

```
fbsource> :count src.IndexFailure _

17159 results, 17159 facts, 29.64ms, 14761584 bytes, 584 compiled bytes

fbsource> :count src.IndexFailure { details = "0 error(s) occurred while indexing" }

13115 results, 13115 facts, 21.12ms, 6530968 bytes, 780 compiled bytes
```

Querying over the [Indexer Coverage](https://fburl.com/scuba/indexer_coverage/m5h3ylgh) table shows that fixing this issue will index ~3,500 more files directly in `fbsource`, and potentially more indirectly affected files. But the actual user impact will likely be lower, most of the 3,500 files are already indexed in other DBs. There are still [173 files](P829689600) that are not indexed in other DBs.

Reviewed By: malanka

Differential Revision: D49318003

fbshipit-source-id: f23e7ec351e553f8771a64c24e47e41505bae1df
  • Loading branch information
mpark authored and facebook-github-bot committed Sep 16, 2023
1 parent f320fc0 commit 5f8fcbe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion glean/lang/clang/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2669,7 +2669,8 @@ struct ASTConsumer : public clang::ASTConsumer {
// Clang is sometimes generating a bogus AST when there are
// compilation errors (even for parts of the AST that should be
// unrelated to the error) so this is a workaround.
if (ctx.getDiagnostics().hasErrorOccurred() && !FLAGS_index_on_error) {
if (ctx.getDiagnostics().hasUncompilableErrorOccurred() &&
!FLAGS_index_on_error) {
db->IndexFailure(ctx);
return;
}
Expand Down

0 comments on commit 5f8fcbe

Please sign in to comment.