1 /*******************************************************************************
2 * Copyright (c) 2002 - 2006 IBM Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package com
.ibm
.wala
.eclipse
.cg
.model
;
13 import java
.util
.Collection
;
15 import com
.ibm
.wala
.cast
.ir
.ssa
.AstIRFactory
;
16 import com
.ibm
.wala
.eclipse
.util
.CancelException
;
17 import com
.ibm
.wala
.ipa
.callgraph
.*;
18 import com
.ibm
.wala
.ipa
.callgraph
.impl
.Util
;
19 import com
.ibm
.wala
.ipa
.cha
.ClassHierarchy
;
20 import com
.ibm
.wala
.ipa
.cha
.IClassHierarchy
;
21 import com
.ibm
.wala
.util
.graph
.InferGraphRoots
;
22 import com
.ibm
.wala
.util
.warnings
.WalaException
;
27 public class WalaJarFileCGModelWithMain
extends WalaJarFileCGModel
{
32 public WalaJarFileCGModelWithMain(String appJar
) {
40 protected CallGraph
createCallGraph(AnalysisScope scope
) throws WalaException
, CancelException
{
42 IClassHierarchy cha
= ClassHierarchy
.make(scope
);
44 Iterable
<Entrypoint
> entrypoints
= com
.ibm
.wala
.ipa
.callgraph
.impl
.Util
.makeMainEntrypoints(scope
, cha
);
45 AnalysisOptions options
= new AnalysisOptions(scope
, entrypoints
);
48 // build the call graph
50 com
.ibm
.wala
.ipa
.callgraph
.CallGraphBuilder builder
= Util
.makeZeroCFABuilder(options
, new AnalysisCache(AstIRFactory
51 .makeDefaultFactory(true)), cha
, scope
, null, null);
52 CallGraph cg
= builder
.makeCallGraph(options
, null);
60 protected Collection
inferRoots(CallGraph cg
) throws WalaException
{
61 return InferGraphRoots
.inferRoots(cg
);