[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG6ebd0aa42066: [include-cleaner] Record macro references in #ifdef clause. (authored by VitaNuo, committed by hokein). Changed prior to commit: https://reviews.llvm.org/D138559?vs=477722&id=477759#toc R

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Thanks, LGTM. I will commit it for you. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477722. VitaNuo added a comment. Simplify test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include-cleaner/lib/Record.cpp clang-tool

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo added inline comments. Comment at: clang-tools-extra/include-cleaner/unittests/RecordTest.cpp:249 + + Inputs.Code = MainFile.code(); + auto AST = build(); hokein wrote: > The `elifndef` and `elifdef` is a C++2b extension feature, so > `Inputs.ExtraArgs

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477721. VitaNuo added a comment. Add -std=c++2b argument to avoid compiler warnings. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/includ

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/include-cleaner/unittests/RecordTest.cpp:235 + +int main() { + #ifdef Y nit: we can get rid of the main function, it is not needed. Comment at: clang-tools-extra/include-clean

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477716. VitaNuo added a comment. Formatting. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include-cleaner/lib/Record.cpp clang-tools-e

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo added inline comments. Comment at: clang-tools-extra/include-cleaner/unittests/RecordTest.cpp:248 + SourceManager &SM = AST.sourceManager(); + ASSERT_THAT(Recorded.MacroReferences, Not(IsEmpty())); + hokein wrote: > nit: this can be removed, as the EXPE

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo added inline comments. Comment at: clang-tools-extra/include-cleaner/lib/Record.cpp:95 private: - void recordMacroRef(const Token &Tok, const MacroInfo &MI) { + void recordMacroRef(const Token &Tok, const MacroInfo &MI, RefType RT) { if (MI.isBuiltinMacro()) -

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477711. VitaNuo added a comment. Address review comments. Format and simplify code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477707. VitaNuo added a comment. Add support for #if defined(X), #elifdef, #elifndef Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/includ

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clang-tools-extra/include-cleaner/lib/Record.cpp:87 + void Ifdef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDefinition &MD) override { +if (!Active) the indentation doesn't look r

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-23 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477554. VitaNuo added a comment. Make explicit RefType default. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include-cleaner/lib/Record.

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-23 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477551. VitaNuo added a comment. Remove the extra test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include-cleaner/lib/Record.cpp cl

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-23 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477549. VitaNuo added a comment. Update. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include-cleaner/lib/Record.cpp clang-tools-extra

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-23 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Thanks, this code looks good to me overall. I think we can extend it to handle the `Defined`, `Elifdef`, `Elifndef` cases. And please add a `[include-cleaner]` prefix in the commit title. Comment at: clang-tools-extra/include-cleaner/lib/Record.cpp:95

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-23 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 477461. VitaNuo added a comment. Update Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138559/new/ https://reviews.llvm.org/D138559 Files: clang-tools-extra/include-cleaner/lib/Record.cpp clang-tools-extra/

[PATCH] D138559: Record macro references in #ifdef clause.

2022-11-23 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo created this revision. Herald added a project: All. VitaNuo requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. Records macro references in #ifdef clauses as ambiguous. Repository: rG LLVM Github Monorepo https://review