@@ -912,7 +912,6 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
912
912
auto targetMachine = irgen.createTargetMachine ();
913
913
if (!targetMachine) return ;
914
914
915
- const llvm::Triple &Triple = Ctx.LangOpts .Target ;
916
915
IRGenModule IGM (irgen, std::move (targetMachine), nullptr , VMContext,
917
916
OutputPath, Opts.getSingleOutputFilename ());
918
917
initLLVMModule (IGM);
@@ -924,13 +923,19 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
924
923
llvm::GlobalVariable::InternalLinkage,
925
924
Data, " __Swift_AST" );
926
925
std::string Section;
927
- if (Triple.isOSBinFormatMachO ())
928
- Section = std::string (MachOASTSegmentName) + " ," + MachOASTSectionName;
929
- else if (Triple.isOSBinFormatCOFF ())
926
+ switch (IGM.TargetInfo .OutputObjectFormat ) {
927
+ case llvm::Triple::UnknownObjectFormat:
928
+ llvm_unreachable (" unknown object format" );
929
+ case llvm::Triple::COFF:
930
930
Section = COFFASTSectionName;
931
- else
931
+ break ;
932
+ case llvm::Triple::ELF:
932
933
Section = ELFASTSectionName;
933
-
934
+ break ;
935
+ case llvm::Triple::MachO:
936
+ Section = std::string (MachOASTSegmentName) + " ," + MachOASTSectionName;
937
+ break ;
938
+ }
934
939
ASTSym->setSection (Section);
935
940
ASTSym->setAlignment (8 );
936
941
::performLLVM (Opts, Ctx.Diags, nullptr , nullptr , IGM.getModule(),
0 commit comments