[llvm] r262778 - Support: catch invalid accesses
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 5 12:00:44 PST 2016
Author: compnerd
Date: Sat Mar 5 14:00:44 2016
New Revision: 262778
URL: http://llvm.org/viewvc/llvm-project?rev=262778&view=rev
Log:
Support: catch invalid accesses
It is possible to invoke these methods on an invalid input resulting in an
invalid substring construction. It seems that we do not have unit tests for
these methods. Tests to ensure that the invalid call is caught to follow in
clang.
Resolves PR26839.
Modified:
llvm/trunk/lib/Support/TargetParser.cpp
Modified: llvm/trunk/lib/Support/TargetParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=262778&r1=262777&r2=262778&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TargetParser.cpp (original)
+++ llvm/trunk/lib/Support/TargetParser.cpp Sat Mar 5 14:00:44 2016
@@ -305,13 +305,13 @@ StringRef llvm::ARM::getArchName(unsigne
}
StringRef llvm::ARM::getCPUAttr(unsigned ArchKind) {
- if (ArchKind >= ARM::AK_LAST)
+ if (ArchKind == ARM::AK_INVALID || ArchKind >= ARM::AK_LAST)
return StringRef();
return ARCHNames[ArchKind].getCPUAttr();
}
StringRef llvm::ARM::getSubArch(unsigned ArchKind) {
- if (ArchKind >= ARM::AK_LAST)
+ if (ArchKind == ARM::AK_INVALID || ArchKind >= ARM::AK_LAST)
return StringRef();
return ARCHNames[ArchKind].getSubArch();
}
More information about the llvm-commits
mailing list