diff options
author | Shafik Yaghmour <syaghmour@apple.com> | 2019-08-27 20:17:35 +0000 |
---|---|---|
committer | Shafik Yaghmour <syaghmour@apple.com> | 2019-08-27 20:17:35 +0000 |
commit | 528f5da6d862f59c6e005f85eb32a0c67f65bc4d (patch) | |
tree | 17404f18575d0c9a83e0d9ba026a052fb3bf3e9c /clang/lib/CodeGen | |
parent | 0c01d920512c87d5b6daec2b7232e3728c8def8f (diff) | |
download | bcm5719-llvm-528f5da6d862f59c6e005f85eb32a0c67f65bc4d.tar.gz bcm5719-llvm-528f5da6d862f59c6e005f85eb32a0c67f65bc4d.zip |
Debug Info: Support for DW_AT_export_symbols for anonymous structs
This implements the DWARF 5 feature described in:
http://dwarfstd.org/ShowIssue.php?issue=141212.1
To support recognizing anonymous structs:
struct A {
struct { // Anonymous struct
int y;
};
} a;
This patch adds support in CGDebugInfo::CreateLimitedType(...) for this new flag and an accompanying test to verify this feature.
Differential Revision: https://reviews.llvm.org/D66667
llvm-svn: 370107
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 422fbc1e290..b1f82d47d44 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3121,7 +3121,8 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) { SmallString<256> Identifier = getTypeIdentifier(Ty, CGM, TheCU); - // Explicitly record the calling convention for C++ records. + // Explicitly record the calling convention and export symbols for C++ + // records. auto Flags = llvm::DINode::FlagZero; if (auto CXXRD = dyn_cast<CXXRecordDecl>(RD)) { if (CGM.getCXXABI().getRecordArgABI(CXXRD) == CGCXXABI::RAA_Indirect) @@ -3132,6 +3133,10 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) { // Record if a C++ record is non-trivial type. if (!CXXRD->isTrivial()) Flags |= llvm::DINode::FlagNonTrivial; + + // Record exports it symbols to the containing structure. + if (CXXRD->isAnonymousStructOrUnion()) + Flags |= llvm::DINode::FlagExportSymbols; } llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( |