diff options
author | Sam McCall <sam.mccall@gmail.com> | 2020-05-20 16:03:42 +0200 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2020-05-26 10:27:28 +0200 |
commit | 1abb883a048153c83a4e11070219d23f362e7377 (patch) | |
tree | 538ec561251bdc29c62006947b9f0bec65db671f /clang/lib/Index/IndexDecl.cpp | |
parent | 80cc43b420a8ab8648f44fbb554b483a2998712d (diff) | |
download | llvm-1abb883a048153c83a4e11070219d23f362e7377.zip llvm-1abb883a048153c83a4e11070219d23f362e7377.tar.gz llvm-1abb883a048153c83a4e11070219d23f362e7377.tar.bz2 |
[clangd] Don't traverse the AST within uninteresting files during indexing
Summary:
We already skip function bodies from these files while parsing, and drop symbols
found in them. However, traversing their ASTs still takes a substantial amount
of time.
Non-scientific benchmark on my machine:
background-indexing llvm-project (llvm+clang+clang-tools-extra), wall time
before: 7:46
after: 5:13
change: -33%
Indexer.cpp libclang should be updated too, I'm less familiar with that code,
and it's doing tricky things with the ShouldSkipFunctionBody callback, so it
needs to be done separately.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80296
Diffstat (limited to 'clang/lib/Index/IndexDecl.cpp')
-rw-r--r-- | clang/lib/Index/IndexDecl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index 68160bc5..2ba323e 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -765,6 +765,9 @@ bool IndexingContext::indexTopLevelDecl(const Decl *D) { if (isa<ObjCMethodDecl>(D)) return true; // Wait for the objc container. + if (IndexOpts.ShouldTraverseDecl && !IndexOpts.ShouldTraverseDecl(D)) + return true; // skip + return indexDecl(D); } |