Ensure that the NRVO flag has some block to insert into. Fixes PR9178!

llvm-svn: 125694
This commit is contained in:
Nick Lewycky 2011-02-16 23:59:08 +00:00
parent 197fcd4418
commit 8d2226208d
2 changed files with 19 additions and 1 deletions

View File

@ -648,7 +648,8 @@ void CodeGenFunction::EmitAutoVarDecl(const VarDecl &D,
// to this variable. Set it to zero to indicate that NRVO was not
// applied.
llvm::Value *Zero = Builder.getFalse();
NRVOFlag = CreateTempAlloca(Zero->getType(), "nrvo");
NRVOFlag = CreateTempAlloca(Zero->getType(), "nrvo");
EnsureInsertPoint();
Builder.CreateStore(Zero, NRVOFlag);
// Record the NRVO flag for this variable.

View File

@ -0,0 +1,17 @@
// RUN: %clang_cc1 -emit-llvm-only %s
// PR9178
void abort() __attribute__((__noreturn__));
struct CoinModelLink {
CoinModelLink();
~CoinModelLink();
};
class CoinModel {
CoinModelLink firstInQuadraticColumn();
};
CoinModelLink CoinModel::firstInQuadraticColumn() {
abort();
CoinModelLink x;
return x;
}