1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Bug 341440: Thread safety for PDOM objects.

This commit is contained in:
Markus Schorn 2011-04-01 09:08:56 +00:00
parent 64dfda5331
commit ffd5ae3839
30 changed files with 100 additions and 79 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2010 IBM Corporation and others.
* Copyright (c) 2004, 2011 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
@ -7,6 +7,7 @@
*
* Contributors:
* Devin Steffler (IBM Corporation) - initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -18,8 +19,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
import org.eclipse.core.runtime.CoreException;
public class CFunctionType implements IFunctionType, ISerializableType {
IType[] parameters = null;
IType returnType = null;
private final IType[] parameters;
private final IType returnType;
public CFunctionType( IType returnType, IType [] types ) {
this.returnType = returnType;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2011 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
@ -41,10 +41,11 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
/**
* Base class for all specialization scopes
* For safe usage in index bindings, all fields need to be final or volatile.
*/
public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializationScope {
final private ICPPClassSpecialization specialClass;
private ICPPBase[] fBases;
private volatile ICPPBase[] fBases; // Used by the pdom bindings, needs to be volatile.
public AbstractCPPClassSpecializationScope(ICPPClassSpecialization specialization) {
this.specialClass= specialization;

View file

@ -23,21 +23,17 @@ import org.eclipse.core.runtime.CoreException;
/**
* Represents c++ function types. Note that we keep typedefs as part of the function type.
* For safe usage in index bindings, all fields need to be final.
*/
public class CPPFunctionType implements ICPPFunctionType, ISerializableType {
private IType[] parameters;
private IType returnType;
private boolean isConst;
private boolean isVolatile;
private boolean takesVarargs;
private final IType[] parameters;
private final IType returnType;
private final boolean isConst;
private final boolean isVolatile;
private final boolean takesVarargs;
/**
* @param returnType
* @param types
*/
public CPPFunctionType(IType returnType, IType[] types) {
this.returnType = returnType;
this.parameters = types;
this(returnType, types, false, false, false);
}
public CPPFunctionType(IType returnType, IType[] types, boolean isConst, boolean isVolatile,

View file

@ -35,10 +35,15 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
/**
* Models the scope represented by an unknown binding such (e.g.: template type parameter). Used within
* the context of templates, only.
* For safe usage in index bindings, all fields need to be final or used in a thread-safe manner otherwise.
*/
public class CPPUnknownScope implements ICPPInternalUnknownScope {
private final ICPPUnknownBinding binding;
private final IASTName scopeName;
/**
* This field needs to be protected when used in PDOMCPPUnknownScope,
* don't use it outside of {@link #getOrCreateBinding(IASTName, int)}
*/
private CharArrayObjectMap map;
public CPPUnknownScope(ICPPUnknownBinding binding, IASTName name) {
@ -131,7 +136,14 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
}
}
if (map == null)
int idx= type ? 0 : function ? 1 : 2;
IBinding result = getOrCreateBinding(name, idx);
return result;
}
protected IBinding getOrCreateBinding(final IASTName name, int idx) {
if (map == null)
map = new CharArrayObjectMap(2);
final char[] c = name.getLookupKey();
@ -141,20 +153,23 @@ public class CPPUnknownScope implements ICPPInternalUnknownScope {
map.put(c, o);
}
int idx= type ? 0 : function ? 1 : 2;
IBinding result= o[idx];
if (result == null) {
if (type) {
switch (idx) {
case 0:
result= new CPPUnknownClass(binding, name.getSimpleID());
} else if (function) {
break;
case 1:
result= new CPPUnknownFunction(binding, name.getSimpleID());
} else {
break;
case 2:
result= new CPPUnknownBinding(binding, name.getSimpleID());
break;
}
o[idx]= result;
}
return result;
}
return result;
}
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) {
return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY);

View file

@ -62,7 +62,7 @@ import org.eclipse.core.runtime.Status;
public class PDOMFile implements IIndexFragmentFile {
private final PDOMLinkage fLinkage;
private final long record;
private IIndexFileLocation location;
private IIndexFileLocation location; // No need to make volatile, all fields of IIndexFileLocation are final.
private static final int FIRST_NAME = 0;
private static final int FIRST_INCLUDE = 4;

View file

@ -70,7 +70,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
// node types
protected static final int LINKAGE= 0; // special one for myself
private BTree fMacroIndex= null;
private BTree fMacroIndex= null; // No need for volatile, all fields of BTree are final.
private final PDOM fPDOM;
private final Database fDatabase;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2010 QNX Software Systems and others.
* Copyright (c) 2006, 2011 QNX Software Systems 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
@ -38,7 +38,7 @@ public abstract class PDOMNamedNode extends PDOMNode {
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 4;
private char[] fName;
private volatile char[] fName;
public PDOMNamedNode(PDOMLinkage linkage, long record) {
super(linkage, record);

View file

@ -32,7 +32,7 @@ public abstract class PDOMNode implements IInternalPDOMNode {
private final PDOMLinkage fLinkage;
protected final long record;
private long cachedParentRecord;
private volatile long cachedParentRecord;
protected PDOMNode(PDOMLinkage linkage, long record) {
fLinkage = linkage;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2010 QNX Software Systems and others.
* Copyright (c) 2006, 2011 QNX Software Systems 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
@ -42,8 +42,8 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType {
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = OFFSET_MAX_VALUE + 8;
private Long fMinValue;
private Long fMaxValue;
private Long fMinValue; // No need for volatile, all fields of Long are final.
private Long fMaxValue; // No need for volatile, all fields of Long are final.
public PDOMCEnumeration(PDOMLinkage linkage, PDOMNode parent, IEnumeration enumeration)
throws CoreException {

View file

@ -56,6 +56,7 @@ import org.eclipse.core.runtime.CoreException;
/**
* Represents the class scope for a class stored in the index.
* For safe use, all fields need to be final.
*/
class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
private static final class PopulateMap implements IPDOMVisitor {
@ -93,7 +94,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
}
};
private IPDOMCPPClassType fBinding;
private final IPDOMCPPClassType fBinding;
public PDOMCPPClassScope(IPDOMCPPClassType binding) {
fBinding= binding;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2011 QNX Software Systems 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
@ -59,8 +59,9 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
*/
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 8;
private ICPPClassScope fScope;
private ObjectMap specializationMap= null;
private volatile ICPPClassScope fScope;
private ObjectMap specializationMap= null; // Obtained from the synchronized PDOM cache
public PDOMCPPClassSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPClassType classType, PDOMBinding specialized)
throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2011 QNX Software Systems 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
@ -59,7 +59,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPClassType.RECORD_SIZE + 10;
private ICPPTemplateParameter[] params; // Cached template parameters.
private volatile ICPPTemplateParameter[] params; // Cached template parameters.
public PDOMCPPClassTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPClassTemplate template) throws CoreException, DOMException {
super(linkage, parent, template);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2009, 2011 Wind River Systems, Inc. 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
@ -39,7 +39,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE= PDOMCPPClassTemplateSpecialization.RECORD_SIZE+12;
private ICPPClassTemplate fPrimaryTemplate;
private volatile ICPPClassTemplate fPrimaryTemplate;
public PDOMCPPClassTemplatePartialSpecializationSpecialization(PDOMCPPLinkage linkage,
PDOMNode parent, PDOMBinding specialized, ICPPClassTemplatePartialSpecialization partial,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* Copyright (c) 2005, 2011 QNX Software Systems 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
@ -61,7 +61,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 14;
private ICPPClassScope fScope;
private PDOMCPPClassScope fScope; // No need for volatile, all fields of PDOMCPPClassScope are final.
public PDOMCPPClassType(PDOMLinkage linkage, PDOMNode parent, ICPPClassType classType) throws CoreException {
super(linkage, parent, classType.getNameCharArray());

View file

@ -56,7 +56,7 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPSpecialization
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPSpecialization.RECORD_SIZE + 8;
private ICPPScope unknownScope;
private PDOMCPPUnknownScope unknownScope; // No need for volatile, PDOMCPPUnknownScope protects its fields.
public PDOMCPPDeferredClassInstance(PDOMLinkage linkage, PDOMNode parent,
ICPPDeferredClassInstance classType, PDOMBinding instantiated) throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 Wind River Systems, Inc. and others.
* Copyright (c) 2010, 2011 Wind River Systems, Inc. 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
@ -38,9 +38,10 @@ import org.eclipse.core.runtime.CoreException;
/**
* Represents the enum scope for an enum stored in the index.
* For safe use all fields need to be final.
*/
class PDOMCPPEnumScope implements ICPPScope, IIndexScope {
private IPDOMCPPEnumType fBinding;
private final IPDOMCPPEnumType fBinding;
public PDOMCPPEnumScope(IPDOMCPPEnumType binding) {
fBinding= binding;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2010 QNX Software Systems and others.
* Copyright (c) 2006, 2011 QNX Software Systems 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
@ -51,10 +51,10 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = OFFSET_FLAGS + 1;
private Long fMinValue;
private Long fMaxValue;
private IType fFixedType= ProblemBinding.NOT_INITIALIZED;
private PDOMCPPEnumScope fScope;
private Long fMinValue; // No need for volatile, all fields of Long are final.
private Long fMaxValue; // No need for volatile, all fields of Long are final.
private volatile IType fFixedType= ProblemBinding.NOT_INITIALIZED;
private PDOMCPPEnumScope fScope; // No need for volatile, all fields of PDOMCPPEnumScope are final.
public PDOMCPPEnumeration(PDOMLinkage linkage, PDOMNode parent, ICPPEnumeration enumeration)
throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* Copyright (c) 2005, 2011 QNX Software Systems 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
@ -85,7 +85,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
private short fAnnotation= -1;
private int fRequiredArgCount= -1;
private ICPPFunctionType fType;
private ICPPFunctionType fType; // No need for volatile, all fields of ICPPFunctionTypes are final.
public PDOMCPPFunction(PDOMLinkage linkage, PDOMNode parent, ICPPFunction function, boolean setTypes) throws CoreException, DOMException {
super(linkage, parent, function.getNameCharArray());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2011 QNX Software Systems 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
@ -74,9 +74,8 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization implements ICP
private static final short ANNOT_PARAMETER_PACK = 8;
private static final short ANNOT_IS_DELETED = 9;
private ICPPFunctionType fType;
private ICPPFunctionType fType; // No need for volatile, all fields of ICPPFunctionTypes are final.
private short fAnnotation= -1;
private int fRequiredArgCount= -1;
public PDOMCPPFunctionSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPFunction astFunction, PDOMBinding specialized) throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 QNX Software Systems and others.
* Copyright (c) 2007, 2011 QNX Software Systems 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
@ -41,7 +41,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = TEMPLATE_PARAMS + Database.PTR_SIZE;
private IPDOMCPPTemplateParameter[] params; // Cached template parameters.
private volatile IPDOMCPPTemplateParameter[] params; // Cached template parameters.
public PDOMCPPFunctionTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunctionTemplate template)
throws CoreException, DOMException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* Copyright (c) 2005, 2011 QNX Software Systems 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
@ -114,7 +114,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
@SuppressWarnings("hiding")
private final static int RECORD_SIZE= FIRST_NAMESPACE_CHILD_OFFSET + Database.PTR_SIZE;
private LinkedList<Runnable> postProcesses = new LinkedList<Runnable>();
// Only used when writing to database, which is single-threaded
private LinkedList<Runnable> postProcesses = new LinkedList<Runnable>();
public PDOMCPPLinkage(PDOM pdom, long record) {
super(pdom, record);

View file

@ -62,7 +62,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
private static int INLINE_FLAG= 0x1;
private int fFlag= -1;
private ICPPNamespaceScope[] fInlineNamespaces;
private volatile ICPPNamespaceScope[] fInlineNamespaces;
public PDOMCPPNamespace(PDOMLinkage linkage, PDOMNode parent, ICPPNamespace namespace) throws CoreException {
super(linkage, parent, namespace.getNameCharArray());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 QNX Software Systems and others.
* Copyright (c) 2008, 2011 QNX Software Systems 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
@ -31,6 +31,7 @@ import org.eclipse.core.runtime.CoreException;
* Base class for specializations and instances of other bindings.
*/
abstract class PDOMCPPSpecialization extends PDOMCPPBinding implements ICPPSpecialization, IPDOMOverloader {
private static final int ARGMAP = PDOMCPPBinding.RECORD_SIZE + 0;
private static final int SIGNATURE_HASH = PDOMCPPBinding.RECORD_SIZE + 4;
private static final int SPECIALIZED = PDOMCPPBinding.RECORD_SIZE + 8;
@ -40,8 +41,8 @@ abstract class PDOMCPPSpecialization extends PDOMCPPBinding implements ICPPSpeci
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 12;
private IBinding fSpecializedCache= null;
private ICPPTemplateParameterMap fArgMap;
private volatile IBinding fSpecializedCache= null;
private volatile ICPPTemplateParameterMap fArgMap;
public PDOMCPPSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPSpecialization spec,
IPDOMBinding specialized) throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 QNX Software Systems and others.
* Copyright (c) 2007, 2011 QNX Software Systems 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
@ -45,7 +45,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding implements IPDOMMem
protected static final int RECORD_SIZE = DEFAULTVAL + Database.PTR_SIZE;
private int fCachedParamID= -1;
private IType fType;
private volatile IType fType;
public PDOMCPPTemplateNonTypeParameter(PDOMLinkage linkage, PDOMNode parent,
ICPPTemplateNonTypeParameter param) throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2011 Wind River Systems, Inc. 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
@ -60,9 +60,9 @@ public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PARAMETERS + Database.PTR_SIZE;
private ICPPScope fUnknownScope;
private PDOMCPPUnknownScope fUnknownScope; // No need for volatile, PDOMCPPUnknownScope protects its fields.
private int fCachedParamID= -1;
private IPDOMCPPTemplateParameter[] params;
private volatile IPDOMCPPTemplateParameter[] params;
public PDOMCPPTemplateTemplateParameter(PDOMLinkage linkage, PDOMNode parent, ICPPTemplateTemplateParameter param)
throws CoreException, DOMException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 QNX Software Systems and others.
* Copyright (c) 2007, 2011 QNX Software Systems 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
@ -51,7 +51,7 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PARAMETERID + 4;
private ICPPScope fUnknownScope;
private PDOMCPPUnknownScope fUnknownScope; // No need for volatile, PDOMCPPUnknownScope protects its fields.
private int fCachedParamID= -1;
public PDOMCPPTemplateTypeParameter(PDOMLinkage linkage, PDOMNode parent, ICPPTemplateTypeParameter param)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Google, Inc and others.
* Copyright (c) 2008, 2011 Google, Inc 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
@ -39,7 +39,7 @@ class PDOMCPPUnknownClassInstance extends PDOMCPPUnknownClassType implements ICP
protected static final int RECORD_SIZE = SIGNATURE_HASH + 4;
// Cached values.
ICPPTemplateArgument[] arguments;
private volatile ICPPTemplateArgument[] arguments;
public PDOMCPPUnknownClassInstance(PDOMLinkage linkage, PDOMNode parent, ICPPUnknownClassInstance classInstance)
throws CoreException {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Google, Inc and others.
* Copyright (c) 2008, 2011 Google, Inc 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
@ -53,7 +53,7 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPUnknownBinding.RECORD_SIZE + 8;
private ICPPScope unknownScope;
private PDOMCPPUnknownScope unknownScope; // No need for volatile, PDOMCPPUnknownScope protects its fields
public PDOMCPPUnknownClassType(PDOMLinkage linkage, PDOMNode parent, ICPPUnknownClassType classType) throws CoreException {
super(linkage, parent, classType);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2011 Wind River Systems, Inc. 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
@ -12,14 +12,12 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.index.IIndexScope;
/**
* @since 5.0
*/
public class PDOMCPPUnknownScope extends CPPUnknownScope implements IIndexScope {
public PDOMCPPUnknownScope(PDOMCPPBinding binding, IASTName name) {
@ -40,4 +38,10 @@ public class PDOMCPPUnknownScope extends CPPUnknownScope implements IIndexScope
public PDOMCPPBinding getScopeBinding() {
return (PDOMCPPBinding) super.getScopeBinding();
}
@Override
// Needs to be thread-safe.
protected synchronized IBinding getOrCreateBinding(IASTName name, int idx) {
return super.getOrCreateBinding(name, idx);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Google, Inc and others.
* Copyright (c) 2008, 2011 Google, Inc 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
@ -43,7 +43,7 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 8;
private IBinding[] delegates;
private volatile IBinding[] delegates;
public PDOMCPPUsingDeclaration(PDOMLinkage linkage, PDOMNode parent, ICPPUsingDeclaration using)
throws CoreException {