[llvm] cb4cd3a - [llvm][AArch64] Fix an assertion message in TargetParserTests. NFC (#98085)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 09:22:55 PDT 2024
Author: Jon Roelofs
Date: 2024-07-09T09:22:53-07:00
New Revision: cb4cd3a834415375cace04b8f7260fd6e26e6835
URL: https://github.com/llvm/llvm-project/commit/cb4cd3a834415375cace04b8f7260fd6e26e6835
DIFF: https://github.com/llvm/llvm-project/commit/cb4cd3a834415375cace04b8f7260fd6e26e6835.diff
LOG: [llvm][AArch64] Fix an assertion message in TargetParserTests. NFC (#98085)
For both overloads, we were printing the bit-pattern for ExpectedFlags
twice. While we're here, also add a convenience line that highlights the
difference between the two sets.
Added:
Modified:
llvm/unittests/TargetParser/TargetParserTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp
index 8231cfd2ad1c9..62be718ba8d14 100644
--- a/llvm/unittests/TargetParser/TargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -110,12 +110,14 @@ template <ARM::ISAKind ISAKind> struct AssertSameExtensionFlags {
if (ExpectedFlags == GotFlags)
return testing::AssertionSuccess();
- return testing::AssertionFailure() << llvm::formatv(
- "CPU: {4}\n"
- "Expected extension flags: {0} ({1:x})\n"
- " Got extension flags: {2} ({3:x})\n",
- FormatExtensionFlags(ExpectedFlags), ExpectedFlags,
- FormatExtensionFlags(GotFlags), ExpectedFlags, CPUName);
+ return testing::AssertionFailure()
+ << llvm::formatv("CPU: {4}\n"
+ "Expected extension flags: {0} ({1:x})\n"
+ " Got extension flags: {2} ({3:x})\n"
+ " Diff: {5} ({6:x})\n",
+ FormatExtensionFlags(ExpectedFlags), ExpectedFlags,
+ FormatExtensionFlags(GotFlags), GotFlags, CPUName,
+ FormatExtensionFlags(ExpectedFlags ^ GotFlags));
}
testing::AssertionResult operator()(const char *m_expr, const char *n_expr,
@@ -127,11 +129,14 @@ template <ARM::ISAKind ISAKind> struct AssertSameExtensionFlags {
return testing::AssertionFailure()
<< llvm::formatv("CPU: {4}\n"
"Expected extension flags: {0} ({1})\n"
- " Got extension flags: {2} ({3})\n",
+ " Got extension flags: {2} ({3})\n"
+ " Diff: {5} ({6})\n",
FormatExtensionFlags(ExpectedFlags),
SerializeExtensionFlags(ExpectedFlags),
FormatExtensionFlags(GotFlags),
- SerializeExtensionFlags(ExpectedFlags), CPUName);
+ SerializeExtensionFlags(GotFlags), CPUName,
+ FormatExtensionFlags(ExpectedFlags ^ GotFlags),
+ SerializeExtensionFlags(ExpectedFlags ^ GotFlags));
}
private:
More information about the llvm-commits
mailing list