From 8ed2e9a9bff80a2bceab9c8210c02f1cd7408cdb Mon Sep 17 00:00:00 2001 From: fallenoak Date: Wed, 6 Jan 2021 22:38:43 -0600 Subject: [PATCH] feat(list): tag allocations with file name and line --- storm/list/TSList.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/storm/list/TSList.hpp b/storm/list/TSList.hpp index 6ca7482..7120b7b 100644 --- a/storm/list/TSList.hpp +++ b/storm/list/TSList.hpp @@ -6,6 +6,7 @@ #include "storm/list/TSLink.hpp" #include #include +#include #define STORM_LIST(T) TSList> @@ -29,6 +30,8 @@ class TSList { void LinkNode(T* ptr, uint32_t linktype, T* existingptr); void LinkToHead(T* ptr); void LinkToTail(T* ptr); + const char* MemFileName() const; + int32_t MemLineNo() const; T* NewNode(uint32_t location, size_t extrabytes, uint32_t flags); T* Next(const T* ptr); T* RawNext(const T* ptr); @@ -156,9 +159,19 @@ void TSList::LinkToTail(T* ptr) { this->LinkNode(ptr, 2, nullptr); } +template +const char* TSList::MemFileName() const { + return typeid(T).name(); +} + +template +int32_t TSList::MemLineNo() const { + return -2; +} + template T* TSList::NewNode(uint32_t location, size_t extrabytes, uint32_t flags) { - void* m = SMemAlloc(sizeof(T) + extrabytes, __FILE__, __LINE__, flags); + void* m = SMemAlloc(sizeof(T) + extrabytes, this->MemFileName(), this->MemLineNo(), flags); T* node;