diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-06-15 23:18:16 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-06-15 23:18:16 +0000 |
commit | c6f91a2081f72f4bf5b9924a82c81f57a3b35adf (patch) | |
tree | bd55740b22161d22bff0aeac7381eff9fa8c74cf /clang/lib | |
parent | 8ff53b3cdabb0ab1ec02ab13bb83b273f62bc94d (diff) | |
download | bcm5719-llvm-c6f91a2081f72f4bf5b9924a82c81f57a3b35adf.tar.gz bcm5719-llvm-c6f91a2081f72f4bf5b9924a82c81f57a3b35adf.zip |
Debug Info: Turn on ODR type uniquing for (the C++ part of) Objective-C++.
rdar://problem/20571359
llvm-svn: 239781
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 48458dbd600..a20e39f3fc0 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -590,18 +590,29 @@ llvm::DIType *CGDebugInfo::CreateType(const PointerType *Ty, Ty->getPointeeType(), Unit); } +/// \return whether a C++ mangling exists for the type defined by TD. +static bool hasCXXMangling(const TagDecl *TD, llvm::DICompileUnit *TheCU) { + switch (TheCU->getSourceLanguage()) { + case llvm::dwarf::DW_LANG_C_plus_plus: + return true; + case llvm::dwarf::DW_LANG_ObjC_plus_plus: + return isa<CXXRecordDecl>(TD) || isa<EnumDecl>(TD); + default: + return false; + } +} + /// In C++ mode, types have linkage, so we can rely on the ODR and /// on their mangled names, if they're external. static SmallString<256> getUniqueTagTypeName(const TagType *Ty, CodeGenModule &CGM, llvm::DICompileUnit *TheCU) { SmallString<256> FullName; - // FIXME: ODR should apply to ObjC++ exactly the same wasy it does to C++. - // For now, only apply ODR with C++. const TagDecl *TD = Ty->getDecl(); - if (TheCU->getSourceLanguage() != llvm::dwarf::DW_LANG_C_plus_plus || - !TD->isExternallyVisible()) + + if (!hasCXXMangling(TD, TheCU) || !TD->isExternallyVisible()) return FullName; + // Microsoft Mangler does not have support for mangleCXXRTTIName yet. if (CGM.getTarget().getCXXABI().isMicrosoft()) return FullName; |