[dllimport] Look through typedefs and arrays in HasNonDllImportDtor

The function is used to check whether a type is a class with
non-dllimport destructor. It needs to look through typedefs and array
types.

llvm-svn: 295257
This commit is contained in:
Hans Wennborg 2017-02-15 23:28:07 +00:00
parent a2111793bb
commit 6c3d625fd9
2 changed files with 2 additions and 2 deletions

View File

@ -1795,7 +1795,7 @@ CodeGenModule::isTriviallyRecursive(const FunctionDecl *FD) {
// Check if T is a class type with a destructor that's not dllimport.
static bool HasNonDllImportDtor(QualType T) {
if (const RecordType *RT = dyn_cast<RecordType>(T))
if (const auto *RT = T->getBaseElementTypeUnsafe()->getAs<RecordType>())
if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl()))
if (RD->getDestructor() && !RD->getDestructor()->hasAttr<DLLImportAttr>())
return true;

View File

@ -358,7 +358,7 @@ __declspec(dllimport) inline int *ReferencingImportedDelete() { delete (int*)nul
USE(ReferencingImportedNew)
USE(ReferencingImportedDelete)
struct ClassWithDtor { ~ClassWithDtor() {} };
struct __declspec(dllimport) ClassWithNonDllImportField { ClassWithDtor t; };
struct __declspec(dllimport) ClassWithNonDllImportField { using X = ClassWithDtor; X t[2]; };
struct __declspec(dllimport) ClassWithNonDllImportBase : public ClassWithDtor { };
USECLASS(ClassWithNonDllImportField);
USECLASS(ClassWithNonDllImportBase);