-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pulse][RFC] count reachable nodes with 0 disjuncts
Summary: we only count nodes reachable from the start node, not following exceptional edges. Hence we use a simple depth-first-search. It we count nodes in catch blocks, this makes difficult to understand the results because this is expected that our analysis will never enter in some of them. Reviewed By: nbenton Differential Revision: D55082611 Privacy Context Container: L1208441 fbshipit-source-id: 34fa381bee09550fbd018a81b537b42955329f5a
- Loading branch information
1 parent
e9383a7
commit 290298e
Showing
8 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package codetoanalyze.java.infer; | ||
|
||
/* | ||
This is a test file specific to the unreachability counting | ||
*/ | ||
|
||
public class CountDeadCode { | ||
|
||
public int no_deadcode() { | ||
int i = 0; | ||
int x = 0; | ||
if (i == 0) { | ||
x = 1; | ||
} | ||
return x; | ||
} | ||
|
||
public int else_with_deadcode() { | ||
int i = 0; | ||
int x; | ||
if (i == 0) { | ||
x = 0; | ||
} else { // only this part | ||
x = 1; // is counted as unreachable | ||
} | ||
return x; | ||
} | ||
|
||
public int long_catch_block() { | ||
try { | ||
int i = 0; | ||
int x; | ||
if (i == 0) { | ||
x = 0; | ||
} else { // only this part | ||
x = 1; // is counted as unreachable | ||
} | ||
return x; | ||
} catch (Exception e) { // the unreachability count | ||
int i = 0; // will not take into account | ||
i++; // this block | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
i++; | ||
return 0; | ||
} | ||
} | ||
} |