[llvm] r372742 - Fix cppcheck "reduce variable scope" warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 05:30:07 PDT 2019
Author: rksimon
Date: Tue Sep 24 05:30:07 2019
New Revision: 372742
URL: http://llvm.org/viewvc/llvm-project?rev=372742&view=rev
Log:
Fix cppcheck "reduce variable scope" warning. NFCI.
Modified:
llvm/trunk/lib/IR/IntrinsicInst.cpp
Modified: llvm/trunk/lib/IR/IntrinsicInst.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IntrinsicInst.cpp?rev=372742&r1=372741&r2=372742&view=diff
==============================================================================
--- llvm/trunk/lib/IR/IntrinsicInst.cpp (original)
+++ llvm/trunk/lib/IR/IntrinsicInst.cpp Tue Sep 24 05:30:07 2019
@@ -67,13 +67,12 @@ int llvm::Intrinsic::lookupLLVMIntrinsic
// size 1. During the search, we can skip the prefix that we already know is
// identical. By using strncmp we consider names with differing suffixes to
// be part of the equal range.
- size_t CmpStart = 0;
size_t CmpEnd = 4; // Skip the "llvm" component.
const char *const *Low = NameTable.begin();
const char *const *High = NameTable.end();
const char *const *LastLow = Low;
while (CmpEnd < Name.size() && High - Low > 0) {
- CmpStart = CmpEnd;
+ size_t CmpStart = CmpEnd;
CmpEnd = Name.find('.', CmpStart + 1);
CmpEnd = CmpEnd == StringRef::npos ? Name.size() : CmpEnd;
auto Cmp = [CmpStart, CmpEnd](const char *LHS, const char *RHS) {
More information about the llvm-commits
mailing list