-
Notifications
You must be signed in to change notification settings - Fork 84
Handle renaming of local variables in incremental analysis (AST) #731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
4256428
Added basic test cases for changed variable names.
TimOrtel 27dd10f
Rename detection works for simple cases
TimOrtel 6bc0fca
Rename detection for method parameters, too
TimOrtel ca6670b
Renaming of method params should work now.
TimOrtel c1e165c
Renaming of results does work for the log files.
TimOrtel d589278
Added multiple incremental runs test
TimOrtel 9eb3f87
Renamed local vars are now also shown in g2html.
TimOrtel d652715
Added incremental aware print statements and replaced traditional pri…
TimOrtel 08da3fb
Renamed variable names are now displayed with their new name in g2html
TimOrtel 3a11fb9
Cleanup print statements and added some docu.
TimOrtel 26d0702
Merge remote-tracking branch 'upstream/master' into dev-local-var-rename
TimOrtel b7fac89
Renamed context to rename_mapping
TimOrtel abf871b
Replaced rename mapping lists with Hashtbls for increased performance
TimOrtel 4745a3f
cleanup print statements and code.
TimOrtel 7d702f7
Merge upstream master
TimOrtel c645c68
cherry picked context -> rename mapping
TimOrtel aed7a3a
Replaced rename mapping lists with Hashtbls for increased performance
TimOrtel 9e95ddb
Old locals are now renamed to the new local names.
TimOrtel 7e89ec2
Fixed duplicate id tests
TimOrtel 0c6b9c4
Moved multiple incremental run tests to subdirectory.
TimOrtel d5979f1
Merge Branch Without Rename Mapping
TimOrtel 37e5703
Merged upstream master
TimOrtel 3b60fb7
Removed unused currentFunctionName global state.
TimOrtel fd691c5
Removed nothing test case
TimOrtel 686a3da
Added include assert to tests. Removed useless test.c
TimOrtel 0a0ee34
Replaced tupletostring with fancy syntax.
TimOrtel 8b28e89
Hashtbl.add is now replaced by Hashtbl.replace in many places.
TimOrtel 77bd926
List optimization.
TimOrtel 7371dc9
method_rename_assumptions now uses varinfo map instead of string hash…
TimOrtel 7b320c9
Removed RenameMapping.
TimOrtel 40281fe
Added documentation to tests in 04-var-rename
TimOrtel 60468d4
Add comment to test-incremental-multiple.sh
TimOrtel 9c8e226
Merge remote-tracking branch 'upstream/master' into dev-local-var-rename
TimOrtel a9d297c
Removed syntactic noise introduced by addition and removal of RenameM…
TimOrtel 31283c9
Removed diffs directory in tests/incremental/04-var-rename
TimOrtel b3487ba
Merge remote-tracking branch 'upstream/master' into dev-local-var-rename
TimOrtel a3f48fa
function parameter names are now also updated. Cleanup code.
TimOrtel 6fe1202
eqF now uses empty rename mapping for header comparison.
TimOrtel 8b5fbd9
Merge remote-tracking branch 'upstream/master' into dev-local-var-rename
TimOrtel fd3f228
CFG comparison now verifies locals again.
TimOrtel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,37 @@ | ||
| #This file runs 3 incremental tests in total. As such it is similar to test-incremental.sh but performs an additional incremental run on top of it. | ||
| test=$1 | ||
|
|
||
| base=./tests/incremental | ||
| source=$base/${test}_1.c | ||
| conf=$base/$test.json | ||
| patch1=$base/${test}_1.patch | ||
| patch2=$base/${test}_2.patch | ||
|
|
||
| args="--enable dbg.debug --enable printstats -v" | ||
|
|
||
| cat $source | ||
|
|
||
| ./goblint --conf $conf $args --enable incremental.save $source &> $base/$test.before.log --html | ||
|
|
||
| patch -p0 -b <$patch1 | ||
|
|
||
| cat $source | ||
|
|
||
| ./goblint --conf $conf $args --enable incremental.load --enable incremental.save $source &> $base/$test.after.incr1.log --html | ||
|
|
||
| patch -p0 <$patch2 | ||
|
|
||
| cat $source | ||
|
|
||
| ./goblint --conf $conf $args --enable incremental.load --enable incremental.save --set save_run $base/$test-incrementalrun $source &> $base/$test.after.incr2.log --html | ||
|
|
||
|
|
||
| #./goblint --conf $conf $args --enable incremental.only-rename --set save_run $base/$test-originalrun $source &> $base/$test.after.scratch.log --html | ||
| #./goblint --conf $conf --enable solverdiffs --compare_runs $base/$test-originalrun $base/$test-incrementalrun $source --html | ||
|
|
||
| patch -p0 -b -R <$patch2 | ||
| patch -p0 -b -R <$patch1 | ||
| # rm -r $base/$test-originalrun $base/$test-incrementalrun | ||
| rm -r $base/$test-incrementalrun | ||
|
|
||
| cat $source | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,11 @@ | ||
| open Cil | ||
|
|
||
| module VarinfoOrdered = struct | ||
| type t = varinfo | ||
|
|
||
| (*x.svar.uid cannot be used, as they may overlap between old and now AST*) | ||
| let compare (x: varinfo) (y: varinfo) = String.compare x.vname y.vname | ||
| end | ||
|
|
||
|
|
||
| module VarinfoMap = Map.Make(VarinfoOrdered) |
This file contains hidden or 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 hidden or 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,4 @@ | ||
| int main() { | ||
| int a = 0; | ||
| return 0; | ||
| } |
This file contains hidden or 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,3 @@ | ||
| { | ||
|
|
||
| } |
This file contains hidden or 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,8 @@ | ||
| --- tests/incremental/04-var-rename/01-unused_rename.c | ||
| +++ tests/incremental/04-var-rename/01-unused_rename.c | ||
| @@ -1,4 +1,4 @@ | ||
| int main() { | ||
| - int a = 0; | ||
| + int b = 0; | ||
| return 0; | ||
| } |
This file contains hidden or 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,3 @@ | ||
| local variable a is renamed to b. | ||
| a/b is not used. | ||
| No semantic changes. |
This file contains hidden or 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,11 @@ | ||
| #include<stdio.h> | ||
|
|
||
| //a is renamed to c, but the usage of a is replaced by b | ||
| int main() { | ||
| int a = 0; | ||
| int b = 1; | ||
|
|
||
| printf("Print %d", a); | ||
|
|
||
| return 0; | ||
| } |
This file contains hidden or 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,3 @@ | ||
| { | ||
|
|
||
| } |
15 changes: 15 additions & 0 deletions
15
tests/incremental/04-var-rename/02-rename_and_shuffle.patch
This file contains hidden or 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,15 @@ | ||
| --- tests/incremental/04-var-rename/02-rename_and_shuffle.c | ||
| +++ tests/incremental/04-var-rename/02-rename_and_shuffle.c | ||
| @@ -2,10 +2,10 @@ | ||
|
|
||
| //a is renamed to c, but the usage of a is replaced by b | ||
| int main() { | ||
| - int a = 0; | ||
| + int c = 0; | ||
| int b = 1; | ||
|
|
||
| - printf("Print %d", a); | ||
| + printf("Print %d", b); | ||
|
|
||
| return 0; | ||
| } |
This file contains hidden or 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,2 @@ | ||
| a is renamed to c, but the usage of a is replaced by b. | ||
| Semantic changes. |
This file contains hidden or 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,11 @@ | ||
| #include<stdio.h> | ||
|
|
||
| //a is renamed to c, but its usages stay the same | ||
| int main() { | ||
| int a = 0; | ||
| int b = 1; | ||
|
|
||
| printf("Print %d", a); | ||
|
|
||
| return 0; | ||
| } |
This file contains hidden or 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,3 @@ | ||
| { | ||
|
|
||
| } |
15 changes: 15 additions & 0 deletions
15
tests/incremental/04-var-rename/03-rename_with_usage.patch
This file contains hidden or 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,15 @@ | ||
| --- tests/incremental/04-var-rename/03-rename_with_usage.c | ||
| +++ tests/incremental/04-var-rename/03-rename_with_usage.c | ||
| @@ -2,10 +2,10 @@ | ||
|
|
||
| //a is renamed to c, but its usages stay the same | ||
| int main() { | ||
| - int a = 0; | ||
| + int c = 0; | ||
| int b = 1; | ||
|
|
||
| - printf("Print %d", a); | ||
| + printf("Print %d", c); | ||
|
|
||
| return 0; | ||
| } |
This file contains hidden or 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,2 @@ | ||
| a is renamed to c, but the usage stays the same. | ||
| No semantic changes. |
This file contains hidden or 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,9 @@ | ||
| #include <assert.h> | ||
|
|
||
| int main() { | ||
| int myVar = 0; | ||
|
|
||
| assert(myVar < 11); | ||
sim642 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return 0; | ||
| } | ||
This file contains hidden or 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,3 @@ | ||
| { | ||
|
|
||
| } |
This file contains hidden or 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,13 @@ | ||
| --- tests/incremental/04-var-rename/04-renamed_assert.c | ||
| +++ tests/incremental/04-var-rename/04-renamed_assert.c | ||
| @@ -1,7 +1,7 @@ | ||
| int main() { | ||
| - int myVar = 0; | ||
| + int myRenamedVar = 0; | ||
|
|
||
| - assert(myVar < 11); | ||
| + assert(myRenamedVar < 11); | ||
|
|
||
| return 0; | ||
| } | ||
| \ Kein Zeilenumbruch am Dateiende. |
This file contains hidden or 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,2 @@ | ||
| local var used in assert is renamed. | ||
| No semantic changes. |
This file contains hidden or 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,8 @@ | ||
| void method(int a) { | ||
| int c = a; | ||
| } | ||
|
|
||
| int main() { | ||
| method(0); | ||
| return 0; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.