Skip to content

Commit 97c8e07

Browse files
committed
Cumulative updates
1 parent cfdd9dd commit 97c8e07

13 files changed

+322
-224
lines changed

src/tip/Tip.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,15 @@ object Tip extends App {
179179
log.error(s"Failure parsing the program: $file", e)
180180
sys.exit(1)
181181
case Success(parsedNode: AProgram) =>
182-
// run normalizer
183-
log.verb("Normalizing")
184-
val programNode = options.normalizer.normalizeProgram(parsedNode)
185-
if (options.normalizer != NoNormalizer)
186-
Output.output(file, OtherOutput(OutputKindE.normalized), programNode.toString, options.out)
182+
val programNode =
183+
if (options.normalizer == NoNormalizer) parsedNode
184+
else {
185+
// run normalizer
186+
log.verb("Normalizing")
187+
val p = options.normalizer.normalizeProgram(parsedNode)
188+
Output.output(file, OtherOutput(OutputKindE.normalized), p.toString, options.out)
189+
p
190+
}
187191

188192
// run declaration analysis
189193
// (for information about the use of 'implicit', see [[tip.analysis.TypeAnalysis]])

src/tip/analysis/AndersenAnalysis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AndersenAnalysis(program: AProgram)(implicit declData: DeclarationData) ex
1818
override def toString = id.toString
1919
}
2020

21-
val solver = new CubicSolver[Cell, Cell]
21+
val solver = new SimpleCubicSolver[Cell, Cell]
2222

2323
import AstOps._
2424
val cells: Set[Cell] = (program.appearingIds.map(Var): Set[Cell]) union program.appearingAllocs.map(Alloc)

src/tip/analysis/ControlFlowAnalysis.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package tip.analysis
22

33
import tip.ast.{AAssignStmt, AIdentifier, AProgram, AstNode, DepthFirstAstVisitor, _}
4-
import tip.solvers.CubicSolver
4+
import tip.solvers.SimpleCubicSolver
55
import tip.util.Log
66
import tip.ast.AstNodeData.{AstNodeWithDeclaration, DeclarationData}
77

@@ -24,7 +24,7 @@ class ControlFlowAnalysis(program: AProgram)(implicit declData: DeclarationData)
2424
}
2525
}
2626

27-
private val solver = new CubicSolver[AstVariable, Decl]
27+
private val solver = new SimpleCubicSolver[AstVariable, Decl]
2828

2929
val allFunctions: Set[AFunDeclaration] = program.funs.toSet
3030

src/tip/analysis/CopyConstantPropagationAnalysis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trait CopyConstantPropagationAnalysisFunctions extends IDEAnalysis[ADeclaration,
6363
case AAssignStmt(id: AIdentifier, right, _) =>
6464
val edges = assign(d, id.declaration, right)
6565
d match {
66-
case Left(a) if id != a =>
66+
case Left(a) if id.declaration != a =>
6767
edges :+ ((d, IdEdge())) // not at the variable being written to, so add identity edge
6868
case _ =>
6969
edges

src/tip/analysis/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ trait ContextSensitiveForwardDependencies[C <: CallContext] extends Dependencies
8989
*/
9090
override def outdep(n: (C, CfgNode)): Set[(C, CfgNode)] =
9191
(n._2 match {
92-
case call: CfgCallNode => Set()
92+
case _: CfgCallNode => Set()
9393
case _ => n._2.succ.toSet
9494
}).map { d =>
9595
(n._1, d)

src/tip/analysis/SteensgaardAnalysis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ sealed trait StTerm
112112
*/
113113
case class AllocVariable(alloc: AAlloc) extends StTerm with Var[StTerm] {
114114

115-
override def toString: String = s"\u27E6alloc{${alloc.loc}}]]"
115+
override def toString: String = s"\u27E6alloc{${alloc.loc}}\u27E7"
116116
}
117117

118118
/**

src/tip/analysis/TypeAnalysis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package tip.analysis
22

33
import tip.ast._
44
import tip.solvers._
5-
import tip.types.{AbsentFieldType, _}
5+
import tip.types._
66
import tip.ast.AstNodeData._
77
import tip.util.{Log, TipProgramException}
88
import AstOps._

src/tip/ast/AstOps.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ object AstOps {
131131
* Checks whether the subtree of the node contains an 'input' expression.
132132
*/
133133
def containsInput: Boolean = {
134-
var res = false;
134+
var res = false
135135
new DepthFirstAstVisitor[Unit] {
136136
override def visit(node: AstNode, arg: Unit): Unit =
137137
node match {
@@ -156,6 +156,15 @@ object AstOps {
156156
case rec: ARecord =>
157157
fields ++= rec.fields.map { _.field }
158158
visitChildren(rec, ())
159+
case as: AAssignStmt =>
160+
as.left match {
161+
case dfw: ADirectFieldWrite =>
162+
fields += dfw.field
163+
case ifw: AIndirectFieldWrite =>
164+
fields += ifw.field
165+
case _ =>
166+
}
167+
visitChildren(as, ())
159168
case _ => visitChildren(node, ())
160169
}
161170
}

src/tip/ast/TipSublanguages.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class NoFunctionPointers(implicit declData: DeclarationData) extends TipSublangu
3939
LanguageRestrictionViolation(s"Indirect call not allowed, $targetFun is not a function", ast.loc)
4040
}
4141
args.foreach(visit(_, x))
42-
case ACallFuncExpr(targetFun, args, _) =>
42+
case ACallFuncExpr(targetFun, _, _) =>
4343
LanguageRestrictionViolation(s"Indirect call not allowed, $targetFun is not a function", ast.loc)
4444
case id: AIdentifier =>
4545
id.declaration match {

src/tip/solvers/CubicSolver.scala

Lines changed: 0 additions & 206 deletions
This file was deleted.

0 commit comments

Comments
 (0)