aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-06-21 14:00:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-06-21 14:00:56 +0000
commit2e645aa5697838f16ec570eb07c2bee7e13d0e0b (patch)
treea764184c2fc9486979b074250b013a0937ee64e5 /lib/CodeGen/CGDebugInfo.cpp
parent798321d8eb5630cd4a8f490a4f25e32ef195fb07 (diff)
downloadsrc-2e645aa5697838f16ec570eb07c2bee7e13d0e0b.tar.gz
src-2e645aa5697838f16ec570eb07c2bee7e13d0e0b.zip
Notes
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 48458dbd6003..a20e39f3fc00 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/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;