Skip to content

Commit 9159179

Browse files
[Format] Avoid repeated hash lookups (NFC) (#108794)
1 parent e509e87 commit 9159179

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/Format/MacroExpander.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ MacroExpander::expand(FormatToken *ID,
191191
auto expandArgument = [&](FormatToken *Tok) -> bool {
192192
// If the current token references a parameter, expand the corresponding
193193
// argument.
194-
if (Tok->isNot(tok::identifier) || ExpandedArgs.contains(Tok->TokenText))
194+
if (Tok->isNot(tok::identifier))
195+
return false;
196+
if (!ExpandedArgs.insert(Tok->TokenText).second)
195197
return false;
196-
ExpandedArgs.insert(Tok->TokenText);
197198
auto I = Def.ArgMap.find(Tok->TokenText);
198199
if (I == Def.ArgMap.end())
199200
return false;

0 commit comments

Comments
 (0)