• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IASTFunctionCallExpression类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression的典型用法代码示例。如果您正苦于以下问题:Java IASTFunctionCallExpression类的具体用法?Java IASTFunctionCallExpression怎么用?Java IASTFunctionCallExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IASTFunctionCallExpression类属于org.eclipse.cdt.core.dom.ast包,在下文中一共展示了IASTFunctionCallExpression类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visit

点赞 3

import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; //导入依赖的package包/类
@Override
public int visit(IASTFunctionCallExpression node) {
	nodeBnd = null;
	nodeName = null;
	returnedEntity = null;

	IASTNode[] children = node.getFunctionNameExpression().getChildren();
	for (int i=0; i < children.length - 1; i++) {   // for all children except the last one (presumably the called function's name)
		children[i].accept(this);
	}

	// try to identify (or create if a stub) the Behavioural being invoked
	Invocation invok = resolveInvokFromName(node, children[children.length - 1]);

	// sometimes there is no function name in the node therefore, no fmx to invok
	// this happens when the result of the call is casted, this creates 2 IASTFunctionCallExpression
	// The parent holds the cast and has empty function name

	visitInvocationArguments(node.getArguments(), invok);

	return PROCESS_SKIP;
}
 

开发者ID:Synectique,
项目名称:VerveineC-Cpp,
代码行数:23,
代码来源:InvocationAccessRefVisitor.java

示例2: visit

点赞 2

import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; //导入依赖的package包/类
@Override
public int visit(IASTExpression node) {
	if (node instanceof IASTFieldReference) {
		return visit((IASTFieldReference)node);
	}
	else if (node instanceof IASTIdExpression) {
		return visit((IASTIdExpression)node);
	}
	else if (node instanceof ICPPASTNewExpression) {
		return visit((ICPPASTNewExpression)node);
	}
	else if (node instanceof IASTFunctionCallExpression) {
		return visit((IASTFunctionCallExpression)node);
	}
	else if (node instanceof IASTUnaryExpression) {
		return visit((IASTUnaryExpression)node);   // to check whether this is an assignement
	}
	else if (node instanceof IASTBinaryExpression) {
		return visit((IASTBinaryExpression)node);   // to check whether this is an assignement
	}
	else if (node instanceof IASTLiteralExpression) {
		return visit((IASTLiteralExpression)node);
	}
	else if (node instanceof IASTTypeIdExpression) {
		return visit((IASTTypeIdExpression)node);
	}
	else if (node instanceof IASTCastExpression) {
		return visit((IASTCastExpression)node);
	}

	return super.visit(node);
}
 

开发者ID:Synectique,
项目名称:VerveineC-Cpp,
代码行数:33,
代码来源:AbstractDispatcherVisitor.java

示例3: visit

点赞 2

import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; //导入依赖的package包/类
public int visit(IASTFunctionCallExpression expression) {
	ISourceLocation loc = getSourceLocation(expression);
	IConstructor typ = tr.resolveType(expression);

	expression.getFunctionNameExpression().accept(this);
	IConstructor functionName = stack.pop();

	IListWriter arguments = vf.listWriter();
	Stream.of(expression.getArguments()).forEach(it -> {
		it.accept(this);
		arguments.append(stack.pop());
	});
	stack.push(builder.Expression_functionCall(functionName, arguments.done(), loc, typ));
	return PROCESS_ABORT;
}
 

开发者ID:cwi-swat,
项目名称:clair,
代码行数:16,
代码来源:Parser.java

示例4: visit

点赞 2

import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; //导入依赖的package包/类
public int visit(IASTExpression expression) {
    // if it�s a function call
    if (expression instanceof IASTFunctionCallExpression) {
        IASTFunctionCallExpression fce = (IASTFunctionCallExpression) expression;
        IASTExpression astExpr = fce.getFunctionNameExpression();
        String fnSig = astExpr.getRawSignature();
        if (isAssertion(fnSig)) {
            ++m_NumberOfAssertions;
        }
    }
    return PROCESS_CONTINUE;
}
 

