Page MenuHomePhabricator

[clangd] WIP: fix several bugs relating to include insertion
Needs ReviewPublic

Authored by sammccall on Apr 13 2020, 10:25 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This should probably be untangled into 3 separate patches, but
looking for feedback first on whether we want to do this at all.

a) store include-insertion information for main-file symbols that are

not eligible for code completion indexing.

b) consider an #ifndef guard that's dangling at the end of the preamble

to be a well-formed header guard (otherwise we never will)

c) load HeaderFileInfo for the preamble main-file even if the file-size

mismatches

Diff Detail

Unit TestsFailed

TimeTest
170 mslldb-unit.Host/_/HostTests::Unknown Unit Message ("")
Note: Google Test filter = ConnectionFileDescriptorTest.TCPGetURIv6 [==========] Running 1 test from 1 test case. [----------] Global test environment set-up.

Event Timeline

sammccall created this revision.Apr 13 2020, 10:25 AM
kadircet added inline comments.Apr 13 2020, 12:30 PM
clang/lib/Lex/Lexer.cpp
2749

I think we should put this behind a PPOpt to make sure we don't regress the rest of the world, as I fear this part of the code might not be well tested.

clang/lib/Serialization/ASTReader.cpp
6155

do we have other (apart from isFileMultiIncludeGuarded) things that depend on HFI for main file being correctly deserialized?

If it is only the include guard, maybe we can store that info in control block and later on restore it when reading HFI for main file in HeaderSearch::getExistingFileInfo?

nridge added a subscriber: nridge.Jul 6 2022, 6:52 PM

@sammccall should we get this patch landed? The issue of #ifndef-guarded header files that include each other recursively is still tripping up some users.

Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJul 6 2022, 6:52 PM