diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-27 12:56:10 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-27 12:56:10 +0000 |
commit | 90176d1ef0c3a8c4e87184920cc2ec65e1394d0a (patch) | |
tree | 6428038026242fe885414deb6f4dc8090bbd3cd0 /lib/Frontend/PCHWriterDecl.cpp | |
parent | 96827eb52405a71c65c200949f3e644368e86454 (diff) |
Always deserialize from PCH file scoped variables with non trivial constructor/destructor.
Fixes http://llvm.org/PR7692
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriterDecl.cpp')
-rw-r--r-- | lib/Frontend/PCHWriterDecl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp index abe2b30d1f..06266d2282 100644 --- a/lib/Frontend/PCHWriterDecl.cpp +++ b/lib/Frontend/PCHWriterDecl.cpp @@ -1114,6 +1114,14 @@ static bool isRequiredDecl(const Decl *D, ASTContext &Context) { } else { const VarDecl *VD = cast<VarDecl>(D); + // Structs that have non-trivial constructors or destructors must be seen. + if (const RecordType *RT = VD->getType()->getAs<RecordType>()) { + if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl())) { + if (!RD->hasTrivialConstructor() || !RD->hasTrivialDestructor()) + return true; + } + } + // In C++, this doesn't need to be seen if it is marked "extern". if (Context.getLangOptions().CPlusPlus && !VD->getInit() && (VD->getStorageClass() == VarDecl::Extern || |