mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[CodeView] Minimal support for S_UNAMESPACE records
Differential Revision: https://reviews.llvm.org/D50007 llvm-svn: 338417
This commit is contained in:
parent
632df24ca9
commit
0f20d5d6a0
@ -143,7 +143,6 @@ CV_SYMBOL(S_MANSLOT , 0x1120)
|
||||
CV_SYMBOL(S_MANMANYREG , 0x1121)
|
||||
CV_SYMBOL(S_MANREGREL , 0x1122)
|
||||
CV_SYMBOL(S_MANMANYREG2 , 0x1123)
|
||||
CV_SYMBOL(S_UNAMESPACE , 0x1124)
|
||||
CV_SYMBOL(S_DATAREF , 0x1126)
|
||||
CV_SYMBOL(S_ANNOTATIONREF , 0x1128)
|
||||
CV_SYMBOL(S_TOKENREF , 0x1129)
|
||||
@ -255,6 +254,7 @@ SYMBOL_RECORD_ALIAS(S_GMANDATA , 0x111d, ManagedGlobalData, DataSym)
|
||||
SYMBOL_RECORD(S_LTHREAD32 , 0x1112, ThreadLocalDataSym)
|
||||
SYMBOL_RECORD_ALIAS(S_GTHREAD32 , 0x1113, GlobalTLS, ThreadLocalDataSym)
|
||||
|
||||
SYMBOL_RECORD(S_UNAMESPACE , 0x1124, UsingNamespaceSym)
|
||||
|
||||
#undef CV_SYMBOL
|
||||
#undef SYMBOL_RECORD
|
||||
|
@ -942,6 +942,19 @@ public:
|
||||
uint32_t RecordOffset;
|
||||
};
|
||||
|
||||
// S_UNAMESPACE
|
||||
class UsingNamespaceSym : public SymbolRecord {
|
||||
public:
|
||||
explicit UsingNamespaceSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
|
||||
explicit UsingNamespaceSym(uint32_t RecordOffset)
|
||||
: SymbolRecord(SymbolRecordKind::RegRelativeSym),
|
||||
RecordOffset(RecordOffset) {}
|
||||
|
||||
StringRef Name;
|
||||
|
||||
uint32_t RecordOffset;
|
||||
};
|
||||
|
||||
// S_ANNOTATION
|
||||
|
||||
using CVSymbol = CVRecord<SymbolKind>;
|
||||
|
@ -307,6 +307,9 @@ static int getSymbolNameOffset(CVSymbol Sym) {
|
||||
// See BPRelativeSym
|
||||
case SymbolKind::S_BPREL32:
|
||||
return 8;
|
||||
// See UsingNamespaceSym
|
||||
case SymbolKind::S_UNAMESPACE:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
@ -611,6 +611,12 @@ Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,
|
||||
UsingNamespaceSym &UN) {
|
||||
W.printString("Namespace", UN.Name);
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error CVSymbolDumperImpl::visitUnknownSymbol(CVSymbol &CVR) {
|
||||
W.printNumber("Length", CVR.length());
|
||||
return Error::success();
|
||||
|
@ -463,3 +463,11 @@ Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) {
|
||||
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error SymbolRecordMapping::visitKnownRecord(CVSymbol &CVR,
|
||||
UsingNamespaceSym &UN) {
|
||||
|
||||
error(IO.mapStringZ(UN.Name));
|
||||
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind,
|
||||
case SymbolKind::S_DEFRANGE_SUBFIELD:
|
||||
break;
|
||||
|
||||
// No type refernces.
|
||||
// No type references.
|
||||
case SymbolKind::S_LABEL32:
|
||||
case SymbolKind::S_OBJNAME:
|
||||
case SymbolKind::S_COMPILE:
|
||||
@ -439,6 +439,7 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind,
|
||||
case SymbolKind::S_FRAMEPROC:
|
||||
case SymbolKind::S_THUNK32:
|
||||
case SymbolKind::S_FRAMECOOKIE:
|
||||
case SymbolKind::S_UNAMESPACE:
|
||||
break;
|
||||
// Scope ending symbols.
|
||||
case SymbolKind::S_END:
|
||||
|
@ -550,6 +550,10 @@ template <> void SymbolRecordImpl<ThreadLocalDataSym>::map(IO &IO) {
|
||||
IO.mapRequired("DisplayName", Symbol.Name);
|
||||
}
|
||||
|
||||
template <> void SymbolRecordImpl<UsingNamespaceSym>::map(IO &IO) {
|
||||
IO.mapRequired("Namespace", Symbol.Name);
|
||||
}
|
||||
|
||||
} // end namespace detail
|
||||
} // end namespace CodeViewYAML
|
||||
} // end namespace llvm
|
||||
|
51
test/DebugInfo/PDB/using-namespace.test
Normal file
51
test/DebugInfo/PDB/using-namespace.test
Normal file
@ -0,0 +1,51 @@
|
||||
# RUN: yaml2obj < %s > %t.obj
|
||||
# RUN: llvm-readobj -codeview %t.obj | FileCheck %s
|
||||
|
||||
# CHECK: Kind: S_UNAMESPACE (0x1124)
|
||||
# CHECK-NEXT: Namespace: __vc_attributes
|
||||
|
||||
--- !COFF
|
||||
header:
|
||||
Machine: IMAGE_FILE_MACHINE_AMD64
|
||||
Characteristics: [ ]
|
||||
sections:
|
||||
- Name: '.debug$S'
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 1
|
||||
Subsections:
|
||||
- !Symbols
|
||||
Records:
|
||||
- Kind: S_OBJNAME
|
||||
ObjNameSym:
|
||||
Signature: 0
|
||||
ObjectName: 'SimpleFunction.obj'
|
||||
- Kind: S_COMPILE3
|
||||
Compile3Sym:
|
||||
Flags: [ SecurityChecks, HotPatch ]
|
||||
Machine: X64
|
||||
FrontendMajor: 19
|
||||
FrontendMinor: 14
|
||||
FrontendBuild: 26433
|
||||
FrontendQFE: 0
|
||||
BackendMajor: 19
|
||||
BackendMinor: 14
|
||||
BackendBuild: 26433
|
||||
BackendQFE: 0
|
||||
Version: 'Microsoft (R) Optimizing Compiler'
|
||||
- Kind: S_UNAMESPACE
|
||||
UsingNamespaceSym:
|
||||
Namespace: __vc_attributes
|
||||
- Kind: S_UNAMESPACE
|
||||
UsingNamespaceSym:
|
||||
Namespace: helper_attributes
|
||||
- Kind: S_UNAMESPACE
|
||||
UsingNamespaceSym:
|
||||
Namespace: atl
|
||||
- Kind: S_UNAMESPACE
|
||||
UsingNamespaceSym:
|
||||
Namespace: std
|
||||
- !StringTable
|
||||
Strings:
|
||||
- 'SimpleFunction.c'
|
||||
symbols:
|
||||
...
|
@ -760,3 +760,9 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) {
|
||||
P.formatLine("original type = {0}", UDT.Type);
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
|
||||
UsingNamespaceSym &UN) {
|
||||
P.format(" `{0}`", UN.Name);
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -601,3 +601,10 @@ TEST_F(TypeIndexIteratorTest, VariableSizeIntegers) {
|
||||
writeFieldList(BaseClass1, BaseClass2);
|
||||
checkTypeReferences(0, TypeIndex(47), TypeIndex(48));
|
||||
}
|
||||
|
||||
TEST_F(TypeIndexIteratorTest, UsingNamespace) {
|
||||
UsingNamespaceSym UN(SymbolRecordKind::UsingNamespaceSym);
|
||||
UN.Name = "std";
|
||||
writeSymbolRecords(UN);
|
||||
checkTypeReferences(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user