diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassScope.java
index ef7b553a89c..fbe1ea328e0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassScope.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Andrew Niefer (IBM Corporation) - initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * Contributors:
+ * Andrew Niefer (IBM Corporation) - initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp;
@@ -25,8 +25,8 @@ public interface ICPPClassScope extends ICPPScope {
/**
* 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
- * code. The methods that will be implicitly declared are: the default
+ * scope. These methods may or may not have been explicitly declared in
+ * the code. The methods that will be implicitly declared are: the default
* constructor, copy constructor, copy assignment operator, and destructor
*/
public ICPPMethod[] getImplicitMethods();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfo.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfo.java
index 2ae00659169..2ae97cfd6e1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfo.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfo.java
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * IBM Rational Software - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.parser;
@@ -19,11 +19,10 @@ import java.util.Map;
*/
public interface IScannerInfo {
/**
- * Returns a Map
containing all the defined preprocessor
- * symbols and their values.
+ * Returns a {@link Map} containing all the defined preprocessor symbols and their values.
* Symbols defined without values have an empty string for a value. For
- * example,-Dsymbol=value would have a map entry (symbol,value). A symbol
- * defined as -Dsymbol= would have a map entry of (symbol,"").
+ * example, -Dsymbol=value would have a map entry (symbol, value). A symbol
+ * defined as -Dsymbol= would have a map entry of (symbol, "").
*/
public Map getDefinedSymbols();
@@ -41,9 +40,10 @@ public interface IScannerInfo {
*
E.g.: /System/Library/Frameworks/__framework__.framework/Headers/__header__,
* /System/Library/Frameworks/__framework__.framework/PrivateHeaders/__header__
* would handle the framework search for '/System/Library/Frameworks'
- *
The variables are handled only, if a search path element makes use of both of the variables.
- * The __framework__ variable will receive the first segment of the include, the __header__ variable
- * the rest. Such a search path element is not used for directives with a single segment (e.g. 'header.h')
+ *
The variables are handled only, if a search path element makes use of both of
+ * the variables. The __framework__ variable will receive the first segment of the include,
+ * 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();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISignificantMacros.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISignificantMacros.java
index e4182f46133..f231a2f82fe 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISignificantMacros.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISignificantMacros.java
@@ -6,9 +6,8 @@
* 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.core.parser;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
index 801741e72df..1759cb2165e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * IBM - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -40,8 +40,8 @@ import org.eclipse.cdt.internal.core.parser.scanner.InternalFileContent;
* C++-specific implementation of a translation-unit.
*/
public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPASTTranslationUnit, IASTAmbiguityParent {
- private CPPNamespaceScope fScope = null;
- private ICPPNamespace fBinding = null;
+ private CPPNamespaceScope fScope;
+ private ICPPNamespace fBinding;
private final CPPScopeMapper fScopeMapper= new CPPScopeMapper(this);
public CPPASTTranslationUnit() {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index e4634d81fb0..b43368d784f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -165,12 +165,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private final IIndex index;
protected ICPPASTTranslationUnit translationUnit;
- private int functionBodyCount= 0;
+ private int functionBodyCount;
private char[] currentClassName;
private final ICPPNodeFactory nodeFactory;
private TemplateIdStrategy fTemplateParameterListStrategy;
-
+
public GNUCPPSourceParser(IScanner scanner, ParserMode mode,
IParserLogService log, ICPPParserExtensionConfiguration config) {
this(scanner, mode, log, config, null);
@@ -181,10 +181,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IIndex index) {
super(scanner, log, mode, CPPNodeFactory.getDefault(),
config.supportStatementsInExpressions(),
- config.supportTypeofUnaryExpressions(),
- config.supportAlignOfUnaryExpression(),
+ config.supportTypeofUnaryExpressions(),
+ config.supportAlignOfUnaryExpression(),
config.supportKnRC(),
- config.supportAttributeSpecifiers(),
+ config.supportAttributeSpecifiers(),
config.supportDeclspecSpecifiers(),
config.getBuiltinBindingsProvider());
allowCPPRestrict = config.allowRestrictPointerOperators();
@@ -210,7 +210,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throw backtrack;
}
-
+
private IASTName qualifiedName() throws BacktrackException, EndOfFileException {
return ambiguousQualifiedName(CastExprCtx.eNotInBExpr);
}
@@ -218,7 +218,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTName ambiguousQualifiedName(CastExprCtx ctx) throws BacktrackException, EndOfFileException {
TemplateIdStrategy strat= new TemplateIdStrategy();
IToken m= mark();
- for(;;) {
+ while (true) {
try {
return qualifiedName(ctx, strat);
} catch (BacktrackException e) {
@@ -237,7 +237,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTName qualifiedName(CastExprCtx ctx, ITemplateIdStrategy strat) throws BacktrackException, EndOfFileException {
if (strat == null)
return ambiguousQualifiedName(ctx);
-
+
ICPPASTQualifiedName qname= null;
IASTName name= null;
final int offset= LA(1).getOffset();
@@ -250,9 +250,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
boolean mustBeLast= false;
boolean haveName= false;
- loop: for(;;) {
+ loop: while (true) {
boolean keywordTemplate= false;
- if (qname != null && LT(1) == IToken.t_template) {
+ if (qname != null && LT(1) == IToken.t_template) {
consume();
keywordTemplate= true;
}
@@ -270,7 +270,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IToken nt= consume();
name = buildName(destructorOffset, nt);
break;
-
+
case IToken.t_operator:
name= operatorId();
break;
@@ -287,7 +287,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
haveName= true;
-
+
// Check for template-id
if (LTcatchEOF(1) == IToken.tLT) {
final boolean inBinaryExpression = ctx != CastExprCtx.eNotInBExpr;
@@ -303,7 +303,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (templateID) {
if (haveArgs == -1)
throwBacktrack(LA(1));
-
+
name= addTemplateArguments(name, strat);
}
}
@@ -362,7 +362,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IToken end= LA(1);
switch (end.getType()) {
case IToken.tGT_in_SHIFTR:
- case IToken.tGT:
+ case IToken.tGT:
consume();
break;
case IToken.tEOC:
@@ -389,7 +389,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
/**
- * Makes a fast check whether there could be template arguments.
+ * Makes a fast check whether there could be template arguments.
* -1: no, 0: ambiguous, 1: yes
*/
private static final int NO_TEMPLATE_ID= -1;
@@ -409,53 +409,53 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tEOC:
case IToken.tCOMPLETION:
return AMBIGUOUS_TEMPLATE_ID;
-
+
case IToken.tLT:
if (nk == 0) {
angleDepth++;
}
break;
case IToken.tGT_in_SHIFTR:
- case IToken.tGT:
+ case IToken.tGT:
if (nk == 0) {
--angleDepth;
if (!inBinaryExpression)
return angleDepth == 0 ? TEMPLATE_ID : AMBIGUOUS_TEMPLATE_ID;
-
+
int end= endsTemplateIDInBinaryExpression();
if (end == NO_TEMPLATE_ID) {
if (angleDepth == 0)
return NO_TEMPLATE_ID;
} else {
return AMBIGUOUS_TEMPLATE_ID;
- }
+ }
}
break;
- case IToken.tLBRACKET:
+ case IToken.tLBRACKET:
if (nk == 0) {
nk= IToken.tLBRACKET;
depth= 0;
} else if (nk == IToken.tLBRACKET) {
depth++;
- }
+ }
break;
- case IToken.tRBRACKET:
+ case IToken.tRBRACKET:
if (nk == IToken.tLBRACKET) {
if (--depth < 0) {
nk= 0;
}
}
break;
- case IToken.tLPAREN:
+ case IToken.tLPAREN:
if (nk == 0) {
nk= IToken.tLPAREN;
depth= 0;
} else if (nk == IToken.tLPAREN) {
depth++;
- }
+ }
break;
- case IToken.tRPAREN:
+ case IToken.tRPAREN:
if (nk == IToken.tLPAREN) {
if (--depth < 0) {
nk= 0;
@@ -476,9 +476,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
backup(mark);
}
}
-
+
/**
- * If '>' is followed by an expression, then it denotes the binary operator,
+ * If '>' is followed by an expression, then it denotes the binary operator,
* else it is the end of a template-id, or special-cast.
*/
private int endsTemplateIDInBinaryExpression() {
@@ -493,10 +493,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return AMBIGUOUS_TEMPLATE_ID;
// Start of unary expression
- case IToken.tMINUS:
- case IToken.tPLUS:
- case IToken.tAMPER:
- case IToken.tSTAR:
+ case IToken.tMINUS:
+ case IToken.tPLUS:
+ case IToken.tAMPER:
+ case IToken.tSTAR:
case IToken.tNOT:
case IToken.tBITCOMPLEMENT:
case IToken.tINCR:
@@ -506,7 +506,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.t_sizeof:
case IGCCToken.t___alignof__:
return NO_TEMPLATE_ID;
-
+
// Start of a postfix expression
case IToken.t_typename:
case IToken.t_char:
@@ -527,7 +527,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.t_const_cast:
case IToken.t_typeid:
return NO_TEMPLATE_ID;
-
+
// Start of a primary expression
case IToken.tINTEGER:
case IToken.tFLOATINGPT:
@@ -546,7 +546,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.t_operator:
case IToken.tCOMPLETION:
return NO_TEMPLATE_ID;
-
+
// Tokens that end an expression
case IToken.tSEMI:
case IToken.tCOMMA:
@@ -565,8 +565,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tGT_in_SHIFTR:
case IToken.tEQUAL:
return TEMPLATE_ID;
-
- default:
+
+ default:
return AMBIGUOUS_TEMPLATE_ID;
}
}
@@ -587,7 +587,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} else {
needComma= true;
}
-
+
IASTNode node= templateArgument(strat);
if (list == null) {
list= new ArrayList();
@@ -616,7 +616,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|| lt1 == IToken.tEOC || lt1 == IToken.tELLIPSIS)) {
// This is potentially a type-id, now check ambiguity with id-expression
IASTDeclSpecifier declspec= typeId.getDeclSpecifier();
- if (declspec instanceof IASTNamedTypeSpecifier) {
+ if (declspec instanceof IASTNamedTypeSpecifier) {
final IASTNamedTypeSpecifier namedDeclspec = (IASTNamedTypeSpecifier) declspec;
IASTName name= namedDeclspec.getName();
if (name.contains(typeId)) {
@@ -652,7 +652,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
return typeId;
}
-
+
// Not a type-id, parse as expression
backup(argStart);
IASTExpression expr= expression(ExprKind.eAssignment, BinaryExprCtx.eInTemplateID, null, strat);
@@ -682,12 +682,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
switch (lt1) {
case IToken.tLPAREN:
op = OverloadableOperator.PAREN; // operator ()
- consume();
+ consume();
endOffset = consume(IToken.tRPAREN).getEndOffset();
break;
case IToken.tLBRACKET:
op = OverloadableOperator.BRACKET; // operator []
- consume();
+ consume();
endOffset = consume(IToken.tRBRACKET).getEndOffset();
break;
case IToken.t_new:
@@ -714,8 +714,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
endOffset= consume().getEndOffset();
}
break;
- }
-
+ }
+
if (op != null) {
IASTName name= nodeFactory.newOperatorName(op.toCharArray());
setRange(name, firstToken.getOffset(), endOffset);
@@ -750,17 +750,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTExpression expression(final ExprKind kind, final BinaryExprCtx ctx, IASTInitializerClause expr, ITemplateIdStrategy strat) throws EndOfFileException, BacktrackException {
final boolean allowComma= kind==ExprKind.eExpression;
boolean allowAssignment= kind !=ExprKind.eConstant;
-
+
if (allowAssignment && LT(1) == IToken.t_throw) {
return throwExpression();
- }
+ }
final int startOffset= expr != null ? ((ASTNode) expr).getOffset() : LA(1).getOffset();
int lt1;
int conditionCount= 0;
BinaryOperator lastOperator= null;
NameOrTemplateIDVariants variants= null;
-
+
if (expr == null) {
Object e = castExpressionForBinaryExpression(strat);
if (e instanceof IASTExpression) {
@@ -780,7 +780,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
boolean allowThrow= false;
// Brace initializers are allowed on the right hand side of an expression
boolean allowBraceInitializer= false;
-
+
BacktrackException tryRecovery= null;
final int operatorOffset= LA().getOffset();
lt1= LT(1);
@@ -789,7 +789,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
conditionCount++;
// ? :
// Precedence: 25 is lower than precedence of logical or; 0 is lower than precedence of expression
- lastOperator= new BinaryOperator(lastOperator, expr, lt1, 25, 0);
+ lastOperator= new BinaryOperator(lastOperator, expr, lt1, 25, 0);
allowAssignment= true; // assignment expressions will be subsumed by the conditional expression
allowThrow= true;
break;
@@ -799,13 +799,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
doneExpression= true;
} else {
// ? :
- // Precedence: 0 is lower than precedence of expression; 15 is lower than precedence of assignment;
- lastOperator= new BinaryOperator(lastOperator, expr, lt1, 0, 15);
+ // Precedence: 0 is lower than precedence of expression; 15 is lower than precedence of assignment;
+ lastOperator= new BinaryOperator(lastOperator, expr, lt1, 0, 15);
allowAssignment= true; // assignment expressions will be subsumed by the conditional expression
allowThrow= true;
}
break;
-
+
case IToken.tCOMMA:
allowThrow= true;
if (!allowComma && conditionCount == 0) {
@@ -831,13 +831,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
doneExpression= true;
} else {
// Assignments group right to left
- lastOperator= new BinaryOperator(lastOperator, expr, lt1, 21, 20);
+ lastOperator= new BinaryOperator(lastOperator, expr, lt1, 21, 20);
allowBraceInitializer= true;
}
break;
case IToken.tOR:
- lastOperator= new BinaryOperator(lastOperator, expr, lt1, 30, 31);
+ lastOperator= new BinaryOperator(lastOperator, expr, lt1, 30, 31);
break;
case IToken.tAND:
lastOperator= new BinaryOperator(lastOperator, expr, lt1, 40, 41);
@@ -878,8 +878,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
backtrack.initialize(token.getOffset(), token.getLength());
tryRecovery= backtrack;
break;
- }
-
+ }
+
lt1= IToken.tSHIFTR; // convert back
consume(); // consume the extra token
//$FALL-THROUGH$
@@ -904,19 +904,19 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
doneExpression= true;
break;
}
-
+
if (!doneExpression && tryRecovery == null) {
consume(); // consumes the operator
-
+
// Link variants that are closed by the new operator
if (variants != null) {
variants.closeVariants(operatorOffset, lastOperator);
}
-
+
// Determine next sub-expression
if (lt1 == IToken.tQUESTION && LT(1) == IToken.tCOLON) {
// Missing sub-expression after '?' (gnu-extension)
- expr= null;
+ expr= null;
} else if (allowThrow && LT(1) == IToken.t_throw) {
// Throw expression
expr= throwExpression();
@@ -939,20 +939,20 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} else {
final Variant ae = (Variant) e;
expr= ae.getExpression();
- if (variants == null)
+ if (variants == null)
variants= new NameOrTemplateIDVariants();
-
+
variants.addBranchPoint(ae.getNext(), lastOperator, allowAssignment, conditionCount);
}
} catch (BacktrackException e) {
- if (variants == null)
+ if (variants == null)
throw e;
tryRecovery= e;
backup(m);
}
}
}
-
+
if (tryRecovery != null || doneExpression) {
if (variants != null) {
if (lt1 == IToken.tEOC) {
@@ -961,7 +961,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// Try fall-back to an open variant
Variant fallback= variants.findFallback(operatorOffset);
if (fallback == null) {
- if (tryRecovery != null)
+ if (tryRecovery != null)
throw tryRecovery;
variants.discardOpenVariants(operatorOffset);
} else {
@@ -982,7 +982,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
}
}
- }
+ }
} while (!doneExpression);
// Check for incomplete conditional expression
@@ -994,7 +994,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
setRange(result, startOffset, calculateEndOffset(expr));
return result;
}
-
+
return buildExpression(lastOperator, expr);
}
@@ -1003,15 +1003,15 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (s != null) {
return castExpression(CastExprCtx.eDirectlyInBExpr, s);
}
-
+
TemplateIdStrategy strat= new TemplateIdStrategy();
Variant variants= null;
IASTExpression singleExpression= null;
IASTName[] firstNames= null;
-
+
final IToken mark= mark();
IToken lastToken= null;
- for(;;) {
+ while (true) {
try {
IASTExpression e = castExpression(CastExprCtx.eDirectlyInBExpr, strat);
if (variants == null) {
@@ -1027,15 +1027,15 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
lastToken= LA();
if (variants != null) {
variants = new Variant(variants, e, strat.getTemplateNames(), lastToken.getOffset());
- }
+ }
if (!strat.setNextAlternative()) {
break;
}
} catch (BacktrackException e) {
if (!strat.setNextAlternative()) {
- if (lastToken == null)
+ if (lastToken == null)
throw e;
-
+
backup(lastToken);
break;
}
@@ -1045,7 +1045,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return variants != null ? variants : singleExpression;
}
-
@Override
protected IASTExpression buildBinaryExpression(int operator, IASTExpression expr1, IASTInitializerClause expr2, int lastOffset) {
IASTBinaryExpression result = nodeFactory.newBinaryExpression(operator, expr1, expr2);
@@ -1063,8 +1062,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
backup(throwToken);
consume();
}
- int o = throwExpression != null ? calculateEndOffset(throwExpression)
- : throwToken.getEndOffset();
+ int o = throwExpression != null ?
+ calculateEndOffset(throwExpression) : throwToken.getEndOffset();
return buildUnaryExpression(ICPPASTUnaryExpression.op_throw,
throwExpression, throwToken.getOffset(), o); // fix for 95225
}
@@ -1095,7 +1094,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return deleteExpression;
}
-
/**
* 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:
@@ -1126,11 +1124,11 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
try {
plcmt= expressionList();
endOffset= consumeOrEOC(IToken.tRPAREN).getEndOffset();
-
+
final int lt1= LT(1);
if (lt1 == IToken.tEOC) {
return newExpression(isGlobal, plcmt, typeid, isNewTypeId, init, offset, endOffset);
- }
+ }
if (lt1 == IToken.tLPAREN) {
// (P)(T) ...
isNewTypeId= false;
@@ -1153,8 +1151,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
int lt1= LT(1);
if (lt1 == IToken.tEOC)
return newExpression(isGlobal, plcmt, typeid, isNewTypeId, init, offset, endOffset);
-
- if (lt1 == IToken.tLPAREN || lt1 == IToken.tLBRACE) {
+
+ if (lt1 == IToken.tLPAREN || lt1 == IToken.tLBRACE) {
init= bracedOrCtorStyleInitializer();
endOffset= calculateEndOffset(init);
return newExpression(isGlobal, plcmt, typeid, isNewTypeId, init, offset, endOffset);
@@ -1169,13 +1167,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
try {
typeid2= typeId(DeclarationOptions.TYPEID);
endOffset2= consumeOrEOC(IToken.tRPAREN).getEndOffset();
-
+
final int lt1= LT(1);
- if (lt1 == IToken.tEOC)
+ if (lt1 == IToken.tEOC)
return newExpression(isGlobal, null, typeid2, false, init2, offset, endOffset2);
-
+
if (lt1 == IToken.tLPAREN || lt1 == IToken.tLBRACE) {
- if (plcmt != null &&
+ if (plcmt != null &&
ASTQueries.findTypeRelevantDeclarator(typeid2.getAbstractDeclarator()) instanceof IASTArrayDeclarator) {
throwBacktrack(LA(1));
}
@@ -1189,9 +1187,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throw e;
endOffset2= -1;
}
-
- if (plcmt == null || endOffset2 > endOffset)
+ if (plcmt == null || endOffset2 > endOffset)
return newExpression(isGlobal, null, typeid2, false, init2, offset, endOffset2);
if (endOffset != endOffset2) {
@@ -1208,9 +1205,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
((ASTNode) ambiguity).setOffsetAndLength((ASTNode) ex1);
return ambiguity;
}
-
+
// T ...
- final IASTTypeId typeid = typeId(DeclarationOptions.TYPEID_NEW);
+ final IASTTypeId typeid = typeId(DeclarationOptions.TYPEID_NEW);
int endOffset = calculateEndOffset(typeid);
IASTInitializer init= null;
final int lt1= LT(1);
@@ -1222,10 +1219,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return newExpression(isGlobal, null, typeid, true, init, offset, endOffset);
}
-
private IASTExpression newExpression(boolean isGlobal, List plcmt, IASTTypeId typeid,
boolean isNewTypeId, IASTInitializer init, int offset, int endOffset) {
-
+
IASTInitializerClause[] plcmtArray= null;
if (plcmt != null && !plcmt.isEmpty()) {
plcmtArray= plcmt.toArray(new IASTInitializerClause[plcmt.size()]);
@@ -1237,7 +1233,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result;
}
-
@Override
protected IASTExpression unaryExpression(CastExprCtx ctx, ITemplateIdStrategy strat) throws EndOfFileException, BacktrackException {
switch (LT(1)) {
@@ -1280,7 +1275,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
setRange(idexpr, id);
IASTUnaryExpression expr= nodeFactory.newUnaryExpression(IASTUnaryExpression.op_sizeofParameterPack, idexpr);
final int lt1= LT(1);
- if (lt1 == IToken.tEOC) {
+ if (lt1 == IToken.tEOC) {
setRange(expr, offset, calculateEndOffset(id));
} else {
final int endOffset = consume(IToken.tRPAREN).getEndOffset(); // )
@@ -1288,12 +1283,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
return expr;
}
- return parseTypeidInParenthesisOrUnaryExpression(false, consume().getOffset(),
+ return parseTypeidInParenthesisOrUnaryExpression(false, consume().getOffset(),
IASTTypeIdExpression.op_sizeof, IASTUnaryExpression.op_sizeof, ctx, strat);
case IGCCToken.t___alignof__:
- return parseTypeidInParenthesisOrUnaryExpression(false, consume().getOffset(),
+ return parseTypeidInParenthesisOrUnaryExpression(false, consume().getOffset(),
IASTTypeIdExpression.op_alignof, IASTUnaryExpression.op_alignOf, ctx, strat);
-
+
case IGCCToken.tTT_has_nothrow_assign:
case IGCCToken.tTT_has_nothrow_constructor:
case IGCCToken.tTT_has_nothrow_copy:
@@ -1311,7 +1306,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IGCCToken.tTT_is_polymorphic:
case IGCCToken.tTT_is_union:
return parseTypeTrait();
-
+
default:
return postfixExpression(ctx, strat);
}
@@ -1320,7 +1315,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTExpression parseTypeTrait() throws EndOfFileException, BacktrackException {
IToken first= consume();
final boolean isBinary= isBinaryTrait(first);
-
+
consume(IToken.tLPAREN);
IASTTypeId typeId= typeId(DeclarationOptions.TYPEID);
IASTTypeId secondTypeId= null;
@@ -1341,7 +1336,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
private boolean isBinaryTrait(IToken first) {
- switch(first.getType()) {
+ switch (first.getType()) {
case IGCCToken.tTT_is_base_of:
return true;
}
@@ -1349,17 +1344,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
private Operator getBinaryTypeTraitOperator(IToken first) {
- switch(first.getType()) {
+ switch (first.getType()) {
case IGCCToken.tTT_is_base_of:
return IASTBinaryTypeIdExpression.Operator.__is_base_of;
}
-
+
assert false;
return null;
}
private int getUnaryTypeTraitOperator(IToken first) {
- switch(first.getType()) {
+ switch (first.getType()) {
case IGCCToken.tTT_has_nothrow_assign:
return IASTTypeIdExpression.op_has_nothrow_assign;
case IGCCToken.tTT_has_nothrow_constructor:
@@ -1400,7 +1395,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* [gnu-extension, compound literals in c++]
* ( type-name ) { initializer-list }
* ( type-name ) { initializer-list , }
- *
+ *
* primary-expression
* postfix-expression [ expression ]
* postfix-expression [ braced-init-list ]
@@ -1439,7 +1434,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.t_const_cast:
firstExpression = specialCastExpression(ICPPASTCastExpression.op_const_cast);
break;
-
+
case IToken.t_typeid:
// 'typeid' ( expression )
// 'typeid' ( type-id )
@@ -1447,7 +1442,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
firstExpression = parseTypeidInParenthesisOrUnaryExpression(true, so,
ICPPASTTypeIdExpression.op_typeid, ICPPASTUnaryExpression.op_typeid, ctx, strat);
break;
-
+
case IToken.tLPAREN:
// Gnu-extension: compound literals in c++
// ( type-name ) { initializer-list }
@@ -1462,12 +1457,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IASTInitializer i = bracedInitList(false);
firstExpression= nodeFactory.newTypeIdInitializerExpression(t, i);
setRange(firstExpression, offset, calculateEndOffset(i));
- break;
+ break;
}
}
} catch (BacktrackException bt) {
}
- backup(m);
+ backup(m);
firstExpression= primaryExpression(ctx, strat);
break;
@@ -1493,7 +1488,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IGCCToken.t_typeof:
firstExpression = simpleTypeConstructorExpression(simpleTypeSpecifier());
break;
-
+
default:
firstExpression = primaryExpression(ctx, strat);
if (firstExpression instanceof IASTIdExpression && LT(1) == IToken.tLBRACE) {
@@ -1528,7 +1523,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IToken.tRPAREN) {
initArray= IASTExpression.EMPTY_EXPRESSION_ARRAY;
} else {
- final List exprList = expressionList();
+ final List exprList = expressionList();
initArray = exprList.toArray(new IASTInitializerClause[exprList.size()]);
}
endOffset = consumeOrEOC(IToken.tRPAREN).getEndOffset();
@@ -1547,7 +1542,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
firstExpression = buildUnaryExpression(IASTUnaryExpression.op_postFixDecr, firstExpression,
((ASTNode) firstExpression).getOffset(), endOffset);
break;
-
+
case IToken.tDOT:
// member access
IToken dot = consume();
@@ -1557,9 +1552,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
IASTName name = qualifiedName(ctx, strat);
-
+
if (name == null)
- throwBacktrack(((ASTNode) firstExpression).getOffset(),
+ throwBacktrack(((ASTNode) firstExpression).getOffset(),
((ASTNode) firstExpression).getLength() + dot.getLength());
ICPPASTFieldReference fieldReference = nodeFactory.newFieldReference(name, firstExpression);
@@ -1580,11 +1575,11 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
name = qualifiedName(ctx, strat);
-
+
if (name == null)
- throwBacktrack(((ASTNode) firstExpression).getOffset(),
+ throwBacktrack(((ASTNode) firstExpression).getOffset(),
((ASTNode) firstExpression).getLength() + arrow.getLength());
-
+
fieldReference = nodeFactory.newFieldReference(name, firstExpression);
fieldReference.setIsPointerDereference(true);
fieldReference.setIsTemplate(isTemplate);
@@ -1603,7 +1598,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
protected IASTAmbiguousExpression createAmbiguousExpression() {
return new CPPASTAmbiguousExpression();
}
-
+
@Override
protected IASTAmbiguousExpression createAmbiguousBinaryVsCastExpression(IASTBinaryExpression binary, IASTCastExpression castExpr) {
return new CPPASTAmbiguousBinaryVsCastExpression(binary, castExpr);
@@ -1617,7 +1612,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
protected ICPPASTAmbiguousTemplateArgument createAmbiguousTemplateArgument() {
return new CPPASTAmbiguousTemplateArgument();
}
-
private IASTExpression simpleTypeConstructorExpression(ICPPASTDeclSpecifier declSpec) throws EndOfFileException, BacktrackException {
IASTInitializer initializer = bracedOrCtorStyleInitializer();
@@ -1634,11 +1628,11 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// TO DO: we need more literals...
case IToken.tINTEGER:
t = consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_integer_constant, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_integer_constant, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
case IToken.tFLOATINGPT:
t = consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_float_constant, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_float_constant, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
case IToken.tSTRING:
case IToken.tLSTRING:
@@ -1650,24 +1644,24 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tUTF16CHAR:
case IToken.tUTF32CHAR:
t = consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_char_constant, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_char_constant, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
case IToken.t_false:
t = consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_false, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_false, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
case IToken.t_true:
t = consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_true, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_true, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
case IToken.t_nullptr:
t= consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_nullptr, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_nullptr, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
-
+
case IToken.t_this:
t = consume();
- literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_this, t.getImage());
+ literalExpression = nodeFactory.newLiteralExpression(IASTLiteralExpression.lk_this, t.getImage());
return setRange(literalExpression, t.getOffset(), t.getEndOffset());
case IToken.tLPAREN:
if (supportStatementsInExpressions && LT(2) == IToken.tLBRACE) {
@@ -1696,7 +1690,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
case IToken.tLBRACKET:
return lambdaExpression();
-
+
default:
IToken la = LA(1);
int startingOffset = la.getOffset();
@@ -1725,11 +1719,11 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
final int offset= LA().getOffset();
ICPPASTLambdaExpression lambdaExpr= nodeFactory.newLambdaExpression();
-
+
// Lambda introducer
consume(IToken.tLBRACKET);
boolean needComma= false;
- switch(LT(1)) {
+ switch (LT(1)) {
case IToken.tASSIGN:
lambdaExpr.setCaptureDefault(CaptureDefault.BY_COPY);
consume();
@@ -1744,31 +1738,31 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
break;
}
- loop: for(;;) {
+ loop: while (true) {
switch (LT(1)) {
- case IToken.tEOC:
+ case IToken.tEOC:
return setRange(lambdaExpr, offset, LA().getEndOffset());
- case IToken.tRBRACKET:
+ case IToken.tRBRACKET:
consume();
break loop;
}
-
+
if (needComma) {
consume(IToken.tCOMMA);
}
-
+
ICPPASTCapture cap= capture();
lambdaExpr.addCapture(cap);
needComma= true;
}
-
+
if (LT(1) == IToken.tLPAREN) {
ICPPASTFunctionDeclarator dtor = functionDeclarator(true);
lambdaExpr.setDeclarator(dtor);
if (LT(1) == IToken.tEOC)
return setRange(lambdaExpr, offset, calculateEndOffset(dtor));
}
-
+
IASTCompoundStatement body = functionBody();
lambdaExpr.setBody(body);
return setRange(lambdaExpr, offset, calculateEndOffset(body));
@@ -1777,7 +1771,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private ICPPASTCapture capture() throws EndOfFileException, BacktrackException {
final int offset= LA().getOffset();
final ICPPASTCapture result = nodeFactory.newCapture();
-
+
switch (LT(1)) {
case IToken.t_this:
return setRange(result, offset, consume().getEndOffset());
@@ -1786,15 +1780,15 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
result.setIsByReference(true);
break;
}
-
+
final IASTName identifier= identifier();
result.setIdentifier(identifier);
-
+
if (LT(1) == IToken.tELLIPSIS) {
result.setIsPackExpansion(true);
return setRange(result, offset, consume().getEndOffset());
- }
-
+ }
+
return setRange(result, offset, calculateEndOffset(identifier));
}
@@ -1826,7 +1820,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
break;
default:
operator = IASTCastExpression.op_cast;
- break;
+ break;
}
return buildCastExpression(operator, typeID, operand, offset, endOffset);
}
@@ -1836,7 +1830,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* using-declaration: using typename? ::? nested-name-specifier
* unqualified-id ; using :: unqualified-id ; using-directive: using
* namespace ::? nested-name-specifier? namespace-name ;
- *
+ *
* @throws BacktrackException
* request for a backtrack
*/
@@ -1859,7 +1853,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
attributes = __attribute__();
-
+
switch (LT(1)) {
case IToken.tSEMI:
case IToken.tEOC:
@@ -1907,13 +1901,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result;
}
-
/**
* static_assert-declaration:
static_assert ( constant-expression , string-literal ) ;
*/
private ICPPASTStaticAssertDeclaration staticAssertDeclaration() throws EndOfFileException, BacktrackException {
- int offset= consume(IToken.t_static_assert).getOffset();
+ int offset= consume(IToken.t_static_assert).getOffset();
consume(IToken.tLPAREN);
IASTExpression e= constantExpression();
int endOffset= calculateEndOffset(e);
@@ -1924,7 +1917,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
consume(IToken.tRPAREN);
endOffset= consume(IToken.tSEMI).getEndOffset();
}
- ICPPASTStaticAssertDeclaration assertion = nodeFactory.newStaticAssertion(e, lit);
+ ICPPASTStaticAssertDeclaration assertion = nodeFactory.newStaticAssertion(e, lit);
return setRange(assertion, offset, endOffset);
}
@@ -1932,14 +1925,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* Implements Linkage specification in the ANSI C++ grammar.
* linkageSpecification : extern "string literal" declaration | extern
* "string literal" { declaration-seq }
- *
+ *
* @throws BacktrackException
* request for a backtrack
*/
protected ICPPASTLinkageSpecification linkageSpecification() throws EndOfFileException, BacktrackException {
int offset= consume().getOffset(); // t_extern
String spec = consume().getImage(); // tString
- ICPPASTLinkageSpecification linkage = nodeFactory.newLinkageSpecification(spec);
+ ICPPASTLinkageSpecification linkage = nodeFactory.newLinkageSpecification(spec);
if (LT(1) == IToken.tLBRACE) {
declarationListInBraces(linkage, offset, DeclarationOptions.GLOBAL);
@@ -1953,15 +1946,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return linkage;
}
-
/**
* Represents the amalgamation of template declarations, template
* instantiations and specializations in the ANSI C++ grammar.
* template-declaration: export? template < template-parameter-list >
* declaration explicit-instantiation: template declaration
* explicit-specialization: template <>declaration
- * @param option
- *
+ * @param option
+ *
* @throws BacktrackException
* request for a backtrack
*/
@@ -1987,9 +1979,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
explicitInstMod= ICPPASTExplicitTemplateInstantiation.INLINE;
break;
}
-
+
consume(IToken.t_template);
-
+
if (LT(1) != IToken.tLT) {
// explicit-instantiation
IASTDeclaration d = declaration(option);
@@ -1998,12 +1990,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
setRange(ti, offset, calculateEndOffset(d));
return ti;
}
-
+
// Modifiers for explicit instantiations
if (explicitInstMod != 0) {
throwBacktrack(LA(1));
}
- consume(IToken.tLT);
+ consume(IToken.tLT);
if (LT(1) == IToken.tGT) {
// explicit-specialization
consume();
@@ -2037,7 +2029,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* template-argument-list: template-argument template-argument-list ,
* template-argument template-argument: assignment-expression type-id
* id-expression
- *
+ *
* @throws BacktrackException
* request for a backtrack
*/
@@ -2046,7 +2038,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
try {
List result = new ArrayList(DEFAULT_PARM_LIST_SIZE);
IToken m= mark();
- for(;;) {
+ while (true) {
try {
return templateParameterList(result);
} catch (BacktrackException e) {
@@ -2111,7 +2103,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
defaultValue = typeId(DeclarationOptions.TYPEID); // type-id
endOffset = calculateEndOffset(defaultValue);
}
-
+
// Check if followed by comma
switch (LT(1)) {
case IToken.tGT:
@@ -2149,7 +2141,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IToken.tASSIGN) { // optional = type-id
if (parameterPack)
throw backtrack;
-
+
consume();
defaultValue = primaryExpression(CastExprCtx.eNotInBExpr, null);
endOffset = calculateEndOffset(defaultValue);
@@ -2157,7 +2149,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} else {
identifierName = nodeFactory.newName();
}
-
+
ICPPASTTemplatedTypeTemplateParameter tpar = nodeFactory.newTemplatedTypeTemplateParameter(identifierName, defaultValue);
tpar.setIsParameterPack(parameterPack);
setRange(tpar, start.getOffset(), endOffset);
@@ -2167,13 +2159,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
tpar.addTemplateParameter(p);
}
return tpar;
- }
-
+ }
+
// Try non-type template parameter
return parameterDeclaration();
}
-
/**
* The most abstract construct within a translationUnit : a declaration.
* declaration : {"asm"} asmDefinition | {"namespace"} namespaceDefinition |
@@ -2183,7 +2174,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* functionDefinition into simpleDeclaration - namespaceAliasDefinition into
* namespaceDefinition - usingDirective into usingDeclaration -
* explicitInstantiation and explicitSpecialization into templateDeclaration
- *
+ *
* @throws BacktrackException
* request a backtrack
*/
@@ -2221,10 +2212,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IASTSimpleDeclaration decl= nodeFactory.newSimpleDeclaration(declspec);
((ASTNode) declspec).setOffsetAndLength(t.getOffset(), 0);
((ASTNode) decl).setOffsetAndLength(t.getOffset(), t.getLength());
- return decl;
+ return decl;
case IToken.t_public:
case IToken.t_protected:
- case IToken.t_private:
+ case IToken.t_private:
if (option == DeclarationOptions.CPP_MEMBER) {
t= consume();
int key= t.getType();
@@ -2235,7 +2226,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
break;
}
-
+
try {
return simpleDeclaration(option);
} catch (BacktrackException e) {
@@ -2252,12 +2243,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
}
}
-
+
/**
* Serves as the namespace declaration portion of the ANSI C++ grammar.
* namespace-definition: namespace identifier { namespace-body } | namespace {
* namespace-body } namespace-body: declaration-seq?
- *
+ *
* @throws BacktrackException
* request a backtrack
*/
@@ -2265,13 +2256,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
final int offset= LA().getOffset();
int endOffset;
boolean isInline= false;
-
+
if (LT(1) == IToken.t_inline) {
consume();
isInline= true;
}
consume(IToken.t_namespace);
-
+
// optional name
IASTName name = null;
if (LT(1) == IToken.tIDENTIFIER) {
@@ -2289,8 +2280,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
ns.setIsInline(isInline);
declarationListInBraces(ns, offset, DeclarationOptions.GLOBAL);
return ns;
- }
-
+ }
+
if (LT(1) == IToken.tASSIGN) {
endOffset= consume().getEndOffset();
if (name.toString() == null) {
@@ -2304,7 +2295,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
ICPPASTNamespaceAlias alias = nodeFactory.newNamespaceAlias(name, qualifiedName);
((ASTNode) alias).setOffsetAndLength(offset, endOffset - offset);
return alias;
- }
+ }
throwBacktrack(LA(1));
return null;
}
@@ -2323,7 +2314,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
protected IASTDeclaration simpleDeclaration(DeclarationOptions declOption) throws BacktrackException, EndOfFileException {
if (LT(1) == IToken.tLBRACE)
throwBacktrack(LA(1));
-
+
final int firstOffset= LA(1).getOffset();
int endOffset= firstOffset;
boolean insertSemi= false;
@@ -2354,7 +2345,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
throw e;
}
-
+
IASTDeclarator[] declarators= IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
if (dtor != null) {
declarators= new IASTDeclarator[]{dtor};
@@ -2394,7 +2385,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tASSIGN: // defaulted or deleted function definition
if (declarators.length != 1 || !declOption.fAllowFunctionDefinition)
throwBacktrack(LA(1));
-
+
dtor= declarators[0];
if (altDeclSpec != null && altDtor != null && dtor != null &&
!(ASTQueries.findTypeRelevantDeclarator(dtor) instanceof IASTFunctionDeclarator)) {
@@ -2402,8 +2393,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
dtor= altDtor;
}
return functionDefinition(firstOffset, declSpec, dtor);
-
- default:
+
+ default:
insertSemi= true;
if (declOption == DeclarationOptions.LOCAL) {
endOffset= figureEndOffset(declSpec, declarators);
@@ -2425,9 +2416,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
throwBacktrack(LA(1));
}
-
+
// no function body
-
+
final boolean isAmbiguous= altDeclSpec != null && altDtor != null && declarators.length == 1;
IASTSimpleDeclaration simpleDeclaration;
if (isAmbiguous) {
@@ -2435,13 +2426,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// prefer the empty declspec, it shall be used if both variants show no problems
simpleDeclaration= nodeFactory.newSimpleDeclaration(altDeclSpec);
simpleDeclaration.addDeclarator(altDtor);
- } else {
+ } else {
simpleDeclaration= nodeFactory.newSimpleDeclaration(declSpec);
for (IASTDeclarator declarator : declarators) {
- simpleDeclaration.addDeclarator(declarator);
+ simpleDeclaration.addDeclarator(declarator);
}
}
-
+
setRange(simpleDeclaration, firstOffset, endOffset);
if (isAmbiguous) {
simpleDeclaration = new CPPASTAmbiguousSimpleDeclaration(simpleDeclaration, declSpec, dtor);
@@ -2457,23 +2448,22 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTDeclaration functionDefinition(final int firstOffset, IASTDeclSpecifier declSpec,
IASTDeclarator outerDtor) throws EndOfFileException, BacktrackException {
-
+
final IASTDeclarator dtor= ASTQueries.findTypeRelevantDeclarator(outerDtor);
if (!(dtor instanceof ICPPASTFunctionDeclarator))
throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);
-
ICPPASTFunctionDefinition fdef;
if (LT(1) == IToken.t_try) {
consume();
- fdef= nodeFactory.newFunctionTryBlock(declSpec, (ICPPASTFunctionDeclarator) dtor, null);
+ fdef= nodeFactory.newFunctionTryBlock(declSpec, (ICPPASTFunctionDeclarator) dtor, null);
} else {
- fdef= nodeFactory.newFunctionDefinition(declSpec, (ICPPASTFunctionDeclarator) dtor, null);
+ fdef= nodeFactory.newFunctionDefinition(declSpec, (ICPPASTFunctionDeclarator) dtor, null);
}
if (LT(1) == IToken.tASSIGN) {
consume();
IToken kind= consume();
- switch(kind.getType()) {
+ switch (kind.getType()) {
case IToken.t_default:
fdef.setIsDefaulted(true);
break;
@@ -2503,7 +2493,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
throw bt;
}
-
+
if (fdef instanceof ICPPASTFunctionWithTryBlock) {
ICPPASTFunctionWithTryBlock tryblock= (ICPPASTFunctionWithTryBlock) fdef;
List handlers = new ArrayList(DEFAULT_CATCH_HANDLER_LIST_SIZE);
@@ -2525,7 +2515,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
* : mem-initializer-list
* mem-initializer-list:
* mem-initializer ...?
- * mem-initializer ...?, mem-initializer-list
+ * mem-initializer ...?, mem-initializer-list
* mem-initializer:
* mem-initializer-id ( expression-list? )
* mem-initializer-id braced-init-list
@@ -2535,7 +2525,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/
protected void ctorInitializer(ICPPASTFunctionDefinition fdef) throws EndOfFileException, BacktrackException {
consume(IToken.tCOLON);
- loop: for(;;) {
+ loop: while (true) {
final int offset= LA(1).getOffset();
final IASTName name = qualifiedName();
final IASTInitializer init;
@@ -2551,7 +2541,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IToken.tELLIPSIS) {
ctorInitializer.setIsPackExpansion(true);
endOffset= consume().getEndOffset();
- }
+ }
fdef.addMemberInitializer(setRange(ctorInitializer, offset, endOffset));
if (LT(1) == IToken.tCOMMA) {
@@ -2564,17 +2554,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
/**
* This routine parses a parameter declaration
- *
+ *
* @throws BacktrackException
* request a backtrack
*/
protected ICPPASTParameterDeclaration parameterDeclaration() throws BacktrackException, EndOfFileException {
final int startOffset= LA(1).getOffset();
-
+
if (LT(1) == IToken.tLBRACKET && supportParameterInfoBlock) {
skipBrackets(IToken.tLBRACKET, IToken.tRBRACKET, 0);
}
-
+
IASTDeclSpecifier declSpec= null;
IASTDeclarator declarator;
try {
@@ -2592,24 +2582,22 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
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,
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;
-
/**
* This function parses a declaration specifier sequence, as according to
- * the ANSI C++ specification.
- * declSpecifier :
- * "register" | "static" | "extern" | "mutable" |
+ * the ANSI C++ specification.
+ * declSpecifier :
+ * "register" | "static" | "extern" | "mutable" |
* "inline" | "virtual" | "explicit" |
- * "typedef" | "friend" | "constexpr" |
+ * "typedef" | "friend" | "constexpr" |
* "const" | "volatile" |
* "short" | "long" | "signed" | "unsigned" | "int" |
- * "char" | "wchar_t" | "bool" | "float" | "double" | "void" |
+ * "char" | "wchar_t" | "bool" | "float" | "double" | "void" |
* "auto" |
* ("typename")? name |
* { "class" | "struct" | "union" } classSpecifier |
@@ -2619,7 +2607,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
protected Decl declSpecifierSeq(final DeclarationOptions option) throws BacktrackException, EndOfFileException {
return declSpecifierSeq(option, false);
}
-
+
private ICPPASTDeclSpecifier simpleTypeSpecifier() throws BacktrackException, EndOfFileException {
Decl d= declSpecifierSeq(null, true);
return (ICPPASTDeclSpecifier) d.fDeclSpec1;
@@ -2885,7 +2873,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
result= (ICPPASTDeclSpecifier) bt.getNodeBeforeProblem();
problem= bt.getProblem();
break declSpecifiers;
- }
+ }
throw bt;
}
endOffset= calculateEndOffset(result);
@@ -2909,7 +2897,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
simpleType= IASTSimpleDeclSpecifier.t_typeof;
consume(IGCCToken.t_typeof);
- typeofExpression= parseTypeidInParenthesisOrUnaryExpression(false, LA(1).getOffset(),
+ typeofExpression= parseTypeidInParenthesisOrUnaryExpression(false, LA(1).getOffset(),
IASTTypeIdExpression.op_typeof, -1, CastExprCtx.eNotInBExpr, null);
encounteredTypename= true;
@@ -2940,7 +2928,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (encounteredRawType && encounteredTypename)
throwBacktrack(LA(1));
-
+
if (single)
break declSpecifiers;
}
@@ -2975,7 +2963,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throw e;
}
}
-
+
Decl target= new Decl();
target.fDeclSpec1= result;
target.fDeclSpec2= altResult;
@@ -2995,7 +2983,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private ICPPASTSimpleDeclSpecifier buildSimpleDeclSpec(int storageClass, int simpleType,
int options, int isLong, IASTExpression typeofExpression, int offset, int endOffset) {
ICPPASTSimpleDeclSpecifier declSpec= nodeFactory.newSimpleDeclSpecifier();
-
+
configureDeclSpec(declSpec, storageClass, options);
declSpec.setType(simpleType);
@@ -3039,7 +3027,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
isScoped= true;
consume();
}
- // if __attribute__ or __declspec occurs after struct/union/class and before the identifier
+ // if __attribute__ or __declspec occurs after struct/union/class and before the identifier
__attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
if (isScoped || LT(1) == IToken.tIDENTIFIER) {
@@ -3065,28 +3053,28 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return elaboratedTypeSpecifier();
}
mark= null;
-
+
if (isOpaque && !isScoped && baseType == null)
throwBacktrack(LA(1));
-
+
if (name == null) {
if (isOpaque)
throwBacktrack(LA(1));
name= nodeFactory.newName();
}
-
+
final ICPPASTEnumerationSpecifier result= nodeFactory.newEnumerationSpecifier(isScoped, name, baseType);
result.setIsOpaque(isOpaque);
if (lt1 == IToken.tLBRACE) {
endOffset= enumBody(result);
- }
+ }
assert endOffset != 0;
return setRange(result, offset, endOffset);
}
/**
* Parse an elaborated type specifier.
- *
+ *
* @throws BacktrackException
* request a backtrack
*/
@@ -3111,18 +3099,18 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
default:
throwBacktrack(LA(1));
}
-
+
final int offset= consume().getOffset();
- // if __attribute__ or __declspec occurs after struct/union/class and before the identifier
+ // if __attribute__ or __declspec occurs after struct/union/class and before the identifier
__attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
IASTName name = qualifiedName();
return setRange(nodeFactory.newElaboratedTypeSpecifier(eck, name), offset, calculateEndOffset(name));
}
-
+
@Override
- protected IASTDeclarator initDeclarator(IASTDeclSpecifier declspec, DeclarationOptions option)
+ protected IASTDeclarator initDeclarator(IASTDeclSpecifier declspec, DeclarationOptions option)
throws EndOfFileException, BacktrackException, FoundAggregateInitializer {
final IToken mark= mark();
IASTDeclarator dtor1= null;
@@ -3132,23 +3120,23 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
try {
dtor1= initDeclarator(DtorStrategy.PREFER_FUNCTION, declspec, option);
verifyDtor(declspec, dtor1, option);
-
+
int lt1= LTcatchEOF(1);
switch (lt1) {
case 0:
return dtor1;
- case IToken.tLBRACE:
- if (option.fCanBeFollowedByBrace
+ case IToken.tLBRACE:
+ if (option.fCanBeFollowedByBrace
|| ASTQueries.findTypeRelevantDeclarator(dtor1) instanceof IASTFunctionDeclarator)
return dtor1;
dtor1= null;
throwBacktrack(LA(1));
break;
-
+
case IToken.tCOLON:
- // a colon can be used after a type-id in a conditional expression
+ // a colon can be used after a type-id in a conditional expression
if (option != DeclarationOptions.CPP_MEMBER && option != DeclarationOptions.GLOBAL)
break;
//$FALL-THROUGH$
@@ -3163,15 +3151,15 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throwBacktrack(LA(1));
}
}
-
+
if (!(dtor1 instanceof IASTFunctionDeclarator))
return dtor1;
-
+
end1= LA(1);
} catch (BacktrackException e) {
bt= e;
- }
-
+ }
+
if (!option.fAllowCtorStyleInitializer || !canHaveConstructorInitializer(declspec, dtor1)) {
if (bt != null)
throw bt;
@@ -3181,7 +3169,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
backup(mark);
try {
dtor2= initDeclarator(DtorStrategy.PREFER_NESTED, declspec, option);
- if (dtor1 == null) {
+ if (dtor1 == null) {
return dtor2;
}
} catch (BacktrackException e) {
@@ -3190,14 +3178,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return dtor1;
}
throw e;
- }
-
+ }
+
// we have an ambiguity
if (end1 != null && LA(1).getEndOffset() != end1.getEndOffset()) {
backup(end1);
return dtor1;
}
-
+
if (functionBodyCount != 0) {
// prefer the variable prototype:
IASTDeclarator h= dtor1; dtor1= dtor2; dtor2= h;
@@ -3225,7 +3213,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// accept conversion operator
if (name instanceof ICPPASTConversionName)
return;
-
if (opt == DeclarationOptions.CPP_MEMBER) {
// Accept constructor and destructor within class body
@@ -3240,15 +3227,15 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return;
}
}
-
+
ASTNode node= (ASTNode) dtor;
throwBacktrack(node.getOffset(), node.getLength());
}
}
-
+
private boolean canHaveConstructorInitializer(IASTDeclSpecifier declspec, IASTDeclarator dtor) {
if (declspec instanceof ICPPASTDeclSpecifier) {
- ICPPASTDeclSpecifier cppspec= (ICPPASTDeclSpecifier) declspec;
+ ICPPASTDeclSpecifier cppspec= (ICPPASTDeclSpecifier) declspec;
if (cppspec.isFriend()) {
return false;
}
@@ -3266,8 +3253,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
dtor.getPointerOperators().length == 0 && dtor.getNestedDeclarator() == null) {
return false;
}
- }
-
+ }
+
if (dtor != null) {
IASTName name = ASTQueries.findInnermostDeclarator(dtor).getName().getLastName();
if (name instanceof ICPPASTTemplateId) {
@@ -3276,18 +3263,18 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (name instanceof ICPPASTOperatorName || name instanceof ICPPASTConversionName)
return false;
}
-
+
return true;
}
/**
* Parses the initDeclarator construct of the ANSI C++ spec. initDeclarator :
* declarator ("=" initializerClause | "(" expressionList ")")?
- *
+ *
* @return declarator that this parsing produced.
* @throws BacktrackException
* request a backtrack
- * @throws FoundAggregateInitializer
+ * @throws FoundAggregateInitializer
*/
private IASTDeclarator initDeclarator(DtorStrategy strategy, IASTDeclSpecifier declspec, DeclarationOptions option)
throws EndOfFileException, BacktrackException, FoundAggregateInitializer {
@@ -3303,13 +3290,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IToken t = consume();
char[] image = t.getCharImage();
if (image.length != 1 || image[0] != '0') {
- throwBacktrack(t);
+ throwBacktrack(t);
}
((ICPPASTFunctionDeclarator) typeRelevantDtor).setPureVirtual(true);
adjustEndOffset(dtor, t.getEndOffset()); // we can only adjust the offset of the outermost dtor.
}
} else {
- if (LTcatchEOF(1) == IToken.tASSIGN && LTcatchEOF(2) == IToken.tLBRACE)
+ if (LTcatchEOF(1) == IToken.tASSIGN && LTcatchEOF(2) == IToken.tLBRACE)
throw new FoundAggregateInitializer(declspec, dtor);
IASTInitializer initializer= optionalInitializer(dtor, option);
@@ -3335,12 +3322,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
return dtor;
}
-
+
/**
* initializer:
* brace-or-equal-initializer
* ( expression-list )
- *
+ *
* brace-or-equal-initializer:
* = initializer-clause
* braced-init-list
@@ -3348,14 +3335,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
@Override
protected IASTInitializer optionalInitializer(IASTDeclarator dtor, DeclarationOptions option) throws EndOfFileException, BacktrackException {
final int lt1= LTcatchEOF(1);
-
+
// = initializer-clause
if (lt1 == IToken.tASSIGN) {
// Check for deleted or defaulted function syntax.
final int lt2= LTcatchEOF(2);
if (lt2 == IToken.t_delete || lt2 == IToken.t_default)
return null;
-
+
int offset= consume().getOffset();
final boolean allowSkipping = LT(1) == IToken.tLBRACE && specifiesArray(dtor);
IASTInitializerClause initClause = initClause(allowSkipping);
@@ -3367,14 +3354,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (option.fAllowBracedInitializer && lt1 == IToken.tLBRACE) {
return bracedInitList(false);
}
-
+
// ( expression-list )
if (option.fAllowCtorStyleInitializer && lt1 == IToken.tLPAREN) {
return ctorStyleInitializer(false);
- }
+ }
return null;
}
-
+
private boolean specifiesArray(IASTDeclarator dtor) {
dtor = ASTQueries.findTypeRelevantDeclarator(dtor);
return dtor instanceof IASTArrayDeclarator;
@@ -3395,12 +3382,12 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throws EndOfFileException, BacktrackException {
IASTInitializerClause[] initArray;
int offset = consume(IToken.tLPAREN).getOffset();
-
+
// ( )
if (optionalExpressionList && LT(1) == IToken.tRPAREN) {
initArray= IASTExpression.EMPTY_EXPRESSION_ARRAY;
} else {
- final List exprList = expressionList();
+ final List exprList = expressionList();
initArray = exprList.toArray(new IASTInitializerClause[exprList.size()]);
}
int endOffset = consumeOrEOC(IToken.tRPAREN).getEndOffset();
@@ -3441,17 +3428,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/
private ICPPASTInitializerList bracedInitList(boolean allowSkipping) throws EndOfFileException, BacktrackException {
int offset = consume(IToken.tLBRACE).getOffset();
-
+
// { }
if (LT(1) == IToken.tRBRACE) {
return setRange(nodeFactory.newInitializerList(), offset, consume().getEndOffset());
}
-
+
// { initializer-list ,opt }
List initList= initializerList(allowSkipping);
if (LT(1) == IToken.tCOMMA)
consume();
-
+
int endOffset= consumeOrEOC(IToken.tRBRACE).getEndOffset();
ICPPASTInitializerList result = nodeFactory.newInitializerList();
for (IASTInitializerClause init : initList) {
@@ -3459,7 +3446,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
return setRange(result, offset, endOffset);
}
-
+
/**
* initializerList:
* initializer-clause ...opt
@@ -3467,10 +3454,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/
private List initializerList(boolean allowSkipping) throws EndOfFileException,
BacktrackException {
-
List result= null;
// List of initializer clauses
- loop: for(;;) {
+ loop: while (true) {
// Clause may be null, add to initializer anyways, such that the size can be computed.
IASTInitializerClause clause = initClause(allowSkipping);
if (LT(1) == IToken.tELLIPSIS) {
@@ -3499,10 +3485,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
consume(IToken.tCOMMA);
}
-
+
if (result == null)
return Collections.emptyList();
-
+
return result;
}
@@ -3514,7 +3500,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
final int offset = LA().getOffset();
IASTDeclSpecifier declSpecifier = null;
IASTDeclarator declarator = null;
-
+
try {
Decl decl= declSpecifierSequence_initDeclarator(option, false);
declSpecifier= decl.fDeclSpec1;
@@ -3522,22 +3508,22 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} catch (FoundAggregateInitializer lie) {
// type-ids have no initializers
throwBacktrack(lie.fDeclarator);
- }
- ICPPASTTypeId result = nodeFactory.newTypeId(declSpecifier, declarator);
+ }
+ ICPPASTTypeId result = nodeFactory.newTypeId(declSpecifier, declarator);
setRange(result, offset, figureEndOffset(declSpecifier, declarator));
return result;
}
/**
* Parse a declarator, as according to the ANSI C++ specification.
- * declarator : (ptrOperator)* directDeclarator
- * directDeclarator :
- * declaratorId |
- * directDeclarator "(" parameterDeclarationClause ")" (cvQualifier)* (exceptionSpecification)* |
- * directDeclarator "[" (constantExpression)? "]" |
- * "(" declarator")" |
- * directDeclarator "(" parameterDeclarationClause ")" (oldKRParameterDeclaration)*
- *
+ * declarator : (ptrOperator)* directDeclarator
+ * directDeclarator :
+ * declaratorId |
+ * directDeclarator "(" parameterDeclarationClause ")" (cvQualifier)* (exceptionSpecification)* |
+ * directDeclarator "[" (constantExpression)? "]" |
+ * "(" declarator")" |
+ * directDeclarator "(" parameterDeclarationClause ")" (oldKRParameterDeclaration)*
+ *
* declaratorId : name
* @return declarator that this parsing produced.
* @throws BacktrackException
@@ -3552,7 +3538,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (pointerOps != null) {
endOffset = calculateEndOffset(pointerOps.get(pointerOps.size() - 1));
}
-
+
// Accept __attribute__ or __declspec between pointer operators and declarator.
__attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
@@ -3571,21 +3557,21 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tCOMPLETION:
if (option.fRequireAbstract)
throwBacktrack(LA(1));
-
+
final IASTName declaratorName= !option.fRequireSimpleName ? qualifiedName() : identifier();
endOffset= calculateEndOffset(declaratorName);
return declarator(pointerOps, hasEllipsis, declaratorName, null, startingOffset, endOffset, strategy, option);
- }
-
+ }
+
if (lt1 == IToken.tLPAREN) {
IASTDeclarator cand1= null;
IToken cand1End= null;
- // try an abstract function declarator
+ // try an abstract function declarator
if (option.fAllowAbstract && option.fAllowFunctions) {
final IToken mark= mark();
try {
cand1= declarator(pointerOps, hasEllipsis, nodeFactory.newName(), null, startingOffset, endOffset, strategy, option);
- if (option.fRequireAbstract || !option.fAllowNested || hasEllipsis)
+ if (option.fRequireAbstract || !option.fAllowNested || hasEllipsis)
return cand1;
cand1End= LA(1);
@@ -3593,7 +3579,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
backup(mark);
}
-
+
// type-ids for new or operator-id:
if (!option.fAllowNested || hasEllipsis) {
if (option.fAllowAbstract) {
@@ -3601,7 +3587,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
throwBacktrack(LA(1));
}
-
+
// try a nested declarator
try {
consume();
@@ -3620,7 +3606,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result;
}
// use the longer variant
- if (cand1End.getOffset() < cand2End.getOffset())
+ if (cand1End.getOffset() < cand2End.getOffset())
return cand2;
} catch (BacktrackException e) {
@@ -3643,7 +3629,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
/**
* Parse a Pointer Operator. ptrOperator : "*" (cvQualifier)* | "&" | ::?
* nestedNameSpecifier "*" (cvQualifier)*
- *
+ *
* @throws BacktrackException
* request a backtrack
*/
@@ -3652,7 +3638,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
for (;;) {
// __attribute__ in-between pointers
__attribute_decl_seq(supportAttributeSpecifiers, false);
-
+
final int lt1 = LT(1);
if (lt1 == IToken.tAMPER || lt1 == IToken.tAND) {
IToken endToken= consume();
@@ -3669,7 +3655,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
return Collections.singletonList(refOp);
}
-
+
IToken mark = mark();
final int startOffset = mark.getOffset();
boolean isConst = false, isVolatile = false, isRestrict = false;
@@ -3704,7 +3690,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
backup(mark);
return result;
}
-
+
int endOffset= consume().getEndOffset();
loop: for (;;) {
switch (LTcatchEOF(1)) {
@@ -3717,7 +3703,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
isVolatile = true;
break;
case IToken.t_restrict:
- if (!allowCPPRestrict)
+ if (!allowCPPRestrict)
throwBacktrack(LA(1));
endOffset= consume().getEndOffset();
isRestrict = true;
@@ -3746,7 +3732,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private IASTDeclarator declarator(List extends IASTPointerOperator> pointerOps, boolean hasEllipsis,
IASTName declaratorName, IASTDeclarator nestedDeclarator, int startingOffset, int endOffset,
- DtorStrategy strategy, DeclarationOptions option)
+ DtorStrategy strategy, DeclarationOptions option)
throws EndOfFileException, BacktrackException {
ICPPASTDeclarator result= null;
List attributes = null;
@@ -3759,20 +3745,20 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
setDeclaratorID(result, hasEllipsis, declaratorName, nestedDeclarator);
}
break loop;
-
+
case IToken.tLBRACKET:
result= arrayDeclarator(option);
setDeclaratorID(result, hasEllipsis, declaratorName, nestedDeclarator);
break loop;
-
+
case IToken.tCOLON:
if (!option.fAllowBitField || nestedDeclarator != null)
break loop; // no backtrack because typeid can be followed by colon
-
+
result= bitFieldDeclarator();
setDeclaratorID(result, hasEllipsis, declaratorName, nestedDeclarator);
break loop;
-
+
case IGCCToken.t__attribute__: // if __attribute__ is after a declarator
if (!supportAttributeSpecifiers)
throwBacktrack(LA(1));
@@ -3824,7 +3810,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
private void setDeclaratorID(ICPPASTDeclarator declarator, boolean hasEllipsis, IASTName declaratorName, IASTDeclarator nestedDeclarator) {
- if (nestedDeclarator != null) {
+ if (nestedDeclarator != null) {
declarator.setNestedDeclarator(nestedDeclarator);
declarator.setName(nodeFactory.newName());
} else {
@@ -3832,7 +3818,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
declarator.setDeclaresParameterPack(hasEllipsis);
}
-
+
/**
* Parse a function declarator starting with the left parenthesis.
*/
@@ -3840,7 +3826,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IToken last = consume(IToken.tLPAREN);
final int startOffset= last.getOffset();
int endOffset= last.getEndOffset();
-
+
final ICPPASTFunctionDeclarator fc = nodeFactory.newFunctionDeclarator(null);
ICPPASTParameterDeclaration pd= null;
paramLoop: while(true) {
@@ -3863,7 +3849,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
default:
if (pd != null)
throwBacktrack(startOffset, endOffset - startOffset);
-
+
pd = parameterDeclaration();
fc.addParameterDeclaration(pd);
endOffset = calculateEndOffset(pd);
@@ -3911,7 +3897,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IToken.t_throw) {
fc.setEmptyExceptionSpecification();
consume(); // throw
- consume(IToken.tLPAREN);
+ consume(IToken.tLPAREN);
thloop: while (true) {
switch (LT(1)) {
@@ -3949,13 +3935,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
attributes = CollectionUtils.merge(attributes,
__attribute_decl_seq(supportAttributeSpecifiers, false));
}
-
+
if (LT(1) == IToken.tARROW) {
consume();
IASTTypeId typeId= typeId(DeclarationOptions.TYPEID_TRAILING_RETURN_TYPE);
fc.setTrailingReturnType(typeId);
endOffset= calculateEndOffset(typeId);
- }
+ }
if (attributes != null) {
for (IASTAttribute attribute : attributes) {
@@ -3975,27 +3961,26 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
consumeArrayModifiers(option, arrayMods);
if (arrayMods.isEmpty())
throwBacktrack(LA(1));
-
+
final int endOffset = calculateEndOffset(arrayMods.get(arrayMods.size() - 1));
final ICPPASTArrayDeclarator d = nodeFactory.newArrayDeclarator(null);
for (IASTArrayModifier m : arrayMods) {
d.addArrayModifier(m);
}
-
+
((ASTNode) d).setOffsetAndLength(start, endOffset-start);
return d;
}
-
-
+
/**
* Parses for a bit field declarator starting with the colon
*/
private ICPPASTFieldDeclarator bitFieldDeclarator() throws EndOfFileException, BacktrackException {
int start= consume(IToken.tCOLON).getOffset();
-
+
final IASTExpression bitField = constantExpression();
final int endOffset = calculateEndOffset(bitField);
-
+
ICPPASTFieldDeclarator d = nodeFactory.newFieldDeclarator(null, bitField);
((ASTNode) d).setOffsetAndLength(start, endOffset-start);
return d;
@@ -4004,7 +3989,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
/**
* Parse a class/struct/union definition. classSpecifier : classKey name
* (baseClause)? "{" (memberSpecification)* "}"
- *
+ *
* @throws BacktrackException
* request a backtrack
*/
@@ -4032,9 +4017,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return null; // line is never reached, hint for the parser
}
- // if __attribute__ or __declspec occurs after struct/union/class and before the identifier
+ // if __attribute__ or __declspec occurs after struct/union/class and before the identifier
__attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
-
+
// class name
IASTName name = null;
if (LT(1) == IToken.tIDENTIFIER) {
@@ -4042,10 +4027,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} else {
name = nodeFactory.newName();
}
-
+
// if __attribute__ or __declspec occurs after struct/union/class identifier and before the { or ;
__attribute_decl_seq(supportAttributeSpecifiers, supportDeclspecSpecifiers);
-
+
ICPPASTCompositeTypeSpecifier astClassSpecifier = nodeFactory.newCompositeTypeSpecifier(classKind, name);
// base clause
@@ -4087,45 +4072,45 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
/**
- * Parse a base clause for a class specification.
- * base-clause:
- * : base-specifier-list
- * base-specifier-list:
- * base-specifier
- * base-specifier-list, base-specifier
+ * Parse a base clause for a class specification.
+ * base-clause:
+ * : base-specifier-list
+ * base-specifier-list:
+ * base-specifier
+ * base-specifier-list, base-specifier
*/
private void baseClause(ICPPASTCompositeTypeSpecifier astClassSpec) throws EndOfFileException, BacktrackException {
consume(IToken.tCOLON);
for (;;) {
ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpec = baseSpecifier();
astClassSpec.addBaseSpecifier(baseSpec);
-
+
if (LT(1) == IToken.tELLIPSIS) {
baseSpec.setIsPackExpansion(true);
adjustEndOffset(baseSpec, consume().getEndOffset());
}
-
+
if (LT(1) != IToken.tCOMMA) {
return;
}
-
+
consume();
}
}
/**
- * base-specifier:
- * ::? nested-name-specifier? class-name
- * virtual access-specifier? ::? nested-name-specifier? class-name
- * access-specifier virtual? ::? nested-name-specifier? class-name
- *
+ * base-specifier:
+ * ::? nested-name-specifier? class-name
+ * virtual access-specifier? ::? nested-name-specifier? class-name
+ * access-specifier virtual? ::? nested-name-specifier? class-name
+ *
* access-specifier: private | protected | public
- * @return
+ * @return
*/
private ICPPASTBaseSpecifier baseSpecifier() throws EndOfFileException, BacktrackException {
int startOffset= LA(1).getOffset();
boolean isVirtual = false;
- int visibility = 0;
+ int visibility = 0;
IASTName name = null;
loop: for (;;) {
switch (LT(1)) {
@@ -4158,10 +4143,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
protected void catchHandlerSequence(List collection) throws EndOfFileException, BacktrackException {
if (LT(1) == IToken.tEOC)
return;
-
- if (LT(1) != IToken.t_catch)
+
+ if (LT(1) != IToken.t_catch)
throwBacktrack(LA(1)); // error, need at least one
-
+
int lt1 = LT(1);
while (lt1 == IToken.t_catch) {
int startOffset = consume().getOffset();
@@ -4195,7 +4180,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
handler.setCatchBody(compoundStatement);
}
}
-
+
collection.add(handler);
lt1 = LTcatchEOF(1);
}
@@ -4216,14 +4201,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
final int endOffset = figureEndOffset(declSpec, declarator);
- final IASTSimpleDeclaration decl= nodeFactory.newSimpleDeclaration(declSpec);
- if (declarator != null)
+ final IASTSimpleDeclaration decl= nodeFactory.newSimpleDeclaration(declSpec);
+ if (declarator != null)
decl.addDeclarator(declarator);
((ASTNode) decl).setOffsetAndLength(startOffset, endOffset - startOffset);
return decl;
}
-
protected IASTStatement catchBlockCompoundStatement() throws BacktrackException, EndOfFileException {
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
int offset = LA(1).getOffset();
@@ -4248,11 +4232,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
translationUnit = nodeFactory.newTranslationUnit(scanner);
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) {
IScope tuScope = translationUnit.getScope();
-
+
IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope);
for (IBinding binding : bindings) {
ASTInternal.addBinding(tuScope, binding);
@@ -4260,7 +4243,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
}
-
private void consumeArrayModifiers(DeclarationOptions option, List collection)
throws EndOfFileException, BacktrackException {
boolean allowExpression= option == DeclarationOptions.TYPEID_NEW;
@@ -4288,7 +4270,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return;
}
-
@Override
protected IASTTranslationUnit getTranslationUnit() {
return translationUnit;
@@ -4362,7 +4343,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
translationUnit = null;
}
-
@Override
protected IASTStatement parseWhileStatement() throws EndOfFileException, BacktrackException {
int startOffset = consume().getOffset();
@@ -4386,7 +4366,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
while_statement = nodeFactory.newWhileStatement((IASTExpression)while_condition, while_body);
else
while_statement = nodeFactory.newWhileStatement((IASTDeclaration)while_condition, while_body);
-
+
((ASTNode) while_statement).setOffsetAndLength(startOffset,
(while_body != null ? calculateEndOffset(while_body) : LA(1).getEndOffset()) - startOffset);
return while_statement;
@@ -4397,7 +4377,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IASTExpression e= null;
IASTSimpleDeclaration decl= null;
IToken end= null;
-
+
IToken mark = mark();
try {
decl= simpleSingleDeclaration(DeclarationOptions.CONDITION);
@@ -4406,7 +4386,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (la != expectToken && la != IToken.tEOC) {
end= null;
decl= null;
- }
+ }
} catch (BacktrackException b) {
}
@@ -4421,7 +4401,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
if (end == null)
return e;
-
final int endOffset = end.getOffset();
final int endOffset2 = end2.getOffset();
@@ -4430,8 +4409,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
setRange(ambig, e);
return ambig;
}
-
- if (endOffset < endOffset2)
+
+ if (endOffset < endOffset2)
return e;
} catch (BacktrackException bt) {
if (end == null) {
@@ -4446,7 +4425,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return decl;
}
-
@Override
protected ASTVisitor createAmbiguityNodeVisitor() {
return new CPPASTAmbiguityResolver();
@@ -4465,7 +4443,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
int so = consume(IToken.t_if).getOffset();
consume(IToken.tLPAREN);
// condition
- IASTNode condition= cppStyleCondition(IToken.tRPAREN);
+ IASTNode condition= cppStyleCondition(IToken.tRPAREN);
if (LT(1) == IToken.tEOC) {
// Completing in the condition
ICPPASTIfStatement new_if = nodeFactory.newIfStatement();
@@ -4481,11 +4459,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
consume(IToken.tRPAREN);
-
IASTStatement thenClause = statement();
ICPPASTIfStatement new_if_statement = nodeFactory.newIfStatement();
((ASTNode) new_if_statement).setOffset(so);
- if (condition != null && (condition instanceof IASTExpression || condition instanceof IASTDeclaration))
+ if (condition != null && (condition instanceof IASTExpression || condition instanceof IASTDeclaration))
// shouldn't be possible but failure in condition() makes it so
{
if (condition instanceof IASTExpression)
@@ -4545,7 +4522,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return result;
}
-
@Override
protected IASTCompoundStatement functionBody() throws EndOfFileException, BacktrackException {
++functionBodyCount;
@@ -4580,7 +4556,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
} else if (switch_condition instanceof IASTDeclaration) {
switch_statement.setControllerDeclaration((IASTDeclaration) switch_condition);
}
-
+
if (switch_body != null) {
switch_statement.setBody(switch_body);
}
@@ -4613,7 +4589,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
return setRange(forStmt, offset, endOffset);
}
-
+
// Look for "for-range-declaration : for-range-initializer"
// for-range-declaration:
// attribute-specifier? type-specifier-seq declarator
@@ -4633,7 +4609,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
default:
init= expression();
}
-
+
ICPPASTRangeBasedForStatement result = nodeFactory.newRangeBasedForStatement();
result.setDeclaration(decl);
result.setInitializerClause(init);
@@ -4644,7 +4620,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
final IASTStatement initStmt = forInitStatement();
IASTNode condition= null;
IASTExpression iterExpr= null;
-
+
int lt1 = LT(1);
if (lt1 != IToken.tSEMI && lt1 != IToken.tEOC) {
condition = cppStyleCondition(IToken.tSEMI);
@@ -4655,13 +4631,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (lt1 != IToken.tRPAREN && lt1 != IToken.tEOC) {
iterExpr = expression();
}
-
+
ICPPASTForStatement result = nodeFactory.newForStatement();
result.setInitializerStatement(initStmt);
if (condition instanceof IASTExpression) {
result.setConditionExpression((IASTExpression) condition);
} else if (condition instanceof IASTDeclaration) {
- result.setConditionDeclaration((IASTDeclaration) condition);
+ result.setConditionDeclaration((IASTDeclaration) condition);
}
result.setIterationExpression(iterExpr);
return result;
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index 8ce68747762..42387484aef 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -95,7 +95,6 @@ import com.ibm.icu.text.MessageFormat;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class CCorePlugin extends Plugin {
-
public static final int STATUS_CDTPROJECT_EXISTS = 1;
public static final int STATUS_CDTPROJECT_MISMATCH = 2;
public static final int CDT_PROJECT_NATURE_ID_MISMATCH = 3;
@@ -299,7 +298,6 @@ public class CCorePlugin extends Plugin {
return fgCPlugin;
}
-
/**
* @see Plugin#shutdown
*/
@@ -510,7 +508,6 @@ public class CCorePlugin extends Plugin {
getDefault().savePluginPreferences();
}
-
/**
* Create CDT console adapter for build console defined as an extension.
* See {@code org.eclipse.cdt.core.CBuildConsole} extension point.
@@ -833,61 +830,61 @@ public class CCorePlugin extends Plugin {
final IProject projectHandle,
final String bsId,
IProgressMonitor monitor)
- throws CoreException, OperationCanceledException {
+ throws CoreException, OperationCanceledException {
- getWorkspace().run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
- if (!projectHandle.exists()) {
- projectHandle.create(description, new SubProgressMonitor(monitor, 1));
- }
-
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
-
- // Open first.
- projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
-
-// mapCProjectOwner(projectHandle, projectID, false);
-
- // Add C Nature ... does not add duplicates
- CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
-
- if(bsId != null){
- ICProjectDescription projDes = createProjectDescription(projectHandle, true);
- ICConfigurationDescription cfgs[] = projDes.getConfigurations();
- ICConfigurationDescription cfg = null;
- for (ICConfigurationDescription cfg2 : cfgs) {
- if(bsId.equals(cfg2.getBuildSystemId())){
- cfg = cfg2;
- break;
- }
- }
-
- if(cfg == null){
- ICConfigurationDescription prefCfg = getPreferenceConfiguration(bsId);
- if(prefCfg != null){
- cfg = projDes.createConfiguration(CDataUtil.genId(prefCfg.getId()), prefCfg.getName(), prefCfg);
- }
- }
-
- if(cfg != null){
- setProjectDescription(projectHandle, projDes);
- }
- }
- } finally {
- monitor.done();
+ getWorkspace().run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ try {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
}
+ monitor.beginTask("Creating C Project...", 3); //$NON-NLS-1$
+ if (!projectHandle.exists()) {
+ projectHandle.create(description, new SubProgressMonitor(monitor, 1));
+ }
+
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ // Open first.
+ projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1));
+
+ // mapCProjectOwner(projectHandle, projectID, false);
+
+ // Add C Nature ... does not add duplicates
+ CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
+
+ if (bsId != null){
+ ICProjectDescription projDes = createProjectDescription(projectHandle, true);
+ ICConfigurationDescription cfgs[] = projDes.getConfigurations();
+ ICConfigurationDescription cfg = null;
+ for (ICConfigurationDescription cfg2 : cfgs) {
+ if (bsId.equals(cfg2.getBuildSystemId())){
+ cfg = cfg2;
+ break;
+ }
+ }
+
+ if (cfg == null){
+ ICConfigurationDescription prefCfg = getPreferenceConfiguration(bsId);
+ if (prefCfg != null){
+ cfg = projDes.createConfiguration(CDataUtil.genId(prefCfg.getId()), prefCfg.getName(), prefCfg);
+ }
+ }
+
+ if (cfg != null){
+ setProjectDescription(projectHandle, projDes);
+ }
+ }
+ } finally {
+ monitor.done();
}
- }, getWorkspace().getRoot(), 0, monitor);
- return projectHandle;
- }
+ }
+ }, getWorkspace().getRoot(), 0, monitor);
+ return projectHandle;
+ }
/**
* Method convertProjectFromCtoCC converts
@@ -899,7 +896,6 @@ public class CCorePlugin extends Plugin {
* @param monitor
* @throws CoreException
*/
-
public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
if ((projectHandle != null)
&& projectHandle.hasNature(CProjectNature.C_NATURE_ID)
@@ -974,7 +970,7 @@ public class CCorePlugin extends Plugin {
for (IConfigurationElement configElement : configElements) {
if (configElement.getName().equals("processList")) { //$NON-NLS-1$
String platform = configElement.getAttribute("platform"); //$NON-NLS-1$
- if (platform == null ) { // first contributor found with not platform will be default.
+ if (platform == null) { // first contributor found with not platform will be default.
if (defaultContributor == null) {
defaultContributor = configElement;
}
@@ -985,12 +981,11 @@ public class CCorePlugin extends Plugin {
}
}
}
- if ( defaultContributor != null) {
+ if (defaultContributor != null) {
return (IProcessList) defaultContributor.createExecutableExtension("class"); //$NON-NLS-1$
}
}
return null;
-
}
/**
@@ -1024,7 +1019,7 @@ public class CCorePlugin extends Plugin {
try {
// Look up in session property for previously created provider
QualifiedName scannerInfoProviderName = new QualifiedName(PLUGIN_ID, SCANNER_INFO_PROVIDER2_NAME);
- provider = (IScannerInfoProvider)project.getSessionProperty(scannerInfoProviderName);
+ provider = (IScannerInfoProvider) project.getSessionProperty(scannerInfoProviderName);
if (provider != null)
return provider;
@@ -1117,8 +1112,6 @@ public class CCorePlugin extends Plugin {
CContentTypes.setUseProjectSpecificContentTypes(project, val);
}
-
-
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_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$
@@ -1130,27 +1123,25 @@ public class CCorePlugin extends Plugin {
* Configure the plug-in with respect to option settings defined in ".options" file
*/
public void configurePluginDebugOptions() {
-
- if(CCorePlugin.getDefault().isDebugging()) {
+ if (CCorePlugin.getDefault().isDebugging()) {
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$
option = Platform.getDebugOption(PARSER_EXCEPTIONS);
- if( option != null ) Util.PARSER_EXCEPTIONS = option.equalsIgnoreCase("true"); //$NON-NLS-1$
+ if (option != null) Util.PARSER_EXCEPTIONS = option.equalsIgnoreCase("true"); //$NON-NLS-1$
option = Platform.getDebugOption(SCANNER);
- if( option != null ) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true"); //$NON-NLS-1$
+ if (option != null) Util.VERBOSE_SCANNER = option.equalsIgnoreCase("true"); //$NON-NLS-1$
option = Platform.getDebugOption(MODEL);
- if(option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
+ if (option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
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) {
getPluginPreferences().setValue(PREF_USE_STRUCTURAL_PARSE_MODE, useNewParser);
savePluginPreferences();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java
index b183769b80a..6aed8cca197 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tomasz Wesolowski - initial API and implementation
+ * Tomasz Wesolowski - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.editor;
@@ -52,13 +52,10 @@ import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
public class OverrideIndicatorManager implements ICReconcilingListener {
-
static final String ANNOTATION_TYPE = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
-
private static final String MESSAGE_SEPARATOR = ";\n"; //$NON-NLS-1$
public static class OverrideInfo {
-
public int nodeOffset;
public int resultType;
public String message;
@@ -79,7 +76,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
public static final int RESULT_SHADOWS = 2;
public class OverrideIndicator extends Annotation {
-
public static final String ANNOTATION_TYPE_ID = "org.eclipse.cdt.ui.overrideIndicator"; //$NON-NLS-1$
private int type;
private ICElementHandle declaration;
@@ -108,9 +104,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
CDTUITools.openInEditor(declaration, true, true);
} catch (CoreException e) {
}
-
}
-
}
private IAnnotationModel fAnnotationModel;
@@ -123,7 +117,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
}
private void handleResult(OverrideInfo info, IIndex index) {
-
Position position = new Position(info.nodeOffset, info.nodeLength);
OverrideIndicator indicator = new OverrideIndicator(info.resultType, info.message, info.binding, index);
@@ -166,7 +159,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
}
if (binding instanceof ICPPMethod) {
method = (ICPPMethod) binding;
- OverrideInfo overrideInfo = testForOverride(method, declaration.getFileLocation());
+ OverrideInfo overrideInfo = checkForOverride(method, declaration);
if (overrideInfo != null) {
handleResult(overrideInfo, index);
}
@@ -209,7 +202,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return PROCESS_SKIP;
}
ICPPMethod method = (ICPPMethod) definitionBinding;
- OverrideInfo overrideInfo = testForOverride(method, definition.getFileLocation());
+ OverrideInfo overrideInfo = checkForOverride(method, definition);
if (overrideInfo != null) {
handleResult(overrideInfo, index);
}
@@ -223,8 +216,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
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();
boolean onlyPureVirtual = true;
@@ -301,7 +294,6 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return info;
}
return null;
-
}
/**
@@ -314,8 +306,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
* @throws DOMException
*/
private static void handleBaseClass(ICPPClassType aClass, ICPPMethod testedOverride,
- Set foundMethods, Set shadowedMethods, Set alreadyTestedBases) throws DOMException {
-
+ Set foundMethods, Set shadowedMethods,
+ Set alreadyTestedBases) throws DOMException {
if (alreadyTestedBases.contains(aClass)) {
return;
} else {
@@ -427,5 +419,4 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
}
return annotationModel;
}
-
}