mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Cosmetics.
This commit is contained in:
parent
860489475c
commit
1f90d6b612
10 changed files with 66 additions and 103 deletions
|
@ -77,11 +77,10 @@ public interface IIndexFile extends IFileNomination {
|
||||||
int getScannerConfigurationHashcode() throws CoreException;
|
int getScannerConfigurationHashcode() throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the hash-code of the file encoding that was used to parse the file.
|
|
||||||
* <code>0</code> will be returned in case the hash-code is unknown.
|
|
||||||
* @return the hash-code of the file encoding or <code>0</code>.
|
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
|
* @deprecated Returns 0.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
int getEncodingHashcode() throws CoreException;
|
int getEncodingHashcode() throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public interface IIndexInclude {
|
public interface IIndexInclude {
|
||||||
IIndexInclude[] EMPTY_INCLUDES_ARRAY = new IIndexInclude[0];
|
IIndexInclude[] EMPTY_INCLUDES_ARRAY = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file that contains this directive.
|
* Returns the file that contains this directive.
|
||||||
|
|
|
@ -585,14 +585,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected final IASTProblem createProblem(int signal, int offset, int length) {
|
protected final IASTProblem createProblem(int signal, int offset, int length) {
|
||||||
IASTProblem result = nodeFactory.newProblem(signal, CharArrayUtils.EMPTY, true);
|
IASTProblem result = nodeFactory.newProblem(signal, CharArrayUtils.EMPTY, true);
|
||||||
((ASTNode) result).setOffsetAndLength(offset, length);
|
((ASTNode) result).setOffsetAndLength(offset, length);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void logThrowable(String methodName, Throwable e) {
|
protected void logThrowable(String methodName, Throwable e) {
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
if (log.isTracing()) {
|
if (log.isTracing()) {
|
||||||
|
@ -605,8 +603,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return scanner.toString();
|
return scanner.toString();
|
||||||
|
@ -656,8 +652,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
resolveAmbiguities();
|
resolveAmbiguities();
|
||||||
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
|
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
|
||||||
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
|
+ (System.currentTimeMillis() - startTime) + "ms"); //$NON-NLS-1$
|
||||||
);
|
|
||||||
IASTTranslationUnit result = getTranslationUnit();
|
IASTTranslationUnit result = getTranslationUnit();
|
||||||
nullifyTranslationUnit();
|
nullifyTranslationUnit();
|
||||||
result.freeze(); // make the AST immutable
|
result.freeze(); // make the AST immutable
|
||||||
|
@ -882,7 +877,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IASTProblemDeclaration buildProblemDeclaration(IASTProblem problem) {
|
private IASTProblemDeclaration buildProblemDeclaration(IASTProblem problem) {
|
||||||
IASTProblemDeclaration pd = nodeFactory.newProblemDeclaration(problem);
|
IASTProblemDeclaration pd = nodeFactory.newProblemDeclaration(problem);
|
||||||
((ASTNode) pd).setOffsetAndLength(((ASTNode) problem));
|
((ASTNode) pd).setOffsetAndLength(((ASTNode) problem));
|
||||||
|
@ -1280,8 +1274,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
protected void translationUnit() {
|
protected void translationUnit() {
|
||||||
try {
|
try {
|
||||||
setupTranslationUnit();
|
setupTranslationUnit();
|
||||||
} catch (Exception e2) {
|
} catch (Exception e) {
|
||||||
logException("translationUnit::createCompilationUnit()", e2); //$NON-NLS-1$
|
logException("translationUnit::createCompilationUnit()", e); //$NON-NLS-1$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parseTranslationUnit();
|
parseTranslationUnit();
|
||||||
|
@ -1423,7 +1417,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected IASTStatement handleFunctionBody() throws BacktrackException, EndOfFileException {
|
protected IASTStatement handleFunctionBody() throws BacktrackException, EndOfFileException {
|
||||||
declarationMark= null;
|
declarationMark= null;
|
||||||
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
|
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
|
||||||
|
@ -1449,7 +1442,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
/**
|
/**
|
||||||
* Parses a function body.
|
* Parses a function body.
|
||||||
*
|
*
|
||||||
* @return TODO
|
* @return the compound statement representing the function body.
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
* request a backtrack
|
* request a backtrack
|
||||||
*/
|
*/
|
||||||
|
@ -1579,7 +1572,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return !parsePassed;
|
return !parsePassed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected abstract IASTDeclaration declaration(DeclarationOptions option) throws BacktrackException, EndOfFileException;
|
protected abstract IASTDeclaration declaration(DeclarationOptions option) throws BacktrackException, EndOfFileException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1751,7 +1743,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return buildASMDirective(offset, buffer.toString(), lastOffset);
|
return buildASMDirective(offset, buffer.toString(), lastOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected IASTDeclaration functionStyleAsmDeclaration() throws BacktrackException, EndOfFileException {
|
protected IASTDeclaration functionStyleAsmDeclaration() throws BacktrackException, EndOfFileException {
|
||||||
final int offset= LA(1).getOffset();
|
final int offset= LA(1).getOffset();
|
||||||
IASTDeclSpecifier declSpec;
|
IASTDeclSpecifier declSpec;
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
||||||
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeOrFunctionSet;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeOrFunctionSet;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -59,7 +62,8 @@ class BuiltinOperators {
|
||||||
private static final int SECOND = 1;
|
private static final int SECOND = 1;
|
||||||
private static final IType PTR_DIFF = new CPPBasicType(Kind.eInt, 0);
|
private static final IType PTR_DIFF = new CPPBasicType(Kind.eInt, 0);
|
||||||
|
|
||||||
public static ICPPFunction[] create(OverloadableOperator operator, IASTInitializerClause[] args, IASTTranslationUnit tu, Object[] globCandidates) {
|
public static ICPPFunction[] create(OverloadableOperator operator, IASTInitializerClause[] args,
|
||||||
|
IASTTranslationUnit tu, Object[] globCandidates) {
|
||||||
if (operator == null || args == null || args.length == 0)
|
if (operator == null || args == null || args.length == 0)
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
|
|
||||||
|
@ -77,7 +81,8 @@ class BuiltinOperators {
|
||||||
private Set<String> fSignatures;
|
private Set<String> fSignatures;
|
||||||
private Object[] fGlobalCandidates;
|
private Object[] fGlobalCandidates;
|
||||||
|
|
||||||
BuiltinOperators(OverloadableOperator operator, IASTInitializerClause[] args, IScope fileScope, Object[] globCandidates) {
|
BuiltinOperators(OverloadableOperator operator, IASTInitializerClause[] args, IScope fileScope,
|
||||||
|
Object[] globCandidates) {
|
||||||
fFileScope= fileScope;
|
fFileScope= fileScope;
|
||||||
fOperator= operator;
|
fOperator= operator;
|
||||||
fUnary= args.length<2;
|
fUnary= args.length<2;
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
return new File(URIUtil.toPath(location.getURI()).toOSString()).lastModified();
|
return new File(URIUtil.toPath(location.getURI()).toOSString()).lastModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEncoding(IIndexFileLocation ifl) {
|
public String getEncoding(IIndexFileLocation ifl) {
|
||||||
String encoding= getFileEncoding(getASTPath(ifl));
|
String encoding= getFileEncoding(getASTPath(ifl));
|
||||||
|
@ -116,7 +115,6 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesIncludeFileExist(String includePath) {
|
public boolean doesIncludeFileExist(String includePath) {
|
||||||
return fExistsCache.isFile(includePath);
|
return fExistsCache.isFile(includePath);
|
||||||
|
@ -199,5 +197,4 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
||||||
public boolean isCaseInsensitiveFileSystem() {
|
public boolean isCaseInsensitiveFileSystem() {
|
||||||
return new File("a").equals(new File("A"));
|
return new File("a").equals(new File("A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ import com.ibm.icu.text.MessageFormat;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
|
|
||||||
protected StandaloneIndexer fIndexer;
|
protected StandaloneIndexer fIndexer;
|
||||||
protected IParserLogService fLogger;
|
protected IParserLogService fLogger;
|
||||||
|
|
||||||
|
@ -47,7 +46,8 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
|
ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
protected StandaloneIndexerTask(StandaloneIndexer indexer, Collection<String> added, Collection<String> changed, Collection<String> removed, boolean isFast) {
|
protected StandaloneIndexerTask(StandaloneIndexer indexer, Collection<String> added,
|
||||||
|
Collection<String> changed, Collection<String> removed, boolean isFast) {
|
||||||
super(concat(added, changed), removed.toArray(), new StandaloneIndexerInputAdapter(indexer), isFast);
|
super(concat(added, changed), removed.toArray(), new StandaloneIndexerInputAdapter(indexer), isFast);
|
||||||
fIndexer= indexer;
|
fIndexer= indexer;
|
||||||
setShowActivity(fIndexer.getShowActivity());
|
setShowActivity(fIndexer.getShowActivity());
|
||||||
|
@ -57,8 +57,7 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
if (getIndexAllFiles()) {
|
if (getIndexAllFiles()) {
|
||||||
setIndexFilesWithoutBuildConfiguration(true);
|
setIndexFilesWithoutBuildConfiguration(true);
|
||||||
setIndexHeadersWithoutContext(UnusedHeaderStrategy.useDefaultLanguage);
|
setIndexHeadersWithoutContext(UnusedHeaderStrategy.useDefaultLanguage);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setIndexFilesWithoutBuildConfiguration(false);
|
setIndexFilesWithoutBuildConfiguration(false);
|
||||||
setIndexHeadersWithoutContext(UnusedHeaderStrategy.skip);
|
setIndexHeadersWithoutContext(UnusedHeaderStrategy.skip);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +104,6 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
return fIndexer.getIndex();
|
return fIndexer.getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final void run(IProgressMonitor monitor) throws InterruptedException {
|
public final void run(IProgressMonitor monitor) throws InterruptedException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
runTask(monitor);
|
runTask(monitor);
|
||||||
|
@ -160,30 +158,19 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#createStatus(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IStatus createStatus(String msg) {
|
protected IStatus createStatus(String msg) {
|
||||||
return new Status(IStatus.ERROR, "org.eclipse.cdt.core", msg, null); //$NON-NLS-1$
|
return new Status(IStatus.ERROR, "org.eclipse.cdt.core", msg, null); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.PDOMWriter#createStatus(java.lang.String, java.lang.Throwable)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IStatus createStatus(String msg, Throwable e) {
|
protected IStatus createStatus(String msg, Throwable e) {
|
||||||
return new Status(IStatus.ERROR, "org.eclipse.cdt.core", msg, e); //$NON-NLS-1$
|
return new Status(IStatus.ERROR, "org.eclipse.cdt.core", msg, e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#getMessage(org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.MessageKind, java.lang.Object[])
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected String getMessage(MessageKind kind, Object... arguments) {
|
protected String getMessage(MessageKind kind, Object... arguments) {
|
||||||
// unfortunately we don't have OSGi on the remote system so for now we'll just settle for
|
// Unfortunately we don't have OSGi on the remote system so for now we'll just settle for
|
||||||
// English strings
|
// English strings
|
||||||
// TODO: find a way to do non-OSGi NLS
|
// TODO: find a way to do non-OSGi NLS
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
@ -200,9 +187,6 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#getLogService()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IParserLogService getLogService() {
|
protected IParserLogService getLogService() {
|
||||||
if (fLogger != null)
|
if (fLogger != null)
|
||||||
|
@ -214,36 +198,23 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||||
fLogger = logService;
|
fLogger = logService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#logError(org.eclipse.core.runtime.IStatus)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void logError(IStatus s) {
|
protected void logError(IStatus s) {
|
||||||
trace(s.getMessage());
|
trace(s.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#logException(java.lang.Throwable)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void logException(Throwable e) {
|
protected void logException(Throwable e) {
|
||||||
trace(e.getMessage());
|
trace(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#getLinkagesToParse()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected int[] getLinkagesToParse() {
|
protected int[] getLinkagesToParse() {
|
||||||
return IDS_FOR_LINKAGES_TO_INDEX;
|
return IDS_FOR_LINKAGES_TO_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.PDOMWriter#trace(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void trace(String message) {
|
protected void trace(String message) {
|
||||||
getLogService().traceLog(message);
|
getLogService().traceLog(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
* Abstract class for resolving paths as computed by the parser.
|
* Abstract class for resolving paths as computed by the parser.
|
||||||
*/
|
*/
|
||||||
public abstract class ASTFilePathResolver {
|
public abstract class ASTFilePathResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve a path as stored in the AST.
|
* Resolve a path as stored in the AST.
|
||||||
* @return an index file location.
|
* @return an index file location.
|
||||||
|
|
|
@ -82,6 +82,7 @@ public abstract class IndexerInputAdapter extends ASTFilePathResolver {
|
||||||
* Returns a code reader for the given input file.
|
* Returns a code reader for the given input file.
|
||||||
*/
|
*/
|
||||||
public abstract FileContent getCodeReader(Object tu);
|
public abstract FileContent getCodeReader(Object tu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the encoding for the file.
|
* Returns the encoding for the file.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.log(e);
|
CUIPlugin.log(e);
|
||||||
}
|
}
|
||||||
return new IIndexInclude[0];
|
return IIndexInclude.EMPTY_INCLUDES_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIndexInclude[] findIncludesTo(IIndex index, IIndexFileLocation ifl, IProgressMonitor pm) {
|
public IIndexInclude[] findIncludesTo(IIndex index, IIndexFileLocation ifl, IProgressMonitor pm) {
|
||||||
|
@ -199,6 +199,6 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.log(e);
|
CUIPlugin.log(e);
|
||||||
}
|
}
|
||||||
return new IIndexInclude[0];
|
return IIndexInclude.EMPTY_INCLUDES_ARRAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue