aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorD. Shah <dave@ds0.me>2021-02-03 19:43:33 +0000
committerD. Shah <dave@ds0.me>2021-02-05 19:19:17 +0000
commitb866601b6398f90967c8ab120f9b9806869f94c4 (patch)
tree24fba325a681b5acd5c3cbfe121eb183650ffeef /common
parentba5568d501decd77352b7afd3897336e99abbdd4 (diff)
downloadnextpnr-b866601b6398f90967c8ab120f9b9806869f94c4.tar.gz
nextpnr-b866601b6398f90967c8ab120f9b9806869f94c4.tar.bz2
nextpnr-b866601b6398f90967c8ab120f9b9806869f94c4.zip
Fix now-illegal use of reinterpret_cast
Signed-off-by: D. Shah <dave@ds0.me>
Diffstat (limited to 'common')
-rw-r--r--common/nextpnr.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index ad89046c..263c8e13 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -841,6 +841,8 @@ struct BaseCtx
// Context meta data
std::unordered_map<IdString, Property> attrs;
+ Context *as_ctx = nullptr;
+
BaseCtx()
{
idstring_str_to_idx = new std::unordered_map<std::string, int>;
@@ -914,9 +916,9 @@ struct BaseCtx
IdString id(const char *s) const { return IdString(this, s); }
- Context *getCtx() { return reinterpret_cast<Context *>(this); }
+ Context *getCtx() { return as_ctx; }
- const Context *getCtx() const { return reinterpret_cast<const Context *>(this); }
+ const Context *getCtx() const { return as_ctx; }
const char *nameOf(IdString name) const { return name.c_str(this); }
@@ -1245,7 +1247,7 @@ struct Context : Arch, DeterministicRNG
// Should we disable printing of the location of nets in the critical path?
bool disable_critical_path_source_print = false;
- Context(ArchArgs args) : Arch(args) {}
+ Context(ArchArgs args) : Arch(args) { BaseCtx::as_ctx = this; }
// --------------------------------------------------------------