Skip to content

Commit

Permalink
Sort LLVM function parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanSalwan committed Feb 12, 2022
1 parent 8a58437 commit 05b05cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .build_number
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1517
1518
3 changes: 3 additions & 0 deletions src/libtriton/ast/llvm/tritonToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ namespace triton {
// Collect used symbolic variables.
auto vars = triton::ast::search(node, triton::ast::VARIABLE_NODE);

//! Sort symbolic variables
std::sort(vars.begin(), vars.end());

// Each symbolic variable is a function argument
std::vector<llvm::Type*> argsType;
argsType.resize(vars.size());
Expand Down
5 changes: 5 additions & 0 deletions src/libtriton/engines/symbolic/symbolicVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ namespace triton {
return stream;
}


bool operator<(const SymbolicVariable& symvar1, const SymbolicVariable& symvar2) {
return symvar1.getId() < symvar2.getId();
}

}; /* symbolic namespace */
}; /* engines namespace */
}; /*triton namespace */
3 changes: 3 additions & 0 deletions src/libtriton/includes/triton/symbolicVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ namespace triton {
//! Displays a symbolic variable.
TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const SymbolicVariable* symVar);

//! Compares two symbolic variables.
TRITON_EXPORT bool operator<(const SymbolicVariable& symvar1, const SymbolicVariable& symvar2);

/*! @} End of symbolic namespace */
};
/*! @} End of engines namespace */
Expand Down

0 comments on commit 05b05cf

Please sign in to comment.