Skip to content
Snippets Groups Projects
Commit 8fd292ed authored by Warren Ristow's avatar Warren Ristow
Browse files

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293911 91177308-0d34-0410-b5e6-96231b3b80d8
parent 21c8bcd7
No related branches found
No related tags found
No related merge requests found
......@@ -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)))
......
// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++11 -fms-extensions -O0 -o - %s | FileCheck --check-prefix=M32 %s
// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -std=c++11 -fms-extensions -O0 -o - %s | FileCheck --check-prefix=M64 %s
struct __declspec(dllexport) SomeStruct {
// Copy assignment operator should be produced, and exported:
// M32: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.SomeStruct* @"\01??4SomeStruct@@QAEAAU0@ABU0@@Z"
// M64: define weak_odr dllexport dereferenceable({{[0-9]+}}) %struct.SomeStruct* @"\01??4SomeStruct@@QEAAAEAU0@AEBU0@@Z"
_Atomic(int) mData;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment