Skip to content

Commit ceefecf

Browse files
Merge pull request #88 from AjayBrahmakshatriya/master
Fixed bug with parents_stack being static
2 parents c74cd27 + ab97219 commit ceefecf

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

.github/workflows/ci-all-samples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
- run: echo "Starting tests"
2222
- name: Checking out repository
2323
uses: actions/checkout@v2
24-
- run: make -C ${{ github.workspace }} -j$(nproc) run
24+
- run: make -C ${{ github.workspace }} -j$(sysctl -n hw.physicalcpu) run
2525
- run: echo "Tests completed"

include/builder/dyn_var.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ struct custom_type : custom_type_base {
6464
}
6565
};
6666

67-
static std::vector<var *> *parents_stack = nullptr;
67+
extern std::vector<var *> *parents_stack;
68+
6869
// Struct to initialize a dyn_var as member;
6970
struct as_member {
7071
var *parent_var;

src/builder/builder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace options {
88
bool track_members = false;
99
}
1010

11+
std::vector<var *> *parents_stack = nullptr;
12+
1113
template <>
1214
std::vector<block::type::Ptr> extract_type_vector_dyn<>(void) {
1315
std::vector<block::type::Ptr> empty_vector;

src/builder/builder_context.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ block::stmt::Ptr builder_context::extract_ast_from_function_internal(std::vector
334334
current_block_stmt->static_offset.clear();
335335
assert(current_block_stmt != nullptr);
336336
ast = current_block_stmt;
337+
338+
if (parents_stack != nullptr) {
339+
parents_stack->clear();
340+
}
341+
337342
bool_vector = b;
338343

339344
block::stmt::Ptr ret_ast;

0 commit comments

Comments
 (0)