[cfe-commits] r125694 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGenCXX/nrvo-noreturn.cc

Nick Lewycky nicholas at mxc.ca
Wed Feb 16 15:59:08 PST 2011


Author: nicholas
Date: Wed Feb 16 17:59:08 2011
New Revision: 125694

URL: http://llvm.org/viewvc/llvm-project?rev=125694&view=rev
Log:
Ensure that the NRVO flag has some block to insert into. Fixes PR9178!

Added:
    cfe/trunk/test/CodeGenCXX/nrvo-noreturn.cc
Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=125694&r1=125693&r2=125694&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Feb 16 17:59:08 2011
@@ -648,7 +648,8 @@
             // 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.

Added: cfe/trunk/test/CodeGenCXX/nrvo-noreturn.cc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/nrvo-noreturn.cc?rev=125694&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/nrvo-noreturn.cc (added)
+++ cfe/trunk/test/CodeGenCXX/nrvo-noreturn.cc Wed Feb 16 17:59:08 2011
@@ -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;
+}
+





More information about the cfe-commits mailing list