The meaning of DILexicalBlockFile


The langref says the following. But I don't quite understand them. Can
somebody show some C code and how the corresponding debug info will be
encoded in the IR using DILexicalBlockFile? Thanks.

DILexicalBlockFile nodes are used to discriminate between sections of
a lexical block. The file: field can be changed to indicate textual
inclusion, or the discriminator: field can be used to discriminate
between control flow within a single block in the source language.

!0 = !DILexicalBlock(scope: !3, file: !4, line: 7, column: 35)
!1 = !DILexicalBlockFile(scope: !0, file: !4, discriminator: 0)
!2 = !DILexicalBlockFile(scope: !0, file: !4, discriminator: 1)

Best way to find source examples to see how IRconstructs are used to represent them is to look in Clang’s tests for the IR construct you’re interested in.

In this case, clang’s test/CodeGen/debug-info-file-change.c demonstrates source code that generates DILexicalBlockFile.