diff options
| author | John McCall <rjmccall@apple.com> | 2010-07-30 04:56:58 +0000 | 
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-07-30 04:56:58 +0000 | 
| commit | 45d494785d18991c7c01b7506ae54e5603115410 (patch) | |
| tree | 186ebf205b012f275cfbdb225edf4bbea708a356 /clang/lib | |
| parent | 8a2f3c778e9dc3aa5d49b3c97f7bc247b004ea3a (diff) | |
| download | bcm5719-llvm-45d494785d18991c7c01b7506ae54e5603115410.tar.gz bcm5719-llvm-45d494785d18991c7c01b7506ae54e5603115410.zip  | |
Emit global destructors even if the destroyed object has no initializers or has
an initializer requiring temporary object disposal.
Fixes rdar:://problem/8246444.
llvm-svn: 109849
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 10 | 
1 files changed, 3 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 0293c5c125f..ddb1abc70a1 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -45,19 +45,15 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,    CodeGenModule &CGM = CGF.CGM;    ASTContext &Context = CGF.getContext(); -  const Expr *Init = D.getInit();    QualType T = D.getType(); -  if (!CGF.hasAggregateLLVMType(T) || T->isAnyComplexType()) -    return; -                                 -  // Avoid generating destructor(s) for initialized objects.  -  if (!isa<CXXConstructExpr>(Init)) -    return; +  // Drill down past array types.    const ConstantArrayType *Array = Context.getAsConstantArrayType(T);    if (Array)      T = Context.getBaseElementType(Array); +  /// If that's not a record, we're done. +  /// FIXME:  __attribute__((cleanup)) ?    const RecordType *RT = T->getAs<RecordType>();    if (!RT)      return;  | 

