r324687 - Fix UBSan issue with PPC::isValidCPUName
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 8 16:13:50 PST 2018
Author: erichkeane
Date: Thu Feb 8 16:13:49 2018
New Revision: 324687
URL: http://llvm.org/viewvc/llvm-project?rev=324687&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Basic/Targets/PPC.cpp
Modified: cfe/trunk/lib/Basic/Targets/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.cpp?rev=324687&r1=324686&r2=324687&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/PPC.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.cpp Thu Feb 8 16:13:49 2018
@@ -493,8 +493,7 @@ static constexpr llvm::StringLiteral Val
};
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 {
More information about the cfe-commits
mailing list