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

Cosmetics

Change-Id: I4a1144c870b820d7bd98e068c659fa6904e2f8ee
This commit is contained in:
Sergey Prigogin 2016-10-09 12:03:53 -07:00
parent 52bd79302f
commit 59f5c157aa

View file

@ -92,17 +92,17 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
db.putRecPtr(record + ID_OFFSET, db.newString(linkageID).getRecord()); db.putRecPtr(record + ID_OFFSET, db.newString(linkageID).getRecord());
pdom.insertLinkage(this); pdom.insertLinkage(this);
} }
@Override @Override
public final PDOM getPDOM() { public final PDOM getPDOM() {
return fPDOM; return fPDOM;
} }
@Override @Override
public final PDOMLinkage getLinkage() { public final PDOMLinkage getLinkage() {
return this; return this;
} }
@Override @Override
public final Database getDB() { public final Database getDB() {
return fDatabase; return fDatabase;
@ -172,7 +172,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
public void addChild(PDOMNode child) throws CoreException { public void addChild(PDOMNode child) throws CoreException {
getIndex().insert(child.getRecord()); getIndex().insert(child.getRecord());
} }
public final PDOMBinding getBinding(long record) throws CoreException { public final PDOMBinding getBinding(long record) throws CoreException {
final PDOMNode node= PDOMNode.load(fPDOM, record); final PDOMNode node= PDOMNode.load(fPDOM, record);
if (node instanceof PDOMBinding) if (node instanceof PDOMBinding)
@ -202,11 +202,11 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
} }
return false; return false;
} }
protected final PDOMBinding attemptFastAdaptBinding(final IBinding binding) throws CoreException { protected final PDOMBinding attemptFastAdaptBinding(final IBinding binding) throws CoreException {
PDOMBinding pdomBinding= binding.getAdapter(PDOMBinding.class); PDOMBinding pdomBinding= binding.getAdapter(PDOMBinding.class);
// There is no guarantee, that the binding is from the same PDOM object. // There is no guarantee, that the binding is from the same PDOM object.
if (pdomBinding != null && pdomBinding.getPDOM() == getPDOM()) { if (pdomBinding != null && pdomBinding.getPDOM() == fPDOM) {
return pdomBinding; return pdomBinding;
} }
return (PDOMBinding) fPDOM.getCachedResult(binding); return (PDOMBinding) fPDOM.getCachedResult(binding);
@ -215,7 +215,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
public final PDOMBinding adaptBinding(IBinding binding) throws CoreException { public final PDOMBinding adaptBinding(IBinding binding) throws CoreException {
return adaptBinding(binding, true); return adaptBinding(binding, true);
} }
public abstract PDOMBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException; public abstract PDOMBinding adaptBinding(IBinding binding, boolean includeLocal) throws CoreException;
public abstract PDOMBinding addBinding(IASTName name) throws CoreException; public abstract PDOMBinding addBinding(IASTName name) throws CoreException;
@ -286,7 +286,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
* @param file the file that has triggered the creation of the name * @param file the file that has triggered the creation of the name
* @param name the name that caused the insertion * @param name the name that caused the insertion
* @param pdomName the name that was inserted into the linkage * @param pdomName the name that was inserted into the linkage
* @throws CoreException * @throws CoreException
* @since 4.0 * @since 4.0
*/ */
public void onCreateName(PDOMFile file, IASTName name, PDOMName pdomName) throws CoreException { public void onCreateName(PDOMFile file, IASTName name, PDOMName pdomName) throws CoreException {
@ -305,7 +305,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
* Callback informing the linkage that a name is about to be deleted. This is * Callback informing the linkage that a name is about to be deleted. This is
* used to do additional processing, like removing inheritance relationships. * used to do additional processing, like removing inheritance relationships.
* @param name the name that is about to be deleted * @param name the name that is about to be deleted
* @throws CoreException * @throws CoreException
* @since 4.0 * @since 4.0
*/ */
public void onDeleteName(PDOMName name) throws CoreException { public void onDeleteName(PDOMName name) throws CoreException {
@ -338,7 +338,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
public ICPPUsingDirective[] getUsingDirectives(PDOMFile file) throws CoreException { public ICPPUsingDirective[] getUsingDirectives(PDOMFile file) throws CoreException {
return ICPPUsingDirective.EMPTY_ARRAY; return ICPPUsingDirective.EMPTY_ARRAY;
} }
public BTree getMacroIndex() { public BTree getMacroIndex() {
if (fMacroIndex == null) { if (fMacroIndex == null) {
fMacroIndex= new BTree(getDB(), record + MACRO_BTREE, new FindBinding.MacroBTreeComparator(fDatabase)); fMacroIndex= new BTree(getDB(), record + MACRO_BTREE, new FindBinding.MacroBTreeComparator(fDatabase));
@ -356,7 +356,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
return ((PDOMMacroContainer) result); return ((PDOMMacroContainer) result);
} }
assert result==null; assert result==null;
MacroContainerFinder visitor = new MacroContainerFinder(this, name); MacroContainerFinder visitor = new MacroContainerFinder(this, name);
getMacroIndex().accept(visitor); getMacroIndex().accept(visitor);
PDOMMacroContainer container= visitor.getMacroContainer(); PDOMMacroContainer container= visitor.getMacroContainer();
@ -393,7 +393,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
/** /**
* Returns the list of global bindings for the given name. * Returns the list of global bindings for the given name.
* @throws CoreException * @throws CoreException
*/ */
public PDOMBinding[] getBindingsViaCache(char[] name, IProgressMonitor monitor) throws CoreException { public PDOMBinding[] getBindingsViaCache(char[] name, IProgressMonitor monitor) throws CoreException {
CharArrayMap<PDOMBinding[]> map = getBindingMap(); CharArrayMap<PDOMBinding[]> map = getBindingMap();
@ -402,7 +402,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
if (result != null) if (result != null)
return result; return result;
} }
BindingCollector visitor = new BindingCollector(this, name, null, false, false, true); BindingCollector visitor = new BindingCollector(this, name, null, false, false, true);
visitor.setMonitor(monitor); visitor.setMonitor(monitor);
getIndex().accept(visitor); getIndex().accept(visitor);
@ -412,7 +412,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
} }
return result; return result;
} }
private CharArrayMap<PDOMBinding[]> getBindingMap() { private CharArrayMap<PDOMBinding[]> getBindingMap() {
final Long key= getRecord(); final Long key= getRecord();
final PDOM pdom = getPDOM(); final PDOM pdom = getPDOM();
@ -508,7 +508,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
chunkPtr += Database.PTR_SIZE; chunkPtr += Database.PTR_SIZE;
chunkLength -= Database.PTR_SIZE; chunkLength -= Database.PTR_SIZE;
} }
chunkLength -= pos; chunkLength -= pos;
db.getBytes(chunkPtr, data, bufferPos, chunkLength); db.getBytes(chunkPtr, data, bufferPos, chunkLength);
bufferPos += chunkLength; bufferPos += chunkLength;
pos = 0; pos = 0;
@ -528,7 +528,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
b = db.getByte(ptr++); b = db.getByte(ptr++);
len |= (b & 0x7F) << shift; len |= (b & 0x7F) << shift;
} }
len += ptr - chunkPtr; len += ptr - chunkPtr;
while (len > 0) { while (len > 0) {
int chunkLength = len; int chunkLength = len;
@ -555,7 +555,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
byte[] data= null; byte[] data= null;
switch (firstByte) { switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE: case TypeMarshalBuffer.INDIRECT_TYPE:
data = loadLinkedSerializedData(db, offset + 1); data = loadLinkedSerializedData(db, offset + 1);
break; break;
case TypeMarshalBuffer.UNSTORABLE_TYPE: case TypeMarshalBuffer.UNSTORABLE_TYPE:
return TypeMarshalBuffer.UNSTORABLE_TYPE_PROBLEM; return TypeMarshalBuffer.UNSTORABLE_TYPE_PROBLEM;
@ -593,7 +593,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
byte[] data= null; byte[] data= null;
switch (firstByte) { switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE: case TypeMarshalBuffer.INDIRECT_TYPE:
data = loadLinkedSerializedData(db, offset + 1); data = loadLinkedSerializedData(db, offset + 1);
break; break;
case TypeMarshalBuffer.UNSTORABLE_TYPE: case TypeMarshalBuffer.UNSTORABLE_TYPE:
return new ProblemBinding(null, ISemanticProblem.TYPE_NOT_PERSISTED); return new ProblemBinding(null, ISemanticProblem.TYPE_NOT_PERSISTED);
@ -631,7 +631,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
byte[] data= null; byte[] data= null;
switch (firstByte) { switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE: case TypeMarshalBuffer.INDIRECT_TYPE:
data = loadLinkedSerializedData(db, offset + 1); data = loadLinkedSerializedData(db, offset + 1);
break; break;
case TypeMarshalBuffer.UNSTORABLE_TYPE: case TypeMarshalBuffer.UNSTORABLE_TYPE:
case TypeMarshalBuffer.NULL_TYPE: case TypeMarshalBuffer.NULL_TYPE:
@ -649,7 +649,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
deleteValue(db, offset); deleteValue(db, offset);
storeValue(db, offset, value); storeValue(db, offset, value);
} }
private void storeValue(Database db, long offset, IValue value) throws CoreException { private void storeValue(Database db, long offset, IValue value) throws CoreException {
if (value != null) { if (value != null) {
TypeMarshalBuffer bc= new TypeMarshalBuffer(this); TypeMarshalBuffer bc= new TypeMarshalBuffer(this);
@ -674,7 +674,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
deleteEvaluation(db, offset); deleteEvaluation(db, offset);
storeEvaluation(db, offset, eval); storeEvaluation(db, offset, eval);
} }
private void storeEvaluation(Database db, long offset, ISerializableEvaluation eval) throws CoreException { private void storeEvaluation(Database db, long offset, ISerializableEvaluation eval) throws CoreException {
if (eval != null) { if (eval != null) {
TypeMarshalBuffer bc= new TypeMarshalBuffer(this); TypeMarshalBuffer bc= new TypeMarshalBuffer(this);
@ -693,13 +693,13 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
return null; return null;
return buffer.unmarshalEvaluation(); return buffer.unmarshalEvaluation();
} }
public void storeExecution(long offset, ISerializableExecution exec) throws CoreException { public void storeExecution(long offset, ISerializableExecution exec) throws CoreException {
final Database db = getDB(); final Database db = getDB();
deleteExecution(db, offset); deleteExecution(db, offset);
storeExecution(db, offset, exec); storeExecution(db, offset, exec);
} }
private void storeExecution(Database db, long offset, ISerializableExecution exec) throws CoreException { private void storeExecution(Database db, long offset, ISerializableExecution exec) throws CoreException {
if (exec != null) { if (exec != null) {
TypeMarshalBuffer bc = new TypeMarshalBuffer(this); TypeMarshalBuffer bc = new TypeMarshalBuffer(this);
@ -707,11 +707,11 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
storeBuffer(db, offset, bc, Database.EXECUTION_SIZE); storeBuffer(db, offset, bc, Database.EXECUTION_SIZE);
} }
} }
private void deleteExecution(Database db, long offset) throws CoreException { private void deleteExecution(Database db, long offset) throws CoreException {
deleteSerializedData(db, offset, Database.EXECUTION_SIZE); deleteSerializedData(db, offset, Database.EXECUTION_SIZE);
} }
public ISerializableExecution loadExecution(long offset) throws CoreException { public ISerializableExecution loadExecution(long offset) throws CoreException {
TypeMarshalBuffer buffer = loadBuffer(offset, Database.EXECUTION_SIZE); TypeMarshalBuffer buffer = loadBuffer(offset, Database.EXECUTION_SIZE);
if (buffer == null) if (buffer == null)
@ -725,7 +725,7 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
byte[] data; byte[] data;
switch (firstByte) { switch (firstByte) {
case TypeMarshalBuffer.INDIRECT_TYPE: case TypeMarshalBuffer.INDIRECT_TYPE:
data = loadLinkedSerializedData(db, offset + 1); data = loadLinkedSerializedData(db, offset + 1);
break; break;
case TypeMarshalBuffer.NULL_TYPE: case TypeMarshalBuffer.NULL_TYPE:
return null; return null;