omjavaid updated this revision to Diff 229971.
omjavaid added a comment.
Added a unittest as suggested by @labath.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70155/new/
https://reviews.llvm.org/D70155
Files:
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp
Index: lldb/unittests/Utility/ArchSpecTest.cpp
===================================================================
--- lldb/unittests/Utility/ArchSpecTest.cpp
+++ lldb/unittests/Utility/ArchSpecTest.cpp
@@ -216,6 +216,41 @@
EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment,
A.GetTriple().getEnvironment());
}
+ {
+ ArchSpec A("arm--linux-eabihf");
+ ArchSpec B("armv8l--linux-gnueabihf");
+
+ EXPECT_TRUE(A.IsValid());
+ EXPECT_TRUE(B.IsValid());
+
+ EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch());
+ EXPECT_EQ(llvm::Triple::ArchType::arm, B.GetTriple().getArch());
+
+ EXPECT_EQ(ArchSpec::eCore_arm_generic, A.GetCore());
+ EXPECT_EQ(ArchSpec::eCore_arm_armv8l, B.GetCore());
+
+ EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor,
+ A.GetTriple().getVendor());
+ EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor,
+ B.GetTriple().getVendor());
+
+ EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS());
+ EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS());
+
+ EXPECT_EQ(llvm::Triple::EnvironmentType::EABIHF,
+ A.GetTriple().getEnvironment());
+ EXPECT_EQ(llvm::Triple::EnvironmentType::GNUEABIHF,
+ B.GetTriple().getEnvironment());
+
+ A.MergeFrom(B);
+ EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch());
+ EXPECT_EQ(ArchSpec::eCore_arm_armv8l, A.GetCore());
+ EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor,
+ A.GetTriple().getVendor());
+ EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS());
+ EXPECT_EQ(llvm::Triple::EnvironmentType::EABIHF,
+ A.GetTriple().getEnvironment());
+ }
}
TEST(ArchSpecTest, MergeFromMachOUnknown) {
Index: lldb/source/Utility/ArchSpec.cpp
===================================================================
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -868,7 +868,7 @@
IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
other.GetCore() != ArchSpec::eCore_arm_generic) {
m_core = other.GetCore();
- CoreUpdated(true);
+ CoreUpdated(false);
}
if (GetFlags() == 0) {
SetFlags(other.GetFlags());
Index: lldb/unittests/Utility/ArchSpecTest.cpp
===================================================================
--- lldb/unittests/Utility/ArchSpecTest.cpp
+++ lldb/unittests/Utility/ArchSpecTest.cpp
@@ -216,6 +216,41 @@
EXPECT_EQ(llvm::Triple::EnvironmentType::UnknownEnvironment,
A.GetTriple().getEnvironment());
}
+ {
+ ArchSpec A("arm--linux-eabihf");
+ ArchSpec B("armv8l--linux-gnueabihf");
+
+ EXPECT_TRUE(A.IsValid());
+ EXPECT_TRUE(B.IsValid());
+
+ EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch());
+ EXPECT_EQ(llvm::Triple::ArchType::arm, B.GetTriple().getArch());
+
+ EXPECT_EQ(ArchSpec::eCore_arm_generic, A.GetCore());
+ EXPECT_EQ(ArchSpec::eCore_arm_armv8l, B.GetCore());
+
+ EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor,
+ A.GetTriple().getVendor());
+ EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor,
+ B.GetTriple().getVendor());
+
+ EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS());
+ EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS());
+
+ EXPECT_EQ(llvm::Triple::EnvironmentType::EABIHF,
+ A.GetTriple().getEnvironment());
+ EXPECT_EQ(llvm::Triple::EnvironmentType::GNUEABIHF,
+ B.GetTriple().getEnvironment());
+
+ A.MergeFrom(B);
+ EXPECT_EQ(llvm::Triple::ArchType::arm, A.GetTriple().getArch());
+ EXPECT_EQ(ArchSpec::eCore_arm_armv8l, A.GetCore());
+ EXPECT_EQ(llvm::Triple::VendorType::UnknownVendor,
+ A.GetTriple().getVendor());
+ EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS());
+ EXPECT_EQ(llvm::Triple::EnvironmentType::EABIHF,
+ A.GetTriple().getEnvironment());
+ }
}
TEST(ArchSpecTest, MergeFromMachOUnknown) {
Index: lldb/source/Utility/ArchSpec.cpp
===================================================================
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -868,7 +868,7 @@
IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
other.GetCore() != ArchSpec::eCore_arm_generic) {
m_core = other.GetCore();
- CoreUpdated(true);
+ CoreUpdated(false);
}
if (GetFlags() == 0) {
SetFlags(other.GetFlags());
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits