Package daikon.chicory
Class DeclWriter
- Object
-
- DaikonWriter
-
- DeclWriter
-
- All Implemented Interfaces:
ComparabilityProvider
public class DeclWriter extends DaikonWriter implements ComparabilityProvider
DeclWriter writes the.decls
file to a stream. It uses traversal pattern trees (seeDaikonVariableInfo
) for each program point. These are also used by theDTraceWriter
.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
debug
Debug flag set from Chicory.debug_decl_print.-
Fields inherited from class DaikonWriter
lineSep, no_modifiers_ppt
-
-
Constructor Summary
Constructors Constructor Description DeclWriter(PrintWriter writer)
Constructs a DeclWriter, preparing it to receive messages.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
classObjectName(Class<?> type)
Returns the correctly formulated ":::OBJECT" name of the class (i.e., the program point name)String
getComparability(DaikonVariableInfo var, DeclReader.DeclPpt compare_ppt)
Get the caparability value for a varaible.void
printDecl(DaikonVariableInfo parent, DaikonVariableInfo var, DeclReader.DeclPpt compare_ppt, ComparabilityProvider comparabilityProvider)
Output most of the decl file information for a single variable.void
printDeclClass(ClassInfo cinfo, @Nullable DeclReader comp_info)
Prints declarations for all the methods in the indicated class.void
printHeaderInfo(String className)
Prints header information to the decls file.-
Methods inherited from class DaikonWriter
escape, isStaticConstField, methodEntryName, methodEntryName, methodExitName, methodExitName, shouldInstrumentMethod, stdClassName
-
-
-
-
Field Detail
-
debug
public boolean debug
Debug flag set from Chicory.debug_decl_print.
-
-
Constructor Detail
-
DeclWriter
public DeclWriter(PrintWriter writer)
Constructs a DeclWriter, preparing it to receive messages.- Parameters:
writer
- stream to write to
-
-
Method Detail
-
printHeaderInfo
public void printHeaderInfo(String className)
Prints header information to the decls file. Should be called once before emitting any other declarations.- Parameters:
className
- name of the top-level class (used only for printing comments)
-
classObjectName
public static String classObjectName(Class<?> type)
Returns the correctly formulated ":::OBJECT" name of the class (i.e., the program point name)- Parameters:
type
- the ClassType type- Returns:
- the correctly formulated String
-
printDeclClass
public void printDeclClass(ClassInfo cinfo, @Nullable DeclReader comp_info)
Prints declarations for all the methods in the indicated class. This method is called at run time to print decls info for a class.- Parameters:
cinfo
- class whose declarations should be printedcomp_info
- comparability information
-
printDecl
public void printDecl(DaikonVariableInfo parent, DaikonVariableInfo var, DeclReader.DeclPpt compare_ppt, ComparabilityProvider comparabilityProvider)
Output most of the decl file information for a single variable. This includes the variable, var-kind, enclosing-var, array, dec-type, rep-type, constant, function-args, flags, and comparability records. Most notably, it does not output the parent record. The records are output via the PrinterWriter passed as an argument to the DeclWriter constructor.- Parameters:
parent
- parent of var in the variable treevar
- variable whose values are to be outputcompare_ppt
- ppt with compare value if comparability-file present, null otherwisecomparabilityProvider
- object on whichComparabilityProvider.getComparability(daikon.chicory.DaikonVariableInfo, daikon.chicory.DeclReader.DeclPpt)
is called. It might be this DeclWriter itself.
-
getComparability
public String getComparability(DaikonVariableInfo var, DeclReader.DeclPpt compare_ppt)
Get the caparability value for a varaible.- Specified by:
getComparability
in interfaceComparabilityProvider
- Parameters:
var
- variable whose value is desiredcompare_ppt
- ppt with compare value if comparability-file present, null otherwise- Returns:
- String containing the comparability value
-
-