[clang-tools-extra] [clangd] Support symbolTags for document symbol (PR #113669)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 28 09:29:59 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 2e43a304f10fd801f068d0f9831f01f2c5b0b2e2 5b77f732f6de70bc7b5eaee459ef600843cf5f63 --extensions cpp,h -- clang-tools-extra/clangd/AST.cpp clang-tools-extra/clangd/AST.h clang-tools-extra/clangd/FindSymbols.cpp clang-tools-extra/clangd/Protocol.cpp clang-tools-extra/clangd/Protocol.h clang-tools-extra/clangd/SemanticHighlighting.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clangd/FindSymbols.cpp b/clang-tools-extra/clangd/FindSymbols.cpp
index 3a782506d3..b7e3df73f9 100644
--- a/clang-tools-extra/clangd/FindSymbols.cpp
+++ b/clang-tools-extra/clangd/FindSymbols.cpp
@@ -187,34 +187,33 @@ std::string getSymbolName(ASTContext &Ctx, const NamedDecl &ND) {
return printName(Ctx, ND);
}
-std::vector<SymbolTag> getSymbolTags(const NamedDecl &ND)
-{
+std::vector<SymbolTag> getSymbolTags(const NamedDecl &ND) {
std::vector<SymbolTag> Tags;
- if (ND.isDeprecated())
+ if (ND.isDeprecated())
Tags.push_back(SymbolTag::Deprecated);
- if (isConst(&ND))
- Tags.push_back(SymbolTag::Constant);
- if (isStatic(&ND))
- Tags.push_back(SymbolTag::Static);
+ if (isConst(&ND))
+ Tags.push_back(SymbolTag::Constant);
+ if (isStatic(&ND))
+ Tags.push_back(SymbolTag::Static);
if (isVirtual(&ND))
- Tags.push_back(SymbolTag::Virtual);
-
+ Tags.push_back(SymbolTag::Virtual);
+
if (const FieldDecl *FD = dyn_cast<FieldDecl>(&ND)) {
switch (FD->getAccess()) {
- case AS_public:
- Tags.push_back(SymbolTag::Public);
- break;
- case AS_protected:
- Tags.push_back(SymbolTag::Protected);
- break;
- case AS_private:
- Tags.push_back(SymbolTag::Private);
- break;
- default:
- break;
+ case AS_public:
+ Tags.push_back(SymbolTag::Public);
+ break;
+ case AS_protected:
+ Tags.push_back(SymbolTag::Protected);
+ break;
+ case AS_private:
+ Tags.push_back(SymbolTag::Private);
+ break;
+ default:
+ break;
}
- }
-
+ }
+
return Tags;
}
diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index 48d8c81d4a..33af2f47fd 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -1090,13 +1090,13 @@ struct CodeAction {
};
llvm::json::Value toJSON(const CodeAction &);
-enum class SymbolTag {
- Deprecated = 1 ,
+enum class SymbolTag {
+ Deprecated = 1,
Private = 2,
Package = 3,
Protected = 4,
Public = 5,
- Internal= 6,
+ Internal = 6,
File = 7,
Static = 8,
Abstract = 9,
@@ -1585,7 +1585,6 @@ struct ResolveTypeHierarchyItemParams {
bool fromJSON(const llvm::json::Value &, ResolveTypeHierarchyItemParams &,
llvm::json::Path);
-
/// The parameter of a `textDocument/prepareCallHierarchy` request.
struct CallHierarchyPrepareParams : public TextDocumentPositionParams {};
``````````
</details>
https://github.com/llvm/llvm-project/pull/113669
More information about the cfe-commits
mailing list