Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clangd/IncludeCleaner.cpp | ||
---|---|---|
38 | I don't understand this special case. | |
93 | This says what, rather than why. Rather maybe: Enums may be usefully forward-declared as *complete* types by specifying an underlying type. In this case, the definition should see the declaration so they can be checked for compatibility. | |
96 | D->isThisDeclarationADefinition() is more idiomatic for the first part | |
98 | rather add(D) here? |
Resolve review comments.
clang-tools-extra/clangd/IncludeCleaner.cpp | ||
---|---|---|
38 | Yes, this is for cases like { "enum class Color;", "enum class Color {}; Color c;", }, I think the problem here is that if we see the definition of the enum, it should be the "ground truth" for the usage, forward declarations are not really useful in this case. It's not much different from the class but I just wanted to handle it separately, not sure if it's OK to merge these two changes into one patch. |
clang-tools-extra/clangd/IncludeCleaner.cpp | ||
---|---|---|
38 | The heuristic seems plausible, though there are counterexamples like: "enum Color;" "void foo(Color); enum Color {};" My main argument would be that we have a general policy here: conservatively consider all redecls as used, rather than trying to work out which is best. It's not clear why enums are special enough that we should hack around them without rethinking the policy. (I think VisitEnumDecl is different - our general policy is that decls *aren't* references to forward-decls, and in enums' case this is violates our meta-policy of "be conservative, consider everything that might be a use"). |
Resolve review & offline comments.
clang-tools-extra/clangd/IncludeCleaner.cpp | ||
---|---|---|
38 | This and our offline discussion makes total sense, I will delete it from the patch. |
Follow-up commit https://github.com/llvm/llvm-project/commit/1c2e249f938c50e1b331a1f7adc83c0a381f3897 (which doesn't seem to have its own phab link) broke clangd tests everywhere, e.g. http://45.33.8.238/linux/59134/step_9.txt
Please take a look.
This is like the third clangd-caused build failure in the last 12 h or so h :/
Yes, I'm aware and actively working on this one. I think I have the fix but
I'm trying to run all the tests (Clang etc) to make sure it doesn't break
anything else.
Hey Kirill,
If you mean removing traversal of the enumdecl->enumtype in
RecursiveASTVisitor, that's a subtle change that potentially affects a
lot of callers.
We'd need to be able to revert it, so we shouldn't rely on it to get
the tests back to green.
It looks like there's a single assertion failure, can you just change
the assertion to assert the (bad) current behavior?
(Or revert the patches)
I don't understand this special case.
It seems you're trying to avoid requiring too many redecls of a referenced type. Why is this important, and different from e.g. Class?