mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
IR: Add MDLocation class
Add a new subclass of `UniquableMDNode`, `MDLocation`. This will be the IR version of `DebugLoc` and `DILocation`. The goal is to rename this to `DILocation` once the IR classes supersede the `DI`-prefixed wrappers. This isn't used anywhere yet. Part of PR21433. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225824 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -387,6 +387,43 @@ TEST_F(MDNodeTest, replaceResolvedOperand) {
|
||||
Temp->replaceAllUsesWith(nullptr);
|
||||
}
|
||||
|
||||
typedef MetadataTest MDLocationTest;
|
||||
|
||||
TEST_F(MDLocationTest, Overflow) {
|
||||
MDNode *N = MDNode::get(Context, None);
|
||||
{
|
||||
MDLocation *L = MDLocation::get(Context, 2, 7, N);
|
||||
EXPECT_EQ(2u, L->getLine());
|
||||
EXPECT_EQ(7u, L->getColumn());
|
||||
}
|
||||
unsigned U24 = 1u << 24;
|
||||
unsigned U8 = 1u << 8;
|
||||
{
|
||||
MDLocation *L = MDLocation::get(Context, U24 - 1, U8 - 1, N);
|
||||
EXPECT_EQ(U24 - 1, L->getLine());
|
||||
EXPECT_EQ(U8 - 1, L->getColumn());
|
||||
}
|
||||
{
|
||||
MDLocation *L = MDLocation::get(Context, U24, U8, N);
|
||||
EXPECT_EQ(0u, L->getLine());
|
||||
EXPECT_EQ(0u, L->getColumn());
|
||||
}
|
||||
{
|
||||
MDLocation *L = MDLocation::get(Context, U24 + 1, U8 + 1, N);
|
||||
EXPECT_EQ(0u, L->getLine());
|
||||
EXPECT_EQ(0u, L->getColumn());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MDLocationTest, getDistinct) {
|
||||
MDNode *N = MDNode::get(Context, None);
|
||||
MDLocation *L0 = MDLocation::getDistinct(Context, 2, 7, N);
|
||||
EXPECT_TRUE(L0->isDistinct());
|
||||
MDLocation *L1 = MDLocation::get(Context, 2, 7, N);
|
||||
EXPECT_FALSE(L1->isDistinct());
|
||||
EXPECT_EQ(L1, MDLocation::get(Context, 2, 7, N));
|
||||
}
|
||||
|
||||
typedef MetadataTest MetadataAsValueTest;
|
||||
|
||||
TEST_F(MetadataAsValueTest, MDNode) {
|
||||
|
Reference in New Issue
Block a user