llvm.org GIT mirror llvm / fb7514f
IR: Allow 16-bits for column info Raise the limit for column information from 8 bits to 16 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226291 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 5 years ago
5 changed file(s) with 20 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
30013001 /// ::= !MDLocation(line: 43, column: 8, scope: !5, inlinedAt: !6)
30023002 bool LLParser::ParseMDLocation(MDNode *&Result, bool IsDistinct) {
30033003 MDUnsignedField line(0, ~0u >> 8);
3004 MDUnsignedField column(0, ~0u >> 24);
3004 MDUnsignedField column(0, ~0u >> 16);
30053005 MDField scope;
30063006 MDField inlinedAt;
30073007 if (ParseMDFieldsImpl([&]() -> bool {
652652
653653 // Set line and column.
654654 assert(Line < (1u << 24) && "Expected 24-bit line");
655 assert(Column < (1u << 8) && "Expected 8-bit column");
655 assert(Column < (1u << 16) && "Expected 16-bit column");
656656
657657 MDNodeSubclassData = Line;
658658 SubclassData16 = Column;
675675 }
676676
677677 static void adjustColumn(unsigned &Column) {
678 // Set to unknown on overflow. Still use 8 bits for now.
679 if (Column >= (1u << 8))
678 // Set to unknown on overflow. We only have 16 bits to play with here.
679 if (Column >= (1u << 16))
680680 Column = 0;
681681 }
682682
22 !0 = !{}
33
44 ; CHECK-NOT: error
5 !1 = !MDLocation(column: 255, scope: !0)
5 !1 = !MDLocation(column: 65535, scope: !0)
66
7 ; CHECK: :[[@LINE+1]]:26: error: value for 'column' too large, limit is 255
8 !2 = !MDLocation(column: 256, scope: !0)
7 ; CHECK: :[[@LINE+1]]:26: error: value for 'column' too large, limit is 65535
8 !2 = !MDLocation(column: 65536, scope: !0)
0 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
11 ; RUN: verify-uselistorder %s
22
3 ; CHECK: !named = !{!0, !1, !1, !2, !2, !3, !3}
4 !named = !{!0, !1, !2, !3, !4, !5, !6}
3 ; CHECK: !named = !{!0, !1, !1, !2, !2, !3, !3, !4}
4 !named = !{!0, !1, !2, !3, !4, !5, !6, !7}
55
66 ; CHECK: !0 = !{}
77 !0 = !{}
1717 ; CHECK-NEXT: !3 = !MDLocation(line: 0, scope: !0)
1818 !5 = !MDLocation(scope: !0)
1919 !6 = !MDLocation(scope: !0, column: 0, line: 0)
20
21 ; CHECK-NEXT: !4 = !MDLocation(line: 16777215, column: 65535, scope: !0)
22 !7 = !MDLocation(line: 16777215, column: 65535, scope: !0)
396396 EXPECT_EQ(7u, L->getColumn());
397397 }
398398 unsigned U24 = 1u << 24;
399 unsigned U8 = 1u << 8;
400 {
401 MDLocation *L = MDLocation::get(Context, U24 - 1, U8 - 1, N);
399 unsigned U16 = 1u << 16;
400 {
401 MDLocation *L = MDLocation::get(Context, U24 - 1, U16 - 1, N);
402402 EXPECT_EQ(U24 - 1, L->getLine());
403 EXPECT_EQ(U8 - 1, L->getColumn());
404 }
405 {
406 MDLocation *L = MDLocation::get(Context, U24, U8, N);
403 EXPECT_EQ(U16 - 1, L->getColumn());
404 }
405 {
406 MDLocation *L = MDLocation::get(Context, U24, U16, N);
407407 EXPECT_EQ(0u, L->getLine());
408408 EXPECT_EQ(0u, L->getColumn());
409409 }
410410 {
411 MDLocation *L = MDLocation::get(Context, U24 + 1, U8 + 1, N);
411 MDLocation *L = MDLocation::get(Context, U24 + 1, U16 + 1, N);
412412 EXPECT_EQ(0u, L->getLine());
413413 EXPECT_EQ(0u, L->getColumn());
414414 }