diff options
author | Reid Kleckner <rnk@google.com> | 2017-08-08 20:30:14 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-08-08 20:30:14 +0000 |
commit | e2e82061f9d5c340f470840f7e64bca597e4b344 (patch) | |
tree | 4a06e0aea2a12ce79ebd874addc58279c28bed5b /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 9f338dcd4fa43eb352d316039b53d374a87fbd7a (diff) | |
download | bcm5719-llvm-e2e82061f9d5c340f470840f7e64bca597e4b344.tar.gz bcm5719-llvm-e2e82061f9d5c340f470840f7e64bca597e4b344.zip |
[codeview] Emit nested enums and typedefs from classes
Previously we limited ourselves to only emitting nested classes, but we
need other kinds of types as well.
This fixes the Visual Studio STL visualizers, so that users can
visualize std::string and other objects.
llvm-svn: 310410
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 833e5bae1cf..4346803738b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1655,7 +1655,7 @@ struct llvm::ClassInfo { TypeIndex VShapeTI; - std::vector<const DICompositeType *> NestedClasses; + std::vector<const DIType *> NestedTypes; }; void CodeViewDebug::clear() { @@ -1706,12 +1706,14 @@ ClassInfo CodeViewDebug::collectClassInfo(const DICompositeType *Ty) { } else if (DDTy->getTag() == dwarf::DW_TAG_pointer_type && DDTy->getName() == "__vtbl_ptr_type") { Info.VShapeTI = getTypeIndex(DDTy); + } else if (DDTy->getTag() == dwarf::DW_TAG_typedef) { + Info.NestedTypes.push_back(DDTy); } else if (DDTy->getTag() == dwarf::DW_TAG_friend) { // Ignore friend members. It appears that MSVC emitted info about // friends in the past, but modern versions do not. } } else if (auto *Composite = dyn_cast<DICompositeType>(Element)) { - Info.NestedClasses.push_back(Composite); + Info.NestedTypes.push_back(Composite); } // Skip other unrecognized kinds of elements. } @@ -1920,7 +1922,7 @@ CodeViewDebug::lowerRecordFieldList(const DICompositeType *Ty) { } // Create nested classes. - for (const DICompositeType *Nested : Info.NestedClasses) { + for (const DIType *Nested : Info.NestedTypes) { NestedTypeRecord R(getTypeIndex(DITypeRef(Nested)), Nested->getName()); FLBR.writeMemberType(R); MemberCount++; @@ -1928,7 +1930,7 @@ CodeViewDebug::lowerRecordFieldList(const DICompositeType *Ty) { TypeIndex FieldTI = FLBR.end(true); return std::make_tuple(FieldTI, Info.VShapeTI, MemberCount, - !Info.NestedClasses.empty()); + !Info.NestedTypes.empty()); } TypeIndex CodeViewDebug::getVBPTypeIndex() { |