This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Change PreambleOnlyAction with content truncation
ClosedPublic

Authored by kadircet on May 5 2020, 8:59 AM.

Details

Summary

Lexing until the token location is past preamble bound could be wrong
in some cases as preprocessor lexer can lex multiple tokens in a single call.

Diff Detail

Event Timeline

kadircet created this revision.May 5 2020, 8:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2020, 8:59 AM
kadircet updated this revision to Diff 262132.May 5 2020, 9:06 AM
  • Add test
sammccall accepted this revision.May 25 2020, 4:55 AM
sammccall added inline comments.
clang-tools-extra/clangd/Preamble.cpp
127

Maybe add a comment here:

// This means we're scanning (though not preprocessing) the preamble section twice.
// However, it's important to precisely follow the preamble bounds used elsewhere.

This guards somewhat against someone sending the reverse patch. Chesterton's fence etc.

This revision is now accepted and ready to land.May 25 2020, 4:55 AM
kadircet marked an inline comment as done.May 25 2020, 10:38 PM
This revision was automatically updated to reflect the committed changes.