Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Add type-check to ManagedPointer::CastManagedPointerTo. #1593

Merged
merged 3 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions benchmark/parser/parser_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
#include <vector>

#include "benchmark/benchmark.h"
#include "parser/delete_statement.h"
#include "parser/insert_statement.h"
#include "parser/postgresparser.h"
#include "parser/update_statement.h"

namespace noisepage {

Expand Down
2 changes: 2 additions & 0 deletions src/include/common/managed_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class ManagedPointer {
*/
template <class NewType>
ManagedPointer<NewType> CastManagedPointerTo() const {
// Either "Underlying is a valid NewType" or "Underlying is base class of NewType".
static_assert(std::is_convertible_v<Underlying *, NewType *> || std::is_base_of_v<Underlying, NewType>);
return ManagedPointer<NewType>(reinterpret_cast<NewType *>(underlying_));
}

Expand Down
2 changes: 2 additions & 0 deletions src/replication/replication_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "common/error/exception.h"
#include "common/json.h"
#include "loggers/replication_logger.h"
#include "replication/primary_replication_manager.h"
#include "replication/replica_replication_manager.h"

namespace noisepage::replication {

Expand Down
8 changes: 8 additions & 0 deletions src/traffic_cop/traffic_cop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
#include "parser/variable_show_statement.h"
#include "planner/plannodes/abstract_plan_node.h"
#include "planner/plannodes/analyze_plan_node.h"
#include "planner/plannodes/create_database_plan_node.h"
#include "planner/plannodes/create_index_plan_node.h"
#include "planner/plannodes/create_namespace_plan_node.h"
#include "planner/plannodes/create_table_plan_node.h"
#include "planner/plannodes/drop_database_plan_node.h"
#include "planner/plannodes/drop_index_plan_node.h"
#include "planner/plannodes/drop_namespace_plan_node.h"
#include "planner/plannodes/drop_table_plan_node.h"
#include "settings/settings_manager.h"
#include "storage/recovery/replication_log_provider.h"
#include "traffic_cop/traffic_cop_defs.h"
Expand Down
2 changes: 2 additions & 0 deletions src/util/query_exec_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "parser/expression/constant_value_expression.h"
#include "parser/postgresparser.h"
#include "parser/variable_set_statement.h"
#include "planner/plannodes/create_index_plan_node.h"
#include "planner/plannodes/drop_index_plan_node.h"
#include "settings/settings_manager.h"
#include "transaction/transaction_context.h"
#include "transaction/transaction_manager.h"
Expand Down