[PATCH] D106203: [clangd] Propagate header-guarded flag from preamble to main AST

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 19 10:13:19 PDT 2021


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks!



================
Comment at: clang-tools-extra/clangd/Preamble.cpp:87
+
+    const SourceManager &SM = CI.getSourceManager();
+    const FileEntry *MainFE = SM.getFileEntryForID(SM.getMainFileID());
----------------
nit: maybe do this at the top and keep the early exit?


================
Comment at: clang-tools-extra/clangd/Preamble.cpp:400
+        std::move(StatCache), CapturedInfo.takeCanonicalIncludes());
+    Result->MainIsIncludeGuarded = CapturedInfo.isMainFileIncludeGuarded();
+    return Result;
----------------
any reason for not making this part of the constructor ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106203



More information about the cfe-commits mailing list