diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:08:19 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:08:19 +0000 | 
| commit | 798321d8eb5630cd4a8f490a4f25e32ef195fb07 (patch) | |
| tree | a59f5569ef36d00388c0428426abef26aa9105b6 /lib/Analysis | |
| parent | 5e20cdd81c44a443562a09007668ffdf76c455af (diff) | |
Diffstat (limited to 'lib/Analysis')
| -rw-r--r-- | lib/Analysis/CFG.cpp | 18 | 
1 files changed, 15 insertions, 3 deletions
| diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 2744c5fbe72d..b2fdd2787985 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -1095,6 +1095,19 @@ CFGBlock *CFGBuilder::addInitializer(CXXCtorInitializer *I) {        // generating destructors for the second time.        return Visit(cast<ExprWithCleanups>(Init)->getSubExpr());      } +    if (BuildOpts.AddCXXDefaultInitExprInCtors) { +      if (CXXDefaultInitExpr *Default = dyn_cast<CXXDefaultInitExpr>(Init)) { +        // In general, appending the expression wrapped by a CXXDefaultInitExpr +        // may cause the same Expr to appear more than once in the CFG. Doing it +        // here is safe because there's only one initializer per field. +        autoCreateBlock(); +        appendStmt(Block, Default); +        if (Stmt *Child = Default->getExpr()) +          if (CFGBlock *R = Visit(Child)) +            Block = R; +        return Block; +      } +    }      return Visit(Init);    } @@ -1179,8 +1192,7 @@ void CFGBuilder::addAutomaticObjDtors(LocalScope::const_iterator B,      }      Ty = Context->getBaseElementType(Ty); -    const CXXDestructorDecl *Dtor = Ty->getAsCXXRecordDecl()->getDestructor(); -    if (Dtor->isNoReturn()) +    if (Ty->getAsCXXRecordDecl()->isAnyDestructorNoReturn())        Block = createNoReturnBlock();      else        autoCreateBlock(); @@ -3682,7 +3694,7 @@ CFGBlock *CFGBuilder::VisitCXXBindTemporaryExprForTemporaryDtors(      const CXXDestructorDecl *Dtor = E->getTemporary()->getDestructor(); -    if (Dtor->isNoReturn()) { +    if (Dtor->getParent()->isAnyDestructorNoReturn()) {        // If the destructor is marked as a no-return destructor, we need to        // create a new block for the destructor which does not have as a        // successor anything built thus far. Control won't flow out of this | 
