Skip to content

Commit b8317df

Browse files
[FileCheck] Avoid repeated hash lookups (NFC) (#131553)
1 parent 8bc0f87 commit b8317df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/FileCheck/FileCheck.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,10 @@ bool Pattern::parsePattern(StringRef PatternStr, StringRef Prefix,
10101010
// Handle substitution of string variables that were defined earlier on
10111011
// the same line by emitting a backreference. Expressions do not
10121012
// support substituting a numeric variable defined on the same line.
1013-
if (!IsNumBlock && VariableDefs.find(SubstStr) != VariableDefs.end()) {
1014-
unsigned CaptureParenGroup = VariableDefs[SubstStr];
1013+
decltype(VariableDefs)::iterator It;
1014+
if (!IsNumBlock &&
1015+
(It = VariableDefs.find(SubstStr)) != VariableDefs.end()) {
1016+
unsigned CaptureParenGroup = It->second;
10151017
if (CaptureParenGroup < 1 || CaptureParenGroup > 9) {
10161018
SM.PrintMessage(SMLoc::getFromPointer(SubstStr.data()),
10171019
SourceMgr::DK_Error,

0 commit comments

Comments
 (0)