|
PTP Release 7.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.cdt.core.dom.ast.ASTVisitor
org.eclipse.cdt.core.dom.ast.c.CASTVisitor
org.eclipse.ptp.pldt.common.analysis.PldtAstVisitor
public abstract class PldtAstVisitor
This dom-walker helper collects interesting constructs (currently
function calls and constants), and adds markers to the source file for
C/C++ code.
This base class encapsulates the common behaviors for both C and C++
code and for visitors looking for MPI, OpenMP, LAPI, etc. etc. types of artifacts
| Field Summary | |
|---|---|
protected boolean |
allowPrefixOnlyMatch
|
static java.lang.String |
ARTIFACT_CALL
|
static java.lang.String |
ARTIFACT_CONSTANT
|
protected static java.lang.String |
ARTIFACT_NAME
|
protected static java.lang.String |
PREFIX
|
| Fields inherited from class org.eclipse.cdt.core.dom.ast.ASTVisitor |
|---|
includeInactiveNodes, PROCESS_ABORT, PROCESS_CONTINUE, PROCESS_SKIP, shouldVisitAmbiguousNodes, shouldVisitArrayModifiers, shouldVisitAttributes, shouldVisitBaseSpecifiers, shouldVisitCaptures, shouldVisitDeclarations, shouldVisitDeclarators, shouldVisitDeclSpecifiers, shouldVisitDesignators, shouldVisitEnumerators, shouldVisitExpressions, shouldVisitImplicitNameAlternates, shouldVisitImplicitNames, shouldVisitInitializers, shouldVisitNames, shouldVisitNamespaces, shouldVisitParameterDeclarations, shouldVisitPointerOperators, shouldVisitProblems, shouldVisitStatements, shouldVisitTemplateParameters, shouldVisitTokens, shouldVisitTranslationUnit, shouldVisitTypeIds |
| Constructor Summary | |
|---|---|
PldtAstVisitor(java.util.List<java.lang.String> includes,
java.lang.String fileName,
boolean prefixOnlyMatch,
ScanReturn scanReturn)
|
|
PldtAstVisitor(java.util.List<java.lang.String> includes,
java.lang.String fileName,
ScanReturn scanReturn)
Constructor without prefixOnlyMatch arg, assumes false |
|
| Method Summary | |
|---|---|
boolean |
addIncludePath(org.eclipse.core.runtime.IPath path,
java.lang.String name,
boolean dontAskAgain)
Add an include path to the prefs - probably found dynamically during analysis and requested to be added by the user Note that the path will be to the actual file in which the name was found; the path that will be added to the prefs is the parent directory of that file. |
boolean |
allowIncludePathAdd()
allow dynamic adding to include path? |
boolean[] |
askUI(java.lang.String title,
java.lang.String message,
boolean dontAskAgain)
Dialog to ask a question in the UI thread, and return its answer plus a persistent setting for not asking the same question again. |
protected java.lang.String |
chooseName(java.lang.String bindingName,
java.lang.String rawSignature)
Choose how to distinguish between binding name, and raw signature. |
java.util.List |
convertToList(java.lang.String stringList)
Convert a string to a list with given delimiters |
protected java.lang.String |
getIncludesPrefID()
needs to be overrridden for derived classes that need to dynamically update the pref store e.g. for the includes path |
protected org.eclipse.jface.preference.IPreferenceStore |
getPreferenceStore()
needs to be overrridden for derived classes that need to dynamically update the pref store e.g. for the includes path |
protected java.lang.String |
getTypeName()
needs to be overrridden for derived classes that need to dynamically update the pref store e.g. for the includes path. |
protected boolean |
isArtifact(org.eclipse.cdt.core.dom.ast.IASTName funcName)
Determines if the funcName is an instance of the type of artifact in which we are interested. |
abstract boolean |
matchesPrefix(java.lang.String name)
will be overridden where needed; note that for C code, the test for if the prefix matches has already been done before this is called so this test isn't necessary. |
void |
processExprWithConstant(org.eclipse.cdt.core.dom.ast.IASTExpression astExpr)
Look for artifacts in an IASTExpression |
void |
processFuncName(org.eclipse.cdt.core.dom.ast.IASTName funcName,
org.eclipse.cdt.core.dom.ast.IASTExpression astExpr)
Process a function name from an expression and determine if it should be marked as an Artifact. |
void |
processIdExprAsLiteral(org.eclipse.cdt.core.dom.ast.IASTIdExpression expression)
Look for artifacts within a IASTIdExpression |
void |
processMacroLiteral(org.eclipse.cdt.core.dom.ast.IASTLiteralExpression expression)
|
protected void |
replaceIncludes(java.lang.String includes)
Replace the includes list in this visitor so the change will be recognized. |
int |
visit(org.eclipse.cdt.core.dom.ast.IASTDeclaration declaration)
Skip decls that are included. |
int |
visit(org.eclipse.cdt.core.dom.ast.IASTExpression expression)
Visit an ast node of type IASTExpression. |
int |
visit(org.eclipse.cdt.core.dom.ast.IASTStatement statement)
Skip statements that are included. |
| Methods inherited from class org.eclipse.cdt.core.dom.ast.ASTVisitor |
|---|
leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, leave, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.cdt.core.dom.ast.c.ICASTVisitor |
|---|
leave, visit |
| Field Detail |
|---|
public static java.lang.String ARTIFACT_CALL
public static java.lang.String ARTIFACT_CONSTANT
protected static java.lang.String ARTIFACT_NAME
protected static java.lang.String PREFIX
protected boolean allowPrefixOnlyMatch
| Constructor Detail |
|---|
public PldtAstVisitor(java.util.List<java.lang.String> includes,
java.lang.String fileName,
boolean prefixOnlyMatch,
ScanReturn scanReturn)
includes - list of include paths that we'll probably want to consider in
the work that this visitor doesfileName - the name of the file that this visitor is visiting(?)prefixOnlyMatch - if true, then artifact is recognized if it starts with the plugin-specific prefix
(e.g. "MPI_" etc.) instead of forcing a lookup of the location of the header file
in which the API is found. This proves to be difficult for users to get right, so prefix-only
recognition of artifacts is allowed here.scanReturn - the ScanReturn object to which the artifacts that we find will
be appended.
public PldtAstVisitor(java.util.List<java.lang.String> includes,
java.lang.String fileName,
ScanReturn scanReturn)
| Method Detail |
|---|
public int visit(org.eclipse.cdt.core.dom.ast.IASTStatement statement)
visit in class org.eclipse.cdt.core.dom.ast.ASTVisitorpublic int visit(org.eclipse.cdt.core.dom.ast.IASTExpression expression)
visit in class org.eclipse.cdt.core.dom.ast.ASTVisitorpublic int visit(org.eclipse.cdt.core.dom.ast.IASTDeclaration declaration)
visit in class org.eclipse.cdt.core.dom.ast.ASTVisitordeclaration -
public void processFuncName(org.eclipse.cdt.core.dom.ast.IASTName funcName,
org.eclipse.cdt.core.dom.ast.IASTExpression astExpr)
astExpr - funcName - public void processExprWithConstant(org.eclipse.cdt.core.dom.ast.IASTExpression astExpr)
astExpr - protected boolean isArtifact(org.eclipse.cdt.core.dom.ast.IASTName funcName)
funcName -
protected java.lang.String chooseName(java.lang.String bindingName,
java.lang.String rawSignature)
bindingName - rawSignature -
public void processMacroLiteral(org.eclipse.cdt.core.dom.ast.IASTLiteralExpression expression)
public void processIdExprAsLiteral(org.eclipse.cdt.core.dom.ast.IASTIdExpression expression)
expression - public boolean allowIncludePathAdd()
protected void replaceIncludes(java.lang.String includes)
includes - public java.util.List convertToList(java.lang.String stringList)
stringList -
public boolean addIncludePath(org.eclipse.core.runtime.IPath path,
java.lang.String name,
boolean dontAskAgain)
path - name - the name (function etc) that was found in the pathdontAskAgain - initial value of toggle "don't ask again"protected java.lang.String getTypeName()
protected java.lang.String getIncludesPrefID()
protected org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
public boolean[] askUI(java.lang.String title,
java.lang.String message,
boolean dontAskAgain)
title - message - dontAskAgain - allows persistent setting to not ask this question again
public abstract boolean matchesPrefix(java.lang.String name)
name -
|
PTP Release 7.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||