Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangt2333 committed May 29, 2024
1 parent 5f40784 commit 28bbad9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ public interface Pointer extends Indexable {
/**
* Removes out edges of this pointer if they satisfy the filter.
* <p>
* <strong>Note:</strong> This method should not be used during pointer analysis iterations,
* as it can break the monotonicity of the analysis.
* <strong>Note:</strong> This method should not be called outside of
* {@link pascal.taie.analysis.pta.plugin.Plugin#onPhaseFinish()},
* otherwise it may break the monotonicity of pointer analysis.
* </p>
*/
void removeEdgesIf(Predicate<PointerFlowEdge> filter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void onPhaseFinish() {
System.out.println("Taint Analysis is in interactive mode,"
+ " you can change your taint config and run the analysis again.\n"
+ "Enter 'r' to run, 'e' to exit: ");
String input = nextLineFromConsole();
String input = readLineFromConsole();
if (input == null) {
break;
}
Expand Down Expand Up @@ -141,7 +141,7 @@ public void onPhaseFinish() {
* or {@code null} if no line is available
*/
@Nullable
private static String nextLineFromConsole() {
private static String readLineFromConsole() {
StringBuilder sb = new StringBuilder();
try {
int c;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/pascal/taie/analysis/pta/pts/PointsToSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ public interface PointsToSet extends Iterable<CSObj>, Copyable<PointsToSet> {
/**
* Removes objects from this set if they satisfy the filter.
* <p>
* <strong>Note:</strong> This method should be used with caution during pointer analysis iterations,
* as it can break the monotonicity of the analysis.
* <strong>Note:</strong> This method should not be called outside of
* {@link pascal.taie.analysis.pta.plugin.Plugin#onPhaseFinish()},
* otherwise it may break the monotonicity of pointer analysis.
* </p>
*/
void removeIf(Predicate<CSObj> filter);
Expand Down
11 changes: 8 additions & 3 deletions src/test/java/pascal/taie/analysis/pta/TaintTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

package pascal.taie.analysis.pta;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import pascal.taie.Main;
import pascal.taie.analysis.Tests;
import pascal.taie.util.MultiStringsSource;

Expand Down Expand Up @@ -72,8 +70,15 @@ public class TaintTest {
@MultiStringsSource({"CallSiteMode",
TAINT_CONFIG_PREFIX + "taint-config-call-site-model.yml"})
void test(String mainClass, String... opts) {
testInNonInteractiveMode(mainClass, opts);
testInInteractiveMode(mainClass, opts);
}

private void testInNonInteractiveMode(String mainClass, String... opts) {
Tests.testPTA(DIR, mainClass, opts);
// test interactive mode
}

private void testInInteractiveMode(String mainClass, String... opts) {
InputStream originalSystemIn = System.in;
try {
String simulatedInput = "r\ne\n";
Expand Down

0 comments on commit 28bbad9

Please sign in to comment.