mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Cosmetics.
This commit is contained in:
parent
0152c28c22
commit
8ce322ad37
6 changed files with 31 additions and 30 deletions
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.parser.util;
|
package org.eclipse.cdt.core.parser.util;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -24,7 +23,7 @@ public class HashTable implements Cloneable {
|
||||||
return currEntry == -1;
|
return currEntry == -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public int size() {
|
public final int size() {
|
||||||
return currEntry + 1;
|
return currEntry + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||||
* For safe usage in index bindings, all fields need to be final or volatile.
|
* For safe usage in index bindings, all fields need to be final or volatile.
|
||||||
*/
|
*/
|
||||||
public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializationScope {
|
public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializationScope {
|
||||||
final private ICPPClassSpecialization specialClass;
|
private final ICPPClassSpecialization specialClass;
|
||||||
private volatile ICPPBase[] fBases; // Used by the pdom bindings, needs to be volatile.
|
private volatile ICPPBase[] fBases; // Used by the pdom bindings, needs to be volatile.
|
||||||
|
|
||||||
public AbstractCPPClassSpecializationScope(ICPPClassSpecialization specialization) {
|
public AbstractCPPClassSpecializationScope(ICPPClassSpecialization specialization) {
|
||||||
|
@ -79,7 +79,8 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
||||||
|
|
||||||
ICPPClassType specialized = specialClass.getSpecializedBinding();
|
ICPPClassType specialized = specialClass.getSpecializedBinding();
|
||||||
IScope classScope = specialized.getCompositeScope();
|
IScope classScope = specialized.getCompositeScope();
|
||||||
IBinding[] bindings = classScope != null ? classScope.getBindings(new ScopeLookupData(name, resolve, false)) : null;
|
IBinding[] bindings = classScope != null ?
|
||||||
|
classScope.getBindings(new ScopeLookupData(name, resolve, false)) : null;
|
||||||
|
|
||||||
if (bindings == null)
|
if (bindings == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
||||||
while (parent instanceof IASTName)
|
while (parent instanceof IASTName)
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
if (parent instanceof ICPPASTCompositeTypeSpecifier) {
|
if (parent instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier)parent;
|
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) parent;
|
||||||
return compSpec.getScope();
|
return compSpec.getScope();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class Chunk {
|
||||||
void read() throws CoreException {
|
void read() throws CoreException {
|
||||||
try {
|
try {
|
||||||
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
||||||
fDatabase.read(buf, (long) fSequenceNumber*Database.CHUNK_SIZE);
|
fDatabase.read(buf, (long) fSequenceNumber * Database.CHUNK_SIZE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CoreException(new DBStatus(e));
|
throw new CoreException(new DBStatus(e));
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ final class Chunk {
|
||||||
void flush() throws CoreException {
|
void flush() throws CoreException {
|
||||||
try {
|
try {
|
||||||
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
||||||
fDatabase.write(buf, (long) fSequenceNumber*Database.CHUNK_SIZE);
|
fDatabase.write(buf, (long) fSequenceNumber * Database.CHUNK_SIZE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CoreException(new DBStatus(e));
|
throw new CoreException(new DBStatus(e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.db;
|
package org.eclipse.cdt.internal.core.pdom.db;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -32,6 +24,14 @@ import java.nio.channels.ClosedChannelException;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database encapsulates access to a flat binary format file with a memory-manager-like API for
|
* Database encapsulates access to a flat binary format file with a memory-manager-like API for
|
||||||
* obtaining and releasing areas of storage (memory).
|
* obtaining and releasing areas of storage (memory).
|
||||||
|
@ -668,7 +668,7 @@ public class Database {
|
||||||
public void giveUpExclusiveLock(final boolean flush) throws CoreException {
|
public void giveUpExclusiveLock(final boolean flush) throws CoreException {
|
||||||
if (fExclusiveLock) {
|
if (fExclusiveLock) {
|
||||||
try {
|
try {
|
||||||
ArrayList<Chunk> dirtyChunks= new ArrayList<Chunk>();
|
ArrayList<Chunk> dirtyChunks= new ArrayList<>();
|
||||||
synchronized (fCache) {
|
synchronized (fCache) {
|
||||||
for (int i= 1; i < fChunksUsed; i++) {
|
for (int i= 1; i < fChunksUsed; i++) {
|
||||||
Chunk chunk= fChunks[i];
|
Chunk chunk= fChunks[i];
|
||||||
|
@ -716,7 +716,7 @@ public class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Be careful as other readers may access chunks concurrently.
|
// Be careful as other readers may access chunks concurrently.
|
||||||
ArrayList<Chunk> dirtyChunks= new ArrayList<Chunk>();
|
ArrayList<Chunk> dirtyChunks= new ArrayList<>();
|
||||||
synchronized (fCache) {
|
synchronized (fCache) {
|
||||||
for (int i= 1; i < fChunksUsed ; i++) {
|
for (int i= 1; i < fChunksUsed ; i++) {
|
||||||
Chunk chunk= fChunks[i];
|
Chunk chunk= fChunks[i];
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (QNX) - Initial API and implementation
|
* Doug Schaefer (QNX) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
private static final class PopulateMap implements IPDOMVisitor {
|
private static final class PopulateMap implements IPDOMVisitor {
|
||||||
private final CharArrayMap<List<PDOMBinding>> fResult;
|
private final CharArrayMap<List<PDOMBinding>> fResult;
|
||||||
|
|
||||||
private PopulateMap(CharArrayMap<List<PDOMBinding>> result) {
|
private PopulateMap(CharArrayMap<List<PDOMBinding>> result) {
|
||||||
fResult = result;
|
fResult = result;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +72,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
final char[] nchars = binding.getNameCharArray();
|
final char[] nchars = binding.getNameCharArray();
|
||||||
List<PDOMBinding> list= fResult.get(nchars);
|
List<PDOMBinding> list= fResult.get(nchars);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list= new ArrayList<PDOMBinding>();
|
list= new ArrayList<>();
|
||||||
fResult.put(nchars, list);
|
fResult.put(nchars, list);
|
||||||
}
|
}
|
||||||
list.add(binding);
|
list.add(binding);
|
||||||
|
@ -126,7 +127,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
try {
|
try {
|
||||||
final char[] nameChars = name.getSimpleID();
|
final char[] nameChars = name.getSimpleID();
|
||||||
if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
|
if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
|
||||||
//9.2 ... The class-name is also inserted into the scope of the class itself
|
// 9.2 ... The class-name is also inserted into the scope of the class itself
|
||||||
return getClassNameBinding();
|
return getClassNameBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
}
|
}
|
||||||
return fBinding.getConstructors();
|
return fBinding.getConstructors();
|
||||||
}
|
}
|
||||||
return new IBinding[] {getClassNameBinding()};
|
return new IBinding[] { getClassNameBinding() };
|
||||||
}
|
}
|
||||||
return getBindingsViaCache(fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE);
|
return getBindingsViaCache(fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE);
|
||||||
}
|
}
|
||||||
|
@ -244,8 +245,8 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
CharArrayMap<List<PDOMBinding>> map= cached == null ? null : cached.get();
|
CharArrayMap<List<PDOMBinding>> map= cached == null ? null : cached.get();
|
||||||
|
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
// there is no cache, build it:
|
// There is no cache, build it:
|
||||||
map= new CharArrayMap<List<PDOMBinding>>();
|
map= new CharArrayMap<>();
|
||||||
IPDOMVisitor visitor= new PopulateMap(map);
|
IPDOMVisitor visitor= new PopulateMap(map);
|
||||||
visitor.visit(ct);
|
visitor.visit(ct);
|
||||||
ct.acceptUncached(visitor);
|
ct.acceptUncached(visitor);
|
||||||
|
@ -256,7 +257,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] find(String name) {
|
public IBinding[] find(String name) {
|
||||||
return CPPSemantics.findBindings( this, name, false );
|
return CPPSemantics.findBindings(this, name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -271,7 +272,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||||
acceptViaCache(fBinding, methods, false);
|
acceptViaCache(fBinding, methods, false);
|
||||||
return methods.getMethods();
|
return methods.getMethods();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return new ICPPMethod[0];
|
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue