PR11926 + duplicates: Fix crash in -Wuninitialized when using a compiler like

g++4.7, which reuses stack space allocated for temporaries. CFGElement::getAs
returns a suitably-cast version of 'this'. Patch by Markus Trippelsdorf!

No test: this code has the same observable behavior as the old code when built
with most compilers, and the tests were already failing when built with a
compiler for which this produced a broken binary.

llvm-svn: 155803
This commit is contained in:
Richard Smith 2012-04-30 00:16:51 +00:00
parent da03f3ba64
commit 6a52771823
1 changed files with 2 additions and 1 deletions

View File

@ -168,7 +168,8 @@ static const BinaryOperator *getLogicalOperatorInChain(const CFGBlock *block) {
if (block->empty())
return 0;
const CFGStmt *cstmt = block->front().getAs<CFGStmt>();
CFGElement front = block->front();
const CFGStmt *cstmt = front.getAs<CFGStmt>();
if (!cstmt)
return 0;