1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-02-27 12:25:14 -08:00
parent 96a4a227aa
commit ba6c3f6316
20 changed files with 94 additions and 98 deletions

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.pdom.tests; package org.eclipse.cdt.internal.pdom.tests;
import java.io.File; import java.io.File;

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.pdom.tests; package org.eclipse.cdt.internal.pdom.tests;
import java.io.File; import java.io.File;

View file

@ -8,24 +8,24 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.core.dom.ast.tag; package org.eclipse.cdt.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
/** /**
* Implementations are contributed with the org.eclipse.cdt.core.tagger extension-point. The implementation is * Implementations are contributed with the org.eclipse.cdt.core.tagger extension-point.
* responsible for populating the tag's data using a given input binding. * The implementation is responsible for populating the tag's data using a given input binding.
* *
* @see #process(ITagWriter, IBinding, IASTName) * @see #process(ITagWriter, IBinding, IASTName)
* @since 5.5 * @since 5.5
*/ */
public interface IBindingTagger { public interface IBindingTagger {
/** /**
* Examines the given input binding to decide if a tag should be created. Use the given tagWriter to * Examines the given input binding to decide if a tag should be created. Use the given
* create data if needed. Return the tag if one was created and null otherwise. A tagger (as identified by * tagWriter to create data if needed. Return the tag if one was created and null otherwise.
* it's unique id string) is allowed to create only one tag for each binding. * A tagger (as identified by it's unique id string) is allowed to create only one tag for each
* binding.
* *
* @param tagWriter * @param tagWriter
* the writer to use for creating new tags * the writer to use for creating new tags

View file

@ -8,13 +8,13 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.core.dom.ast.tag; package org.eclipse.cdt.core.dom.ast.tag;
/** /**
* Tags are used to annotate {@link ITagReader}'s with extra information. They are created by implementations * Tags are used to annotate {@link ITagReader}'s with extra information. They are created by
* of {@link IBindingTagger} which are contributed using the org.eclipse.cdt.core.tagger extension point. The * implementations of {@link IBindingTagger} which are contributed using
* base tag interface is read-only, it is extended by the writable {@link IWritableTag}. * the org.eclipse.cdt.core.tagger extension point. The base tag interface is read-only, it is
* extended by the writable {@link IWritableTag}.
* *
* @see IBindingTagger * @see IBindingTagger
* @see ITagReader * @see ITagReader
@ -25,20 +25,21 @@ public interface ITag {
/** A constant that is returned to indicate a read failure. */ /** A constant that is returned to indicate a read failure. */
public static final int FAIL = -1; public static final int FAIL = -1;
/** Return the number of bytes in the tag's data payload. */ /** Returns the number of bytes in the tag's data payload. */
public int getDataLen(); public int getDataLen();
/** Return the globally unique id of the tagger that created the receiver. */ /** Returns the globally unique id of the tagger that created the receiver. */
public String getTaggerId(); public String getTaggerId();
/** Return the byte from the specified offset or {@link #FAIL} on failure. */ /** Returns the byte from the specified offset or {@link #FAIL} on failure. */
public int getByte(int offset); public int getByte(int offset);
/** /**
* Return the specified number of bytes from the specified offset. Specify len of -1 to read all bytes * Returns the specified number of bytes from the specified offset. Specify {@code len} of -1
* from the specified offset to the end of the payload. Return null if the given range is not valid. This * to read all bytes from the specified offset to the end of the payload. Returns null if
* would be expected if the version of the contributor has changed in a way that changes the structure of * the given range is not valid. This would be expected if the version of the contributor has
* the data that it stores. Contributors must be able to deal with that case. * changed in a way that changes the structure of the data that it stores. Contributors must be
* able to deal with that case.
*/ */
public byte[] getBytes(int offset, int len); public byte[] getBytes(int offset, int len);
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.core.dom.ast.tag; package org.eclipse.cdt.core.dom.ast.tag;
/** /**
@ -20,16 +19,17 @@ package org.eclipse.cdt.core.dom.ast.tag;
*/ */
public interface ITagReader { public interface ITagReader {
/** /**
* Look for a tag for the receiver, returns null if there is no such tag. * Looks for a tag for the receiver, returns null if there is no such tag.
* *
* @param id * @param id
* A string that uniquely identifies the tag to be returned. This value was provided by the * A string that uniquely identifies the tag to be returned. This value was provided
* contributor when the tag was created (see {@link ITagWriter#createTag(String, int)}). * by the contributor when the tag was created
* (see {@link ITagWriter#createTag(String, int)}).
*/ */
public ITag getTag(String id); public ITag getTag(String id);
/** /**
* Return all tags known to the receiver. Does not return null. * Returns all tags known to the receiver. Does not return null.
*/ */
public Iterable<ITag> getTags(); public Iterable<ITag> getTags();
} }

View file

@ -8,14 +8,13 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.core.dom.ast.tag; package org.eclipse.cdt.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
/** /**
* Provides ITagReaders for specific bindings. The kind of the reader will vary based on the kind of the input * Provides ITagReaders for specific bindings. The kind of the reader will vary based on the kind
* binding. * of the input binding.
* *
* @see ITag * @see ITag
* @see ITagReader * @see ITagReader
@ -23,8 +22,8 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
*/ */
public interface ITagService { public interface ITagService {
/** /**
* Finds or creates a tag reader for the specified binding or null if a reader cannot be associated with * Finds or creates a tag reader for the specified binding or null if a reader cannot be
* this binding. * associated with this binding.
* *
* @param binding * @param binding
* could be null * could be null

View file

@ -20,20 +20,20 @@ package org.eclipse.cdt.core.dom.ast.tag;
*/ */
public interface ITagWriter { public interface ITagWriter {
/** /**
* Create and return a new tag for the receiver. E.g., if this writer is associated with a persistent * Creates and returns a new tag for the receiver. E.g., if this writer is associated with
* binding, then returned tag will read and write from the PDOM database. * a persistent binding, then returned tag will read and write from the PDOM database.
* *
* @param id * @param id
* A string that uniquely identifies the tag to be returned. This value will be used by the * A string that uniquely identifies the tag to be returned. This value will be used
* contributor when to find the tag (see {@link ITagReader#getTag(String)}). * by the contributor when to find the tag (see {@link ITagReader#getTag(String)}).
* @param len * @param len
* The number of bytes that should be allocated to store the tag's data. * The number of bytes that should be allocated to store the tag's data.
*/ */
public IWritableTag createTag(String id, int len); public IWritableTag createTag(String id, int len);
/** /**
* Sets the receiver's tags to only the ones provided. Deletes existing tags that are not in the argument * Sets the receiver's tags to only the ones provided. Deletes existing tags that are not in
* list. * the argument list.
*/ */
public boolean setTags(Iterable<ITag> tags); public boolean setTags(Iterable<ITag> tags);
} }

View file

@ -8,12 +8,12 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.core.dom.ast.tag; package org.eclipse.cdt.core.dom.ast.tag;
/** /**
* Tags are used to annotate {@link ITagWriter}'s with extra information. They are created by implementations * Tags are used to annotate {@link ITagWriter}'s with extra information. They are created by
* of {@link IBindingTagger} which are contributed using the org.eclipse.cdt.core.tagger extension point. * implementations of {@link IBindingTagger} which are contributed using
* the org.eclipse.cdt.core.tagger extension point.
* *
* @see IBindingTagger * @see IBindingTagger
* @see ITagReader * @see ITagReader
@ -21,13 +21,13 @@ package org.eclipse.cdt.core.dom.ast.tag;
* @since 5.5 * @since 5.5
*/ */
public interface IWritableTag extends ITag { public interface IWritableTag extends ITag {
/** Write the given byte to the given offset in the tag. Return true if successful and false otherwise. */ /** Writes the given byte to the given offset in the tag. Returns {@code true} if successful. */
public boolean putByte(int offset, byte data); public boolean putByte(int offset, byte data);
/** /**
* Write the argument buffer into the receiver's payload starting at the specified offset. Write the * Writes the argument buffer into the receiver's payload starting at the specified offset.
* specified number of bytes or the full buffer when len is -1. Return true if successful and false * Writes the specified number of bytes or the full buffer when {@code len} is -1. Returns
* otherwise. * {@code true} if successful.
*/ */
public boolean putBytes(int offset, byte data[], int len); public boolean putBytes(int offset, byte data[], int len);
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.core.dom.ast.tag; package org.eclipse.cdt.internal.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@ -47,7 +46,7 @@ public class NonCachedTaggable implements ITagReader, ITagWriter {
@Override @Override
public boolean setTags(Iterable<ITag> tags) { public boolean setTags(Iterable<ITag> tags) {
// this non-caching implementation has nothing to set, the tags will be regenerated // This non-caching implementation has nothing to set, the tags will be regenerated
// when they are queried // when they are queried
return true; return true;
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.core.dom.ast.tag; package org.eclipse.cdt.internal.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.tag.ITag; import org.eclipse.cdt.core.dom.ast.tag.ITag;

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.core.dom.ast.tag; package org.eclipse.cdt.internal.core.dom.ast.tag;
import java.util.HashMap; import java.util.HashMap;
@ -29,6 +28,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
public class TagManager { public class TagManager {
private static final String EXTENSION_POINT = "tagger"; //$NON-NLS-1$
private static TagManager INSTANCE; private static TagManager INSTANCE;
private Map<String, TaggerDescriptor> taggers; private Map<String, TaggerDescriptor> taggers;
@ -43,14 +43,12 @@ public class TagManager {
taggers = loadExtensions(); taggers = loadExtensions();
} }
private static final String ExtensionPoint = "tagger"; //$NON-NLS-1$
private static Map<String, TaggerDescriptor> loadExtensions() { private static Map<String, TaggerDescriptor> loadExtensions() {
Map<String, TaggerDescriptor> taggers = new HashMap<String, TaggerDescriptor>(); Map<String, TaggerDescriptor> taggers = new HashMap<String, TaggerDescriptor>();
// load the extensions // Load the extensions
IConfigurationElement[] elements = Platform.getExtensionRegistry() IConfigurationElement[] elements = Platform.getExtensionRegistry()
.getConfigurationElementsFor(CCorePlugin.PLUGIN_ID, ExtensionPoint); .getConfigurationElementsFor(CCorePlugin.PLUGIN_ID, EXTENSION_POINT);
for (IConfigurationElement element : elements) { for (IConfigurationElement element : elements) {
TaggerDescriptor desc = new TaggerDescriptor(element); TaggerDescriptor desc = new TaggerDescriptor(element);
taggers.put(desc.getId(), desc); taggers.put(desc.getId(), desc);
@ -60,8 +58,8 @@ public class TagManager {
} }
/** /**
* Provide an opportunity for the specified tagger to process the given values. The tagger will only run * Provides an opportunity for the specified tagger to process the given values. The tagger will
* if its enablement expression returns true for the arguments. * only run if its enablement expression returns true for the arguments.
*/ */
public ITag process(String taggerId, ITagWriter tagWriter, IBinding binding, IASTName ast) { public ITag process(String taggerId, ITagWriter tagWriter, IBinding binding, IASTName ast) {
TaggerDescriptor desc = taggers.get(taggerId); TaggerDescriptor desc = taggers.get(taggerId);
@ -72,7 +70,7 @@ public class TagManager {
return tagger == null ? null : tagger.process(tagWriter, binding, ast); return tagger == null ? null : tagger.process(tagWriter, binding, ast);
} }
/** Provide an opportunity for all enabled taggers to process the given values. */ /** Provides an opportunity for all enabled taggers to process the given values. */
public Iterable<ITag> process(ITagWriter tagWriter, IBinding binding, IASTName ast) { public Iterable<ITag> process(ITagWriter tagWriter, IBinding binding, IASTName ast) {
List<ITag> tags = new LinkedList<ITag>(); List<ITag> tags = new LinkedList<ITag>();
for (TaggerDescriptor desc : taggers.values()) { for (TaggerDescriptor desc : taggers.values()) {
@ -87,7 +85,7 @@ public class TagManager {
return tags; return tags;
} }
/** Add or remove tags from the destination to ensure that it has the same tag information as the source. */ /** Adds or removes tags from the destination to ensure that it has the same tag information as the source. */
public void syncTags(IPDOMBinding dst, IBinding src) { public void syncTags(IPDOMBinding dst, IBinding src) {
// don't try to copy any tags when there are no contributors to this extension point // don't try to copy any tags when there are no contributors to this extension point
if (dst == null || taggers.isEmpty()) if (dst == null || taggers.isEmpty())

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.core.dom.ast.tag; package org.eclipse.cdt.internal.core.dom.ast.tag;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
@ -17,16 +16,17 @@ import org.eclipse.cdt.core.dom.ast.tag.ITagService;
public class TagService implements ITagService { public class TagService implements ITagService {
/** /**
* First gives the IBinding instance a chance to convert itself, by calling IAdaptable#getAdapter( * First gives the IBinding instance a chance to convert itself, by calling
* ITagReader.class ) on the binding. If the binding doesn't provide an implementation then a simple, * IAdaptable#getAdapter(ITagReader.class) on the binding. If the binding doesn't provide
* in-memory, non-cached implementation is created and returned. * an implementation then a simple, in-memory, non-cached implementation is created and
* returned.
*/ */
@Override @Override
public ITagReader findTagReader(IBinding binding) { public ITagReader findTagReader(IBinding binding) {
if (binding == null) if (binding == null)
return null; return null;
// let the binding adapt to its own tag reader // Let the binding adapt to its own tag reader
ITagReader tagReader = (ITagReader) binding.getAdapter(ITagReader.class); ITagReader tagReader = (ITagReader) binding.getAdapter(ITagReader.class);
if (tagReader != null) if (tagReader != null)
return tagReader; return tagReader;

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.core.dom.ast.tag; package org.eclipse.cdt.internal.core.dom.ast.tag;
import java.util.Arrays; import java.util.Arrays;
@ -33,9 +32,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
/** /**
* Internal container for extensions of org.eclipse.cdt.core.tagger. The implementation of the tagger is * Internal container for extensions of org.eclipse.cdt.core.tagger. The implementation of
* instantiated only after checking the enablement expression (if present) for the specified binding. This * the tagger is instantiated only after checking the enablement expression (if present) for
* avoids activating the contributing plugin until it is actually needed. * the specified binding. This avoids activating the contributing plugin until it is actually
* needed.
*/ */
public class TaggerDescriptor { public class TaggerDescriptor {
private static final String Attr_LocalId = "local-id"; //$NON-NLS-1$ private static final String Attr_LocalId = "local-id"; //$NON-NLS-1$
@ -52,10 +52,10 @@ public class TaggerDescriptor {
private static final String VAR_LANGUAGEID = "languageId"; //$NON-NLS-1$ private static final String VAR_LANGUAGEID = "languageId"; //$NON-NLS-1$
/** /**
* An empty implementation of the tagger used as a placeholder in descriptors that are unable to load the * An empty implementation of the tagger used as a placeholder in descriptors that are unable
* contributed class. * to load the contributed class.
*/ */
private static final IBindingTagger NullTagger = new IBindingTagger() { private static final IBindingTagger NULL_TAGGER = new IBindingTagger() {
@Override @Override
public ITag process(ITagWriter tagWriter, IBinding binding, IASTName ast) { public ITag process(ITagWriter tagWriter, IBinding binding, IASTName ast) {
return null; return null;
@ -97,8 +97,8 @@ public class TaggerDescriptor {
// there must be a valid local id // there must be a valid local id
if (localId == null) { if (localId == null) {
String extId = element.getDeclaringExtension().getSimpleIdentifier(); String extId = element.getDeclaringExtension().getSimpleIdentifier();
CCorePlugin CCorePlugin.log("Invalid extension " + globalId + '.' + extId //$NON-NLS-1$
.log("Invalid extension " + globalId + '.' + extId + " must provide tagger's local-id"); //$NON-NLS-1$ //$NON-NLS-2$ + " must provide tagger's local-id"); //$NON-NLS-1$
return null; return null;
} }
@ -109,8 +109,8 @@ public class TaggerDescriptor {
// make sure the local id has real content // make sure the local id has real content
if (localId.isEmpty()) { if (localId.isEmpty()) {
String extId = element.getDeclaringExtension().getSimpleIdentifier(); String extId = element.getDeclaringExtension().getSimpleIdentifier();
CCorePlugin CCorePlugin.log("Invalid extension " + globalId + '.' + extId //$NON-NLS-1$
.log("Invalid extension " + globalId + '.' + extId + " must provide value for tagger's local-id"); //$NON-NLS-1$ //$NON-NLS-2$ + " must provide value for tagger's local-id"); //$NON-NLS-1$
return null; return null;
} }
@ -121,12 +121,12 @@ public class TaggerDescriptor {
} }
private boolean matches(ITranslationUnit tu) { private boolean matches(ITranslationUnit tu) {
// if the enablement expression is missing or structurally invalid, then return immediately // If the enablement expression is missing or structurally invalid, then return immediately
if (fStatus != null) if (fStatus != null)
return fStatus.booleanValue(); return fStatus.booleanValue();
// if there is no tu, then the enablement expression cannot be evaluated, assume that all taggers // If there is no tu, then the enablement expression cannot be evaluated, assume that all
// are needed // taggers are needed
if (tu == null) if (tu == null)
return true; return true;
@ -171,7 +171,7 @@ public class TaggerDescriptor {
CCorePlugin.log("Error in class attribute of " + id, e); //$NON-NLS-1$ CCorePlugin.log("Error in class attribute of " + id, e); //$NON-NLS-1$
// mark the tagger with an empty implementation to prevent future load attempts // mark the tagger with an empty implementation to prevent future load attempts
tagger = NullTagger; tagger = NULL_TAGGER;
} }
} }
} }

View file

@ -344,7 +344,7 @@ public class CPPVisitor extends ASTQueries {
if (inScope == null) if (inScope == null)
return false; return false;
IBinding pb= names[names.length-2].resolvePreBinding(); IBinding pb= names[names.length - 2].resolvePreBinding();
if (pb instanceof IProblemBinding) if (pb instanceof IProblemBinding)
return false; return false;
@ -930,11 +930,11 @@ public class CPPVisitor extends ASTQueries {
if (name instanceof ICPPASTQualifiedName) { if (name instanceof ICPPASTQualifiedName) {
IASTName[] names = ((ICPPASTQualifiedName) name).getNames(); IASTName[] names = ((ICPPASTQualifiedName) name).getNames();
if (names.length >= 2) { if (names.length >= 2) {
IBinding b= names[names.length-2].resolvePreBinding(); IBinding b= names[names.length - 2].resolvePreBinding();
if (b instanceof IType) { if (b instanceof IType) {
IType classType= getNestedType((IType) b, TDEF); IType classType= getNestedType((IType) b, TDEF);
if (classType instanceof ICPPClassType) { if (classType instanceof ICPPClassType) {
final char[] dtorName = names[names.length-1].getLookupKey(); final char[] dtorName = names[names.length - 1].getLookupKey();
final char[] className = ((ICPPClassType) classType).getNameCharArray(); final char[] className = ((ICPPClassType) classType).getNameCharArray();
return CharArrayUtils.equals(dtorName, className); return CharArrayUtils.equals(dtorName, className);
} }
@ -1303,7 +1303,7 @@ public class CPPVisitor extends ASTQueries {
IASTName name = findInnermostDeclarator(fnDeclarator).getName(); IASTName name = findInnermostDeclarator(fnDeclarator).getName();
if (name instanceof ICPPASTQualifiedName) { if (name instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames(); IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
name = ns[ns.length -1]; name = ns[ns.length - 1];
} }
return getContainingScope(name); return getContainingScope(name);
} }

View file

@ -1006,9 +1006,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
IASTTranslationUnit ast= createAST(lang, codeReader, scanInfo, isSource, fASTOptions, ctx, pm); IASTTranslationUnit ast= createAST(lang, codeReader, scanInfo, isSource, fASTOptions, ctx, pm);
fStatistics.fParsingTime += System.currentTimeMillis() - start; fStatistics.fParsingTime += System.currentTimeMillis() - start;
if (ast != null) { if (ast != null) {
// Give the new AST-TU a chance to recognize its translation unit before it is written // Give the new AST a chance to recognize its translation unit before it is written
// to the index. // to the index.
((ASTTranslationUnit)ast).setOriginatingTranslationUnit((ITranslationUnit)tu); ((ASTTranslationUnit) ast).setOriginatingTranslationUnit((ITranslationUnit) tu);
writeToIndex(lang.getLinkageID(), ast, codeReader, ctx, pm); writeToIndex(lang.getLinkageID(), ast, codeReader, ctx, pm);
} }
} catch (CoreException e) { } catch (CoreException e) {

View file

@ -69,13 +69,14 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
if (adapter.isAssignableFrom(PDOMBinding.class)) if (adapter.isAssignableFrom(PDOMBinding.class))
return this; return this;
// Any PDOMBinding can have a persistent tag. These tags should be deleted when the PDOMBinding // Any PDOMBinding can have a persistent tag. These tags should be deleted when
// is deleted. However, PDOMBinding's don't get deleted, so there is no way to trigger deleting // the PDOMBinding is deleted. However, PDOMBinding's don't get deleted, so there is no way
// of the tags. If the implementation is changed so that PDOMBindings do get deleted, then call: // to trigger deleting of the tags. If the implementation is changed so that PDOMBindings
// PDOMTagIndex.setTags( getPDOM(), pdomBinding.record, Collections.<ITag>emptyList() ); // do get deleted, then it should call:
// PDOMTagIndex.setTags(getPDOM(), pdomBinding.record, Collections.<ITag>emptyList());
// to clear out all tags for the binding. // to clear out all tags for the binding.
if (adapter.isAssignableFrom(ITagReader.class)) if (adapter.isAssignableFrom(ITagReader.class))
return new PDOMTaggable( getPDOM(), getRecord() ); return new PDOMTaggable(getPDOM(), getRecord());
return null; return null;
} }

View file

@ -99,9 +99,9 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
getPDOM().putCachedResult(inputBinding, pdomBinding); getPDOM().putCachedResult(inputBinding, pdomBinding);
} }
// Synchronize the tags associated with the persistent binding to match the set that is // Synchronize the tags associated with the persistent binding to match the set that
// associated with the input binding. // is associated with the input binding.
TagManager.getInstance().syncTags( pdomBinding, inputBinding ); TagManager.getInstance().syncTags(pdomBinding, inputBinding);
return pdomBinding; return pdomBinding;
} }
@ -114,9 +114,10 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
pdomBinding.update(this, fromBinding); pdomBinding.update(this, fromBinding);
// Update the tags based on the tags from the new binding. This was in PDOMBinding.update, but // Update the tags based on the tags from the new binding. This cannot be done in
// I found that not all subclasses (e.g., PDOMCPPFunction) call the parent implementation. // PDOMBinding.update, because not all subclasses (e.g., PDOMCPPFunction) call
TagManager.getInstance().syncTags( pdomBinding, fromBinding ); // the superclass implementation.
TagManager.getInstance().syncTags(pdomBinding, fromBinding);
} }
return pdomBinding; return pdomBinding;
} }

View file

@ -362,9 +362,9 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
addImplicitMethods(pdomBinding, (ICPPClassType) binding, fromName); addImplicitMethods(pdomBinding, (ICPPClassType) binding, fromName);
} }
// Synchronize the tags associated with the persistent binding to match the set that is // Synchronize the tags associated with the persistent binding to match
// associated with the input binding. // the set that is associated with the input binding.
TagManager.getInstance().syncTags( pdomBinding, inputBinding ); TagManager.getInstance().syncTags(pdomBinding, inputBinding);
} }
} catch (DOMException e) { } catch (DOMException e) {
throw new CoreException(Util.createStatus(e)); throw new CoreException(Util.createStatus(e));
@ -378,8 +378,9 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
pdomBinding.update(this, fromBinding); pdomBinding.update(this, fromBinding);
// Update the tags based on the tags from the new binding. This was in PDOMBinding.update, but // Update the tags based on the tags from the new binding. This cannot be done in
// I found that not all subclasses (e.g., PDOMCPPFunction) call the parent implementation. // PDOMBinding.update, because not all subclasses (e.g., PDOMCPPFunction) call
// the superclass implementation.
TagManager.getInstance().syncTags(pdomBinding, fromBinding); TagManager.getInstance().syncTags(pdomBinding, fromBinding);
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Andrew Eidsness - Initial implementation * Andrew Eidsness - Initial implementation
*/ */
package org.eclipse.cdt.internal.core.pdom.tag; package org.eclipse.cdt.internal.core.pdom.tag;
import java.util.Collections; import java.util.Collections;

View file

@ -208,7 +208,7 @@ public class CCorePlugin extends Plugin {
/** /**
* @noreference This field is not intended to be referenced by clients. * @noreference This field is not intended to be referenced by clients.
*/ */
public CDTLogWriter cdtLog = null; public CDTLogWriter cdtLog;
private volatile CProjectDescriptionManager fNewCProjectDescriptionManager; private volatile CProjectDescriptionManager fNewCProjectDescriptionManager;