[PATCH] D103091: [SystemZ][z/OS] Validate symbol names for z/OS for printing without quotes
Anirudh Prasad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 26 07:37:21 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb37a2fcd8d7c: [SystemZ][z/OS] Validate symbol names for z/OS for printing without quotes (authored by anirudhp).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103091/new/
https://reviews.llvm.org/D103091
Files:
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
Index: llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
===================================================================
--- llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
+++ llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp
@@ -48,6 +48,7 @@
AllowHashAtStartOfIdentifier = Value;
}
void setAllowDotIsPC(bool Value) { DotIsPC = Value; }
+ void setAssemblerDialect(unsigned Value) { AssemblerDialect = Value; }
};
// Setup a testing class that the GTest framework can call.
@@ -734,4 +735,19 @@
AsmToken::Error, AsmToken::EndOfStatement, AsmToken::Eof});
lexAndCheckTokens(AsmStr, ExpectedTokens);
}
+
+TEST_F(SystemZAsmLexerTest, CheckPrintAcceptableSymbol) {
+ std::string AsmStr = "ab13_$.@";
+ EXPECT_EQ(true, MUPMAI->isValidUnquotedName(AsmStr));
+ AsmStr += "#";
+ EXPECT_EQ(false, MUPMAI->isValidUnquotedName(AsmStr));
+}
+
+TEST_F(SystemZAsmLexerTest, CheckPrintAcceptableSymbol2) {
+ MUPMAI->setAssemblerDialect(1);
+ std::string AsmStr = "ab13_$.@";
+ EXPECT_EQ(true, MUPMAI->isValidUnquotedName(AsmStr));
+ AsmStr += "#";
+ EXPECT_EQ(true, MUPMAI->isValidUnquotedName(AsmStr));
+}
} // end anonymous namespace
Index: llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
===================================================================
--- llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
+++ llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
@@ -19,6 +19,7 @@
class SystemZMCAsmInfo : public MCAsmInfoELF {
public:
explicit SystemZMCAsmInfo(const Triple &TT);
+ bool isAcceptableChar(char C) const override;
};
} // end namespace llvm
Index: llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
===================================================================
--- llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
+++ llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
@@ -37,3 +37,10 @@
SupportsDebugInformation = true;
ExceptionsType = ExceptionHandling::DwarfCFI;
}
+
+bool SystemZMCAsmInfo::isAcceptableChar(char C) const {
+ if (AssemblerDialect == AD_ATT)
+ return MCAsmInfo::isAcceptableChar(C);
+
+ return MCAsmInfo::isAcceptableChar(C) || C == '#';
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103091.347960.patch
Type: text/x-patch
Size: 2181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210526/f7dfdeaa/attachment.bin>
More information about the llvm-commits
mailing list