Recommit r208506: DebugInfo: Include lexical scopes in inlined subroutines.
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 14 May 2014 01:08:28 +0000 (01:08 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 14 May 2014 01:08:28 +0000 (01:08 +0000)
commitee8af3e2a03495f3d846900fab56be324a0af167
treed310418514a402be8e30ea7708f4f1a278e0a057
parent22dcd3985f3ecb73cf8f6ca606dc30d1946fe00b
Recommit r208506: DebugInfo: Include lexical scopes in inlined subroutines.

This was reverted in r208642 due to regressions surrounding file changes
within lexical scopes causing inlining information to be lost.

The issue was in LexicalScopes::getOrCreateInlinedScope, where I was
previously testing "isLexicalBlock" which is false for
"DILexicalBlockFile" (a scope used to represent changes in the current
file name) and assuming it was then a function (breaking out of the
inlined scope path and reaching for the parent non-inlined scopes). By
inverting the condition and testing for "isSubprogram" the correct
behavior is attained.

(also found some weirdness in Clang, see r208742 when reducing this test
case - the resulting test case doesn't apply with the Clang fix, but
I've added a more realistic test case to inline-scopes.ll which does
reproduce the issue and demonstrate the fix)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208748 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/STLExtras.h
include/llvm/CodeGen/LexicalScopes.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/LexicalScopes.cpp
test/DebugInfo/inline-scopes.ll [new file with mode: 0644]