c++的cg图

   private static void trace(List functionDefList){
        functionDefList.stream().forEach(f->{
            IASTNode[] iastNodes = f.getDeclarator().getName().getChildren();
            Arrays.stream(iastNodes).forEach(t->{
                if (t instanceof CPPASTName){
                    CPPASTName cppastName = (CPPASTName) t;
                    IBinding iBinding = cppastName.resolveBinding();
                    if (iBinding instanceof CPPClassType) {
                        CxxClassFuncSetFactory.handle((CPPClassType) iBinding, new CxxFuncDef(f));
                    }
                }
            });
        });
    }


     

public class CxxClassFuncSetFactory {
    public static void handle(){
        Arrays.stream(cppClassType.getAllDeclaredMethods()).forEach(icppMethod -> {
             String cls = icppMethod.getClass().getName();
             if (icppMethod instanceof CPPConstructor) {
                //todo     
             }
             else if (icppMethod instanceof CPPMethod) {
                //todo
             }
        });
    }
}

if (iastNode instanceof IASTName) {
            IASTName iastName = (IASTName) iastNode;
            IBinding iBinding = iastName.resolveBinding();
            if(iBinding !=null && !(iBinding instanceof ProblemBinding)){
                try {
                    IScope iScope = iBinding.getScope();
                    System.out.println("scope:" + iScope.getClass().getName());
                    if(iScope != null && iScope.getScopeName() != null){
                        EScopeKind eScopeKind = iScope.getKind();
                        IName iName = iScope.getScopeName();
                        String simepleID = new String(iName.getSimpleID());
                        System.out.println();
//                        return FunctionCallDto.builder()
//                                .setScopeKind(iScope.getKind())
//                                .setScopeSimpleName(new String(iName.getSimpleID()))
//                                .setIastFileLocation(iastName.getFileLocation())
//                                .setVariableName(iastName.getRawSignature())
//                                .build();
                    }
                }catch (Exception e) {
                    logger.error(e);
                }
            }
        }

        Arrays.stream(iastNode.getChildren()).forEach(TraceUtil::trace);
    }

你可能感兴趣的:(数学建模)