IRGen: Centralize logic that decides whether the platform suppports typed malloc

NFC intended
This commit is contained in:
Arnold Schwaighofer
2025-04-23 10:43:06 -07:00
parent 77eb4f05ec
commit 3f8c743aed
3 changed files with 8 additions and 7 deletions

View File

@@ -3789,10 +3789,15 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
Args.hasFlag(OPT_enable_async_frame_push_pop_metadata,
OPT_disable_async_frame_push_pop_metadata,
Opts.EmitAsyncFramePushPopMetadata);
bool platformSupportsTypedMalloc = !llvm::Triple(Triple).isOSLinux() &&
!llvm::Triple(Triple).isOSWindows();
Opts.EmitTypeMallocForCoroFrame =
Args.hasFlag(OPT_enable_emit_type_malloc_for_coro_frame,
OPT_disable_emit_type_malloc_for_coro_frame,
Opts.EmitTypeMallocForCoroFrame);
(Opts.EmitTypeMallocForCoroFrame && platformSupportsTypedMalloc));
Opts.AsyncFramePointerAll = Args.hasFlag(OPT_enable_async_frame_pointer_all,
OPT_disable_async_frame_pointer_all,
Opts.AsyncFramePointerAll);