diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-08-17 19:34:38 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-08-17 19:34:38 +0000 |
| commit | 631f6b779f4d248755ad71398d0f296653dd62cf (patch) | |
| tree | 817597699dc876210d1681a258acaaca031345a9 /lib/Analysis | |
| parent | 7fd6ba58d980ec2bf312a80444948501dd27d020 (diff) | |
Notes
Diffstat (limited to 'lib/Analysis')
| -rw-r--r-- | lib/Analysis/CFG.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index d7a9bdb3d82cd..a67f0910e15a7 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -3902,7 +3902,17 @@ CFGImplicitDtor::getDestructorDecl(ASTContext &astContext) const { case CFGElement::AutomaticObjectDtor: { const VarDecl *var = castAs<CFGAutomaticObjDtor>().getVarDecl(); QualType ty = var->getType(); - ty = ty.getNonReferenceType(); + + // FIXME: See CFGBuilder::addLocalScopeForVarDecl. + // + // Lifetime-extending constructs are handled here. This works for a single + // temporary in an initializer expression. + if (ty->isReferenceType()) { + if (const Expr *Init = var->getInit()) { + ty = getReferenceInitTemporaryType(astContext, Init); + } + } + while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) { ty = arrayType->getElementType(); } |
