-
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.
Merge pull request #92 from AjayBrahmakshatriya/master
Fixed bug with dyn_var<T*> requiring T to be completely defined
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 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,5 @@ | ||
void bar (void) { | ||
linked_list* x_0; | ||
((x_0->next)->next)->next = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
void bar (void) { | ||
linked_list* var0; | ||
((var0->next)->next)->next = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Include the headers | ||
#include "blocks/c_code_generator.h" | ||
#include "builder/static_var.h" | ||
#include "builder/dyn_var.h" | ||
#include "blocks/rce.h" | ||
#include <iostream> | ||
|
||
// Include the BuildIt types | ||
using builder::dyn_var; | ||
using builder::static_var; | ||
|
||
struct linked_list { | ||
static constexpr const char* type_name = "linked_list"; | ||
dyn_var<linked_list*> next = builder::with_name("next"); | ||
}; | ||
|
||
static void bar(void) { | ||
dyn_var<struct linked_list*> x; | ||
x->next->next->next = 0; | ||
} | ||
|
||
int main(int argc, char* argv[]) { | ||
builder::builder_context context; | ||
auto ast = context.extract_function_ast(bar, "bar"); | ||
block::c_code_generator::generate_code(ast, std::cout, 0); | ||
return 0; | ||
} | ||
|
||
|