[PATCH] D146017: [clangd][wip] Get rid of the include-cleaner hacky macro-reference implementation

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 00:45:01 PDT 2023


hokein created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
hokein requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

By extending and using the existing MainFileMacros structure.

- record more information (InConditionalDirective) in MacroOccurrence
- collect macro references inside macro body

When emiting include-cleaner diagnostics, we convert the result to the
RecordedPP structure just-in-time to interop with include-cleaner

Put all together into a patch (might need to split)
TODO: the newly-added test doesn't pass, because there are some other
issues in missing-include diagnostics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146017

Files:
  clang-tools-extra/clangd/CollectMacros.cpp
  clang-tools-extra/clangd/CollectMacros.h
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146017.504971.patch
Type: text/x-patch
Size: 13007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230314/b8ebde23/attachment.bin>


More information about the cfe-commits mailing list