| 1259 | //BEGIN build* |
| 1260 | template<CXCursorKind CK, class DeclType, bool hasContext> |
| 1261 | CXChildVisitResult Visitor::buildDeclaration(CXCursor cursor) |
| 1262 | { |
| 1263 | auto id = makeId(cursor); |
| 1264 | if (CK == CXCursor_UnexposedDecl && id.isEmpty()) { |
| 1265 | // skip unexposed declarations that have no identifier set |
| 1266 | // this is useful to skip e.g. friend declarations |
| 1267 | return CXChildVisit_Recurse; |
| 1268 | } |
| 1269 | IF_DEBUG(clangDebug() << "id:" << id << "- CK:" << CK << "- DeclType:" << typeid(DeclType).name() << "- hasContext:" << hasContext;) |
| 1270 | |
| 1271 | // Code path for class declarations that may be defined "out-of-line", e.g. |
| 1272 | // "SomeNameSpace::SomeClass {};" |
| 1273 | QScopedPointer<CurrentContext> helperContext; |
| 1274 | if (CursorKindTraits::isClass(CK) || CursorKindTraits::isFunction(CK)) { |
| 1275 | const auto lexicalParent = clang_getCursorLexicalParent(cursor); |
| 1276 | const auto semanticParent = clang_getCursorSemanticParent(cursor); |
| 1277 | const bool isOutOfLine = !clang_equalCursors(lexicalParent, semanticParent); |
| 1278 | if (isOutOfLine) { |
| 1279 | const QString scope = ClangUtils::getScope(cursor); |
| 1280 | auto context = createContext<CK, DUContext::Helper>(cursor, QualifiedIdentifier(scope)); |
| 1281 | helperContext.reset(new CurrentContext(context, m_parentContext->keepAliveContexts)); |
| 1282 | } |
| 1283 | } |
| 1284 | |
| 1285 | // if helperContext is null, this is a no-op |
| 1286 | PushValue<CurrentContext*> pushCurrent(m_parentContext, helperContext.isNull() ? m_parentContext : helperContext.data()); |
| 1287 | |
| 1288 | if (hasContext) { |
| 1289 | auto context = createContext<CK, CursorKindTraits::contextType(CK)>(cursor, QualifiedIdentifier(id)); |
| 1290 | createDeclaration<CK, DeclType>(cursor, id, context); |
| 1291 | CurrentContext newParent(context, m_parentContext->keepAliveContexts); |
| 1292 | PushValue<CurrentContext*> pushCurrent(m_parentContext, &newParent); |
| 1293 | clang_visitChildren(cursor, &visitCursor, this); |
| 1294 | return CXChildVisit_Continue; |
| 1295 | } |
| 1296 | createDeclaration<CK, DeclType>(cursor, id, nullptr); |
| 1297 | return CXChildVisit_Recurse; |
| 1298 | } |
| 1299 | |
| 1300 | CXChildVisitResult Visitor::buildParmDecl(CXCursor cursor) |
| 1301 | { |
nothing calls this directly
no test coverage detected