@@ -55,14 +55,15 @@ using namespace CodeGen;
5555// / shouldEmitLifetimeMarkers - Decide whether we need emit the life-time
5656// / markers.
5757static bool shouldEmitLifetimeMarkers (const CodeGenOptions &CGOpts,
58- const LangOptions &LangOpts) {
59- #ifdef _WIN32
60- // [SEH] when we enable EHAsynch, we should not emit life time mark
61- // if (LangOpts.EHAsynch)
62- CodeGenOptions *CGOptsTemp = (CodeGenOptions *)&CGOpts;
63- CGOptsTemp->DisableLifetimeMarkers = true ;
64- return false ;
65- #endif
58+ const LangOptions &LangOpts,
59+ const llvm::Triple &Triple) {
60+ if (Triple.isOSWindows () || Triple.isOSBinFormatCOFF ()) {
61+ // [SEH] when we enable EHAsynch, we should not emit life time mark
62+ // if (LangOpts.EHAsynch)
63+ auto &MutableCGOpts = const_cast <CodeGenOptions &>(CGOpts);
64+ MutableCGOpts.DisableLifetimeMarkers = true ;
65+ return false ;
66+ }
6667
6768 if (CGOpts.DisableLifetimeMarkers )
6869 return false ;
@@ -84,7 +85,8 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext)
8485 SanOpts(CGM .getLangOpts().Sanitize), CurFPFeatures(CGM .getLangOpts()),
8586 DebugInfo(CGM .getModuleDebugInfo()), PGO(cgm),
8687 ShouldEmitLifetimeMarkers(
87- shouldEmitLifetimeMarkers (CGM .getCodeGenOpts(), CGM.getLangOpts())) {
88+ shouldEmitLifetimeMarkers (CGM .getCodeGenOpts(), CGM.getLangOpts(),
89+ CGM.getTarget().getTriple())) {
8890 if (!suppressNewContext)
8991 CGM .getCXXABI ().getMangleContext ().startNewFunction ();
9092 EHStack.setCGF (this );
0 commit comments