From e52007cac4faf07ad2776136015fcbfc076ddd84 Mon Sep 17 00:00:00 2001 From: Anirudh Prasad Date: Tue, 1 Jun 2021 15:55:34 -0400 Subject: [PATCH] [SystemZ][z/OS] Stricter condition for HLASM class instantiation - A lot of lit tests simply specify the arch minus the triple. On z/OS, this could result in a scenario of some-other-triple-unknown-ibm-zos. This points to an incorrect triple + arch combo. - To prevent this, isOSzOS change is switched in favour of isOSBinFormatGOFF. - This is because, the GOFF format is set only if the triple is systemz and if the operating system is GOFF. And currently, there are no other architectures/os's using the GOFF file format. - An argument could be made that the problematic tests be fixed to explicitly specify the arch-vendor-triple string, but there's a large number of these tests, and adding this stricter scope ensures that we aren't instantiating the incorrect instance of the AsmParser for other platforms when run on z/OS. Reviewed By: uweigand Differential Revision: https://reviews.llvm.org/D103343 --- llvm/lib/MC/MCParser/AsmParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index f2e25b9ff522..2383a02fb8e1 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -6374,7 +6374,7 @@ bool parseAssignmentExpression(StringRef Name, bool allow_redef, MCAsmParser *llvm::createMCAsmParser(SourceMgr &SM, MCContext &C, MCStreamer &Out, const MCAsmInfo &MAI, unsigned CB) { - if (C.getTargetTriple().isOSzOS()) + if (C.getTargetTriple().isSystemZ() && C.getTargetTriple().isOSzOS()) return new HLASMAsmParser(SM, C, Out, MAI, CB); return new AsmParser(SM, C, Out, MAI, CB);