Initialize output parameters

If the function returns true, it should
set all output paremeters, similar to Output::preflightElement, or we
have UB on code like:

```
void *SaveInfo;
if (io.preflightFlowElement(i, SaveInfo))
  io.postflightFlowElement(SaveInfo);
```

It's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116826
This commit is contained in:
Vitaly Buka 2022-01-07 10:22:35 -08:00
parent ec2945d031
commit ee43259cbc
1 changed files with 2 additions and 1 deletions

View File

@ -629,7 +629,7 @@ void Output::endFlowSequence() {
outputUpToEndOfLine(" ]");
}
bool Output::preflightFlowElement(unsigned, void *&) {
bool Output::preflightFlowElement(unsigned, void *&SaveInfo) {
if (NeedFlowSequenceComma)
output(", ");
if (WrapColumn && Column > WrapColumn) {
@ -639,6 +639,7 @@ bool Output::preflightFlowElement(unsigned, void *&) {
Column = ColumnAtFlowStart;
output(" ");
}
SaveInfo = nullptr;
return true;
}