This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Copy existing includes in ReplayPreamble
ClosedPublic

Authored by kadircet on Jun 2 2020, 3:14 AM.

Details

Summary

ReplayPreamble was just grabbing the reference of IncludeStructure
passed to it and then replayed any includes seen so while exiting
built-in file.

This implies any include seen in built-in files being replayed as part
of preamble, even though they are not. This wasn't an issue until we've
started patching preambles, as includes from built-in files were not
mapped back to main-file.

This patch copies over existing includes at the time of
ReplayPreamble::attach and only replies those to prevent any includes
from the preamble patch getting mixed-in.

Diff Detail

Event Timeline

kadircet created this revision.Jun 2 2020, 3:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2020, 3:14 AM
sammccall accepted this revision.Jun 2 2020, 3:23 AM
sammccall added inline comments.
clang-tools-extra/clangd/ParsedAST.cpp
385–386

it seems like it would be clearer to pass Preamble->preambleIncludes() here, at this point?
(And move within the constructor, so still just one copy)

This revision is now accepted and ready to land.Jun 2 2020, 3:23 AM
kadircet updated this revision to Diff 267848.Jun 2 2020, 4:34 AM
kadircet marked an inline comment as done.
  • Address comment
This revision was automatically updated to reflect the committed changes.