diff options
author | Zachary Turner <zturner@google.com> | 2018-11-01 04:02:41 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-11-01 04:02:41 +0000 |
commit | 56a5a0c3ce57da8c4c8def9f30b628bcb9a4f87f (patch) | |
tree | eeba8968219049c8ba6175238e29b0b1dd4997b0 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 03170a904f5b5f7f6eb11db4b427c35180e29e2e (diff) | |
download | llvm-56a5a0c3ce57da8c4c8def9f30b628bcb9a4f87f.zip llvm-56a5a0c3ce57da8c4c8def9f30b628bcb9a4f87f.tar.gz llvm-56a5a0c3ce57da8c4c8def9f30b628bcb9a4f87f.tar.bz2 |
[CodeView] Emit the correct TypeIndex for std::nullptr_t.
The TypeIndex used by cl.exe is 0x103, which indicates a SimpleTypeMode
of NearPointer (note the absence of the bitness, normally pointers use a
mode of NearPointer32 or NearPointer64) and a SimpleTypeKind of void.
So this is basically a void*, but without a specified size, which makes
sense given how std::nullptr_t is defined.
clang-cl was actually not emitting *anything* for this. Instead, when we
encountered std::nullptr_t in a DIType, we would actually just emit a
TypeIndex of 0, which is obviously wrong.
std::nullptr_t in DWARF is represented as a DW_TAG_unspecified_type with
a name of "decltype(nullptr)", so we add that logic along with a test,
as well as an update to the dumping code so that we no longer print
void* when dumping 0x103 (which would previously treat Void/NearPointer
no differently than Void/NearPointer64).
Differential Revision: https://reviews.llvm.org/D53957
llvm-svn: 345811
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 42259d4..9b2b347 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1516,6 +1516,8 @@ TypeIndex CodeViewDebug::lowerType(const DIType *Ty, const DIType *ClassTy) { case dwarf::DW_TAG_union_type: return lowerTypeUnion(cast<DICompositeType>(Ty)); case dwarf::DW_TAG_unspecified_type: + if (Ty->getName() == "decltype(nullptr)") + return TypeIndex::NullptrT(); return TypeIndex::None(); default: // Use the null type index. |