mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 09:45:39 +02:00
Cosmetics.
This commit is contained in:
parent
bd0e88a3e2
commit
090345f405
9 changed files with 1158 additions and 1170 deletions
|
@ -1,3 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Cortell - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.alltests;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
@ -13,20 +23,20 @@ public class AllTests extends TestSuite {
|
|||
public static Test suite() throws Exception {
|
||||
final AllTests suite = new AllTests();
|
||||
suite.addTest(org.eclipse.cdt.autotools.tests.AllAutotoolsTests.suite());
|
||||
// // There are intermittent failures in these tests. No pattern to failures. Seems like indexer is interrupted
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||
suite.addTest(org.eclipse.cdt.codan.core.test.AutomatedIntegrationSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.lrparser.tests.LRParserTestSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.parser.xlc.tests.suite.XlcTestSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.parser.upc.tests.UPCParserTestSuite.suite());
|
||||
}
|
||||
// // There are intermittent failures in these tests. No pattern to failures. Seems like indexer is interrupted
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||
suite.addTest(org.eclipse.cdt.codan.core.test.AutomatedIntegrationSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.lrparser.tests.LRParserTestSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.parser.xlc.tests.suite.XlcTestSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.core.parser.upc.tests.UPCParserTestSuite.suite());
|
||||
}
|
||||
suite.addTest(org.eclipse.cdt.core.suite.AutomatedIntegrationSuite.suite());
|
||||
|
||||
// These tests fail intermittently due to gdb not shutting down and thus
|
||||
// not being able to delete the project (exe locked)
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||
suite.addTest(org.eclipse.cdt.debug.core.tests.AllDebugTests.suite());
|
||||
}
|
||||
|
||||
// These tests fail intermittently due to gdb not shutting down and thus
|
||||
// not being able to delete the project (exe locked)
|
||||
if (System.getProperty("cdt.skip.known.test.failures") == null) { //$NON-NLS-1$
|
||||
suite.addTest(org.eclipse.cdt.debug.core.tests.AllDebugTests.suite());
|
||||
}
|
||||
suite.addTest(org.eclipse.cdt.errorparsers.xlc.tests.AllXlcErrorParserTests.suite());
|
||||
suite.addTest(org.eclipse.cdt.make.core.tests.AutomatedIntegrationSuite.suite());
|
||||
suite.addTest(org.eclipse.cdt.managedbuilder.tests.suite.AllManagedBuildTests.suite());
|
||||
|
|
|
@ -40,10 +40,7 @@ import org.eclipse.core.runtime.content.IContentType;
|
|||
* @author dsteffle
|
||||
*/
|
||||
public class DOMSearchUtil {
|
||||
private static final IASTName[] BLANK_NAME_ARRAY = new IASTName[0];
|
||||
// private static final IASTName[] EMPTY_NAME_LIST = BLANK_NAME_ARRAY;
|
||||
|
||||
public static final int DECLARATIONS = 1;
|
||||
public static final int DECLARATIONS = 1;
|
||||
public static final int DEFINITIONS = 2;
|
||||
public static final int DECLARATIONS_DEFINITIONS = 3;
|
||||
public static final int REFERENCES = 4;
|
||||
|
@ -135,7 +132,7 @@ public class DOMSearchUtil {
|
|||
IASTTranslationUnit tu = searchName.getTranslationUnit();
|
||||
|
||||
if (tu == null) {
|
||||
return BLANK_NAME_ARRAY;
|
||||
return IASTName.EMPTY_NAME_ARRAY;
|
||||
}
|
||||
|
||||
IBinding binding = searchName.resolveBinding();
|
||||
|
@ -162,7 +159,7 @@ public class DOMSearchUtil {
|
|||
// fix for 86829, 95224
|
||||
if ((binding instanceof ICPPConstructor || (binding instanceof ICPPMethod && ((ICPPMethod)binding).isDestructor()))
|
||||
&& binding.getScope() instanceof ICPPClassScope) {
|
||||
binding = ((ICPPClassScope)binding.getScope()).getClassType();
|
||||
binding = ((ICPPClassScope) binding.getScope()).getClassType();
|
||||
names = getNames(tu, binding, limitTo);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2013 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -19,8 +19,8 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
*/
|
||||
public interface ICPPFunctionScope extends ICPPScope {
|
||||
/**
|
||||
* Get the scope representing the function body. returns null if there is no
|
||||
* function definition
|
||||
* Returns the scope representing the function body, or {@code null} if there is no
|
||||
* function definition.
|
||||
*
|
||||
* @throws DOMException
|
||||
*/
|
||||
|
|
|
@ -127,7 +127,7 @@ public class CharTable extends HashTable {
|
|||
if (i < 0 || i > currEntry)
|
||||
return null;
|
||||
|
||||
return keyTable[ i ];
|
||||
return keyTable[i];
|
||||
}
|
||||
|
||||
public final boolean containsKey(char[] key, int start, int len) {
|
||||
|
@ -143,7 +143,7 @@ public class CharTable extends HashTable {
|
|||
if (idx == -1)
|
||||
return null;
|
||||
|
||||
return keyTable[ idx ];
|
||||
return keyTable[idx];
|
||||
}
|
||||
|
||||
public int lookup(char[] buffer) {
|
||||
|
@ -177,7 +177,7 @@ public class CharTable extends HashTable {
|
|||
}
|
||||
|
||||
public Object[] keyArray() {
|
||||
Object[] keys = new Object[ size() ];
|
||||
Object[] keys = new Object[size()];
|
||||
System.arraycopy(keyTable, 0, keys, 0, keys.length);
|
||||
return keys;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
|
@ -56,8 +56,8 @@ public class ASTInternal {
|
|||
if (scope instanceof IASTInternalScope) {
|
||||
((IASTInternalScope) scope).addName(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isStatic(IFunction func, boolean resolveAll) {
|
||||
if (func instanceof ICPPInternalFunction) {
|
||||
return ((ICPPInternalFunction) func).isStatic(resolveAll);
|
||||
|
@ -103,7 +103,7 @@ public class ASTInternal {
|
|||
if (node != null) {
|
||||
if (!isPartOfSource(node))
|
||||
return null;
|
||||
if ((result= resolveConflict(result, node)) == null)
|
||||
if ((result= resolveConflict(result, node)) == null)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class ASTInternal {
|
|||
return n2;
|
||||
|
||||
IASTFileLocation loc2= n2.getFileLocation();
|
||||
if (loc2 != null && loc1.getContextInclusionStatement() != loc2.getContextInclusionStatement())
|
||||
if (loc2 != null && loc1.getContextInclusionStatement() != loc2.getContextInclusionStatement())
|
||||
return null;
|
||||
|
||||
return n1;
|
||||
|
@ -167,7 +167,7 @@ public class ASTInternal {
|
|||
if (decls != null) {
|
||||
for (final IASTNode node : decls) {
|
||||
if (node != null) {
|
||||
if ((result= resolveConflict(result, node)) == null)
|
||||
if ((result= resolveConflict(result, node)) == null)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -194,14 +194,14 @@ public class ASTInternal {
|
|||
return true;
|
||||
IASTNode[] decls= internal.getDeclarations();
|
||||
return decls != null && decls.length > 0 && decls[0] != null;
|
||||
}
|
||||
}
|
||||
if (binding instanceof IIndexBinding) {
|
||||
try {
|
||||
return IndexFilter.ALL_DECLARED.acceptBinding(binding);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return binding != null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,18 +20,18 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
*/
|
||||
public interface IASTInternalScope extends IScope {
|
||||
/**
|
||||
* Return the physical IASTNode that this scope was created for
|
||||
* Returns the physical IASTNode that this scope was created for
|
||||
*/
|
||||
public IASTNode getPhysicalNode();
|
||||
|
||||
/**
|
||||
* This adds an IBinding to the scope. It is primarily used by the parser to add
|
||||
* Adds an IBinding to the scope. It is primarily used by the parser to add
|
||||
* implicit IBindings to the scope (such as GCC built-in functions).
|
||||
*/
|
||||
public void addBinding(IBinding binding);
|
||||
|
||||
/**
|
||||
* Add an IASTName to be cached in this scope
|
||||
* Adds an IASTName to be cached in this scope
|
||||
*/
|
||||
public void addName(IASTName name);
|
||||
|
||||
|
@ -47,5 +47,4 @@ public interface IASTInternalScope extends IScope {
|
|||
* node from the cache.
|
||||
*/
|
||||
public void removeNestedFromCache(IASTNode container);
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
* Scope of a function, containing labels.
|
||||
*/
|
||||
public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
||||
|
||||
private CharArrayObjectMap<IBinding> labels = CharArrayObjectMap.emptyMap();
|
||||
|
||||
/**
|
||||
|
@ -52,9 +51,6 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
return EScopeKind.eLocal;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#addBinding(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||
*/
|
||||
@Override
|
||||
public void addBinding(IBinding binding) {
|
||||
//3.3.4 only labels have function scope
|
||||
|
@ -67,16 +63,10 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
labels.put(binding.getNameCharArray(), binding);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
|
||||
*/
|
||||
public IBinding getBinding(IASTName name) {
|
||||
return labels.get(name.getLookupKey());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IBinding[] find(String name) {
|
||||
char[] n = name.toCharArray();
|
||||
|
@ -106,9 +96,6 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
return CPPVisitor.getContainingNonTemplateScope(name);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope#getBodyScope()
|
||||
*/
|
||||
@Override
|
||||
public IScope getBodyScope() {
|
||||
IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode();
|
||||
|
@ -121,9 +108,6 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
@Override
|
||||
public IName getScopeName() {
|
||||
IASTNode node = getPhysicalNode();
|
||||
|
|
|
@ -375,26 +375,24 @@ public class CPPVisitor extends ASTQueries {
|
|||
}
|
||||
|
||||
private static IBinding createBinding(IASTGotoStatement gotoStatement) {
|
||||
ICPPFunctionScope functionScope = (ICPPFunctionScope) getContainingScope(gotoStatement.getName());
|
||||
IASTName name = gotoStatement.getName();
|
||||
IBinding binding;
|
||||
binding = functionScope.getBinding(name, false);
|
||||
ICPPFunctionScope functionScope = (ICPPFunctionScope) getContainingScope(name);
|
||||
IBinding binding = functionScope.getBinding(name, false);
|
||||
if (binding == null || !(binding instanceof ILabel)) {
|
||||
binding = new CPPLabel(name);
|
||||
ASTInternal.addName(functionScope, name);
|
||||
ASTInternal.addName(functionScope, name);
|
||||
}
|
||||
|
||||
return binding;
|
||||
}
|
||||
|
||||
private static IBinding createBinding(IASTLabelStatement labelStatement) {
|
||||
ICPPFunctionScope functionScope = (ICPPFunctionScope) getContainingScope(labelStatement.getName());
|
||||
IASTName name = labelStatement.getName();
|
||||
IBinding binding;
|
||||
binding = functionScope.getBinding(name, false);
|
||||
ICPPFunctionScope functionScope = (ICPPFunctionScope) getContainingScope(name);
|
||||
IBinding binding = functionScope.getBinding(name, false);
|
||||
if (binding == null || !(binding instanceof ILabel)) {
|
||||
binding = new CPPLabel(name);
|
||||
ASTInternal.addName(functionScope, name);
|
||||
ASTInternal.addName(functionScope, name);
|
||||
} else {
|
||||
((CPPLabel) binding).setLabelStatement(name);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue