llvm.org GIT mirror llvm / a7336f2
[CodeView] Minimal support for S_UNAMESPACE records Differential Revision: https://reviews.llvm.org/D50007 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338417 91177308-0d34-0410-b5e6-96231b3b80d8 Alexandre Ganea 1 year, 1 month ago
10 changed file(s) with 102 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
142142 CV_SYMBOL(S_MANMANYREG , 0x1121)
143143 CV_SYMBOL(S_MANREGREL , 0x1122)
144144 CV_SYMBOL(S_MANMANYREG2 , 0x1123)
145 CV_SYMBOL(S_UNAMESPACE , 0x1124)
146145 CV_SYMBOL(S_DATAREF , 0x1126)
147146 CV_SYMBOL(S_ANNOTATIONREF , 0x1128)
148147 CV_SYMBOL(S_TOKENREF , 0x1129)
254253 SYMBOL_RECORD(S_LTHREAD32 , 0x1112, ThreadLocalDataSym)
255254 SYMBOL_RECORD_ALIAS(S_GTHREAD32 , 0x1113, GlobalTLS, ThreadLocalDataSym)
256255
256 SYMBOL_RECORD(S_UNAMESPACE , 0x1124, UsingNamespaceSym)
257257
258258 #undef CV_SYMBOL
259259 #undef SYMBOL_RECORD
941941 uint32_t RecordOffset;
942942 };
943943
944 // S_UNAMESPACE
945 class UsingNamespaceSym : public SymbolRecord {
946 public:
947 explicit UsingNamespaceSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
948 explicit UsingNamespaceSym(uint32_t RecordOffset)
949 : SymbolRecord(SymbolRecordKind::RegRelativeSym),
950 RecordOffset(RecordOffset) {}
951
952 StringRef Name;
953
954 uint32_t RecordOffset;
955 };
956
944957 // S_ANNOTATION
945958
946959 using CVSymbol = CVRecord;
306306 // See BPRelativeSym
307307 case SymbolKind::S_BPREL32:
308308 return 8;
309 // See UsingNamespaceSym
310 case SymbolKind::S_UNAMESPACE:
311 return 0;
309312 default:
310313 return -1;
311314 }
610610 return Error::success();
611611 }
612612
613 Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
614 UsingNamespaceSym &UN) {
615 W.printString("Namespace", UN.Name);
616 return Error::success();
617 }
618
613619 Error CVSymbolDumperImpl::visitUnknownSymbol(CVSymbol &CVR) {
614620 W.printNumber("Length", CVR.length());
615621 return Error::success();
462462
463463 return Error::success();
464464 }
465
466 Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
467 UsingNamespaceSym &UN) {
468
469 error(IO.mapStringZ(UN.Name));
470
471 return Error::success();
472 }
427427 case SymbolKind::S_DEFRANGE_SUBFIELD:
428428 break;
429429
430 // No type refernces.
430 // No type references.
431431 case SymbolKind::S_LABEL32:
432432 case SymbolKind::S_OBJNAME:
433433 case SymbolKind::S_COMPILE:
438438 case SymbolKind::S_FRAMEPROC:
439439 case SymbolKind::S_THUNK32:
440440 case SymbolKind::S_FRAMECOOKIE:
441 case SymbolKind::S_UNAMESPACE:
441442 break;
442443 // Scope ending symbols.
443444 case SymbolKind::S_END:
549549 IO.mapRequired("DisplayName", Symbol.Name);
550550 }
551551
552 template <> void SymbolRecordImpl::map(IO &IO) {
553 IO.mapRequired("Namespace", Symbol.Name);
554 }
555
552556 } // end namespace detail
553557 } // end namespace CodeViewYAML
554558 } // end namespace llvm
0 # RUN: yaml2obj < %s > %t.obj
1 # RUN: llvm-readobj -codeview %t.obj | FileCheck %s
2
3 # CHECK: Kind: S_UNAMESPACE (0x1124)
4 # CHECK-NEXT: Namespace: __vc_attributes
5
6 --- !COFF
7 header:
8 Machine: IMAGE_FILE_MACHINE_AMD64
9 Characteristics: [ ]
10 sections:
11 - Name: '.debug$S'
12 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
13 Alignment: 1
14 Subsections:
15 - !Symbols
16 Records:
17 - Kind: S_OBJNAME
18 ObjNameSym:
19 Signature: 0
20 ObjectName: 'SimpleFunction.obj'
21 - Kind: S_COMPILE3
22 Compile3Sym:
23 Flags: [ SecurityChecks, HotPatch ]
24 Machine: X64
25 FrontendMajor: 19
26 FrontendMinor: 14
27 FrontendBuild: 26433
28 FrontendQFE: 0
29 BackendMajor: 19
30 BackendMinor: 14
31 BackendBuild: 26433
32 BackendQFE: 0
33 Version: 'Microsoft (R) Optimizing Compiler'
34 - Kind: S_UNAMESPACE
35 UsingNamespaceSym:
36 Namespace: __vc_attributes
37 - Kind: S_UNAMESPACE
38 UsingNamespaceSym:
39 Namespace: helper_attributes
40 - Kind: S_UNAMESPACE
41 UsingNamespaceSym:
42 Namespace: atl
43 - Kind: S_UNAMESPACE
44 UsingNamespaceSym:
45 Namespace: std
46 - !StringTable
47 Strings:
48 - 'SimpleFunction.c'
49 symbols:
50 ...
759759 P.formatLine("original type = {0}", UDT.Type);
760760 return Error::success();
761761 }
762
763 Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
764 UsingNamespaceSym &UN) {
765 P.format(" `{0}`", UN.Name);
766 return Error::success();
767 }
599599 BaseClassRecord BaseClass2(MemberAccess::Public, TypeIndex(48), 1);
600600 writeFieldList(BaseClass1, BaseClass2);
601601 checkTypeReferences(0, TypeIndex(47), TypeIndex(48));
602 }
602 }
603
604 TEST_F(TypeIndexIteratorTest, UsingNamespace) {
605 UsingNamespaceSym UN(SymbolRecordKind::UsingNamespaceSym);
606 UN.Name = "std";
607 writeSymbolRecords(UN);
608 checkTypeReferences(0);
609 }