ArchSpec: fix unintentional promotion of unspecified unknowns to specified unknowns

* ArchSpec::MergeFrom() would erroneously promote an unspecified
  unknown to a specified unknown when both the ArchSpec and the merged
  in ArchSpec were both unspecified unknowns. This no longer happens,
  which fixes issues with global module cache lookup in some
  situations.

* Added ArchSpec::DumpTriple(Stream&) that now properly prints
  unspecified unknowns as '*' and specified unknows as 'unknown'.
  This makes it trivial to tell the difference between the two.
  Converted printing code over ot using DumpTriple() rather than
  building from scratch.

* Fixed up a couple places that were not guaranteeing that an
  unspecified unknown was recorded as such.

llvm-svn: 250253
This commit is contained in:
Todd Fiala
2015-10-13 23:41:19 +00:00
parent a59fcbae4f
commit 7df337f85c
10 changed files with 85 additions and 27 deletions

View File

@@ -1605,6 +1605,12 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
}
}
// Make any unknown triple components to be unspecified unknowns.
if (arch_spec.GetTriple().getVendor() == llvm::Triple::UnknownVendor)
arch_spec.GetTriple().setVendorName (llvm::StringRef());
if (arch_spec.GetTriple().getOS() == llvm::Triple::UnknownOS)
arch_spec.GetTriple().setOSName (llvm::StringRef());
return section_headers.size();
}
}