MCPcopy Create free account
hub / github.com/KDE/kdevelop / findForwardDeclaration

Method findForwardDeclaration

plugins/clang/duchain/clanghelpers.cpp:283–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283DeclarationPointer ClangHelpers::findForwardDeclaration(CXType type, DUContext* context, CXCursor cursor)
284{
285 if(type.kind != CXType_Record && type.kind != CXType_ObjCInterface && type.kind != CXType_ObjCClass){
286 return {};
287 }
288
289 auto qualifiedIdentifier = QualifiedIdentifier(ClangString(clang_getTypeSpelling(type)).toString());
290
291 DUChainReadLocker lock;
292 const auto decls = context->findDeclarations(qualifiedIdentifier,
293 CursorInRevision(ClangLocation(clang_getCursorLocation(cursor)))
294 );
295
296 for (auto decl : decls) {
297 if (decl->isForwardDeclaration()) {
298 return DeclarationPointer(decl);
299 }
300 }
301 return {};
302}
303
304RangeInRevision ClangHelpers::cursorSpellingNameRange(CXCursor cursor, const Identifier& id)
305{

Callers

nothing calls this directly

Calls 7

ClangStringClass · 0.85
ClangLocationClass · 0.85
findDeclarationsMethod · 0.80
QualifiedIdentifierClass · 0.50
CursorInRevisionClass · 0.50
toStringMethod · 0.45
isForwardDeclarationMethod · 0.45

Tested by

no test coverage detected