TPTP 4.6.0 Platform Project
Public API Specification

org.eclipse.tptp.platform.analysis.codereview.cpp.rules.function
Class RuleFunctionPreferInitialization

java.lang.Object
  extended by org.eclipse.tptp.platform.analysis.core.element.AbstractAnalysisElement
      extended by org.eclipse.tptp.platform.analysis.core.rule.AbstractAnalysisRule
          extended by org.eclipse.tptp.platform.analysis.codereview.cpp.rules.function.RuleFunctionPreferInitialization
All Implemented Interfaces:
org.eclipse.core.runtime.IExecutableExtension, IAnalysisElement, IAnalysisRule

public class RuleFunctionPreferInitialization
extends AbstractAnalysisRule


Field Summary
 
Fields inherited from class org.eclipse.tptp.platform.analysis.core.element.AbstractAnalysisElement
CATEGORY_ELEMENT_TYPE, COMBO_VALUE, DETAIL_PROVIDER, PROVIDER_ELEMENT_TYPE, PROVIDER_MANAGER_ELEMENT_TYPE, RESULT_ELEMENT_TYPE, RULE_ELEMENT_TYPE
 
Constructor Summary
RuleFunctionPreferInitialization()
           
 
Method Summary
 void analyze(AnalysisHistory history)
          Analyze this rule
static boolean variableIsConstant(CodeReviewResource resource, org.eclipse.cdt.core.dom.ast.IASTNode expression, boolean searchOnlyCurrentFunction, boolean assumeThisIfDecNotFound)
          Identifies if the parameter in the given expression is a constant.
 
Methods inherited from class org.eclipse.tptp.platform.analysis.core.rule.AbstractAnalysisRule
addHistoryResultSet, getIconName, getLabelWithParameters, getLabelWithVariables, getOwnedElements, getQuickFix, getQuickFixCount, getQuickFixIterator, getViewer, hasQuickFixes, isCustom, removeHistoryResultSet, setCustom, setInitializationData, setQuickFixId
 
Methods inherited from class org.eclipse.tptp.platform.analysis.core.element.AbstractAnalysisElement
addDetailProvider, addHistoryResultSet, addOwnedElement, addOwnedElements, addParameter, addParameters, deleteHistoryResults, dispose, getDetailProviders, getElementType, getExecutionHistory, getExternalDataMap, getHelpID, getHistoryResults, getId, getLabel, getOwner, getOwnerId, getParameter, getParameterCount, getParameterList, getPluginId, getProvider, getProviderManager, getViewerID, getVisibleParameterCount, postAnalyze, preAnalyze, removeHistoryResultSet, setElementType, setExternalDataMap, setHelpID, setIconName, setId, setInitializationData, setLabel, setOwner, setOwnerId, setPluginId, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.tptp.platform.analysis.core.rule.IAnalysisRule
addParameter, addParameters, getParameter, getParameterCount, getParameterList, getProvider, getVisibleParameterCount
 
Methods inherited from interface org.eclipse.tptp.platform.analysis.core.element.IAnalysisElement
addDetailProvider, addHistoryResultSet, addOwnedElement, addOwnedElements, dispose, getDetailProviders, getElementType, getExternalDataMap, getHelpID, getHistoryResults, getId, getLabel, getOwner, getPluginId, preAnalyze, setElementType, setExternalDataMap, setHelpID, setIconName, setId, setLabel, setOwner, setPluginId
 

Constructor Detail

RuleFunctionPreferInitialization

public RuleFunctionPreferInitialization()
Method Detail

analyze

public void analyze(AnalysisHistory history)
Analyze this rule

Specified by:
analyze in interface IAnalysisRule
Specified by:
analyze in class AbstractAnalysisRule
Parameters:
history - A reference to the history record for this analysis

variableIsConstant

public static boolean variableIsConstant(CodeReviewResource resource,
                                         org.eclipse.cdt.core.dom.ast.IASTNode expression,
                                         boolean searchOnlyCurrentFunction,
                                         boolean assumeThisIfDecNotFound)
Identifies if the parameter in the given expression is a constant. This works for the following node types: IASTIdExpression, IASTDeclarator, IASTFieldReference, IASTName

Parameters:
resource -
expression, - one of: IASTUnaryExpression, IASTIdExpression, IASTDeclarator, IASTFieldReference, IASTName
searchOnlyCurrentFunction - if true, searches only in the context of the current function, if false tries to find declaration from the class it belongs to
assumeThisIfDecNotFound - returns this value if the declaration of the expression was not found, ie assumes this result if result is actually unkown
Returns:
boolean true if expression is a pointer, or the value given (AssumeThisIfDecNotFound) if the declaration was not found

TPTP 4.6.0 Platform Project
Public API Specification