[PATCH] D149600: [MemProf] Recognize hot/cold operator new as replaceable allocations

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 12:01:13 PDT 2023


tejohnson added inline comments.


================
Comment at: clang/test/CodeGenCXX/new_hot_cold.cpp:16
+
+enum class __hot_cold_t : uint8_t;
+namespace malloc_namespace {
----------------
snehasish wrote:
> Can we skip the typedef and just say `enum class __hot_cold_t : unsigned char;`?
> 
> Also it might be useful to link to the tcmalloc documentation for hot_cold_t to document the expected underlying type?
> https://github.com/google/tcmalloc/blob/220043886d4e2efff7a5702d5172cb8065253664/tcmalloc/malloc_extension.h#L53
> 
> 
> Can we skip the typedef and just say enum class __hot_cold_t : unsigned char;?

I did that specifically to test the way it is declared in tcmalloc. In particular, this tests the TypedefType while loop at lines 3301-2 in Decl.cpp which was required to "see through" that and handle that case properly. I can add a comment here to the test. Will also add the link to tcmalloc here and in Decl.cpp


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149600/new/

https://reviews.llvm.org/D149600



More information about the cfe-commits mailing list