This solves an issue seen in a Chromium build, which resulted from incorrect bitcode read/write handling for DIArgList. The specific cause of the issue is that previously, when writing DIArgList to bitcode, there was no guarantee that all of its arguments had been written to bitcode beforehand. DIArgList is strict about its arguments, and will only accept ValueAsMetadata*, so forward MD references (temporary MDNode*s) are not valid when constructing a DIArgList object. It also meant that if a ConstantAsMetadata was only referenced in a DIArgList, it would not be written at all, resulting in a null record.
This issue was further obfuscated by the fact that DIArgList was not being stringent enough when reading and writing bitcode records; although DIArgList does not support null values for its arguments, it was allowing the argument records to be null.
This has been fixed by adding a new method to the ValueEnumerator to handle DIArgList that enumerates any ConstantAsMetadata arguments and contains a number of DIArgList-specific assertions. The read/write code has also been modified to appropriately assert that its arguments are non-null.
clang-tidy: warning: invalid case style for function 'EnumerateFunctionLocalListMetadata' [readability-identifier-naming]
not useful