开发者ID:dheraclio,
项目名称:dependometer,
代码行数:13,
代码来源:SourceFileParser.java

示例5: check

点赞 2

import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; //导入依赖的package包/类
@Override
public List<CheckResult> check(Object obj) {
    List<CheckResult> checkResults = Lists.newArrayList();

    IASTTranslationUnit translationUnit = (IASTTranslationUnit) obj;
    ASTExpressionsVisitor expressionsVisitor = new ASTExpressionsVisitor();
    translationUnit.accept(expressionsVisitor);

    for (IASTExpression expression: expressionsVisitor.getExpressions()) {
        if (!(expression instanceof IASTFunctionCallExpression))
            continue;
        IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression;
        if (callExpression.getFunctionNameExpression() == null)
            continue;
        if (!overflowFunctions.contains(callExpression.getFunctionNameExpression().toString()))
            continue;
        CheckResult checkResult = new CheckResult(
            ErrorItem.BUFFER_OVERFLOW_FUNCTION,
            ErrorType.RISK,
            translationUnit.getFilePath(),
            expression.getFileLocation().getStartingLineNumber(),
            expression.getFileLocation().getEndingLineNumber()
        );
        checkResults.add(checkResult);

        // log
        Map<String, Object> scopes = Maps.newHashMap();
        scopes.put("checkResult", checkResult);
        scopes.put("functionName", callExpression.getFunctionNameExpression().toString());
        String comments = compileErrorMessage(errorMessage, scopes);
        logger.error(comments);

        checkResult.setComments(comments);
    }

    return checkResults;
}
 

开发者ID:magicsky,
项目名称:sya,
代码行数:38,
代码来源:BufferOverflowFunctionChecker.java

示例6: resolveInvokFromName

点赞 2

import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression; //导入依赖的package包/类
protected Invocation resolveInvokFromName(IASTFunctionCallExpression node, IASTNode invokNode) {
	Invocation invok = null;
	NamedEntity fmx = null;

	if (invokNode instanceof IASTName) {
		nodeName = (IASTName)invokNode;
		nodeBnd = resolver.getBinding( nodeName );

		if (nodeBnd != null) {
			fmx = dico.getEntityByKey(nodeBnd);
		}

		if ( (fmx == null) && (nodeName != null) ) {
			fmx = resolver.resolveOrCreate(nodeName.toString(), /*mayBeNull*/true, /*mustBeClass*/false);
		}

		if ( (fmx == null) && (nodeName != null) ) {
			fmx = makeStubBehavioural(nodeName.toString(), node.getArguments().length, /*isMethod*/false);
		}

		if (fmx instanceof eu.synectique.verveine.core.gen.famix.Class) {
			// found a class instead of a behavioral. May happen, for example in the case of a "throw ClassName(...)"
			fmx = makeStubBehavioural(fmx.getName(), node.getArguments().length, /*isMethod*/true);
		}

		// now create the invocation
		if (fmx != null) {
			if (fmx instanceof BehaviouralEntity) {
				invok = invocationOfBehavioural((BehaviouralEntity) fmx);
				dico.addSourceAnchor(invok, filename, node.getFileLocation());
			}
			else if (fmx instanceof StructuralEntity) {
				// fmx is probably a pointer to a BehavioralEntity
				String stubSig =  resolver.mkStubSig(fmx.getName(), node.getArguments().length);
				invok = (DereferencedInvocation) dereferencedInvocation( (StructuralEntity)fmx, stubSig);
				dico.addSourceAnchor(invok, filename, node.getFileLocation());
			}
		}
	}

	return invok;
}
 

开发者ID:Synectique,
项目名称:VerveineC-Cpp,
代码行数:43,
代码来源:InvocationAccessRefVisitor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)