This is an archive of the discontinued LLVM Phabricator instance.

[Frontend] Allow to use PrecompiledPreamble without calling CanReuse
ClosedPublic

Authored by ilya-biryukov on Jan 12 2018, 6:19 AM.

Details

Summary

The new method 'OverridePreamble' allows to override the preamble of
any source file without checking if preamble bounds or dependencies
were changed.

This is used for completion in clangd.

Diff Detail

Repository
rC Clang

Event Timeline

ilya-biryukov created this revision.Jan 12 2018, 6:19 AM
sammccall accepted this revision.Jan 12 2018, 6:44 AM
sammccall added inline comments.
include/clang/Frontend/PrecompiledPreamble.h
107–111

Simpler just as "/// Requires that CanReuse() is true."

118

i think you mean "does not".

I find some of the wording here confusing - "does not require checking" seems like too weak a claim. It's also a bit long, and hard to quickly see at a glance which function you might want to call.

I'd suggest:

/// Configure \CI to use this preamble for \p MainFileBuffer.
/// Like AddImplicitPreamble, but doesn't assume or check CanReuse()!
/// If this preamble doesn't match the file, it may parse differently.
lib/Frontend/PrecompiledPreamble.cpp
683

nit: this is just assert(VFS)

This revision is now accepted and ready to land.Jan 12 2018, 6:44 AM
  • Simplify comments
ilya-biryukov marked 2 inline comments as done.
  • Remove redundant assertion message
ilya-biryukov marked an inline comment as done.Jan 15 2018, 1:59 AM
ilya-biryukov added inline comments.
include/clang/Frontend/PrecompiledPreamble.h
107–111

Much more concise this way, thanks.

118

Thanks, your wording looks much better.

This revision was automatically updated to reflect the committed changes.