summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorWarren Ristow <warren.ristow@sony.com>2017-02-02 17:53:34 +0000
committerWarren Ristow <warren.ristow@sony.com>2017-02-02 17:53:34 +0000
commit8d17b4050076c9dea7b68dc0ac208de8f19d9c01 (patch)
tree8fd1acb107836947c199e2bdaa5b6c0c2c6bc6a4 /clang/lib/CodeGen/CGClass.cpp
parentfc89bbcc712550d91e018a682e9369df88e80872 (diff)
downloadbcm5719-llvm-8d17b4050076c9dea7b68dc0ac208de8f19d9c01.tar.gz
bcm5719-llvm-8d17b4050076c9dea7b68dc0ac208de8f19d9c01.zip
Prevent ICE in dllexport class with _Atomic data member
Guard against a null pointer dereference that caused Clang to crash when processing a class containing an _Atomic qualified data member, and that is tagged with 'dllexport'. Differential Revision: https://reviews.llvm.org/D29208 llvm-svn: 293911
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index c3e907e9cd5..03c3358bd8b 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -1131,10 +1131,11 @@ namespace {
RHS = EC->getSubExpr();
if (!RHS)
return nullptr;
- MemberExpr *ME2 = dyn_cast<MemberExpr>(RHS);
- if (dyn_cast<FieldDecl>(ME2->getMemberDecl()) != Field)
- return nullptr;
- return Field;
+ if (MemberExpr *ME2 = dyn_cast<MemberExpr>(RHS)) {
+ if (ME2->getMemberDecl() == Field)
+ return Field;
+ }
+ return nullptr;
} else if (CXXMemberCallExpr *MCE = dyn_cast<CXXMemberCallExpr>(S)) {
CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(MCE->getCalleeDecl());
if (!(MD && isMemcpyEquivalentSpecialMember(MD)))
OpenPOWER on IntegriCloud