public abstract class PldtAstVisitor
extends CASTVisitor
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowPrefixOnlyMatch |
static String |
ARTIFACT_CALL |
static String |
ARTIFACT_CONSTANT |
protected static String |
ARTIFACT_NAME |
protected static String |
PREFIX |
Constructor and Description |
---|
PldtAstVisitor(List<String> includes,
String fileName,
boolean prefixOnlyMatch,
ScanReturn scanReturn) |
PldtAstVisitor(List<String> includes,
String fileName,
ScanReturn scanReturn)
Constructor without prefixOnlyMatch arg, assumes false
|
Modifier and Type | Method and Description |
---|---|
boolean |
addIncludePath(IPath path,
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(String title,
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 String |
chooseName(String bindingName,
String rawSignature)
Choose how to distinguish between binding name, and raw signature.
|
List |
convertToList(String stringList)
Convert a string to a list with given delimiters
|
protected String |
getIncludesPrefID()
needs to be overrridden for derived classes that need to dynamically update the pref store
e.g. for the includes path
|
protected IPreferenceStore |
getPreferenceStore()
needs to be overrridden for derived classes that need to dynamically update the pref store
e.g. for the includes path
|
protected 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(IASTName funcName)
Determines if the funcName is an instance of the type of artifact in
which we are interested.
|
abstract boolean |
matchesPrefix(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(IASTExpression astExpr)
Look for artifacts in an IASTExpression
|
void |
processFuncName(IASTName funcName,
IASTExpression astExpr)
Process a function name from an expression and determine if it should be
marked as an Artifact.
|
void |
processIdExprAsLiteral(IASTIdExpression expression)
Look for artifacts within a IASTIdExpression
|
void |
processMacroLiteral(IASTLiteralExpression expression) |
protected void |
replaceIncludes(String includes)
Replace the includes list in this visitor so the change will be recognized.
|
int |
visit(IASTDeclaration declaration)
Skip decls that are included.
|
int |
visit(IASTExpression expression)
Visit an ast node of type IASTExpression.
|
int |
visit(IASTStatement statement)
Skip statements that are included.
|
public static String ARTIFACT_CALL
public static String ARTIFACT_CONSTANT
protected static String ARTIFACT_NAME
protected static String PREFIX
protected boolean allowPrefixOnlyMatch
public PldtAstVisitor(List<String> includes, 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(List<String> includes, String fileName, ScanReturn scanReturn)
public int visit(IASTStatement statement)
public int visit(IASTExpression expression)
public int visit(IASTDeclaration declaration)
declaration
- public void processFuncName(IASTName funcName, IASTExpression astExpr)
astExpr
- funcName
- public void processExprWithConstant(IASTExpression astExpr)
astExpr
- protected boolean isArtifact(IASTName funcName)
funcName
- protected String chooseName(String bindingName, String rawSignature)
bindingName
- rawSignature
- public void processMacroLiteral(IASTLiteralExpression expression)
public void processIdExprAsLiteral(IASTIdExpression expression)
expression
- public boolean allowIncludePathAdd()
protected void replaceIncludes(String includes)
includes
- public List convertToList(String stringList)
stringList
- public boolean addIncludePath(IPath path, 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 String getTypeName()
protected String getIncludesPrefID()
protected IPreferenceStore getPreferenceStore()
public boolean[] askUI(String title, String message, boolean dontAskAgain)
title
- message
- dontAskAgain
- allows persistent setting to not ask this question againpublic abstract boolean matchesPrefix(String name)
name
- Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.