Previously, when clang was compiled with -DLLVM_ENABLE_ASSERTIONS=ON, the attached test was yielding:
inlinable function call in a function with debug info must have a !dbg location call void @"??1?$c@UB@@@@QEAA@XZ"(%struct.c* @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A") fatal error: error in backend: Broken module found, compilation aborted! Stack dump: 0. Program arguments: <f:\svn\buildninja\bin\clang -cc1 -emit-llvm debug-info-no-location.cpp> -gcodeview -debug-info-kind=limited 1. <eof> parser at end of file 2. Per-function optimization
Fixes PR43012
Is it OK to look up the lexical block stack at this point? The block stack isn't function local, it's part of CGDebugInfo, which is for the whole module, unlike CodeGenFunction. If we start emitting one of these thunks while we're emitting some other function, we could get some strange results. Does anything ensure we've pushed at least one scope by the time we come here?