DebugInfo: Don't leak location information from one function into the prologue of...
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 14 Oct 2014 16:43:46 +0000 (16:43 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 14 Oct 2014 16:43:46 +0000 (16:43 +0000)
commit89fe0a613086e1adcffc6d0bacac40ec671aae90
treed6d3cf0fa73e6d4028b32c5e6b625dcaad473c63
parent1315fc9138ff8af3bbcdd4ec96d4f61e340f1f4a
DebugInfo: Don't leak location information from one function into the prologue of the next function.

CodeGenFunction objects aren't really designed to be reused for more
than one function, and doing so can leak debug info location information
from one function into the prologue of the next.

Add an assertion in to catch reuses of CodeGenFunction, which
surprisingly only caught the ObjC atomic getter/setter cases. Fix those
and add a test to demonstrate the issue.

The test is a bit slim, because we're just testing for the absence of a
debug location on the prologue instructions, which by itself probably
wouldn't be the end of the world - but the particular debug location
that was ending up there was for the previous function's last
instruction. This produced debug info for another function within this
function, which is something I'm trying to remove all cases of as its a
substantial source of bugs, especially around inlining (see r219215).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219690 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CodeGenFunction.cpp
test/CodeGenObjCXX/property-objects.mm