-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for extracting member names with RECOVER_VAR_NAMES=1
- Loading branch information
1 parent
73cea03
commit 2f0182a
Showing
5 changed files
with
154 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
void bar (void) { | ||
int x_0; | ||
char x_mem2_1; | ||
int y_mem1_2; | ||
char y_mem2_3; | ||
x_0 = x_mem2_1; | ||
y_mem2_3 = y_mem1_2; | ||
} | ||
|
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,9 @@ | ||
void bar (void) { | ||
int var0; | ||
char var1; | ||
int var2; | ||
char var3; | ||
var0 = var1; | ||
var3 = var2; | ||
} | ||
|
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,38 @@ | ||
// Include the headers | ||
#include "blocks/c_code_generator.h" | ||
#include "builder/dyn_var.h" | ||
#include "builder/static_var.h" | ||
#include <iostream> | ||
|
||
// Include the BuildIt types | ||
using builder::dyn_var; | ||
using builder::static_var; | ||
|
||
|
||
// Members of this struct will have names except for the first one | ||
// since we currently don't match sizes | ||
struct wrapper1 { | ||
dyn_var<int> mem1; | ||
dyn_var<char> mem2; | ||
}; | ||
|
||
// Members of this struct will have names since the first member is a non dynamic one | ||
struct wrapper2 { | ||
int spacer; | ||
dyn_var<int> mem1; | ||
dyn_var<char> mem2; | ||
}; | ||
|
||
|
||
static void bar(void) { | ||
struct wrapper1 x; | ||
struct wrapper2 y; | ||
x.mem1 = x.mem2; | ||
y.mem2 = y.mem1; | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
block::c_code_generator::generate_code( | ||
builder::builder_context().extract_function_ast(bar, "bar"), std::cout, 0); | ||
return 0; | ||
} |
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