Fix UBSan issue with PPC::isValidCPUName

Apparently storing the pointer to a StringLiteral as
a StringRef caused this section of code to issue a ubsan
warning.  This will hopefully fix that.

llvm-svn: 324687
This commit is contained in:
Erich Keane 2018-02-09 00:13:49 +00:00
parent a37e00968e
commit fa69c71dce
1 changed files with 1 additions and 2 deletions

View File

@ -493,8 +493,7 @@ static constexpr llvm::StringLiteral ValidCPUNames[] = {
};
bool PPCTargetInfo::isValidCPUName(StringRef Name) const {
const StringRef *FoundName = llvm::find(ValidCPUNames, Name);
return FoundName != std::end(ValidCPUNames);
return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);
}
void PPCTargetInfo::fillValidCPUList(SmallVectorImpl<StringRef> &Values) const {