edu.cmu.cs.crystal.tac.eclipse
Class EclipseTACSimpleTestDriver

java.lang.Object
  extended by edu.cmu.cs.crystal.tac.eclipse.EclipseTACSimpleTestDriver
All Implemented Interfaces:
ICrystalAnalysis

public class EclipseTACSimpleTestDriver
extends Object
implements ICrystalAnalysis

This class makes 3-address code unit tests available as a Crystal analysis. It also provides static helper methods used by those unit tests. The preferred way of running unit tests, however, is using Eclipse's JUnit plugin test feature.

Author:
Kevin Bierhoff

Constructor Summary
EclipseTACSimpleTestDriver()
           
 
Method Summary
 void afterAllCompilationUnits()
          Inform the analysis that all compilation units have been analyzed.
static void assertMethodParameter(Variable x, org.eclipse.jdt.core.dom.MethodDeclaration m, int parameterIndex, EclipseTAC tac)
           
static void assertOperands(List<org.eclipse.jdt.core.dom.Expression> exprs, List<Variable> operands, EclipseTAC tac)
           
 void beforeAllCompilationUnits()
          Inform the analysis that the analysis process is about to begin.
static org.eclipse.jdt.core.dom.VariableDeclarationFragment getFirstField(org.eclipse.jdt.core.dom.CompilationUnit compUnit)
           
static org.eclipse.jdt.core.dom.MethodDeclaration getFirstMethod(org.eclipse.jdt.core.dom.CompilationUnit compUnit)
           
static org.eclipse.jdt.core.dom.Statement getLastStatement(org.eclipse.jdt.core.dom.MethodDeclaration methodDecl)
           
static org.eclipse.jdt.core.dom.ReturnStatement getLastStatementReturn(org.eclipse.jdt.core.dom.MethodDeclaration methodDecl)
           
 String getName()
           
static org.eclipse.jdt.core.dom.CompilationUnit parseCode(String qualifiedCompUnitName, String code)
           
 void runAnalysis(IAnalysisReporter reporter, IAnalysisInput input, org.eclipse.jdt.core.ICompilationUnit compUnit, org.eclipse.jdt.core.dom.CompilationUnit rootNode)
          Run the analysis!
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EclipseTACSimpleTestDriver

public EclipseTACSimpleTestDriver()
Method Detail

runAnalysis

public void runAnalysis(IAnalysisReporter reporter,
                        IAnalysisInput input,
                        org.eclipse.jdt.core.ICompilationUnit compUnit,
                        org.eclipse.jdt.core.dom.CompilationUnit rootNode)
Description copied from interface: ICrystalAnalysis
Run the analysis!

Specified by:
runAnalysis in interface ICrystalAnalysis
Parameters:
reporter - The object that is used to report errors. Output.
input - The input to this analysis.
compUnit - The compilation unit
rootNode - The root ASTNode of the compilation unit

assertOperands

public static void assertOperands(List<org.eclipse.jdt.core.dom.Expression> exprs,
                                  List<Variable> operands,
                                  EclipseTAC tac)

assertMethodParameter

public static void assertMethodParameter(Variable x,
                                         org.eclipse.jdt.core.dom.MethodDeclaration m,
                                         int parameterIndex,
                                         EclipseTAC tac)

getFirstMethod

public static org.eclipse.jdt.core.dom.MethodDeclaration getFirstMethod(org.eclipse.jdt.core.dom.CompilationUnit compUnit)

getFirstField

public static org.eclipse.jdt.core.dom.VariableDeclarationFragment getFirstField(org.eclipse.jdt.core.dom.CompilationUnit compUnit)

getLastStatementReturn

public static org.eclipse.jdt.core.dom.ReturnStatement getLastStatementReturn(org.eclipse.jdt.core.dom.MethodDeclaration methodDecl)

getLastStatement

public static org.eclipse.jdt.core.dom.Statement getLastStatement(org.eclipse.jdt.core.dom.MethodDeclaration methodDecl)

parseCode

public static org.eclipse.jdt.core.dom.CompilationUnit parseCode(String qualifiedCompUnitName,
                                                                 String code)
                                                          throws CoreException
Throws:
CoreException

getName

public String getName()
Specified by:
getName in interface ICrystalAnalysis
Returns:
a unique name for this analysis

afterAllCompilationUnits

public void afterAllCompilationUnits()
Description copied from interface: ICrystalAnalysis
Inform the analysis that all compilation units have been analyzed.

Specified by:
afterAllCompilationUnits in interface ICrystalAnalysis

beforeAllCompilationUnits

public void beforeAllCompilationUnits()
Description copied from interface: ICrystalAnalysis
Inform the analysis that the analysis process is about to begin.

Specified by:
beforeAllCompilationUnits in interface ICrystalAnalysis