[PATCH] D124166: [clangd] Correctly identify self-contained headers included rercursively
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 21 06:49:13 PDT 2022
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/Headers.cpp:111
+ // If a self-contained header is included recursively it will get
+ // different FileIDs each time. Only the last result of
+ // isSelfContainedHeader is reliable, so we should remove the header
----------------
second sentence just echoes the code: say why, not what
isSelfContainedHeader only returns true once the full header-guard structure has been seen, i.e. when exiting the *outer* copy of the file. So last result wins.
================
Comment at: clang-tools-extra/clangd/Headers.cpp:115
+ // wasn't one.
if (!isSelfContainedHeader(FE, PrevFID, SM, HeaderInfo))
Out->NonSelfContained.insert(
----------------
nit: reverse the if condition to avoid double-negative.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124166/new/
https://reviews.llvm.org/D124166
More information about the cfe-commits
mailing list