1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-08-08 15:08:33 -07:00
parent 9e00dad206
commit dd039973ae
7 changed files with 424 additions and 467 deletions

View file

@ -25,8 +25,8 @@ public interface ICPPClassScope extends ICPPScope {
/** /**
* Returns an array of methods that were implicitly added to this class * Returns an array of methods that were implicitly added to this class
* scope. These methods may or may not have been explicitly declared in the * scope. These methods may or may not have been explicitly declared in
* code. The methods that will be implicitly declared are: the default * the code. The methods that will be implicitly declared are: the default
* constructor, copy constructor, copy assignment operator, and destructor * constructor, copy constructor, copy assignment operator, and destructor
*/ */
public ICPPMethod[] getImplicitMethods(); public ICPPMethod[] getImplicitMethods();

View file

@ -19,8 +19,7 @@ import java.util.Map;
*/ */
public interface IScannerInfo { public interface IScannerInfo {
/** /**
* Returns a <code>Map</code> containing all the defined preprocessor * Returns a {@link Map} containing all the defined preprocessor symbols and their values.
* symbols and their values.
* Symbols defined without values have an empty string for a value. For * Symbols defined without values have an empty string for a value. For
* example, -Dsymbol=value would have a map entry (symbol, value). A symbol * example, -Dsymbol=value would have a map entry (symbol, value). A symbol
* defined as -Dsymbol= would have a map entry of (symbol, ""). * defined as -Dsymbol= would have a map entry of (symbol, "").
@ -41,9 +40,10 @@ public interface IScannerInfo {
* <br> E.g.: /System/Library/Frameworks/__framework__.framework/Headers/__header__, * <br> E.g.: /System/Library/Frameworks/__framework__.framework/Headers/__header__,
* /System/Library/Frameworks/__framework__.framework/PrivateHeaders/__header__ * /System/Library/Frameworks/__framework__.framework/PrivateHeaders/__header__
* would handle the framework search for '/System/Library/Frameworks' * would handle the framework search for '/System/Library/Frameworks'
* <br> The variables are handled only, if a search path element makes use of both of the variables. * <br> The variables are handled only, if a search path element makes use of both of
* The __framework__ variable will receive the first segment of the include, the __header__ variable * the variables. The __framework__ variable will receive the first segment of the include,
* the rest. Such a search path element is not used for directives with a single segment (e.g. 'header.h') * the __header__ variable the rest. Such a search path element is not used for directives
* with a single segment (e.g. 'header.h')
*/ */
public String[] getIncludePaths(); public String[] getIncludePaths();
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; package org.eclipse.cdt.core.parser;
import org.eclipse.cdt.core.parser.util.CharArrayUtils; import org.eclipse.cdt.core.parser.util.CharArrayUtils;

View file

@ -40,8 +40,8 @@ import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent;
* C++-specific implementation of a translation-unit. * C++-specific implementation of a translation-unit.
*/ */
public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPASTTranslationUnit, IASTAmbiguityParent { public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPASTTranslationUnit, IASTAmbiguityParent {
private CPPNamespaceScope fScope = null; private CPPNamespaceScope fScope;
private ICPPNamespace fBinding = null; private ICPPNamespace fBinding;
private final CPPScopeMapper fScopeMapper= new CPPScopeMapper(this); private final CPPScopeMapper fScopeMapper= new CPPScopeMapper(this);
public CPPASTTranslationUnit() { public CPPASTTranslationUnit() {

View file

@ -165,7 +165,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private final IIndex index; private final IIndex index;
protected ICPPASTTranslationUnit translationUnit; protected ICPPASTTranslationUnit translationUnit;
private int functionBodyCount= 0; private int functionBodyCount;
private char[] currentClassName; private char[] currentClassName;
private final ICPPNodeFactory nodeFactory; private final ICPPNodeFactory nodeFactory;
@ -218,7 +218,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTName ambiguousQualifiedName(CastExprCtx ctx) throws BacktrackException, EndOfFileException { private IASTName ambiguousQualifiedName(CastExprCtx ctx) throws BacktrackException, EndOfFileException {
TemplateIdStrategy strat= new TemplateIdStrategy(); TemplateIdStrategy strat= new TemplateIdStrategy();
IToken m= mark(); IToken m= mark();
for(;;) { while (true) {
try { try {
return qualifiedName(ctx, strat); return qualifiedName(ctx, strat);
} catch (BacktrackException e) { } catch (BacktrackException e) {
@ -250,7 +250,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
boolean mustBeLast= false; boolean mustBeLast= false;
boolean haveName= false; boolean haveName= false;
loop: for(;;) { loop: while (true) {
boolean keywordTemplate= false; boolean keywordTemplate= false;
if (qname != null && LT(1) == IToken.t_template) { if (qname != null && LT(1) == IToken.t_template) {
consume(); consume();
@ -1011,7 +1011,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
final IToken mark= mark(); final IToken mark= mark();
IToken lastToken= null; IToken lastToken= null;
for(;;) { while (true) {
try { try {
IASTExpression e = castExpression(CastExprCtx.eDirectlyInBExpr, strat); IASTExpression e = castExpression(CastExprCtx.eDirectlyInBExpr, strat);
if (variants == null) { if (variants == null) {
@ -1045,7 +1045,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return variants != null ? variants : singleExpression; return variants != null ? variants : singleExpression;
} }
@Override @Override
protected IASTExpression buildBinaryExpression(int operator, IASTExpression expr1, IASTInitializerClause expr2, int lastOffset) { protected IASTExpression buildBinaryExpression(int operator, IASTExpression expr1, IASTInitializerClause expr2, int lastOffset) {
IASTBinaryExpression result = nodeFactory.newBinaryExpression(operator, expr1, expr2); IASTBinaryExpression result = nodeFactory.newBinaryExpression(operator, expr1, expr2);
@ -1063,8 +1062,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
backup(throwToken); backup(throwToken);
consume(); consume();
} }
int o = throwExpression != null ? calculateEndOffset(throwExpression) int o = throwExpression != null ?
: throwToken.getEndOffset(); calculateEndOffset(throwExpression) : throwToken.getEndOffset();
return buildUnaryExpression(ICPPASTUnaryExpression.op_throw, return buildUnaryExpression(ICPPASTUnaryExpression.op_throw,
throwExpression, throwToken.getOffset(), o); // fix for 95225 throwExpression, throwToken.getOffset(), o); // fix for 95225
} }
@ -1095,7 +1094,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return deleteExpression; return deleteExpression;
} }
/** /**
* Parse a new-expression. There is room for ambiguities. With P for placement, T for typeid, * Parse a new-expression. There is room for ambiguities. With P for placement, T for typeid,
* and I for initializer the potential patterns (with the new omitted) are: * and I for initializer the potential patterns (with the new omitted) are:
@ -1190,7 +1188,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
endOffset2= -1; endOffset2= -1;
} }
if (plcmt == null || endOffset2 > endOffset) if (plcmt == null || endOffset2 > endOffset)
return newExpression(isGlobal, null, typeid2, false, init2, offset, endOffset2); return newExpression(isGlobal, null, typeid2, false, init2, offset, endOffset2);
@ -1222,7 +1219,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return newExpression(isGlobal, null, typeid, true, init, offset, endOffset); return newExpression(isGlobal, null, typeid, true, init, offset, endOffset);
} }
private IASTExpression newExpression(boolean isGlobal, List<IASTInitializerClause> plcmt, IASTTypeId typeid, private IASTExpression newExpression(boolean isGlobal, List<IASTInitializerClause> plcmt, IASTTypeId typeid,
boolean isNewTypeId, IASTInitializer init, int offset, int endOffset) { boolean isNewTypeId, IASTInitializer init, int offset, int endOffset) {
@ -1237,7 +1233,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result; return result;
} }
@Override @Override
protected IASTExpression unaryExpression(CastExprCtx ctx, ITemplateIdStrategy strat) throws EndOfFileException, BacktrackException { protected IASTExpression unaryExpression(CastExprCtx ctx, ITemplateIdStrategy strat) throws EndOfFileException, BacktrackException {
switch (LT(1)) { switch (LT(1)) {
@ -1618,7 +1613,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return new CPPASTAmbiguousTemplateArgument(); return new CPPASTAmbiguousTemplateArgument();
} }
private IASTExpression simpleTypeConstructorExpression(ICPPASTDeclSpecifier declSpec) throws EndOfFileException, BacktrackException { private IASTExpression simpleTypeConstructorExpression(ICPPASTDeclSpecifier declSpec) throws EndOfFileException, BacktrackException {
IASTInitializer initializer = bracedOrCtorStyleInitializer(); IASTInitializer initializer = bracedOrCtorStyleInitializer();
ICPPASTSimpleTypeConstructorExpression result = nodeFactory.newSimpleTypeConstructorExpression( ICPPASTSimpleTypeConstructorExpression result = nodeFactory.newSimpleTypeConstructorExpression(
@ -1744,7 +1738,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} }
break; break;
} }
loop: for(;;) { loop: while (true) {
switch (LT(1)) { switch (LT(1)) {
case IToken.tEOC: case IToken.tEOC:
return setRange(lambdaExpr, offset, LA().getEndOffset()); return setRange(lambdaExpr, offset, LA().getEndOffset());
@ -1907,7 +1901,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result; return result;
} }
/** /**
* static_assert-declaration: * static_assert-declaration:
static_assert ( constant-expression , string-literal ) ; static_assert ( constant-expression , string-literal ) ;
@ -1953,7 +1946,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return linkage; return linkage;
} }
/** /**
* Represents the amalgamation of template declarations, template * Represents the amalgamation of template declarations, template
* instantiations and specializations in the ANSI C++ grammar. * instantiations and specializations in the ANSI C++ grammar.
@ -2046,7 +2038,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
try { try {
List<ICPPASTTemplateParameter> result = new ArrayList<ICPPASTTemplateParameter>(DEFAULT_PARM_LIST_SIZE); List<ICPPASTTemplateParameter> result = new ArrayList<ICPPASTTemplateParameter>(DEFAULT_PARM_LIST_SIZE);
IToken m= mark(); IToken m= mark();
for(;;) { while (true) {
try { try {
return templateParameterList(result); return templateParameterList(result);
} catch (BacktrackException e) { } catch (BacktrackException e) {
@ -2173,7 +2165,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return parameterDeclaration(); return parameterDeclaration();
} }
/** /**
* The most abstract construct within a translationUnit : a declaration. * The most abstract construct within a translationUnit : a declaration.
* declaration : {"asm"} asmDefinition | {"namespace"} namespaceDefinition | * declaration : {"asm"} asmDefinition | {"namespace"} namespaceDefinition |
@ -2462,7 +2453,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (!(dtor instanceof ICPPASTFunctionDeclarator)) if (!(dtor instanceof ICPPASTFunctionDeclarator))
throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset); throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);
ICPPASTFunctionDefinition fdef; ICPPASTFunctionDefinition fdef;
if (LT(1) == IToken.t_try) { if (LT(1) == IToken.t_try) {
consume(); consume();
@ -2535,7 +2525,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/ */
protected void ctorInitializer(ICPPASTFunctionDefinition fdef) throws EndOfFileException, BacktrackException { protected void ctorInitializer(ICPPASTFunctionDefinition fdef) throws EndOfFileException, BacktrackException {
consume(IToken.tCOLON); consume(IToken.tCOLON);
loop: for(;;) { loop: while (true) {
final int offset= LA(1).getOffset(); final int offset= LA(1).getOffset();
final IASTName name = qualifiedName(); final IASTName name = qualifiedName();
final IASTInitializer init; final IASTInitializer init;
@ -2592,14 +2582,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return parm; return parm;
} }
private final static int INLINE= 0x1, CONST= 0x2, CONSTEXPR= 0x4, RESTRICT= 0x8, VOLATILE= 0x10, private final static int INLINE= 0x1, CONST= 0x2, CONSTEXPR= 0x4, RESTRICT= 0x8, VOLATILE= 0x10,
SHORT= 0x20, UNSIGNED= 0x40, SIGNED= 0x80, COMPLEX= 0x100, IMAGINARY= 0x200, SHORT= 0x20, UNSIGNED= 0x40, SIGNED= 0x80, COMPLEX= 0x100, IMAGINARY= 0x200,
VIRTUAL= 0x400, EXPLICIT= 0x800, FRIEND= 0x1000, THREAD_LOCAL= 0x2000; VIRTUAL= 0x400, EXPLICIT= 0x800, FRIEND= 0x1000, THREAD_LOCAL= 0x2000;
private static final int FORBID_IN_EMPTY_DECLSPEC = private static final int FORBID_IN_EMPTY_DECLSPEC =
CONST | RESTRICT | VOLATILE | SHORT | UNSIGNED | SIGNED | COMPLEX | IMAGINARY | FRIEND | THREAD_LOCAL; CONST | RESTRICT | VOLATILE | SHORT | UNSIGNED | SIGNED | COMPLEX | IMAGINARY | FRIEND | THREAD_LOCAL;
/** /**
* This function parses a declaration specifier sequence, as according to * This function parses a declaration specifier sequence, as according to
* the ANSI C++ specification. * the ANSI C++ specification.
@ -3226,7 +3214,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (name instanceof ICPPASTConversionName) if (name instanceof ICPPASTConversionName)
return; return;
if (opt == DeclarationOptions.CPP_MEMBER) { if (opt == DeclarationOptions.CPP_MEMBER) {
// Accept constructor and destructor within class body // Accept constructor and destructor within class body
final char[] nchars= name.getLookupKey(); final char[] nchars= name.getLookupKey();
@ -3467,10 +3454,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/ */
private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException, private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException,
BacktrackException { BacktrackException {
List<IASTInitializerClause> result= null; List<IASTInitializerClause> result= null;
// List of initializer clauses // List of initializer clauses
loop: for(;;) { loop: while (true) {
// Clause may be null, add to initializer anyways, such that the size can be computed. // Clause may be null, add to initializer anyways, such that the size can be computed.
IASTInitializerClause clause = initClause(allowSkipping); IASTInitializerClause clause = initClause(allowSkipping);
if (LT(1) == IToken.tELLIPSIS) { if (LT(1) == IToken.tELLIPSIS) {
@ -3986,7 +3972,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return d; return d;
} }
/** /**
* Parses for a bit field declarator starting with the colon * Parses for a bit field declarator starting with the colon
*/ */
@ -4223,7 +4208,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return decl; return decl;
} }
protected IASTStatement catchBlockCompoundStatement() throws BacktrackException, EndOfFileException { protected IASTStatement catchBlockCompoundStatement() throws BacktrackException, EndOfFileException {
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) { if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
int offset = LA(1).getOffset(); int offset = LA(1).getOffset();
@ -4248,8 +4232,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
translationUnit = nodeFactory.newTranslationUnit(scanner); translationUnit = nodeFactory.newTranslationUnit(scanner);
translationUnit.setIndex(index); translationUnit.setIndex(index);
// add built-in names to the scope // Add built-in names to the scope.
// add built-in names to the scope
if (builtinBindingsProvider != null) { if (builtinBindingsProvider != null) {
IScope tuScope = translationUnit.getScope(); IScope tuScope = translationUnit.getScope();
@ -4260,7 +4243,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} }
} }
private void consumeArrayModifiers(DeclarationOptions option, List<IASTArrayModifier> collection) private void consumeArrayModifiers(DeclarationOptions option, List<IASTArrayModifier> collection)
throws EndOfFileException, BacktrackException { throws EndOfFileException, BacktrackException {
boolean allowExpression= option == DeclarationOptions.TYPEID_NEW; boolean allowExpression= option == DeclarationOptions.TYPEID_NEW;
@ -4288,7 +4270,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return; return;
} }
@Override @Override
protected IASTTranslationUnit getTranslationUnit() { protected IASTTranslationUnit getTranslationUnit() {
return translationUnit; return translationUnit;
@ -4362,7 +4343,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
translationUnit = null; translationUnit = null;
} }
@Override @Override
protected IASTStatement parseWhileStatement() throws EndOfFileException, BacktrackException { protected IASTStatement parseWhileStatement() throws EndOfFileException, BacktrackException {
int startOffset = consume().getOffset(); int startOffset = consume().getOffset();
@ -4422,7 +4402,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (end == null) if (end == null)
return e; return e;
final int endOffset = end.getOffset(); final int endOffset = end.getOffset();
final int endOffset2 = end2.getOffset(); final int endOffset2 = end2.getOffset();
if (endOffset == endOffset2) { if (endOffset == endOffset2) {
@ -4446,7 +4425,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return decl; return decl;
} }
@Override @Override
protected ASTVisitor createAmbiguityNodeVisitor() { protected ASTVisitor createAmbiguityNodeVisitor() {
return new CPPASTAmbiguityResolver(); return new CPPASTAmbiguityResolver();
@ -4481,7 +4459,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} }
consume(IToken.tRPAREN); consume(IToken.tRPAREN);
IASTStatement thenClause = statement(); IASTStatement thenClause = statement();
ICPPASTIfStatement new_if_statement = nodeFactory.newIfStatement(); ICPPASTIfStatement new_if_statement = nodeFactory.newIfStatement();
((ASTNode) new_if_statement).setOffset(so); ((ASTNode) new_if_statement).setOffset(so);
@ -4545,7 +4522,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result; return result;
} }
@Override @Override
protected IASTCompoundStatement functionBody() throws EndOfFileException, BacktrackException { protected IASTCompoundStatement functionBody() throws EndOfFileException, BacktrackException {
++functionBodyCount; ++functionBodyCount;

View file

@ -95,7 +95,6 @@ import com.ibm.icu.text.MessageFormat;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class CCorePlugin extends Plugin { public class CCorePlugin extends Plugin {
public static final int STATUS_CDTPROJECT_EXISTS = 1; public static final int STATUS_CDTPROJECT_EXISTS = 1;
public static final int STATUS_CDTPROJECT_MISMATCH = 2; public static final int STATUS_CDTPROJECT_MISMATCH = 2;
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3; public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
@ -299,7 +298,6 @@ public class CCorePlugin extends Plugin {
return fgCPlugin; return fgCPlugin;
} }
/** /**
* @see Plugin#shutdown * @see Plugin#shutdown
*/ */
@ -510,7 +508,6 @@ public class CCorePlugin extends Plugin {
getDefault().savePluginPreferences(); getDefault().savePluginPreferences();
} }
/** /**
* Create CDT console adapter for build console defined as an extension. * Create CDT console adapter for build console defined as an extension.
* See {@code org.eclipse.cdt.core.CBuildConsole} extension point. * See {@code org.eclipse.cdt.core.CBuildConsole} extension point.
@ -899,7 +896,6 @@ public class CCorePlugin extends Plugin {
* @param monitor * @param monitor
* @throws CoreException * @throws CoreException
*/ */
public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException { public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
if ((projectHandle != null) if ((projectHandle != null)
&& projectHandle.hasNature(CProjectNature.C_NATURE_ID) && projectHandle.hasNature(CProjectNature.C_NATURE_ID)
@ -990,7 +986,6 @@ public class CCorePlugin extends Plugin {
} }
} }
return null; return null;
} }
/** /**
@ -1117,8 +1112,6 @@ public class CCorePlugin extends Plugin {
CContentTypes.setUseProjectSpecificContentTypes(project, val); CContentTypes.setUseProjectSpecificContentTypes(project, val);
} }
private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$ private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$
private static final String PARSER = CCorePlugin.PLUGIN_ID + "/debug/parser" ; //$NON-NLS-1$ private static final String PARSER = CCorePlugin.PLUGIN_ID + "/debug/parser" ; //$NON-NLS-1$
private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$ private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$
@ -1130,7 +1123,6 @@ public class CCorePlugin extends Plugin {
* Configure the plug-in with respect to option settings defined in ".options" file * Configure the plug-in with respect to option settings defined in ".options" file
*/ */
public void configurePluginDebugOptions() { public void configurePluginDebugOptions() {
if (CCorePlugin.getDefault().isDebugging()) { if (CCorePlugin.getDefault().isDebugging()) {
String option = Platform.getDebugOption(PARSER); String option = Platform.getDebugOption(PARSER);
if (option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ if (option != null) Util.VERBOSE_PARSER = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
@ -1146,11 +1138,10 @@ public class CCorePlugin extends Plugin {
option = Platform.getDebugOption(DELTA); option = Platform.getDebugOption(DELTA);
if (option != null) Util.VERBOSE_DELTA= option.equalsIgnoreCase("true") ; //$NON-NLS-1$ if (option != null) Util.VERBOSE_DELTA= option.equalsIgnoreCase("true") ; //$NON-NLS-1$
} }
} }
// Preference to turn on/off the use of structural parse mode to build the CModel // Preference to turn on/off the use of structural parse mode to build the CModel.
public void setStructuralParseMode(boolean useNewParser) { public void setStructuralParseMode(boolean useNewParser) {
getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser); getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser);
savePluginPreferences(); savePluginPreferences();

View file

@ -52,13 +52,10 @@ import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI; import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
public class OverrideIndicatorManager implements ICReconcilingListener { public class OverrideIndicatorManager implements ICReconcilingListener {
static final String ANNOTATION_TYPE = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$ static final String ANNOTATION_TYPE = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
private static final String MESSAGE_SEPARATOR = ";\n"; //$NON-NLS-1$ private static final String MESSAGE_SEPARATOR = ";\n"; //$NON-NLS-1$
public static class OverrideInfo { public static class OverrideInfo {
public int nodeOffset; public int nodeOffset;
public int resultType; public int resultType;
public String message; public String message;
@ -79,7 +76,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
public static final int RESULT_SHADOWS = 2; public static final int RESULT_SHADOWS = 2;
public class OverrideIndicator extends Annotation { public class OverrideIndicator extends Annotation {
public static final String ANNOTATION_TYPE_ID = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$ public static final String ANNOTATION_TYPE_ID = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
private int type; private int type;
private ICElementHandle declaration; private ICElementHandle declaration;
@ -108,9 +104,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
CDTUITools.openInEditor(declaration, true, true); CDTUITools.openInEditor(declaration, true, true);
} catch (CoreException e) { } catch (CoreException e) {
} }
} }
} }
private IAnnotationModel fAnnotationModel; private IAnnotationModel fAnnotationModel;
@ -123,7 +117,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
} }
private void handleResult(OverrideInfo info, IIndex index) { private void handleResult(OverrideInfo info, IIndex index) {
Position position = new Position(info.nodeOffset, info.nodeLength); Position position = new Position(info.nodeOffset, info.nodeLength);
OverrideIndicator indicator = new OverrideIndicator(info.resultType, info.message, info.binding, index); OverrideIndicator indicator = new OverrideIndicator(info.resultType, info.message, info.binding, index);
@ -166,7 +159,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
} }
if (binding instanceof ICPPMethod) { if (binding instanceof ICPPMethod) {
method = (ICPPMethod) binding; method = (ICPPMethod) binding;
OverrideInfo overrideInfo = testForOverride(method, declaration.getFileLocation()); OverrideInfo overrideInfo = checkForOverride(method, declaration);
if (overrideInfo != null) { if (overrideInfo != null) {
handleResult(overrideInfo, index); handleResult(overrideInfo, index);
} }
@ -209,7 +202,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return PROCESS_SKIP; return PROCESS_SKIP;
} }
ICPPMethod method = (ICPPMethod) definitionBinding; ICPPMethod method = (ICPPMethod) definitionBinding;
OverrideInfo overrideInfo = testForOverride(method, definition.getFileLocation()); OverrideInfo overrideInfo = checkForOverride(method, definition);
if (overrideInfo != null) { if (overrideInfo != null) {
handleResult(overrideInfo, index); handleResult(overrideInfo, index);
} }
@ -223,8 +216,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
ast.accept(new MethodDefinitionFinder()); ast.accept(new MethodDefinitionFinder());
} }
public static OverrideInfo testForOverride(ICPPMethod testedOverride, IASTFileLocation location) throws DOMException { private static OverrideInfo checkForOverride(ICPPMethod testedOverride, IASTNode node) throws DOMException {
IASTFileLocation location = node.getFileLocation();
testedOverride.getClassOwner().getBases(); testedOverride.getClassOwner().getBases();
boolean onlyPureVirtual = true; boolean onlyPureVirtual = true;
@ -301,7 +294,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return info; return info;
} }
return null; return null;
} }
/** /**
@ -314,8 +306,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
* @throws DOMException * @throws DOMException
*/ */
private static void handleBaseClass(ICPPClassType aClass, ICPPMethod testedOverride, private static void handleBaseClass(ICPPClassType aClass, ICPPMethod testedOverride,
Set<ICPPMethod> foundMethods, Set<ICPPMethod> shadowedMethods, Set<ICPPClassType> alreadyTestedBases) throws DOMException { Set<ICPPMethod> foundMethods, Set<ICPPMethod> shadowedMethods,
Set<ICPPClassType> alreadyTestedBases) throws DOMException {
if (alreadyTestedBases.contains(aClass)) { if (alreadyTestedBases.contains(aClass)) {
return; return;
} else { } else {
@ -427,5 +419,4 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
} }
return annotationModel; return annotationModel;
} }
} }