Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 30365 Build 30364: arc lint + arc unit
Event Timeline
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
28 | Functions should be static, not in anonymous namespace. See LLVM Coding Guidelines. | |
30 | Return type is not obvious, so auto should not be used. | |
121 | Return type is not obvious, so auto should not be used. | |
clang/lib/AST/TypePrinter.cpp | ||
1642 | Return type is not obvious, so auto should not be used. |
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
89–90 | can we unify this with getTemplateSpecializationArgLocs somehow? it seems that args as written would also be favorable here (see FIXME in line 112) | |
121 | nit: I'd suggest keeping {} for symmetry. | |
123 | why isn't this handled in getTemplateSpecializationArgLocs? Add a comment? | |
124 | could you add comment/example explaining what's special about this case? | |
clang-tools-extra/clangd/AST.h | ||
54 | Maybe printTemplateSpecializationArgs since we are only handling template specialization? I think we could drop AsWritten from the name. It should be clear to just explain in the comment. | |
clang-tools-extra/unittests/clangd/ASTUtilsTests.cpp | ||
16 ↗ | (On Diff #191677) | I think this kind of tests would be more readable using TEST_P [1] with code and expected arguments as parameters. Up to you though. |
clang/lib/AST/TypePrinter.cpp | ||
1635 | could you add clang tests for these changes? | |
1643 | why? /// Represents an empty template argument, e.g., one that has not /// been deduced. It seems legitimate. Since this hot code path, we would want to avoid hard assertion if possible. |
clang/lib/AST/TypePrinter.cpp | ||
---|---|---|
1640 | It's unclear to me what the new behavior is with changes in this file. Could you add comment? It might make sense to split the clang change into a separate patch and get folks who are more familiar to take a look. |
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
28 | We tend to put internal functions to anonymous namespace quite a lot in clangd. |
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
89–90 | See D59641 | |
123 | it is mentioned in getTemplateSpecializationArgLocs, would you rather move the comment here? | |
clang/lib/AST/TypePrinter.cpp | ||
1635 | We've also discussed this in the original comment and decided infrastructure necessary was too overwhelming. First we need to invoke compiler and get the AST, then write a Visitor to fetch relevant decls and only after that call printTemplateArguments ... | |
1640 | it just prevents erasure from TypeLoc to Type when printing the argument, so that we can do a fine-grained printing if Location is already there. | |
1643 | Sure, letting TemplateArgument::print handle that |
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
28 | I don't think it's reasonable to have one style per project. Even if clangd has such historical code, it'll be good idea to change it to confirm to common guidelines. Evolution of LLDB formatting style is good example. |
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
89–90 | thought? | |
123 | I think it would be clearer if we do something like: if (auto *Cls = llvm::dyn_cast<ClassTemplateSpecializationDecl>(&ND)) { // handle this specially because ... } else { // use getTemplateSpecializationArgLocs to handle rest of cases. } | |
136 | I'm not quite sure if I understand this FIXME. In this else branch, we are handling this case. Do you mean this is not a proper fix and future work is needed here? Could you elaborate? One thing that's worth commenting is why we could use Cls->getTemplateArgs().asArray() when Cls->getTypeAsWritten is null. It's not trivial from the code. | |
clang/lib/AST/TypePrinter.cpp | ||
1635 | No test at all is concerning... I think there are lit tests for AST printing in test/AST/. Is it possible to have some of those? | |
1640 | could you add this into comment? |
- Address comments
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
123 | I am not performing this in the order you mentioned since ClassTemplatePartialSpecializationDecl is also a ClassTemplateSpecializationDecl, but if you insist I can change the ordering by adding another condition(which just looks ugly). | |
136 | Yes, this should rather be fixed in AST itself. Updating comment to explain the fallback strategy. |
clang-tools-extra/clangd/AST.cpp | ||
---|---|---|
139 | Adding the test case, but the problem is there wouldn't be a change in behavior(at least not in the cases that I can think of) since a full specialization doesn't have any dependent types. |
clang-tools-extra/trunk/unittests/clangd/CMakeLists.txt | ||
---|---|---|
16 ↗ | (On Diff #194830) | Keep alphabetized? |
Maybe printTemplateSpecializationArgs since we are only handling template specialization?
I think we could drop AsWritten from the name. It should be clear to just explain in the comment.