-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Autocomplete] skip static annotation comment #164854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-clangd @llvm/pr-subscribers-clang-tools-extra Author: Kostiantyn Liepieshov (liepieshov) ChangesSkip Full diff: https://github.com/llvm/llvm-project/pull/164854.diff 2 Files Affected:
diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp
index 718c1bc5f355a..d0b88918894c0 100644
--- a/clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -2019,6 +2019,22 @@ TEST(Hover, All) {
HI.Definition = "class Foo {}";
HI.Documentation = "Forward class declaration";
}},
+ {
+ R"cpp(// Function declaration ignore static annotation
+ void foo();
+ /*static*/ void foo() {}
+ void g() { [[f^oo]](); }
+ )cpp",
+ [](HoverInfo &HI) {
+ HI.Name = "foo";
+ HI.Kind = index::SymbolKind::Function;
+ HI.NamespaceScope = "";
+ HI.Type = "void ()";
+ HI.Definition = "void foo()";
+ HI.Documentation = "Function declaration ignore static annotation";
+ HI.ReturnType = "void";
+ HI.Parameters = std::vector<HoverInfo::Param>{};
+ }},
{
R"cpp(// Function declaration
void foo();
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 32c8f6209a693..caecab17cb81b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -398,7 +398,7 @@ const RawComment *ASTContext::getRawCommentForAnyRedecl(
continue;
}
const RawComment *RedeclComment = getRawCommentForDeclNoCache(Redecl);
- if (RedeclComment) {
+ if (RedeclComment && RedeclComment->getRawText(SourceMgr) != "/*static*/") {
cacheRawCommentForDecl(*Redecl, *RedeclComment);
if (OriginalDecl)
*OriginalDecl = Redecl;
|
Skip /*static*/ annotation on function definitions to use the better defined declaration documentation.
52ea575 to
8d5d646
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is better than before. So LGTM.
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Skip
/*static*/annotation on function definitions to use the better defined declaration documentation.