@@ -760,6 +760,7 @@ class CFGBuilder {
760760 void cleanupConstructionContext (Expr *E);
761761
762762 void autoCreateBlock () { if (!Block) Block = createBlock (); }
763+
763764 CFGBlock *createBlock (bool add_successor = true );
764765 CFGBlock *createNoReturnBlock ();
765766
@@ -818,15 +819,21 @@ class CFGBuilder {
818819 B->appendStmt (const_cast <Stmt*>(S), cfg->getBumpVectorContext ());
819820 }
820821
821- void appendConstructor (CFGBlock *B, CXXConstructExpr *CE) {
822+ void appendConstructor (CXXConstructExpr *CE) {
823+ CXXConstructorDecl *C = CE->getConstructor ();
824+ if (C && C->isNoReturn ())
825+ Block = createNoReturnBlock ();
826+ else
827+ autoCreateBlock ();
828+
822829 if (const ConstructionContext *CC =
823830 retrieveAndCleanupConstructionContext (CE)) {
824- B ->appendConstructor (CE, CC, cfg->getBumpVectorContext ());
831+ Block ->appendConstructor (CE, CC, cfg->getBumpVectorContext ());
825832 return ;
826833 }
827834
828835 // No valid construction context found. Fall back to statement.
829- B ->appendStmt (CE, cfg->getBumpVectorContext ());
836+ Block ->appendStmt (CE, cfg->getBumpVectorContext ());
830837 }
831838
832839 void appendCall (CFGBlock *B, CallExpr *CE) {
@@ -4832,9 +4839,7 @@ CFGBlock *CFGBuilder::VisitCXXConstructExpr(CXXConstructExpr *C,
48324839 // construct these objects. Construction contexts we find here aren't for the
48334840 // constructor C, they're for its arguments only.
48344841 findConstructionContextsForArguments (C);
4835-
4836- autoCreateBlock ();
4837- appendConstructor (Block, C);
4842+ appendConstructor (C);
48384843
48394844 return VisitChildren (C);
48404845}
@@ -4892,16 +4897,15 @@ CFGBlock *CFGBuilder::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *E,
48924897 return Visit (E->getSubExpr (), asc);
48934898}
48944899
4895- CFGBlock *CFGBuilder::VisitCXXTemporaryObjectExpr (CXXTemporaryObjectExpr *C ,
4900+ CFGBlock *CFGBuilder::VisitCXXTemporaryObjectExpr (CXXTemporaryObjectExpr *E ,
48964901 AddStmtChoice asc) {
48974902 // If the constructor takes objects as arguments by value, we need to properly
48984903 // construct these objects. Construction contexts we find here aren't for the
48994904 // constructor C, they're for its arguments only.
4900- findConstructionContextsForArguments (C);
4905+ findConstructionContextsForArguments (E);
4906+ appendConstructor (E);
49014907
4902- autoCreateBlock ();
4903- appendConstructor (Block, C);
4904- return VisitChildren (C);
4908+ return VisitChildren (E);
49054909}
49064910
49074911CFGBlock *CFGBuilder::VisitImplicitCastExpr (ImplicitCastExpr *E,
0 commit comments