forked from OSchip/llvm-project
When checking whether a return statement returns a stack-local
variable, handle conditional operators involving a throw-expression. Fixes GCC DejaGNU's g++.dg/template/cond4.C. llvm-svn: 117027
This commit is contained in:
parent
ebdb43d54d
commit
270b2ef0e7
|
@ -1923,11 +1923,18 @@ static DeclRefExpr* EvalAddr(Expr *E) {
|
|||
ConditionalOperator *C = cast<ConditionalOperator>(E);
|
||||
|
||||
// Handle the GNU extension for missing LHS.
|
||||
if (Expr *lhsExpr = C->getLHS())
|
||||
if (DeclRefExpr* LHS = EvalAddr(lhsExpr))
|
||||
return LHS;
|
||||
if (Expr *lhsExpr = C->getLHS()) {
|
||||
// In C++, we can have a throw-expression, which has 'void' type.
|
||||
if (!lhsExpr->getType()->isVoidType())
|
||||
if (DeclRefExpr* LHS = EvalAddr(lhsExpr))
|
||||
return LHS;
|
||||
}
|
||||
|
||||
return EvalAddr(C->getRHS());
|
||||
// In C++, we can have a throw-expression, which has 'void' type.
|
||||
if (C->getRHS()->getType()->isVoidType())
|
||||
return NULL;
|
||||
|
||||
return EvalAddr(C->getRHS());
|
||||
}
|
||||
|
||||
// For casts, we need to handle conversions from arrays to
|
||||
|
|
Loading…
Reference in New Issue