diff options
author | John McCall <rjmccall@apple.com> | 2010-08-05 22:02:13 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-05 22:02:13 +0000 |
commit | 7121c8f551d9c91c0cf0e5e1f7f9aafa97241b17 (patch) | |
tree | 099aaf34b7e07f43b544874e611430fcb00954bc /lib/CodeGen/Mangle.cpp | |
parent | a7be5065edc93ab52a25b2588a23a41a4beba21e (diff) |
Don't crash when mangling empty anonymous unions. We never actually *need*
these, but it's convenient to mangle them when deferring them (in the 99.99%
case where it's not an anonymous union, of course).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110381 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index b5f629aeb5..7bdbabc8c0 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -699,7 +699,11 @@ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND, // a program to refer to the anonymous union, and there is therefore no // need to mangle its name. const FieldDecl *FD = FindFirstNamedDataMember(RD); - assert(FD && "Didn't find a named data member!"); + + // It's actually possible for various reasons for us to get here + // with an empty anonymous struct / union. Fortunately, it + // doesn't really matter what name we generate. + if (!FD) break; assert(FD->getIdentifier() && "Data member name isn't an identifier!"); mangleSourceName(FD->getIdentifier()); |