[clang-tools-extra] c35f3f8 - Fix up clangd after clang commit llvmorg-11-init-13375-g0a088ead85f.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 23:49:44 PDT 2020


Author: Richard Smith
Date: 2020-04-28T23:49:35-07:00
New Revision: c35f3f8679050df77a32512a73a94ba856190089

URL: https://github.com/llvm/llvm-project/commit/c35f3f8679050df77a32512a73a94ba856190089
DIFF: https://github.com/llvm/llvm-project/commit/c35f3f8679050df77a32512a73a94ba856190089.diff

LOG: Fix up clangd after clang commit llvmorg-11-init-13375-g0a088ead85f.

It's not clear whether clangd should really consider #import to mark a
header as self-contained or not, but this change preserves the old (and
unit-tested) behavior.

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/SymbolCollector.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index 471061672107..739aef880de9 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -743,7 +743,11 @@ bool SymbolCollector::isSelfContainedHeader(FileID FID) {
     const FileEntry *FE = SM.getFileEntryForID(FID);
     if (!FE)
       return false;
-    if (!PP->getHeaderSearchInfo().isFileMultipleIncludeGuarded(FE))
+    // FIXME: Should files that have been #import'd be considered
+    // self-contained? That's really a property of the includer,
+    // not of the file.
+    if (!PP->getHeaderSearchInfo().isFileMultipleIncludeGuarded(FE) &&
+        !PP->getHeaderSearchInfo().hasFileBeenImported(FE))
       return false;
     // This pattern indicates that a header can't be used without
     // particular preprocessor state, usually set up by another header.


        


More information about the cfe-commits mailing list