1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-03-17 21:53:29 -07:00
parent d3b2a6305b
commit 0496018fad
5 changed files with 101 additions and 107 deletions

View file

@ -447,14 +447,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException { Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException {
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info; TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
// generate structure // Generate structure
this.parse(newElements, pm); this.parse(newElements, pm);
// ///////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////
if (isWorkingCopy()) { if (isWorkingCopy()) {
ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement(); ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement();
// might be IResource.NULL_STAMP if original does not exist // Might be IResource.NULL_STAMP if original does not exist
IResource r = original.getResource(); IResource r = original.getResource();
if (r != null && r instanceof IFile) { if (r != null && r instanceof IFile) {
unitInfo.fTimestamp = ((IFile) r).getModificationStamp(); unitInfo.fTimestamp = ((IFile) r).getModificationStamp();
@ -499,7 +499,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} else { } else {
workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory); workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory);
} }
// open the working copy now to ensure contents are that of the current state of this element // Open the working copy now to ensure contents are that of the current state of this element
workingCopy.open(monitor); workingCopy.open(monitor);
return workingCopy; return workingCopy;
} }
@ -541,7 +541,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return null; return null;
} }
// create a new info and make it the current info // Create a new info and make it the current info
// (this will remove the info and its children just before storing the new infos) // (this will remove the info and its children just before storing the new infos)
CModelManager manager = CModelManager.getDefault(); CModelManager manager = CModelManager.getDefault();
boolean hadTemporaryCache = manager.hasTemporaryCache(); boolean hadTemporaryCache = manager.hasTemporaryCache();
@ -555,7 +555,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache(); Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache();
openWhenClosed(info, monitor); openWhenClosed(info, monitor);
if (newElements.get(this) == null) { if (newElements.get(this) == null) {
// close any buffer that was opened for the new elements // Close any buffer that was opened for the new elements
Iterator<ICElement> iterator = newElements.keySet().iterator(); Iterator<ICElement> iterator = newElements.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ICElement element = iterator.next(); ICElement element = iterator.next();
@ -593,13 +593,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override @Override
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException { protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException {
// create buffer - translation units only use default buffer factory // Create buffer - translation units only use default buffer factory
BufferManager bufManager = getBufferManager(); BufferManager bufManager = getBufferManager();
IBuffer buffer = getBufferFactory().createBuffer(this); IBuffer buffer = getBufferFactory().createBuffer(this);
if (buffer == null) if (buffer == null)
return null; return null;
// set the buffer source // Set the buffer source
if (buffer.getCharacters() == null) { if (buffer.getCharacters() == null) {
IResource resource = this.getResource(); IResource resource = this.getResource();
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
@ -620,10 +620,10 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
} }
// add buffer to buffer cache // Add buffer to buffer cache
bufManager.addBuffer(buffer); bufManager.addBuffer(buffer);
// listen to buffer changes // Listen to buffer changes
buffer.addBufferChangedListener(this); buffer.addBufferChangedListener(this);
return buffer; return buffer;
@ -889,6 +889,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID }; private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID };
public IIndexFile[] getContextToHeader(IIndex index, int style) { public IIndexFile[] getContextToHeader(IIndex index, int style) {
if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) { if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) {
try { try {

View file

@ -2125,7 +2125,7 @@ public class CPPVisitor extends ASTQueries {
} }
IType type = expr.getExpressionType(); IType type = expr.getExpressionType();
if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) { if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) {
switch((expr).getValueCategory()) { switch (expr.getValueCategory()) {
case XVALUE: case XVALUE:
type= new CPPReferenceType(type, true); type= new CPPReferenceType(type, true);
break; break;

View file

@ -469,6 +469,7 @@ public class PDOM extends PlatformObject implements IPDOM {
public int compare(long record) throws CoreException { public int compare(long record) throws CoreException {
return 0; return 0;
} }
@Override @Override
public boolean visit(long record) throws CoreException { public boolean visit(long record) throws CoreException {
PDOMFile file = PDOMFile.recreateFile(PDOM.this, record); PDOMFile file = PDOMFile.recreateFile(PDOM.this, record);

View file

@ -10,19 +10,17 @@
* Andrew Ferguson (Symbian) - Provide B-tree deletion routine * Andrew Ferguson (Symbian) - Provide B-tree deletion routine
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
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.cdt.core.CCorePlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import com.ibm.icu.text.MessageFormat;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
public class BTree { public class BTree {
// Constants for internal deletion routine (see deleteImp doc) // Constants for internal deletion routine (see deleteImp doc)
@ -113,10 +111,10 @@ public class BTree {
// if this node is full (last record isn't null), split it // if this node is full (last record isn't null), split it
if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) { if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) {
long median = getRecord(chunk, node, MEDIAN_RECORD); long median = getRecord(chunk, node, MEDIAN_RECORD);
if (median == record) if (median == record) {
// found it, never mind // found it, never mind
return median; return median;
else { } else {
// split it // split it
// create the new node and move the larger records over // create the new node and move the larger records over
long newnode = allocateNode(); long newnode = allocateNode();
@ -171,16 +169,13 @@ public class BTree {
long checkRec= getRecord(chunk, node, middle); long checkRec= getRecord(chunk, node, middle);
if (checkRec == 0) { if (checkRec == 0) {
upper= middle; upper= middle;
} } else {
else {
int compare= cmp.compare(checkRec, record); int compare= cmp.compare(checkRec, record);
if (compare > 0) { if (compare > 0) {
upper= middle; upper= middle;
} } else if (compare < 0) {
else if (compare < 0) {
lower= middle + 1; lower= middle + 1;
} } else {
else {
// found it, no insert, just return the record // found it, no insert, just return the record
return record; return record;
} }
@ -561,13 +556,11 @@ public class BTree {
long checkRec = getRecord(chunk, node, middle); long checkRec = getRecord(chunk, node, middle);
if (checkRec == 0) { if (checkRec == 0) {
upper= middle; upper= middle;
} } else {
else {
int compare= visitor.compare(checkRec); int compare= visitor.compare(checkRec);
if (compare >= 0) { if (compare >= 0) {
upper= middle; upper= middle;
} } else {
else {
lower= middle + 1; lower= middle + 1;
} }
} }
@ -584,8 +577,7 @@ public class BTree {
if (compare > 0) { if (compare > 0) {
// start point is to the left // start point is to the left
return accept(getChild(chunk, node, i), visitor); return accept(getChild(chunk, node, i), visitor);
} } else if (compare == 0) {
else if (compare == 0) {
if (!accept(getChild(chunk, node, i), visitor)) if (!accept(getChild(chunk, node, i), visitor))
return false; return false;
if (!visitor.visit(record)) if (!visitor.visit(record))