aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-03-17 07:41:51 -0700
committerGitHub <noreply@github.com>2025-03-17 07:41:51 -0700
commitb8317df8d8f6dc110edfbf86d8269c912cb2a2a9 (patch)
tree09ac32970bc2c85a0176ac1565eae9f2cdc39043 /llvm/lib/FileCheck/FileCheck.cpp
parent8bc0f879a05228c58235ded510360da2220f0afd (diff)
downloadllvm-b8317df8d8f6dc110edfbf86d8269c912cb2a2a9.zip
llvm-b8317df8d8f6dc110edfbf86d8269c912cb2a2a9.tar.gz
llvm-b8317df8d8f6dc110edfbf86d8269c912cb2a2a9.tar.bz2
[FileCheck] Avoid repeated hash lookups (NFC) (#131553)
Diffstat (limited to 'llvm/lib/FileCheck/FileCheck.cpp')
-rw-r--r--llvm/lib/FileCheck/FileCheck.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index 931a4d3..072dbef 100644
--- a/llvm/lib/FileCheck/FileCheck.cpp
+++ b/llvm/lib/FileCheck/FileCheck.cpp
@@ -1010,8 +1010,10 @@ bool Pattern::parsePattern(StringRef PatternStr, StringRef Prefix,
// Handle substitution of string variables that were defined earlier on
// the same line by emitting a backreference. Expressions do not
// support substituting a numeric variable defined on the same line.
- if (!IsNumBlock && VariableDefs.find(SubstStr) != VariableDefs.end()) {
- unsigned CaptureParenGroup = VariableDefs[SubstStr];
+ decltype(VariableDefs)::iterator It;
+ if (!IsNumBlock &&
+ (It = VariableDefs.find(SubstStr)) != VariableDefs.end()) {
+ unsigned CaptureParenGroup = It->second;
if (CaptureParenGroup < 1 || CaptureParenGroup > 9) {
SM.PrintMessage(SMLoc::getFromPointer(SubstStr.data()),
SourceMgr::DK_Error,