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