<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/95831>95831</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang][CoverageMapping] Assertion fails when headers included in function bodies
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:codegen,
            coverage
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          whentojump
      </td>
    </tr>
</table>

<pre>
    Reduced from https://github.com/zsh-users/zsh/blob/zsh-5.9/Src/jobs.c#L2327

```c
void a() {
#include <stdint.h>
}
```

Compiler explorer [link](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,selection:(endColumn:1,endLineNumber:4,positionColumn:1,positionLineNumber:4,selectionStartColumn:1,selectionStartLineNumber:4,startColumn:1,startLineNumber:4),source:'void+a()+%7B%0A%23include+%3Cstdint.h%3E%0A%7D%0A'),l:'5',n:'1',o:'C+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((g:!((h:compiler,i:(compiler:cclang_assertions_trunk,filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1',verboseDemangling:'0'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,libs:!(),options:'-fprofile-instr-generate+-fcoverage-mapping',overrides:!(),selection:(endColumn:90,endLineNumber:4,positionColumn:90,positionLineNumber:4,selectionStartColumn:90,selectionStartLineNumber:4,startColumn:90,startLineNumber:4),source:1),l:'5',n:'0',o:'+x86-64+clang+(assertions+trunk)+(Editor+%231)',t:'0')),header:(),k:50,l:'4',m:46.95459579180509,n:'0',o:'',s:0,t:'0'),(g:!((h:output,i:(compilerName:'x86-64+clang+(assertions+trunk)',editorid:1,fontScale:14,fontUsePx:'0',j:1,wrap:'1'),l:'5',n:'0',o:'Output+of+x86-64+clang+(assertions+trunk)+(Compiler+%231)',t:'0')),header:(),l:'4',m:53.0454042081949,n:'0',o:'',s:0,t:'0')),k:50,l:'3',n:'0',o:'',t:'0')),l:'2',n:'0',o:'',t:'0')),version:4)



</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVk9vq7oT_TTOBiUCgwEvskjIzer-bn961XvbysCEuDU2sk3avk__ZJumof9uW12porFn5tjMnDMMM4Z3EmCNyBaR3YKN9qj0-v4I0qrbsR8WtWof139BOzbQRget-uho7WBQukF4j_C-4_Y41qtG9Qjv_zXH5WhAm_Ab4X0tVD0ZyIoivL_WDcL7W1WbVYNw-hOnuEDxDsWb6ZnH4a8J65PibcQQLhGmESq2kxdOuWzE2EKE0srYlku7OqL0x2Qudi_QLo-oVD9wATqCh0EoDTpCZCu4vENkh3D54v1UWythV0p3fiPtvCnxNyrfXxxRumlUCz9abpVGuOLeWh64AMl68KsiQbhAuDooaa8bJtxukk0bfxv4_0Nwi4PbrTMjXAkm3Vk3NzcNwpUBAY3lSoYDQLaVEmMvJ2eQ7U8u4dfY16BRunHwgzLcRcwcnzZfeZ8PuLZM21nM3PQ68nXAW37UGdSomykrruYIb6eqI7xFmBTu4QpPzqUPhovyY5L-ePIqdtOvIuCLAE1CJuUs_SqsKoS30zU8Mk4nu72sAg14dyjdkPgZOJsBxzPgsHCcit9Aqz7Bo0DYZxadd9JN0zg63DBjQLtKmBurR3nnSMSFdVr0EfXsYjWXTD_OkhC2rupbaOzM0Ki-B2mvpHicYbRQj13FhDAz9xZ6JjsBc1-uHU9OYGbb8ADNaOda4NKCmHkJXmumHyvVzkGt5v0s9AS6VgZ24QZcdi8zfRCsM_9wuL8aQP45BQpem4uauZPU4GsRgpeHQSsn_CWXxuplBxI0s45my0OjTqBZB8ueDYO7c2DOCbTmLbzE_UDsNP6s2r3nV-Xug76k9xDxW8EnHwj0pY62D2W-zDOEt571X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