summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-05 22:02:13 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-05 22:02:13 +0000
commit491462425a8aaf3f1b3d4d9879e58e9368dc2bdc (patch)
treeb2ac69347c2ebbbe7bbe16f412c96a7f23e66e46 /clang/lib/CodeGen
parent638c82321184b5bd644e3b5248354e9c4d59d786 (diff)
downloadbcm5719-llvm-491462425a8aaf3f1b3d4d9879e58e9368dc2bdc.tar.gz
bcm5719-llvm-491462425a8aaf3f1b3d4d9879e58e9368dc2bdc.zip
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). llvm-svn: 110381
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/Mangle.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index b5f629aeb54..7bdbabc8c07 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud