1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Code formatting.

This commit is contained in:
Sergey Prigogin 2008-05-26 03:50:33 +00:00
parent bf0052226e
commit 36fcc9697a

View file

@ -149,8 +149,7 @@ public class CVisitor {
}
private void addProblem(IASTProblem problem) {
if( problems.length == numFound ) // if the found array is full, then double the array
{
if (problems.length == numFound) { // if the found array is full, then double the array
IASTProblem[] old = problems;
problems = new IASTProblem[old.length * 2];
for (int j = 0; j < old.length; ++j)
@ -907,7 +906,8 @@ public class CVisitor {
}
node= node.getParent();
}
while (node instanceof IASTDeclarator);
while (node instanceof IASTDeclarator)
;
IScope scope = getContainingScope(parent);
@ -1034,6 +1034,7 @@ public class CVisitor {
protected static IBinding resolveBinding(IASTNode node) {
return resolveBinding(node, COMPLETE);
}
protected static IBinding resolveBinding(IASTNode node, int bits) {
if (node instanceof IASTFunctionDefinition) {
IASTFunctionDefinition functionDef = (IASTFunctionDefinition) node;
@ -1279,7 +1280,6 @@ public class CVisitor {
CharArrayObjectMap prefixMap = prefix ? new CharArrayObjectMap(2) : null;
while (blockItem != null) {
IASTNode parent = blockItem.getParent();
IASTNode[] nodes = null;
IScope scope = null;
@ -1601,6 +1601,7 @@ public class CVisitor {
}
return null;
}
private static IASTName checkForBinding(IScope scope, IASTDeclaration declaration, IASTName name, boolean typesOnly, CharArrayObjectMap prefixMap) throws DOMException{
char[] n = name.toCharArray();
IASTName tempName = null;
@ -1655,9 +1656,11 @@ public class CVisitor {
protected static IASTDeclarator findDefinition(IASTDeclarator declarator, int beginAtLoc) {
return (IASTDeclarator) findDefinition(declarator, declarator.getName().toCharArray(), beginAtLoc);
}
protected static IASTFunctionDeclarator findDefinition(IASTFunctionDeclarator declarator) {
return (IASTFunctionDeclarator) findDefinition(declarator, declarator.getName().toCharArray(), AT_NEXT);
}
protected static IASTDeclSpecifier findDefinition(ICASTElaboratedTypeSpecifier declSpec) {
return (IASTDeclSpecifier) findDefinition(declSpec, declSpec.getName().toCharArray(), AT_BEGINNING);
}
@ -1856,6 +1859,7 @@ public class CVisitor {
return createBaseType(declSpec);
}
/**
* Returns an IType[] corresponding to the parameter types of the IASTFunctionDeclarator parameter.
*
@ -1997,23 +2001,19 @@ public class CVisitor {
return action.getDeclarationNames();
}
public static IASTName[] getReferences(IASTTranslationUnit tu, IBinding binding) {
CollectReferencesAction action = new CollectReferencesAction(binding);
tu.accept(action);
return action.getReferences();
}
public static IBinding findTypeBinding(IASTNode startingPoint, IASTName name) throws DOMException {
if( startingPoint instanceof IASTTranslationUnit )
{
if (startingPoint instanceof IASTTranslationUnit) {
IASTDeclaration[] declarations = ((IASTTranslationUnit)startingPoint).getDeclarations();
if (declarations.length > 0)
return (IBinding) findBinding(declarations[declarations.length - 1], name, COMPLETE | INCLUDE_BLOCK_ITEM );
}
if( startingPoint instanceof IASTCompoundStatement )
{
if (startingPoint instanceof IASTCompoundStatement) {
IASTStatement[] statements = ((IASTCompoundStatement)startingPoint).getStatements();
if (statements.length > 0)
return (IBinding) findBinding(statements[statements.length - 1], name, COMPLETE | INCLUDE_BLOCK_ITEM);
@ -2147,8 +2147,9 @@ public class CVisitor {
} else {
pointOfDecl = nd.getOffset() + nd.getLength();
}
} else
} else {
pointOfDecl = nd.getOffset() + nd.getLength();
}
return (pointOfDecl < ((ASTNode)nodeB).getOffset());
}