mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 07:01:03 +08:00
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:
@@ -844,9 +844,9 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
|
||||
void
|
||||
ArchSpec::MergeFrom(const ArchSpec &other)
|
||||
{
|
||||
if (GetTriple().getVendor() == llvm::Triple::UnknownVendor && !TripleVendorWasSpecified())
|
||||
if (TripleVendorIsUnspecifiedUnknown() && !other.TripleVendorIsUnspecifiedUnknown())
|
||||
GetTriple().setVendor(other.GetTriple().getVendor());
|
||||
if (GetTriple().getOS() == llvm::Triple::UnknownOS && !TripleOSWasSpecified())
|
||||
if (TripleOSIsUnspecifiedUnknown() && !other.TripleOSIsUnspecifiedUnknown())
|
||||
GetTriple().setOS(other.GetTriple().getOS());
|
||||
if (GetTriple().getArch() == llvm::Triple::UnknownArch)
|
||||
GetTriple().setArch(other.GetTriple().getArch());
|
||||
@@ -1444,3 +1444,18 @@ ArchSpec::GetStopInfoOverrideCallback () const
|
||||
return StopInfoOverrideCallbackTypeARM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ArchSpec::DumpTriple(Stream &s) const
|
||||
{
|
||||
const llvm::Triple &triple = GetTriple();
|
||||
llvm::StringRef arch_str = triple.getArchName();
|
||||
llvm::StringRef vendor_str = triple.getVendorName();
|
||||
llvm::StringRef os_str = triple.getOSName();
|
||||
|
||||
s.Printf("%s-%s-%s",
|
||||
arch_str.empty() ? "*" : arch_str.str().c_str(),
|
||||
vendor_str.empty() ? "*" : vendor_str.str().c_str(),
|
||||
os_str.empty() ? "*" : os_str.str().c_str()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user