Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void setSolver(Solver solver) {
addPlugin(new ArrayModel.AnalysisModel(solver),
new ArrayModel.IRModel(solver),
new UnsafeModel(solver),
new DoPriviledgedModel(solver));
new DoPriviledgedModel(solver),
new ObjectModel(solver));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Tai-e: A Static Analysis Framework for Java
*
* Copyright (C) 2022 Tian Tan <[email protected]>
* Copyright (C) 2022 Yue Li <[email protected]>
*
* This file is part of Tai-e.
*
* Tai-e is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tai-e is distributed in the hope that it will be useful,but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Tai-e. If not, see <https://www.gnu.org/licenses/>.
*/

package pascal.taie.analysis.pta.plugin.natives;

import pascal.taie.analysis.pta.core.solver.Solver;
import pascal.taie.analysis.pta.plugin.util.IRModelPlugin;
import pascal.taie.analysis.pta.plugin.util.InvokeHandler;
import pascal.taie.analysis.pta.plugin.util.InvokeUtils;
import pascal.taie.ir.exp.Var;
import pascal.taie.ir.stmt.Copy;
import pascal.taie.ir.stmt.Invoke;
import pascal.taie.ir.stmt.Stmt;

import java.util.List;

public class ObjectModel extends IRModelPlugin {
ObjectModel(Solver solver) {
super(solver);
}

@InvokeHandler(signature = "<java.lang.Object: java.lang.Object clone()>")
public List<Stmt> objectClone(Invoke invoke) {
Var result = invoke.getResult();
return result != null
? List.of(new Copy(result, InvokeUtils.getVar(invoke, InvokeUtils.BASE)))
: List.of();
}
}