forked from OSchip/llvm-project
Use size_t to store Pos, avoid truncating value
on 64-bit builds. Analysis and original patch by Török Edwin. Code audit found another place with the same problem, also fixed here. llvm-svn: 45746
This commit is contained in:
parent
2940c5c56d
commit
bb956ca730
|
@ -103,7 +103,7 @@ PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M,
|
|||
const std::string &TT = M.getTargetTriple();
|
||||
if (TT.length() > 7) {
|
||||
// Determine which version of darwin this is.
|
||||
unsigned DarwinPos = TT.find("-darwin");
|
||||
size_t DarwinPos = TT.find("-darwin");
|
||||
if (DarwinPos != std::string::npos) {
|
||||
if (isdigit(TT[DarwinPos+7]))
|
||||
DarwinVers = atoi(&TT[DarwinPos+7]);
|
||||
|
|
|
@ -257,7 +257,7 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
|
|||
// if one cannot be determined, to true.
|
||||
const std::string& TT = M.getTargetTriple();
|
||||
if (TT.length() > 5) {
|
||||
unsigned Pos;
|
||||
size_t Pos;
|
||||
if ((Pos = TT.find("-darwin")) != std::string::npos) {
|
||||
TargetType = isDarwin;
|
||||
|
||||
|
|
Loading…
Reference in New Issue