diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-02-01 00:41:00 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-02-01 00:41:00 +0000 |
commit | ee625afea71ef5a9c1e386564919b86915d96b0d (patch) | |
tree | 9cc0c0caf7427ab543a95be0e384f0f4fcf28b41 /lib/Sema/SemaDecl.cpp | |
parent | fe9b559f81535ade84d24c42569378f80df47847 (diff) |
Fix crash on invalid in microsoft anonymous struct extension.
Fixes PR11847. Patch from Jason Haslam!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149460 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d545d03ac5..87bcfe9127 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2952,9 +2952,10 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, SmallVector<NamedDecl*, 2> Chain; Chain.push_back(Anon); - if (InjectAnonymousStructOrUnionMembers(*this, S, CurContext, - Record->getDefinition(), - AS_none, Chain, true)) + RecordDecl *RecordDef = Record->getDefinition(); + if (!RecordDef || InjectAnonymousStructOrUnionMembers(*this, S, CurContext, + RecordDef, AS_none, + Chain, true)) Anon->setInvalidDecl(); return Anon; |