From 5e1b5af8df4f8d3476667de9ed9552bcc0bd1dcd Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 25 Feb 2015 19:57:24 -0800 Subject: [PATCH] You can forward declare a class as a struct and vice versa. --- src/Project.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Project.cpp b/src/Project.cpp index f72761c37..4aa75f4af 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -958,6 +958,14 @@ Set Project::findTargets(const Symbol &symbol) if (symbol.isClass() && symbol.isDefinition()) return ret; + auto sameKind = [&symbol](CXCursorKind kind) { + if (kind == symbol.kind) + return true; + if (symbol.isClass()) + return kind == CXCursor_ClassDecl || kind == CXCursor_StructDecl; + return false; + }; + switch (symbol.kind) { case CXCursor_ClassDecl: case CXCursor_ClassTemplate: @@ -969,7 +977,7 @@ Set Project::findTargets(const Symbol &symbol) case CXCursor_FunctionTemplate: { const Set symbols = findByUsr(symbol.usr, symbol.location.fileId(), symbol.isDefinition() ? ArgDependsOn : DependsOnArg); for (const auto &c : symbols) { - if (symbol.kind == c.kind && symbol.isDefinition() != c.isDefinition()) { + if (sameKind(c.kind) && symbol.isDefinition() != c.isDefinition()) { ret.insert(c); break; }