mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @deprecated Returns 0.
|
||||
*/
|
||||
@Deprecated
|
||||
int getEncodingHashcode() throws CoreException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @since 4.0
|
||||
*/
|
||||
public interface IIndexInclude {
|
||||
IIndexInclude[] EMPTY_INCLUDES_ARRAY = new IIndexInclude[0];
|
||||
IIndexInclude[] EMPTY_INCLUDES_ARRAY = {};
|
||||
|
||||
/**
|
||||
* Returns the file that contains this directive.
|
||||
|
|
|
@ -585,14 +585,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected final IASTProblem createProblem(int signal, int offset, int length) {
|
||||
IASTProblem result = nodeFactory.newProblem(signal, CharArrayUtils.EMPTY, true);
|
||||
((ASTNode) result).setOffsetAndLength(offset, length);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected void logThrowable(String methodName, Throwable e) {
|
||||
if (e != null) {
|
||||
if (log.isTracing()) {
|
||||
|
@ -605,8 +603,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return scanner.toString();
|
||||
|
@ -656,8 +652,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
startTime = System.currentTimeMillis();
|
||||
resolveAmbiguities();
|
||||
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
|
||||
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
|
||||
);
|
||||
+ (System.currentTimeMillis() - startTime) + "ms"); //$NON-NLS-1$
|
||||
IASTTranslationUnit result = getTranslationUnit();
|
||||
nullifyTranslationUnit();
|
||||
result.freeze(); // make the AST immutable
|
||||
|
@ -882,7 +877,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
private IASTProblemDeclaration buildProblemDeclaration(IASTProblem problem) {
|
||||
IASTProblemDeclaration pd = nodeFactory.newProblemDeclaration(problem);
|
||||
((ASTNode) pd).setOffsetAndLength(((ASTNode) problem));
|
||||
|
@ -1280,8 +1274,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
protected void translationUnit() {
|
||||
try {
|
||||
setupTranslationUnit();
|
||||
} catch (Exception e2) {
|
||||
logException("translationUnit::createCompilationUnit()", e2); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
logException("translationUnit::createCompilationUnit()", e); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
parseTranslationUnit();
|
||||
|
@ -1423,7 +1417,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected IASTStatement handleFunctionBody() throws BacktrackException, EndOfFileException {
|
||||
declarationMark= null;
|
||||
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
|
||||
|
@ -1449,7 +1442,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
/**
|
||||
* Parses a function body.
|
||||
*
|
||||
* @return TODO
|
||||
* @return the compound statement representing the function body.
|
||||
* @throws BacktrackException
|
||||
* request a backtrack
|
||||
*/
|
||||
|
@ -1579,7 +1572,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
return !parsePassed;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
protected IASTDeclaration functionStyleAsmDeclaration() throws BacktrackException, EndOfFileException {
|
||||
final int offset= LA(1).getOffset();
|
||||
IASTDeclSpecifier declSpec;
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
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.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.HashSet;
|
||||
|
@ -59,7 +62,8 @@ class BuiltinOperators {
|
|||
private static final int SECOND = 1;
|
||||
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)
|
||||
return EMPTY;
|
||||
|
||||
|
@ -77,7 +81,8 @@ class BuiltinOperators {
|
|||
private Set<String> fSignatures;
|
||||
private Object[] fGlobalCandidates;
|
||||
|
||||
BuiltinOperators(OverloadableOperator operator, IASTInitializerClause[] args, IScope fileScope, Object[] globCandidates) {
|
||||
BuiltinOperators(OverloadableOperator operator, IASTInitializerClause[] args, IScope fileScope,
|
||||
Object[] globCandidates) {
|
||||
fFileScope= fileScope;
|
||||
fOperator= operator;
|
||||
fUnary= args.length<2;
|
||||
|
|
|
@ -55,7 +55,6 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
|||
return new File(URIUtil.toPath(location.getURI()).toOSString()).lastModified();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEncoding(IIndexFileLocation ifl) {
|
||||
String encoding= getFileEncoding(getASTPath(ifl));
|
||||
|
@ -116,7 +115,6 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doesIncludeFileExist(String includePath) {
|
||||
return fExistsCache.isFile(includePath);
|
||||
|
@ -199,5 +197,4 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
|||
public boolean isCaseInsensitiveFileSystem() {
|
||||
return new File("a").equals(new File("A"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ import com.ibm.icu.text.MessageFormat;
|
|||
* @since 4.0
|
||||
*/
|
||||
public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
||||
|
||||
protected StandaloneIndexer fIndexer;
|
||||
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
|
||||
};
|
||||
|
||||
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);
|
||||
fIndexer= indexer;
|
||||
setShowActivity(fIndexer.getShowActivity());
|
||||
|
@ -57,8 +57,7 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
if (getIndexAllFiles()) {
|
||||
setIndexFilesWithoutBuildConfiguration(true);
|
||||
setIndexHeadersWithoutContext(UnusedHeaderStrategy.useDefaultLanguage);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setIndexFilesWithoutBuildConfiguration(false);
|
||||
setIndexHeadersWithoutContext(UnusedHeaderStrategy.skip);
|
||||
}
|
||||
|
@ -105,7 +104,6 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
return fIndexer.getIndex();
|
||||
}
|
||||
|
||||
|
||||
public final void run(IProgressMonitor monitor) throws InterruptedException {
|
||||
long start = System.currentTimeMillis();
|
||||
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
|
||||
protected IStatus createStatus(String msg) {
|
||||
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
|
||||
protected IStatus createStatus(String msg, Throwable e) {
|
||||
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
|
||||
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
|
||||
// TODO: find a way to do non-OSGi NLS
|
||||
switch (kind) {
|
||||
|
@ -200,9 +187,6 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#getLogService()
|
||||
*/
|
||||
@Override
|
||||
protected IParserLogService getLogService() {
|
||||
if (fLogger != null)
|
||||
|
@ -214,36 +198,23 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
fLogger = logService;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#logError(org.eclipse.core.runtime.IStatus)
|
||||
*/
|
||||
@Override
|
||||
protected void logError(IStatus s) {
|
||||
trace(s.getMessage());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#logException(java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
protected void logException(Throwable e) {
|
||||
trace(e.getMessage());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#getLinkagesToParse()
|
||||
*/
|
||||
@Override
|
||||
protected int[] getLinkagesToParse() {
|
||||
return IDS_FOR_LINKAGES_TO_INDEX;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.pdom.PDOMWriter#trace(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected void trace(String 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.
|
||||
*/
|
||||
public abstract class ASTFilePathResolver {
|
||||
|
||||
/**
|
||||
* Resolve a path as stored in the AST.
|
||||
* @return an index file location.
|
||||
|
|
|
@ -82,6 +82,7 @@ public abstract class IndexerInputAdapter extends ASTFilePathResolver {
|
|||
* Returns a code reader for the given input file.
|
||||
*/
|
||||
public abstract FileContent getCodeReader(Object tu);
|
||||
|
||||
/**
|
||||
* Returns the encoding for the file.
|
||||
*/
|
||||
|
|
|
@ -172,7 +172,7 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
return new IIndexInclude[0];
|
||||
return IIndexInclude.EMPTY_INCLUDES_ARRAY;
|
||||
}
|
||||
|
||||
public IIndexInclude[] findIncludesTo(IIndex index, IIndexFileLocation ifl, IProgressMonitor pm) {
|
||||
|
@ -199,6 +199,6 @@ public class IBContentProvider extends AsyncTreeContentProvider {
|
|||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
return new IIndexInclude[0];
|
||||
return IIndexInclude.EMPTY_INCLUDES_ARRAY;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue