]> granicus.if.org Git - clang/commit
Introduce cleanup scopes for "if" statements in two places:
authorDouglas Gregor <dgregor@apple.com>
Tue, 24 Nov 2009 16:43:22 +0000 (16:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 24 Nov 2009 16:43:22 +0000 (16:43 +0000)
commit01234bbc1cb94946df8046ad95e17537082b4f71
treeeea1a78781609dd8b68cbd5c11160a06fbabc703
parent71d9f7c5092772b61d9dd4f8ab7711900012f893
Introduce cleanup scopes for "if" statements in two places:
  - Outside the "if", to ensure that we destroy the condition variable
    at the end of the "if" statement rather than at the end of the
    block containing the "if" statement.
  - Inside the "then" and "else" branches, so that we emit then- or
    else-local cleanups at the end of the corresponding block when the
    block is not a compound statement.

To make adding these new cleanup scopes easier (and since
switch/do/while will all need the same treatment), added the
CleanupScope RAII object to introduce a new cleanup scope and make
sure it gets cleaned up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89773 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGStmt.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenCXX/condition.cpp [new file with mode: 0644]