[PATCH] D40521: [scudo] Allow for compile-time choice of the SizeClassMap

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 13:32:45 PST 2017


alekseyshl added a comment.

In https://reviews.llvm.org/D40521#937952, @cryptoad wrote:

> I guess another question that I had for you @alekseyshl : would you rather see #if or #ifdef?
>  I am not sure SCUDO_SCM_DEFAULT=1 makes sense as opposed to it just being defined.


Another idea, how about defining the type name?

  SCUDO_SIZE_CLASS_MAP={Default|Compact|VeryCompact}

and then do something like this:

  #if !defined(SCUDO_SIZE_CLASS_MAP)
  # define SCUDO_SIZE_CLASS_MAP Default
  #endif
  
  #define SIZE_CLASS_MAP_TYPE SIZE_CLASS_MAP_TYPE_(SCUDO_SIZE_CLASS_MAP)
  #define SIZE_CLASS_MAP_TYPE_(T) SIZE_CLASS_MAP_TYPE__(T)
  #define SIZE_CLASS_MAP_TYPE__(T) T##SizeClassMap
  
  typedef SIZE_CLASS_MAP_TYPE SizeClassMap;



================
Comment at: lib/scudo/scudo_platform.h:67
+#elif SCUDO_SCM_DEFAULT
+typedef DefaultSizeClassMap SizeClassMap;
+#else
----------------
cryptoad wrote:
> alekseyshl wrote:
> > Why not just fold it into #else?
> Well the train of thought was that the actual default might be different in the future so I wanted to have a separate #else there.
Default value might be different from the one Scudo defaults to in case it was not defined? Hmm...


https://reviews.llvm.org/D40521





More information about the llvm-commits mailing list