DebugInfo: Consider global variables without locations to be valid
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 4 Jul 2013 23:15:18 +0000 (23:15 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 4 Jul 2013 23:15:18 +0000 (23:15 +0000)
commit09bb56f0a0bb098faf076e54ee84221c1fd9fefa
tree52e5032243bddff3c58b75de350a39ee25780db2
parent8be527901ac87d49f7b0b56c96dbc6dadabb5069
DebugInfo: Consider global variables without locations to be valid

We were being a bit too aggresive here in classifying global variables
with no global reference or constant value to be invalid - this would
cause LLVM to not emit the DWARF description of the global variable if
it had been optimized away, which isn't helpful for users who might
benefit from the global variable's description even if there's no
location information.

This also fixes a crasher issue here that I was unable to reduce a test
case for - involving a using decl (& subsequent
DW_TAG_imported_declaration ) of such a global variable that, once
optimized away, would crash when an attempt to emit the imported
declaration was made.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185675 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/DebugInfo.cpp
test/DebugInfo/global.ll [new file with mode: 0644]