Skip to content

Commit 280d2a3

Browse files
[AST] Avoid repeated hash lookups (NFC) (#126461)
1 parent 3653041 commit 280d2a3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/AST/RawCommentList.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ void RawCommentList::addComment(const RawComment &RC,
287287

288288
// If this is the first Doxygen comment, save it (because there isn't
289289
// anything to merge it with).
290-
if (OrderedComments[CommentFile].empty()) {
291-
OrderedComments[CommentFile][CommentOffset] =
292-
new (Allocator) RawComment(RC);
290+
auto &OC = OrderedComments[CommentFile];
291+
if (OC.empty()) {
292+
OC[CommentOffset] = new (Allocator) RawComment(RC);
293293
return;
294294
}
295295

296-
const RawComment &C1 = *OrderedComments[CommentFile].rbegin()->second;
296+
const RawComment &C1 = *OC.rbegin()->second;
297297
const RawComment &C2 = RC;
298298

299299
// Merge comments only if there is only whitespace between them.

0 commit comments

Comments
 (0)