diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-10-24 21:29:06 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-10-24 21:29:06 +0000 |
commit | 39e177692ea2096af2ad0dcead79250b50958fa3 (patch) | |
tree | 00137791a748ead8e0fd71f5d8bdf3217317fc68 /lib/Sema/SemaDecl.cpp | |
parent | 9dd686d2be3c3785a089ff12a3d3eb64e9b32dc0 (diff) |
Fix false positive in -Wunused-variable when a ctor call make involve cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 19442b98c1..e8d017c098 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1286,6 +1286,8 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) { return false; if (const Expr *Init = VD->getInit()) { + if (const ExprWithCleanups *Cleanups = dyn_cast<ExprWithCleanups>(Init)) + Init = Cleanups->getSubExpr(); const CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init); if (Construct && !Construct->isElidable()) { |