Make sure we handle a supplementary output list with no outputs in it (#18117)

This commit is contained in:
Jordan Rose
2018-07-20 17:19:45 -07:00
committed by GitHub
parent 3ef027153b
commit 79928ad5f2
3 changed files with 23 additions and 5 deletions

View File

@@ -110,11 +110,19 @@ static void writeQuotedEscaped(llvm::raw_ostream &os,
void OutputFileMap::write(llvm::raw_ostream &os,
ArrayRef<StringRef> inputs) const {
for (const auto input : inputs) {
const TypeToPathMap *outputMap = getOutputMapForInput(input);
if (!outputMap)
continue;
writeQuotedEscaped(os, input);
os << ":\n";
os << ":";
const TypeToPathMap *outputMap = getOutputMapForInput(input);
if (!outputMap) {
// The map doesn't have an entry for this input. (Perhaps there were no
// outputs and thus the entry was never created.) Put an empty sub-map
// into the output and move on.
os << " {}\n";
continue;
}
os << "\n";
for (auto &typeAndOutputPath : *outputMap) {
file_types::ID type = typeAndOutputPath.getFirst();
StringRef output = typeAndOutputPath.getSecond();