carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.35k stars 1.48k forks source link

Fix crash when disabling debug info #4249

Closed dwblaikie closed 2 months ago

dwblaikie commented 2 months ago

The source line debug info generation assumed that the function would have debug info. Check for a non-null disubprogram to ensure we are emitting debug info for the function.

Rather than checking the dibuilder - this way if we implement nodebug function attributes, it'll fall out naturally (by creating a null disubprogram) rather than having to come back and change this from "is debug info enabled" to "is debug info enabled for this function" later on.