summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-06-23 16:33:53 +0000
committerHans Wennborg <hans@hanshq.net>2016-06-23 16:33:53 +0000
commitb510b458b98da0ed586824f41aa97443ac1cca94 (patch)
treeac5b24a21973b2611376136f9cac96526ba99894 /llvm/lib/CodeGen/AsmPrinter
parenta9d4085fee983dfdd94346d8058a04ac42a5cd89 (diff)
downloadbcm5719-llvm-b510b458b98da0ed586824f41aa97443ac1cca94.tar.gz
bcm5719-llvm-b510b458b98da0ed586824f41aa97443ac1cca94.zip
[codeview] Emit retained types
Differential Revision: http://reviews.llvm.org/D21630 llvm-svn: 273579
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp15
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 4edc6aece16..4c46e5177fa 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -344,6 +344,9 @@ void CodeViewDebug::endModule() {
setCurrentSubprogram(nullptr);
emitDebugInfoForGlobals();
+ // Emit retained types.
+ emitDebugInfoForRetainedTypes();
+
// Switch back to the generic .debug$S section after potentially processing
// comdat symbol sections.
switchToDebugSectionForSymbol(nullptr);
@@ -1802,6 +1805,18 @@ void CodeViewDebug::emitDebugInfoForGlobals() {
}
}
+void CodeViewDebug::emitDebugInfoForRetainedTypes() {
+ NamedMDNode *CUs = MMI->getModule()->getNamedMetadata("llvm.dbg.cu");
+ for (const MDNode *Node : CUs->operands()) {
+ for (auto *Ty : cast<DICompileUnit>(Node)->getRetainedTypes()) {
+ if (DIType *RT = dyn_cast<DIType>(Ty)) {
+ getTypeIndex(RT);
+ // FIXME: Add to global/local DTU list.
+ }
+ }
+ }
+}
+
void CodeViewDebug::emitDebugInfoForGlobal(const DIGlobalVariable *DIGV,
MCSymbol *GVSym) {
// DataSym record, see SymbolRecord.h for more info.
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index a7976d8d2ac..93480d11610 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -191,6 +191,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
void emitDebugInfoForGlobals();
+ void emitDebugInfoForRetainedTypes();
+
void emitDebugInfoForUDTs(
ArrayRef<std::pair<std::string, codeview::TypeIndex>> UDTs);
OpenPOWER on IntegriCloud