Skip to content

Commit

Permalink
SVF: fixes after testing on Clang 14
Browse files Browse the repository at this point in the history
  • Loading branch information
tempname11 committed Sep 13, 2023
1 parent cc35a47 commit 8572d96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
14 changes: 11 additions & 3 deletions svf_runtime/src/svf_runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ struct Array {
};
#endif // SVF_COMMON_TYPES_INCLUDED

#ifndef SVF_COMMON_CPP_TRICKERY_INCLUDED
#define SVF_COMMON_CPP_TRICKERY_INCLUDED

template<typename T>
struct GetSchemaFromType;

#endif // SVF_COMMON_CPP_TRICKERY_INCLUDED

namespace runtime {

typedef SVFRT_MessageHeader MessageHeader;
Expand Down Expand Up @@ -75,7 +83,7 @@ ReadMessageResult<Entry> read_message(
AllocatorFn *allocator_fn = 0,
void *allocator_ptr = 0
) {
using SchemaDescription = svf::GetSchemaFromType<Entry>::SchemaDescription;
using SchemaDescription = typename svf::GetSchemaFromType<Entry>::SchemaDescription;
SVFRT_ReadMessageResult result = {};
SVFRT_read_message_implementation(
&result,
Expand Down Expand Up @@ -124,7 +132,7 @@ T *read_array(
Array<T> array,
U32 index
) {
using SchemaDescription = svf::GetSchemaFromType<T>::SchemaDescription;
using SchemaDescription = typename svf::GetSchemaFromType<T>::SchemaDescription;
auto stride = ctx->struct_strides.pointer[SchemaDescription::template PerType<T>::index];
if (index > array.count) {
return 0;
Expand Down Expand Up @@ -153,7 +161,7 @@ WriteContext<Entry> write_message_start(
void *writer_ptr,
WriterFn *writer_fn
) {
using SchemaDescription = svf::GetSchemaFromType<Entry>::SchemaDescription;
using SchemaDescription = typename svf::GetSchemaFromType<Entry>::SchemaDescription;
SVFRT_WriteContext context = {};
SVFRT_write_message_implementation(
&context,
Expand Down
14 changes: 10 additions & 4 deletions svf_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,25 @@ add_library(svf_runtime
#
# Generated files.
#

set (GENERATED_H_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom/generated/h)
set (GENERATED_HPP_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom/generated/hpp)
file(MAKE_DIRECTORY ${GENERATED_H_DIR})
file(MAKE_DIRECTORY ${GENERATED_HPP_DIR})

function(generate_schema_files SCHEMA_NAME)
set (TXT_NAME ${CMAKE_CURRENT_SOURCE_DIR}/schema/${SCHEMA_NAME}.txt)
set (HPP_NAME ${CMAKE_CURRENT_BINARY_DIR}/custom/generated/hpp/${SCHEMA_NAME}.hpp)
set (H_NAME ${CMAKE_CURRENT_BINARY_DIR}/custom/generated/h/${SCHEMA_NAME}.h)
set (H_NAME ${GENERATED_H_DIR}/${SCHEMA_NAME}.h)
set (HPP_NAME ${GENERATED_HPP_DIR}/${SCHEMA_NAME}.hpp)
add_custom_command(
OUTPUT ${HPP_NAME}
COMMAND svfc cpp ${TXT_NAME} ${HPP_NAME}
DEPENDS svfc ${TXT_NAME}
DEPENDS svfc ${TXT_NAME} ${HPP_DIR}
)
add_custom_command(
OUTPUT ${H_NAME}
COMMAND svfc c ${TXT_NAME} ${H_NAME}
DEPENDS svfc ${TXT_NAME}
DEPENDS svfc ${TXT_NAME} ${H_DIR}
)
if (${SCHEMA_NAME} STREQUAL meta)
add_custom_target(${SCHEMA_NAME}_hpp ALL DEPENDS ${HPP_NAME})
Expand Down

0 comments on commit 8572d96

Please sign in to comment.