[PATCH] D78038: [clangd] WIP: fix several bugs relating to include insertion

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 12:59:44 PDT 2020


kadircet added inline comments.


================
Comment at: clang/lib/Lex/Lexer.cpp:2749
+    // most useful answer is "yes, this file has a header guard".
+    if (!ConditionalStack.empty())
+      MIOpt.ExitTopLevelConditional();
----------------
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.


================
Comment at: clang/lib/Serialization/ASTReader.cpp:6155
+      // To avoid doing this on every miss, require the bare filename to match.
+      if (Pos == Table->end() && M.Kind == clang::serialization::MK_Preamble &&
+          llvm::sys::path::filename(FE->getName()) ==
----------------
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`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78038/new/

https://reviews.llvm.org/D78038





More information about the cfe-commits mailing list