mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42: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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
|
@ -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.
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Ed Swartz (Nokia)
|
||||
* Mike Kucera (IBM) - bug #206952
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Ed Swartz (Nokia)
|
||||
* Mike Kucera (IBM) - bug #206952
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
|
@ -252,7 +252,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
// Use to create the completion node
|
||||
protected ASTCompletionNode createCompletionNode(IToken token) {
|
||||
// the preprocessor may deliver tokens for literals or header-names.
|
||||
if(completionNode == null && token != null && token.getType() == IToken.tCOMPLETION) {
|
||||
if (completionNode == null && token != null && token.getType() == IToken.tCOMPLETION) {
|
||||
completionNode = new ASTCompletionNode(token, getTranslationUnit());
|
||||
}
|
||||
return completionNode;
|
||||
|
@ -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()) {
|
||||
|
@ -604,8 +602,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
log.traceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String 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
|
||||
|
@ -736,7 +731,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
int endOffset;
|
||||
loop: try {
|
||||
endOffset= LA(1).getOffset();
|
||||
while(true) {
|
||||
while (true) {
|
||||
switch (LT(1)) {
|
||||
case IToken.tEOC:
|
||||
endOffset= getEndOffset();
|
||||
|
@ -776,7 +771,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
int depth= 0;
|
||||
int endOffset= offset;
|
||||
loop: try {
|
||||
while(true) {
|
||||
while (true) {
|
||||
switch (LT(1)) {
|
||||
case IToken.tEOC:
|
||||
endOffset= getEndOffset();
|
||||
|
@ -827,7 +822,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
int endOffset= consume(IToken.tLBRACE).getOffset();
|
||||
|
||||
int stmtOffset= -1;
|
||||
while(true) {
|
||||
while (true) {
|
||||
IToken next= LAcatchEOF(1);
|
||||
if (next == null) {
|
||||
((ASTNode) result).setOffsetAndLength(offset, endOffset-offset);
|
||||
|
@ -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));
|
||||
|
@ -992,7 +986,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
private IASTExpression buildExpression(IASTExpression left, BinaryOperator operator) {
|
||||
int op, unaryOp= 0;
|
||||
final IASTInitializerClause right= operator.fExpression;
|
||||
switch(operator.fOperatorToken) {
|
||||
switch (operator.fOperatorToken) {
|
||||
case IToken.tQUESTION:
|
||||
final IASTInitializerClause negative;
|
||||
if (operator.fNext == null || operator.fNext.fOperatorToken != IToken.tCOLON) {
|
||||
|
@ -1220,7 +1214,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
consume();
|
||||
boolean unaryFailed= false;
|
||||
if (ctx == CastExprCtx.eDirectlyInBExpr) {
|
||||
switch (LT(1)){
|
||||
switch (LT(1)) {
|
||||
// ambiguity with unary operator
|
||||
case IToken.tPLUS: case IToken.tMINUS:
|
||||
case IToken.tSTAR: case IToken.tAMPER:
|
||||
|
@ -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();
|
||||
|
@ -1403,7 +1397,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
|
||||
if (operator == IASTUnaryExpression.op_star && operand instanceof IASTLiteralExpression) {
|
||||
IASTLiteralExpression lit= (IASTLiteralExpression) operand;
|
||||
switch(lit.getKind()) {
|
||||
switch (lit.getKind()) {
|
||||
case IASTLiteralExpression.lk_char_constant:
|
||||
case IASTLiteralExpression.lk_float_constant:
|
||||
case IASTLiteralExpression.lk_integer_constant:
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -1603,7 +1595,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
// support simple declarations without declarators
|
||||
final boolean acceptEmpty = acceptCompoundWithoutDtor && isLegalWithoutDtor(result.fDeclSpec1);
|
||||
if (acceptEmpty) {
|
||||
switch(lt1) {
|
||||
switch (lt1) {
|
||||
case 0:
|
||||
case IToken.tEOC:
|
||||
case IToken.tSEMI:
|
||||
|
@ -1698,7 +1690,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
if (declarationMark != null) {
|
||||
backup(declarationMark);
|
||||
// avoid creating an empty declaration
|
||||
switch(LTcatchEOF(1)) {
|
||||
switch (LTcatchEOF(1)) {
|
||||
case 0: // eof
|
||||
case IToken.tEOC:
|
||||
case IToken.tSEMI:
|
||||
|
@ -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;
|
||||
|
@ -1803,7 +1794,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
int open= 1;
|
||||
while (open > 0) {
|
||||
t= consume();
|
||||
switch(t.getType()) {
|
||||
switch (t.getType()) {
|
||||
case IToken.tLPAREN:
|
||||
open++;
|
||||
break;
|
||||
|
@ -1948,9 +1939,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
* in this case the type defaults to int and is know as "implicit int".
|
||||
*/
|
||||
protected static boolean isImplicitInt(IASTDeclaration declaration) {
|
||||
if(declaration instanceof IASTSimpleDeclaration) {
|
||||
if (declaration instanceof IASTSimpleDeclaration) {
|
||||
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)declaration).getDeclSpecifier();
|
||||
if(declSpec instanceof IASTSimpleDeclSpecifier &&
|
||||
if (declSpec instanceof IASTSimpleDeclSpecifier &&
|
||||
((IASTSimpleDeclSpecifier)declSpec).getType() == IASTSimpleDeclSpecifier.t_unspecified) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1966,7 +1957,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
IASTName name = identifier(); // tIDENTIFIER
|
||||
consume(IToken.tCOLON); // tCOLON
|
||||
IASTStatement nestedStatement = statement();
|
||||
int lastOffset = calculateEndOffset( nestedStatement );
|
||||
int lastOffset = calculateEndOffset(nestedStatement);
|
||||
|
||||
|
||||
IASTLabelStatement label_statement = nodeFactory.newLabelStatement(name, nestedStatement);
|
||||
|
@ -2208,7 +2199,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
if (!isValidTypeIDForUnaryExpression(unaryExprKind, typeid)) {
|
||||
typeid= null;
|
||||
} else {
|
||||
switch(LT(1)) {
|
||||
switch (LT(1)) {
|
||||
case IToken.tRPAREN:
|
||||
case IToken.tEOC:
|
||||
endOffset1= consume().getEndOffset();
|
||||
|
@ -2309,7 +2300,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
protected abstract IASTAmbiguousExpression createAmbiguousCastVsFunctionCallExpression(IASTCastExpression castExpr, IASTFunctionCallExpression funcCall);
|
||||
|
||||
protected IASTStatement forInitStatement() throws BacktrackException, EndOfFileException {
|
||||
if( LT(1) == IToken.tSEMI )
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
return parseNullStatement();
|
||||
try {
|
||||
return parseDeclarationOrExpressionStatement();
|
||||
|
@ -2334,7 +2325,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
protected void __attribute_decl_seq(boolean allowAttrib, boolean allowDeclspec) throws BacktrackException, EndOfFileException {
|
||||
while (true) {
|
||||
final int lt = LTcatchEOF(1);
|
||||
if ( allowAttrib && (lt == IGCCToken.t__attribute__)) {
|
||||
if (allowAttrib && (lt == IGCCToken.t__attribute__)) {
|
||||
__attribute__();
|
||||
} else if (allowDeclspec && (lt == IGCCToken.t__declspec)) {
|
||||
__declspec();
|
||||
|
@ -2433,7 +2424,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
if (token.getType() == IToken.tLPAREN) {
|
||||
consume();
|
||||
int openParen= 1;
|
||||
while(true) {
|
||||
while (true) {
|
||||
token = LA(1);
|
||||
consume();
|
||||
if (token.getType() == IToken.tLPAREN) {
|
||||
|
@ -2573,7 +2564,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
protected void skipBrackets(int left, int right, int terminator) throws EndOfFileException, BacktrackException {
|
||||
consume(left);
|
||||
int nesting= 0;
|
||||
while(true) {
|
||||
while (true) {
|
||||
final int lt1= LT(1);
|
||||
if (lt1 == IToken.tEOC || lt1 == terminator)
|
||||
throwBacktrack(LA(1));
|
||||
|
|
|
@ -6,12 +6,15 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
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;
|
||||
|
||||
|
@ -70,14 +74,15 @@ class BuiltinOperators {
|
|||
private final boolean fUnary;
|
||||
private IType fType1;
|
||||
private IType fType2;
|
||||
private IType[][] fClassConversionTypes= {null, null};
|
||||
private boolean[] fIsClass= {false,false};
|
||||
private IType[][] fClassConversionTypes= { null, null };
|
||||
private boolean[] fIsClass= { false, false };
|
||||
private IScope fFileScope;
|
||||
private List<ICPPFunction> fResult;
|
||||
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;
|
||||
|
@ -97,7 +102,7 @@ class BuiltinOperators {
|
|||
|
||||
|
||||
private ICPPFunction[] create() {
|
||||
switch(fOperator) {
|
||||
switch (fOperator) {
|
||||
case ARROW:
|
||||
case COMMA:
|
||||
case DELETE:
|
||||
|
@ -390,7 +395,7 @@ class BuiltinOperators {
|
|||
for (IType t1 : p1) {
|
||||
for (IType t2 : p2) {
|
||||
IType rt= null;
|
||||
switch(rstrat) {
|
||||
switch (rstrat) {
|
||||
case USE_BOOL:
|
||||
rt= CPPBasicType.BOOLEAN;
|
||||
break;
|
||||
|
@ -491,7 +496,7 @@ class BuiltinOperators {
|
|||
if (refType instanceof ICPPReferenceType) {
|
||||
IType t= SemanticUtil.getNestedType(((ICPPReferenceType) refType).getType(), TDEF);
|
||||
if (!SemanticUtil.getCVQualifier(t).isConst()) {
|
||||
switch(assign) {
|
||||
switch (assign) {
|
||||
case WITHOUT_OPERATION:
|
||||
if (isEnumeration(t) || isPointerToMember(t) || isPointer(t)) {
|
||||
addFunction(refType, refType, SemanticUtil.getNestedType(t, TDEF|ALLCVQ));
|
||||
|
@ -592,7 +597,7 @@ class BuiltinOperators {
|
|||
private boolean isFloatingPoint(IType type) {
|
||||
if (type instanceof IBasicType) {
|
||||
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
||||
switch(kind) {
|
||||
switch (kind) {
|
||||
case eDouble:
|
||||
case eFloat:
|
||||
return true;
|
||||
|
@ -613,7 +618,7 @@ class BuiltinOperators {
|
|||
private boolean isArithmetic(IType type) {
|
||||
if (type instanceof IBasicType) {
|
||||
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
||||
switch(kind) {
|
||||
switch (kind) {
|
||||
case eBoolean:
|
||||
case eChar:
|
||||
case eChar16:
|
||||
|
@ -634,7 +639,7 @@ class BuiltinOperators {
|
|||
private boolean isIntegral(IType type) {
|
||||
if (type instanceof IBasicType) {
|
||||
IBasicType.Kind kind= ((IBasicType) type).getKind();
|
||||
switch(kind) {
|
||||
switch (kind) {
|
||||
case eBoolean:
|
||||
case eChar:
|
||||
case eChar16:
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* IBM Corporation
|
||||
* Markus Schorn - initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.indexer;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -182,7 +180,7 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
|||
public AbstractLanguage[] getLanguages(Object tu, UnusedHeaderStrategy strat) {
|
||||
ILanguage language = fIndexer.getLanguageMapper().getLanguage(tu.toString());
|
||||
if (language instanceof AbstractLanguage) {
|
||||
return new AbstractLanguage[] {(AbstractLanguage) language};
|
||||
return new AbstractLanguage[] { (AbstractLanguage) language };
|
||||
}
|
||||
return new AbstractLanguage[0];
|
||||
}
|
||||
|
@ -199,5 +197,4 @@ public class StandaloneIndexerInputAdapter extends IndexerInputAdapter {
|
|||
public boolean isCaseInsensitiveFileSystem() {
|
||||
return new File("a").equals(new File("A"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* IBM Corporation
|
||||
* Markus Schorn - initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.indexer;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -104,7 +103,6 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
|
|||
protected final IWritableIndex createIndex() {
|
||||
return fIndexer.getIndex();
|
||||
}
|
||||
|
||||
|
||||
public final void run(IProgressMonitor monitor) throws InterruptedException {
|
||||
long start = System.currentTimeMillis();
|
||||
|
@ -160,33 +158,22 @@ 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) {
|
||||
switch (kind) {
|
||||
case parsingFileTask:
|
||||
return MessageFormat.format("parsing {0} ({1})", arguments); //$NON-NLS-1$
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
|
@ -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.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||
|
||||
|
|
|
@ -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