Replace unreachable() with assert(false)
This commit is contained in:
@ -40,7 +40,6 @@ namespace elna::gcc
|
||||
std::shared_ptr<symbol_table> symbols, std::unordered_map<std::string, tree>& unresolved,
|
||||
std::vector<std::string>& path);
|
||||
|
||||
|
||||
class generic_visitor final : public boot::parser_visitor
|
||||
{
|
||||
tree current_expression{ NULL_TREE };
|
||||
@ -68,11 +67,13 @@ namespace elna::gcc
|
||||
tree procedure_address, const std::vector<boot::expression *>& arguments);
|
||||
void build_record_call(location_t call_location,
|
||||
tree symbol, const std::vector<boot::expression *>& arguments);
|
||||
bool build_builtin_procedures(boot::procedure_call *call);
|
||||
void build_assert_builtin(location_t call_location, const std::vector<boot::expression *>& arguments);
|
||||
|
||||
bool expect_trait_type_only(boot::traits_expression *trait);
|
||||
bool expect_trait_for_integral_type(boot::traits_expression *trait);
|
||||
void visit_statements(const std::vector<boot::statement *>& statements);
|
||||
bool extract_constant(location_t expression_location);
|
||||
bool assert_constant(location_t expression_location);
|
||||
|
||||
public:
|
||||
generic_visitor(std::shared_ptr<symbol_table> symbol_table,
|
||||
|
@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#include "elna/boot/ast.h"
|
||||
#include "elna/boot/symbol.h"
|
||||
#include "elna/gcc/elna1.h"
|
||||
|
||||
namespace elna::gcc
|
||||
{
|
||||
@ -82,4 +83,18 @@ namespace elna::gcc
|
||||
tree find_field_by_name(location_t expression_location, tree type, const std::string& field_name);
|
||||
tree build_global_pointer_type(tree type);
|
||||
tree build_label_decl(const char *name, location_t loc);
|
||||
|
||||
tree extract_constant(tree expression);
|
||||
|
||||
template<typename... Args>
|
||||
tree call_built_in(location_t call_location, const char *name, tree return_type, Args... arguments)
|
||||
{
|
||||
tree *builtin = elna_global_decls->get(name);
|
||||
gcc_assert(builtin != nullptr);
|
||||
|
||||
tree fndecl_type = build_function_type(return_type, TYPE_ARG_TYPES(*builtin));
|
||||
tree builtin_addr = build1_loc(call_location, ADDR_EXPR, build_pointer_type(fndecl_type), *builtin);
|
||||
|
||||
return build_call_nary(return_type, builtin_addr, sizeof...(Args), arguments...);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#pragma once
|
||||
|
||||
enum elna_tree_index
|
||||
{
|
||||
ELNA_TI_INT_TYPE,
|
||||
|
Reference in New Issue
Block a user