Fix cppcheck "reduce variable scope" warning. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 24 Sep 2019 12:30:07 +0000 (12:30 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 24 Sep 2019 12:30:07 +0000 (12:30 +0000)
llvm-svn: 372742

llvm/lib/IR/IntrinsicInst.cpp

index 2996cfb..d3c948d 100644 (file)
@@ -67,13 +67,12 @@ int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,
   // 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) {