[PATCH] D115484: [clangd] Include-fixer: handle more "incomplete type" diags, clean up tests
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 10 08:22:01 PST 2021
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/IncludeFixer.cpp:75
+ /*
+ There are many "incomplete type" diagnostics!
+ They are almost all Sema diagnostics with "incomplete" in the name.
----------------
have you considered updating these diagnostics to have "incomplete" as diagnostic category and do the filtering here based on that?
================
Comment at: clang-tools-extra/clangd/IncludeFixer.cpp:176
+ if (auto * ET = llvm::dyn_cast<EnumType>(T))
+ if (ET->getDecl()->getDefinition() == nullptr)
+ return fixIncompleteType(*T);
----------------
nit: `if (!ET->...)`
================
Comment at: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp:842
- ns::X $incomplete[[var]];
- $tag[[ref_x]]->f();
- $use[[ns::X()]];
- $sizeof[[sizeof]](ns::X);
- for (auto it : $for[[ref_x]]);
+ std::vector<std::pair<llvm::StringRef, llvm::StringRef>> Tests{
+ {"incomplete_nested_name_spec", "[[ns::X::]]Nested n;"},
----------------
thanks this one looks a lot better!
I just wonder if we should send it as a separate patch though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115484/new/
https://reviews.llvm.org/D115484
More information about the cfe-commits
mailing list