if (!fromStd(function)) { CsmScope scope = function.getScope(); if (!CsmKindUtilities.isNamespace(scope) || !((CsmNamespace)scope).isGlobal()) { cancelled.set(true);
private static XRefResultSet.ContextScope classifyFunctionScope(CsmFunction fun, PrintWriter printOut) { assert fun != null; XRefResultSet.ContextScope out = XRefResultSet.ContextScope.UNRESOLVED; CsmScope outScope = fun.getScope(); if (outScope == null) { printOut.println("ERROR: no scope for function " + fun); // NOI18N return out; } if (CsmKindUtilities.isConstructor(fun)) { out = CsmBaseUtilities.isInlineFunction(fun) ? XRefResultSet.ContextScope.INLINED_CONSTRUCTOR : XRefResultSet.ContextScope.CONSTRUCTOR; } else if (CsmKindUtilities.isMethod(fun)) { out = CsmBaseUtilities.isInlineFunction(fun) ? XRefResultSet.ContextScope.INLINED_METHOD : XRefResultSet.ContextScope.METHOD; } else { if (CsmKindUtilities.isFile(outScope)) { out = XRefResultSet.ContextScope.FILE_LOCAL_FUNCTION; } else { CsmNamespace ns = CsmBaseUtilities.getFunctionNamespace(fun); if (ns != null) { out = ns.isGlobal() ? XRefResultSet.ContextScope.GLOBAL_FUNCTION : XRefResultSet.ContextScope.NAMESPACE_FUNCTION; } } } if (out == XRefResultSet.ContextScope.UNRESOLVED) { printOut.println("ERROR: non classified function " + fun); // NOI18N } return out; }
if (CsmKindUtilities.isFunctionDefinition(decl) && ((CsmFunction)decl).isStatic()) { CsmFunction func = (CsmFunction) decl; if (func.equals(func.getDeclaration()) && CsmKindUtilities.isFile(func.getScope())) { if(CsmVisibilityQuery.isVisible(func)) { symbols.add(new CppSymbolDescriptor(func));
private List<CsmType> createFunctionParams(Collection<AST> targetFunParamsAsts, CsmFunction context) { List<CsmType> params = new ArrayList<>(); for (AST paramAst : targetFunParamsAsts) { if (paramAst != null) { AST paramTypeStart = paramAst.getFirstChild(); while (paramTypeStart != null && !AstUtil.isTypeNode(paramTypeStart) && !AstRenderer.isQualifier(paramTypeStart.getType())) { paramTypeStart = paramTypeStart.getNextSibling(); } if (paramTypeStart != null && AstRenderer.isQualifier(paramTypeStart.getType())) { AST typeAst = AstRenderer.getFirstSiblingSkipQualifiers(paramTypeStart); if (!AstUtil.isTypeNode(typeAst)) { paramTypeStart = null; } } if (paramTypeStart != null) { AST ptrOperator = AstUtil.findSiblingOfType(paramTypeStart, CPPTokenTypes.CSM_PTR_OPERATOR); // TODO: AST has wrong offsets here! CsmType type = TypeFactory.createType(paramTypeStart, context.getContainingFile(), ptrOperator, 0, context.getScope()); params.add(type); } } } return params; }
fun = decl != null ? decl : fun; if (fun != null) { owner = fun.getScope();