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

Eli Friedman eli.friedman at gmail.com
Sun May 16 20:40:23 PDT 2010


On Sat, May 15, 2010 at 9:39 AM, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Sat May 15 11:39:56 2010
> New Revision: 103872
>
> URL: http://llvm.org/viewvc/llvm-project?rev=103872&view=rev
> Log:
> When applying the named return value optimization, we still need to
> destroy the variable along the exceptional edge; it's only during
> normal execution that we avoid destroying this variable.

Only loosely relevant to this commit, but it looks like the following
case is mishandled; the generated code never calls printf:

extern "C" void exit(int) throw();
extern "C" int printf(const char*,...) throw();
struct A {
  int x;
  A() {}
  A(const A&) { printf("Copying\n"); }
  ~A() { printf("Destroying\n"); }
};
A f(int x) {
  {
    A y;
    if (x)
      return y;
  }
  exit(1);
}

-Eli



More information about the cfe-commits mailing list