mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-24 08:39:13 +00:00
[clangd] Make go-to-def jumps to overriden methods on final
specifier.
Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D73690
This commit is contained in:
parent
2692751895
commit
827f49e3fa
@ -22,6 +22,7 @@
|
||||
#include "index/SymbolLocation.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Attr.h"
|
||||
#include "clang/AST/Attrs.inc"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/DeclCXX.h"
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
@ -277,7 +278,9 @@ std::vector<LocatedSymbol> locateSymbolAt(ParsedAST &AST, Position Pos,
|
||||
for (const NamedDecl *D : getDeclAtPosition(AST, SourceLoc, Relations)) {
|
||||
// Special case: void foo() ^override: jump to the overridden method.
|
||||
if (const auto *CMD = llvm::dyn_cast<CXXMethodDecl>(D)) {
|
||||
const auto *Attr = D->getAttr<OverrideAttr>();
|
||||
const InheritableAttr* Attr = D->getAttr<OverrideAttr>();
|
||||
if (!Attr)
|
||||
Attr = D->getAttr<FinalAttr>();
|
||||
const syntax::Token *Tok =
|
||||
spelledIdentifierTouching(SourceLoc, AST.getTokens());
|
||||
if (Attr && Tok &&
|
||||
|
@ -452,6 +452,11 @@ TEST(LocateSymbol, All) {
|
||||
class X : Y { void a() ^override {} };
|
||||
)cpp",
|
||||
|
||||
R"cpp(// Final specifier jumps to overridden method
|
||||
class Y { virtual void $decl[[a]]() = 0; };
|
||||
class X : Y { void a() ^final {} };
|
||||
)cpp",
|
||||
|
||||
R"cpp(// Heuristic resolution of dependent method
|
||||
template <typename T>
|
||||
struct S {
|
||||
|
Loading…
Reference in New Issue
Block a user