[IR] Module's NamedMD table needn't be 'void *'
Summary: In July 21 2010 `llvm::NamedMDNode` was refactored such that it would no longer subclass `llvm::Value`: https://github.com/llvm/llvm-project/commit/2637cc1a38d7336ea30caf As part of this change, a map type from metadata names to their named metadata, `llvm::MDSymbolTable`, was deleted. In its place, the type of member `llvm::Module::NamedMDSymTab` was changed, from `llvm::MDSymbolTable` to `void *`. The underlying memory allocations for this pointer were changed to `new StringMap<NamedMDNode *>()`. However, as far as I can tell, there's no need for obscuring the underlying type being pointed to by the `void *`, and no need for static casts from `void *` to `StringMap`. In fact, I don't think there's a need for explicit calls to `new` and `delete` at all. This commit changes `NamedMDSymTab` from a pointer to a reference, which automatically couples its lifetime with the lifetime of its owning `llvm::Module` instance, thus removing the explicit calls to `new` and `delete` in the `llvm::Module` constructor and destructor. It also changes the type from `void *` to a newly defined `NamedMDSymTabType`, and removes the static casts. Test Plan: An ASAN-enabled build and run of `check-all` succeeds with this change (aside from some tests that always fail for me in ASAN for some reason, such as `check-clang` `SemaTemplate/stack-exhaustion.cpp`). Reviewers: aprantl, dblaikie, chandlerc, pcc, echristo Reviewed By: dblaikie Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72812
Loading
Please sign in to comment