kadircet created this revision. kadircet added a reviewer: ioeric. Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ilya-biryukov. Herald added a project: clang.
Currently createStaticIndexingAction always set Origin to Static, which makes it hard to change it later on by different indexers(One needs to go over each symbol making a new copy). This patch changes that behavior to rather respect it if set by user. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D59205 Files: clangd/index/IndexAction.cpp clangd/index/IndexAction.h Index: clangd/index/IndexAction.h =================================================================== --- clangd/index/IndexAction.h +++ clangd/index/IndexAction.h @@ -22,7 +22,7 @@ // - include paths are always collected, and canonicalized appropriately // - references are always counted // - all references are collected (if RefsCallback is non-null) -// - the symbol origin is always Static +// - the symbol origin is set to Static if not specified by caller std::unique_ptr<FrontendAction> createStaticIndexingAction( SymbolCollector::Options Opts, std::function<void(SymbolSlab)> SymbolsCallback, Index: clangd/index/IndexAction.cpp =================================================================== --- clangd/index/IndexAction.cpp +++ clangd/index/IndexAction.cpp @@ -183,7 +183,8 @@ index::IndexingOptions::SystemSymbolFilterKind::All; Opts.CollectIncludePath = true; Opts.CountReferences = true; - Opts.Origin = SymbolOrigin::Static; + if (Opts.Origin == SymbolOrigin::Unknown) + Opts.Origin = SymbolOrigin::Static; Opts.StoreAllDocumentation = false; if (RefsCallback != nullptr) { Opts.RefFilter = RefKind::All;
Index: clangd/index/IndexAction.h =================================================================== --- clangd/index/IndexAction.h +++ clangd/index/IndexAction.h @@ -22,7 +22,7 @@ // - include paths are always collected, and canonicalized appropriately // - references are always counted // - all references are collected (if RefsCallback is non-null) -// - the symbol origin is always Static +// - the symbol origin is set to Static if not specified by caller std::unique_ptr<FrontendAction> createStaticIndexingAction( SymbolCollector::Options Opts, std::function<void(SymbolSlab)> SymbolsCallback, Index: clangd/index/IndexAction.cpp =================================================================== --- clangd/index/IndexAction.cpp +++ clangd/index/IndexAction.cpp @@ -183,7 +183,8 @@ index::IndexingOptions::SystemSymbolFilterKind::All; Opts.CollectIncludePath = true; Opts.CountReferences = true; - Opts.Origin = SymbolOrigin::Static; + if (Opts.Origin == SymbolOrigin::Unknown) + Opts.Origin = SymbolOrigin::Static; Opts.StoreAllDocumentation = false; if (RefsCallback != nullptr) { Opts.RefFilter = RefKind::All;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits