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.
This commit is contained in:
Richard Smith 2020-04-28 23:22:53 -07:00
parent 52a6d47ada
commit c35f3f8679
1 changed files with 5 additions and 1 deletions

View File

@ -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.