mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 02:05:39 +02:00
Cosmetics.
This commit is contained in:
parent
84e82daec5
commit
5337c7707b
25 changed files with 423 additions and 470 deletions
|
@ -11,14 +11,12 @@
|
||||||
package org.eclipse.cdt.core.model;
|
package org.eclipse.cdt.core.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IDeclaration is a base interface for any C Model element that could be
|
* Base interface for any C Model element that could be considered a declaration.
|
||||||
* considered a declaration.
|
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IDeclaration extends ICElement, ISourceManipulation, ISourceReference {
|
public interface IDeclaration extends ICElement, ISourceManipulation, ISourceReference {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the declaration is static
|
* Checks if the declaration is static
|
||||||
* Returns true if the declaration is static, false otherwise.
|
* Returns true if the declaration is static, false otherwise.
|
||||||
|
@ -29,7 +27,7 @@ public interface IDeclaration extends ICElement, ISourceManipulation, ISourceRef
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the declaration is constant.
|
* Checks if the declaration is constant.
|
||||||
* Returns true if the decalration is constant, false otherwise.
|
* Returns true if the declaration is constant, false otherwise.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws CModelException
|
* @throws CModelException
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.model;
|
package org.eclipse.cdt.core.model;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a function
|
* Represents a function
|
||||||
*
|
*
|
||||||
|
@ -18,7 +17,6 @@ package org.eclipse.cdt.core.model;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IFunctionDeclaration extends IDeclaration {
|
public interface IFunctionDeclaration extends IDeclaration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type signatures of the exceptions this method throws,
|
* Returns the type signatures of the exceptions this method throws,
|
||||||
* in the order declared in the source. Returns an empty array
|
* in the order declared in the source. Returns an empty array
|
||||||
|
|
|
@ -17,5 +17,4 @@ package org.eclipse.cdt.core.model;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IMethod extends IMethodDeclaration {
|
public interface IMethod extends IMethodDeclaration {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.model;
|
package org.eclipse.cdt.core.model;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the declaration method of a class
|
* Represents the declaration method of a class
|
||||||
*
|
*
|
||||||
|
@ -18,7 +17,6 @@ package org.eclipse.cdt.core.model;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
|
public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this method is a constructor.
|
* Returns whether this method is a constructor.
|
||||||
*
|
*
|
||||||
|
@ -78,5 +76,4 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
|
||||||
* return true if the member is a friend.
|
* return true if the member is a friend.
|
||||||
*/
|
*/
|
||||||
public boolean isFriend() throws CModelException;
|
public boolean isFriend() throws CModelException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic visitor for ast-nodes.
|
* Generic visitor for AST nodes.
|
||||||
* <p> Clients may subclass. </p>
|
* <p> Clients may subclass. </p>
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public abstract class ASTGenericVisitor extends ASTVisitor implements ICPPASTVisitor, ICASTVisitor {
|
public abstract class ASTGenericVisitor extends ASTVisitor implements ICPPASTVisitor, ICASTVisitor {
|
||||||
|
|
||||||
public ASTGenericVisitor(boolean visitNodes) {
|
public ASTGenericVisitor(boolean visitNodes) {
|
||||||
super(visitNodes);
|
super(visitNodes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base class for all visitors to traverse ast nodes. <br>
|
* Abstract base class for all visitors to traverse AST nodes. <br>
|
||||||
* visit() methods implement a top-down traversal, and <br>
|
* visit() methods implement a top-down traversal, and <br>
|
||||||
* leave() methods implement a bottom-up traversal. <br>
|
* leave() methods implement a bottom-up traversal. <br>
|
||||||
*
|
*
|
||||||
|
@ -142,7 +142,6 @@ public abstract class ASTVisitor {
|
||||||
*/
|
*/
|
||||||
public boolean shouldVisitAmbiguousNodes = false;
|
public boolean shouldVisitAmbiguousNodes = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implicit names are created to allow implicit bindings to be resolved,
|
* Implicit names are created to allow implicit bindings to be resolved,
|
||||||
* normally they are not visited, set this flag to true to visit them.
|
* normally they are not visited, set this flag to true to visit them.
|
||||||
|
@ -150,7 +149,6 @@ public abstract class ASTVisitor {
|
||||||
*/
|
*/
|
||||||
public boolean shouldVisitImplicitNames = false;
|
public boolean shouldVisitImplicitNames = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sometimes more than one implicit name is created for a binding,
|
* Sometimes more than one implicit name is created for a binding,
|
||||||
* set this flag to true to visit more than one name for an implicit binding.
|
* set this flag to true to visit more than one name for an implicit binding.
|
||||||
|
@ -158,7 +156,6 @@ public abstract class ASTVisitor {
|
||||||
*/
|
*/
|
||||||
public boolean shouldVisitImplicitNameAlternates = false;
|
public boolean shouldVisitImplicitNameAlternates = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a visitor that does not visit any kind of node per default.
|
* Creates a visitor that does not visit any kind of node per default.
|
||||||
*/
|
*/
|
||||||
|
@ -329,6 +326,7 @@ public abstract class ASTVisitor {
|
||||||
public int leave(IASTArrayModifier arrayModifier) {
|
public int leave(IASTArrayModifier arrayModifier) {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@ -398,6 +396,7 @@ public abstract class ASTVisitor {
|
||||||
public int visit( IASTComment comment){
|
public int visit( IASTComment comment){
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use {@link IASTTranslationUnit#getComments()}, instead.
|
* @deprecated use {@link IASTTranslationUnit#getComments()}, instead.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTBreakStatement extends IASTStatement {
|
public interface IASTBreakStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTCaseStatement extends IASTStatement {
|
public interface IASTCaseStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>ASTNodeProperty</code> that represents the relationship between a
|
* <code>ASTNodeProperty</code> that represents the relationship between a
|
||||||
* case statement and the expression it contains.
|
* case statement and the expression it contains.
|
||||||
|
@ -30,7 +29,6 @@ public interface IASTCaseStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The expression that determines whether this case should be taken.
|
* The expression that determines whether this case should be taken.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public IASTExpression getExpression();
|
public IASTExpression getExpression();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTContinueStatement extends IASTStatement {
|
public interface IASTContinueStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTDeclarationStatement extends IASTStatement {
|
public interface IASTDeclarationStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>DECLARATION</code> represents the relationship between a
|
* <code>DECLARATION</code> represents the relationship between a
|
||||||
* declaration statement and the declaration it wraps.
|
* declaration statement and the declaration it wraps.
|
||||||
|
@ -50,5 +49,4 @@ public interface IASTDeclarationStatement extends IASTStatement {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IASTDeclarationStatement copy(CopyStyle style);
|
public IASTDeclarationStatement copy(CopyStyle style);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTDefaultStatement extends IASTStatement {
|
public interface IASTDefaultStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,13 +17,13 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTDoStatement extends IASTStatement {
|
public interface IASTDoStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>BODY</code> represents the relationship between a
|
* <code>BODY</code> represents the relationship between a
|
||||||
* <code>IASTDoStatement</code> and its nested body
|
* <code>IASTDoStatement</code> and its nested body
|
||||||
* <code>IASTStatement</code>.
|
* <code>IASTStatement</code>.
|
||||||
*/
|
*/
|
||||||
public static final ASTNodeProperty BODY = new ASTNodeProperty("IASTDoStatement.BODY - nested body for IASTDoStatement"); //$NON-NLS-1$
|
public static final ASTNodeProperty BODY =
|
||||||
|
new ASTNodeProperty("IASTDoStatement.BODY - nested body for IASTDoStatement"); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>CONDITION</code> represents the relationship between a
|
* <code>CONDITION</code> represents the relationship between a
|
||||||
|
@ -74,5 +74,4 @@ public interface IASTDoStatement extends IASTStatement {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IASTDoStatement copy(CopyStyle style);
|
public IASTDoStatement copy(CopyStyle style);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTNameOwner {
|
public interface IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Role of name in this context is a declaration.
|
* Role of name in this context is a declaration.
|
||||||
*/
|
*/
|
||||||
|
@ -45,5 +44,4 @@ public interface IASTNameOwner {
|
||||||
* @return r_definition, r_declaration, r_reference or r_unclear.
|
* @return r_definition, r_declaration, r_reference or r_unclear.
|
||||||
*/
|
*/
|
||||||
public int getRoleForName(IASTName name);
|
public int getRoleForName(IASTName name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,5 +33,4 @@ public interface IASTStatement extends IASTNode {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IASTStatement copy(CopyStyle style);
|
public IASTStatement copy(CopyStyle style);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTSwitchStatement extends IASTStatement {
|
public interface IASTSwitchStatement extends IASTStatement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>CONTROLLER_EXP</code> represents the relationship between an
|
* <code>CONTROLLER_EXP</code> represents the relationship between an
|
||||||
* <code>IASTSwitchStatement</code> and it's nested
|
* <code>IASTSwitchStatement</code> and it's nested
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each IASTName segment has property being <code>SEGMENT_NAME</code>.
|
* Each IASTName segment has property being <code>SEGMENT_NAME</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +30,7 @@ public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Add a subname.
|
* Add a subname.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name <code>IASTName</code>
|
||||||
* <code>IASTName</code>
|
|
||||||
*/
|
*/
|
||||||
public void addName(IASTName name);
|
public void addName(IASTName name);
|
||||||
|
|
||||||
|
@ -45,7 +43,6 @@ public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last name is often semantically significant.
|
* The last name is often semantically significant.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IASTName getLastName();
|
public IASTName getLastName();
|
||||||
|
@ -60,15 +57,13 @@ public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Set this name to be fully qualified or not (true/false).
|
* Set this name to be fully qualified or not (true/false).
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value boolean
|
||||||
* boolean
|
|
||||||
*/
|
*/
|
||||||
public void setFullyQualified(boolean value);
|
public void setFullyQualified(boolean value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used to check if the ICPPASTQualifiedName's last segment is
|
* This is used to check if the ICPPASTQualifiedName's last segment is
|
||||||
* an ICPPASTConversionName or an ICPPASTOperatorName.
|
* an ICPPASTConversionName or an ICPPASTOperatorName.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public boolean isConversionOrOperator();
|
public boolean isConversionOrOperator();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
|
@ -33,7 +32,6 @@ public interface ICPPASTRangeBasedForStatement extends IASTStatement, IASTImplic
|
||||||
public static final ASTNodeProperty BODY = new ASTNodeProperty(
|
public static final ASTNodeProperty BODY = new ASTNodeProperty(
|
||||||
"ICPPASTRangeBasedForStatement.BODY [IASTStatement]"); //$NON-NLS-1$
|
"ICPPASTRangeBasedForStatement.BODY [IASTStatement]"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the for-range-declaration
|
* Returns the for-range-declaration
|
||||||
*/
|
*/
|
||||||
|
@ -60,7 +58,6 @@ public interface ICPPASTRangeBasedForStatement extends IASTStatement, IASTImplic
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTRangeBasedForStatement copy(CopyStyle style);
|
public ICPPASTRangeBasedForStatement copy(CopyStyle style);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not allowed on frozen AST.
|
* Not allowed on frozen AST.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon - Initial API and implementation
|
* John Camelon - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Sergey Prigoin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class ASTNodeSpecification<T extends IASTNode> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void visit(ASTNode astNode, IASTImageLocation imageLocation) {
|
public void visit(ASTNode astNode, IASTImageLocation imageLocation) {
|
||||||
if (isAcceptableNode(astNode) && imageLocation != null) {
|
if (isAcceptableNode(astNode) && imageLocation != null) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTBreakStatement extends ASTNode implements IASTBreakStatement {
|
public class CPPASTBreakStatement extends ASTNode implements IASTBreakStatement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
|
@ -35,7 +34,6 @@ public class CPPASTBreakStatement extends ASTNode implements IASTBreakStatement
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
|
|
||||||
public class CPPASTReturnStatement extends ASTNode implements IASTReturnStatement, IASTAmbiguityParent {
|
public class CPPASTReturnStatement extends ASTNode implements IASTReturnStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTInitializerClause retValue;
|
private IASTInitializerClause retValue;
|
||||||
|
|
||||||
public CPPASTReturnStatement() {
|
public CPPASTReturnStatement() {
|
||||||
|
@ -37,8 +36,8 @@ public class CPPASTReturnStatement extends ASTNode implements IASTReturnStatemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTReturnStatement copy(CopyStyle style) {
|
public CPPASTReturnStatement copy(CopyStyle style) {
|
||||||
CPPASTReturnStatement copy = new CPPASTReturnStatement(retValue == null ? null
|
CPPASTReturnStatement copy =
|
||||||
: retValue.copy(style));
|
new CPPASTReturnStatement(retValue == null ? null : retValue.copy(style));
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
if (style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
copy.setCopyLocation(this);
|
copy.setCopyLocation(this);
|
||||||
|
@ -59,7 +58,6 @@ public class CPPASTReturnStatement extends ASTNode implements IASTReturnStatemen
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setReturnValue(IASTExpression returnValue) {
|
public void setReturnValue(IASTExpression returnValue) {
|
||||||
setReturnArgument(returnValue);
|
setReturnArgument(returnValue);
|
||||||
|
|
|
@ -19,13 +19,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTGenericVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTGenericVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
@ -199,6 +192,13 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection of methods to extract information from a C++ translation unit.
|
* Collection of methods to extract information from a C++ translation unit.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.ILog;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
@ -106,10 +105,9 @@ public class NodeContainer {
|
||||||
names.add(nameInfo);
|
names.add(nameInfo);
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
ILog logger = CUIPlugin.getDefault().getLog();
|
|
||||||
IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID,
|
IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID,
|
||||||
e.getMessage(), e);
|
e.getMessage(), e);
|
||||||
logger.log(status);
|
CUIPlugin.log(status);
|
||||||
}
|
}
|
||||||
} else if (binding instanceof IVariable) {
|
} else if (binding instanceof IVariable) {
|
||||||
NameInformation nameInformation = new NameInformation(name);
|
NameInformation nameInformation = new NameInformation(name);
|
||||||
|
@ -129,8 +127,8 @@ public class NodeContainer {
|
||||||
for (NameInformation nameInfo : names) {
|
for (NameInformation nameInfo : names) {
|
||||||
IASTName name = nameInfo.getName();
|
IASTName name = nameInfo.getName();
|
||||||
|
|
||||||
IASTTranslationUnit unit = name.getTranslationUnit();
|
IASTTranslationUnit ast = name.getTranslationUnit();
|
||||||
IASTName[] nameDeclarations = unit.getDeclarationsInAST(name.resolveBinding());
|
IASTName[] nameDeclarations = ast.getDeclarationsInAST(name.resolveBinding());
|
||||||
if (nameDeclarations.length != 0) {
|
if (nameDeclarations.length != 0) {
|
||||||
nameInfo.setDeclarationName(nameDeclarations[nameDeclarations.length - 1]);
|
nameInfo.setDeclarationName(nameDeclarations[nameDeclarations.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.ui.editors.text.TextEditor;
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
@ -39,6 +38,7 @@ import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
* A collection of helper methods to interact with the workbench's IDocuments and IFiles
|
* A collection of helper methods to interact with the workbench's IDocuments and IFiles
|
||||||
*/
|
*/
|
||||||
public class EclipseObjects {
|
public class EclipseObjects {
|
||||||
|
|
||||||
static public IWorkbenchPage getActivePage() {
|
static public IWorkbenchPage getActivePage() {
|
||||||
return getActiveWindow().getActivePage();
|
return getActiveWindow().getActivePage();
|
||||||
}
|
}
|
||||||
|
@ -47,16 +47,13 @@ public class EclipseObjects {
|
||||||
* @return the active, visible TextEditor
|
* @return the active, visible TextEditor
|
||||||
*/
|
*/
|
||||||
static public IEditorPart getActiveEditor() {
|
static public IEditorPart getActiveEditor() {
|
||||||
IEditorPart editor = null;
|
|
||||||
|
|
||||||
IWorkbenchPage page = getActivePage();
|
IWorkbenchPage page = getActivePage();
|
||||||
|
|
||||||
if (page.isEditorAreaVisible()
|
IEditorPart activeEditor = page.getActiveEditor();
|
||||||
&& page.getActiveEditor() != null
|
if (page.isEditorAreaVisible() && activeEditor instanceof TextEditor) {
|
||||||
&& page.getActiveEditor() instanceof TextEditor) {
|
return activeEditor;
|
||||||
editor = page.getActiveEditor();
|
|
||||||
}
|
}
|
||||||
return editor;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,12 +87,11 @@ public class EclipseObjects {
|
||||||
static public IFile getActiveFile() {
|
static public IFile getActiveFile() {
|
||||||
IEditorInput editorInput = getActiveEditor().getEditorInput();
|
IEditorInput editorInput = getActiveEditor().getEditorInput();
|
||||||
|
|
||||||
IFile aFile = null;
|
|
||||||
if (editorInput instanceof IFileEditorInput) {
|
if (editorInput instanceof IFileEditorInput) {
|
||||||
aFile = ((IFileEditorInput)editorInput).getFile();
|
return ((IFileEditorInput) editorInput).getFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
return aFile;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,38 +131,28 @@ public class EclipseObjects {
|
||||||
IFile file = getFile((IStructuredSelection) selection);
|
IFile file = getFile((IStructuredSelection) selection);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
return EclipseObjects.getActiveFile();
|
return getActiveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
static private IFile getFile(IStructuredSelection selection) {
|
static private IFile getFile(IStructuredSelection selection) {
|
||||||
IFile file = null;
|
|
||||||
Object o = selection.getFirstElement();
|
Object o = selection.getFirstElement();
|
||||||
|
|
||||||
if (o instanceof ICElement) {
|
if (o instanceof ICElement) {
|
||||||
ICElement e= (ICElement) o;
|
ICElement e= (ICElement) o;
|
||||||
IResource r= e.getUnderlyingResource();
|
IResource r= e.getUnderlyingResource();
|
||||||
if (r instanceof IFile) {
|
if (r instanceof IFile) {
|
||||||
file= (IFile) r;
|
return (IFile) r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return file;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the file at the specified path string
|
* @return the file at the specified path string
|
||||||
*/
|
*/
|
||||||
public static IFile getFileForPathString(String path) {
|
public static IFile getFileForPathString(String filePath) {
|
||||||
IPath ipath = new Path(path);
|
IPath path = new Path(filePath);
|
||||||
return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(ipath);
|
return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the file containing the node
|
|
||||||
*/
|
|
||||||
public static IFile getFile(IASTNode node){
|
|
||||||
if(node == null)
|
|
||||||
return null;
|
|
||||||
return getFileForPathString(node.getFileLocation().getFileName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue