mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
566e4fdca9
commit
cc5074d0bc
22 changed files with 78 additions and 75 deletions
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
|
@ -74,7 +74,8 @@ public class ASTInternal {
|
|||
}
|
||||
}
|
||||
|
||||
public static IASTNode getDeclaredInSourceFileOnly(IIndexFragment forFragment, IBinding binding, boolean requireDefinition, PDOMBinding nonLocal) {
|
||||
public static IASTNode getDeclaredInSourceFileOnly(IIndexFragment forFragment, IBinding binding,
|
||||
boolean requireDefinition, PDOMBinding glob) {
|
||||
IASTNode[] decls;
|
||||
IASTNode def;
|
||||
if (binding instanceof ICPPInternalBinding) {
|
||||
|
@ -110,9 +111,9 @@ public class ASTInternal {
|
|||
if (result == null)
|
||||
return null;
|
||||
|
||||
if (requireDefinition && nonLocal != null) {
|
||||
if (requireDefinition && glob != null) {
|
||||
try {
|
||||
if (nonLocal.hasDeclaration())
|
||||
if (glob.hasDeclaration())
|
||||
return null;
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class CPPBuiltinParameter extends PlatformObject implements ICPPParameter
|
|||
return result;
|
||||
}
|
||||
|
||||
private IType type= null;
|
||||
private IType type;
|
||||
|
||||
public CPPBuiltinParameter(IType type) {
|
||||
this.type = type;
|
||||
|
|
|
@ -31,8 +31,8 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
* Binding for a c++ function parameter
|
||||
*/
|
||||
public class CPPLambdaExpressionParameter extends PlatformObject implements ICPPParameter {
|
||||
private IType fType = null;
|
||||
private IASTName fDeclaration = null;
|
||||
private IType fType;
|
||||
private IASTName fDeclaration;
|
||||
|
||||
public CPPLambdaExpressionParameter(IASTName name) {
|
||||
fDeclaration = name;
|
||||
|
@ -77,14 +77,17 @@ public class CPPLambdaExpressionParameter extends PlatformObject implements ICPP
|
|||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getQualifiedName() {
|
||||
return new String[] { getName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[][] getQualifiedNameCharArray() {
|
||||
return new char[][] { getNameCharArray() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGloballyQualified() {
|
||||
return false;
|
||||
|
|
|
@ -15,12 +15,10 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
|
||||
|
||||
/**
|
||||
* Caches instances per template, the template definitions need to implement this interface
|
||||
*/
|
||||
public interface ICPPInstanceCache {
|
||||
|
||||
/**
|
||||
* Attempts to cache an instance with this template
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -18,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
* Interface for ast-internal implementations of function bindings.
|
||||
*/
|
||||
public interface ICPPInternalFunction extends ICPPInternalBinding {
|
||||
|
||||
/**
|
||||
* Called to resolve the parameter in the second phase.
|
||||
*/
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* IBM - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
|
||||
|
||||
/**
|
||||
* Interface for templates from the ast.
|
||||
*/
|
||||
|
|
|
@ -534,8 +534,9 @@ public class CPPTemplates {
|
|||
|
||||
ICPPASTTemplateDeclaration templateDeclaration = templates[0];
|
||||
IASTDeclaration decl = templateDeclaration.getDeclaration();
|
||||
while (decl instanceof ICPPASTTemplateDeclaration)
|
||||
while (decl instanceof ICPPASTTemplateDeclaration) {
|
||||
decl = ((ICPPASTTemplateDeclaration) decl).getDeclaration();
|
||||
}
|
||||
|
||||
IASTName name = null;
|
||||
if (decl instanceof IASTSimpleDeclaration) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
|
@ -26,20 +26,20 @@ abstract class CompositeCPPBinding extends CompositeIndexBinding implements ICPP
|
|||
@Override
|
||||
public String[] getQualifiedName() {
|
||||
try {
|
||||
return ((ICPPBinding)rbinding).getQualifiedName();
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
return ((ICPPBinding) rbinding).getQualifiedName();
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
return ((ICPPBinding)rbinding).getQualifiedNameCharArray();
|
||||
return ((ICPPBinding) rbinding).getQualifiedNameCharArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
return ((ICPPBinding)rbinding).isGloballyQualified();
|
||||
return ((ICPPBinding) rbinding).isGloballyQualified();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
|
|
|
@ -297,16 +297,17 @@ abstract public class PDOMWriter {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
} catch (RuntimeException e) {
|
||||
th= e;
|
||||
} catch (StackOverflowError e) {
|
||||
th= e;
|
||||
} catch (AssertionError e) {
|
||||
th= e;
|
||||
} finally {
|
||||
// Because the caller holds a read-lock, the result cache of the index is never cleared.
|
||||
// ==> Before releasing the lock for the last time in this ast, we clear the result cache.
|
||||
if (i == data.fSelectedFiles.length-1) {
|
||||
// Because the caller holds a read-lock, the result cache of the index is never
|
||||
// cleared. Before releasing the lock for the last time in this AST, we clear
|
||||
// the result cache.
|
||||
if (i == data.fSelectedFiles.length - 1) {
|
||||
data.fIndex.clearResultCache();
|
||||
}
|
||||
lock.release();
|
||||
|
|
|
@ -115,7 +115,7 @@ public class FindBinding {
|
|||
public PDOMBinding getResult() {
|
||||
return fResult;
|
||||
}
|
||||
// IPDOMVisitor
|
||||
|
||||
@Override
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
if (node instanceof PDOMBinding) {
|
||||
|
@ -127,7 +127,7 @@ public class FindBinding {
|
|||
}
|
||||
return false; /* do not visit children of node */
|
||||
}
|
||||
// IPDOMVisitor
|
||||
|
||||
@Override
|
||||
public void leave(IPDOMNode node) throws CoreException {
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Bryan Wilkinson
|
||||
*/
|
||||
public interface IPDOMOverloader {
|
||||
|
||||
/**
|
||||
* @return the signature hash for this PDOM element, which will be unique
|
||||
* for all sibling IPDOMOverloaders with the same name.
|
||||
|
|
|
@ -211,7 +211,7 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation {
|
|||
try {
|
||||
Database db = linkage.getDB();
|
||||
long bindingRec = db.getRecPtr(record + BINDING_REC_OFFSET);
|
||||
PDOMBinding binding = linkage.getBinding(bindingRec);
|
||||
IPDOMBinding binding = linkage.getBinding(bindingRec);
|
||||
return binding != null ? binding.getNameCharArray() : null;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
|
|
|
@ -80,27 +80,28 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
|
||||
@Override
|
||||
public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
|
||||
if (newBinding instanceof IFunction) {
|
||||
IFunction func= (IFunction) newBinding;
|
||||
IFunctionType newType;
|
||||
IParameter[] newParams;
|
||||
byte newAnnotation;
|
||||
newType= func.getType();
|
||||
newParams = func.getParameters();
|
||||
newAnnotation = PDOMCAnnotation.encodeAnnotation(func);
|
||||
if (!(newBinding instanceof IFunction))
|
||||
return;
|
||||
|
||||
setType(linkage, newType);
|
||||
PDOMCParameter oldParams= getFirstParameter(null);
|
||||
setParameters(newParams);
|
||||
if (oldParams != null) {
|
||||
oldParams.delete(linkage);
|
||||
}
|
||||
getDB().putByte(record + ANNOTATIONS, newAnnotation);
|
||||
IFunction func= (IFunction) newBinding;
|
||||
IFunctionType newType;
|
||||
IParameter[] newParams;
|
||||
byte newAnnotation;
|
||||
newType= func.getType();
|
||||
newParams = func.getParameters();
|
||||
newAnnotation = PDOMCAnnotation.encodeAnnotation(func);
|
||||
|
||||
setType(linkage, newType);
|
||||
PDOMCParameter oldParams= getFirstParameter(null);
|
||||
setParameters(newParams);
|
||||
if (oldParams != null) {
|
||||
oldParams.delete(linkage);
|
||||
}
|
||||
getDB().putByte(record + ANNOTATIONS, newAnnotation);
|
||||
}
|
||||
|
||||
private void setType(PDOMLinkage linkage, IFunctionType ft) throws CoreException {
|
||||
linkage.storeType(record+FUNCTION_TYPE, ft);
|
||||
linkage.storeType(record + FUNCTION_TYPE, ft);
|
||||
}
|
||||
|
||||
private void setParameters(IParameter[] params) throws CoreException {
|
||||
|
@ -109,7 +110,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
db.putInt(record + NUM_PARAMS, params.length);
|
||||
db.putRecPtr(record + FIRST_PARAM, 0);
|
||||
PDOMCParameter next= null;
|
||||
for (int i= params.length-1; i >= 0; --i) {
|
||||
for (int i= params.length; --i >= 0;) {
|
||||
next= new PDOMCParameter(linkage, this, params[i], next);
|
||||
}
|
||||
db.putRecPtr(record + FIRST_PARAM, next == null ? 0 : next.getRecord());
|
||||
|
@ -134,8 +135,8 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
public IFunctionType getType() {
|
||||
try {
|
||||
return (IFunctionType) getLinkage().loadType(record + FUNCTION_TYPE);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new ProblemFunctionType(ISemanticProblem.TYPE_NOT_PERSISTED);
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +164,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
|
|||
|
||||
long next = db.getRecPtr(record + FIRST_PARAM);
|
||||
for (int i = 0; i < n && next != 0; i++) {
|
||||
IType type= i<ptypes.length ? ptypes[i] : null;
|
||||
IType type= i < ptypes.length ? ptypes[i] : null;
|
||||
final PDOMCParameter par = new PDOMCParameter(linkage, next, type);
|
||||
next= par.getNextPtr();
|
||||
result[i]= par;
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.internal.core.index.IndexCPPSignatureUtil;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.FindBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
|
@ -34,12 +35,13 @@ public class CPPFindBinding extends FindBinding {
|
|||
public CPPBindingBTreeComparator(PDOMLinkage linkage) {
|
||||
super(linkage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(long record1, long record2) throws CoreException {
|
||||
int cmp = super.compare(record1, record2);
|
||||
if (cmp == 0) {
|
||||
PDOMBinding binding1 = linkage.getBinding(record1);
|
||||
PDOMBinding binding2 = linkage.getBinding(record2);
|
||||
IPDOMBinding binding1 = linkage.getBinding(record1);
|
||||
IPDOMBinding binding2 = linkage.getBinding(record2);
|
||||
if (binding1 instanceof IPDOMOverloader && binding2 instanceof IPDOMOverloader) {
|
||||
int ty1 = ((IPDOMOverloader) binding1).getSignatureHash();
|
||||
int ty2 = ((IPDOMOverloader) binding2).getSignatureHash();
|
||||
|
@ -66,7 +68,7 @@ public class CPPFindBinding extends FindBinding {
|
|||
int c1 = PDOMNode.getNodeType(fLinkage.getDB(), record);
|
||||
int c2= fConstant;
|
||||
if (c1 == c2) {
|
||||
PDOMBinding binding = fLinkage.getBinding(record);
|
||||
IPDOMBinding binding = fLinkage.getBinding(record);
|
||||
if (binding instanceof IPDOMOverloader) {
|
||||
c1 = ((IPDOMOverloader) binding).getSignatureHash();
|
||||
c2= fSigHash;
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding
|
|||
|
||||
@Override
|
||||
public final boolean isGloballyQualified() throws DOMException {
|
||||
// local stuff is not stored in the index.
|
||||
// Local stuff is not stored in the index.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -64,8 +64,9 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
super(linkage, parent, template);
|
||||
|
||||
final Database db = getDB();
|
||||
final ICPPTemplateParameter[] origParams= template.getTemplateParameters();
|
||||
final IPDOMCPPTemplateParameter[] params = PDOMTemplateParameterArray.createPDOMTemplateParameters(linkage, this, origParams);
|
||||
ICPPTemplateParameter[] origParams= template.getTemplateParameters();
|
||||
IPDOMCPPTemplateParameter[] params =
|
||||
PDOMTemplateParameterArray.createPDOMTemplateParameters(linkage, this, origParams);
|
||||
long rec= PDOMTemplateParameterArray.putArray(db, params);
|
||||
db.putRecPtr(record + PARAMETERS, rec);
|
||||
db.putShort(record + RELEVANT_PARAMETERS, (short) params.length);
|
||||
|
@ -247,8 +248,9 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
// exclude other kinds of class templates
|
||||
if (type instanceof ICPPClassTemplatePartialSpecialization ||
|
||||
type instanceof ICPPTemplateTemplateParameter ||
|
||||
type instanceof ICPPClassSpecialization)
|
||||
type instanceof ICPPClassSpecialization) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ICPPClassType ctype= (ICPPClassType) type;
|
||||
if (ctype.getKey() != getKey())
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -35,7 +35,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
||||
implements ICPPFunctionTemplate, ICPPInstanceCache, IPDOMMemberOwner, IPDOMCPPTemplateParameterOwner {
|
||||
|
||||
private static final int TEMPLATE_PARAMS = PDOMCPPFunction.RECORD_SIZE;
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
|
|
|
@ -56,7 +56,7 @@ class PDOMCPPParameter extends PDOMNamedNode implements ICPPParameter, IPDOMBind
|
|||
public PDOMCPPParameter(PDOMLinkage linkage, PDOMNode parent, ICPPParameter param, PDOMCPPParameter next)
|
||||
throws CoreException {
|
||||
super(linkage, parent, param.getNameCharArray());
|
||||
fType= null; // this constructor is used for adding parameters to the database, only.
|
||||
fType= null; // This constructor is used for adding parameters to the database, only.
|
||||
|
||||
Database db = getDB();
|
||||
db.putByte(record + FLAGS, param.hasDefaultValue() ? FLAG_DEFAULT_VALUE : 0);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -41,7 +41,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMemberOwner,
|
||||
ICPPTemplateTypeParameter, ICPPUnknownBinding, ICPPUnknownType, IIndexType,
|
||||
IPDOMCPPTemplateParameter {
|
||||
|
||||
private static final int PACK_BIT = 1 << 31;
|
||||
|
||||
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE;
|
||||
|
|
Loading…
Add table
Reference in a new issue