Skip to content

Commit ee3c892

Browse files
[clang-tidy] Use DenseMap::insert_range (NFC) (llvm#133844)
We can safely switch to insert_range here because SyntheticStmtSourceMap starts out empty in the constructor. Also TheCFG->synthetic_stmts() comes from DenseMap, so we know that the keys are unique. That is, operator[] and insert are equivalent in this particular case.
1 parent eb2aba4 commit ee3c892

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clang-tools-extra/clang-tidy/utils/ExprSequence.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ getAllInitListForms(const InitListExpr *InitList) {
8484
ExprSequence::ExprSequence(const CFG *TheCFG, const Stmt *Root,
8585
ASTContext *TheContext)
8686
: Context(TheContext), Root(Root) {
87-
for (const auto &SyntheticStmt : TheCFG->synthetic_stmts()) {
88-
SyntheticStmtSourceMap[SyntheticStmt.first] = SyntheticStmt.second;
89-
}
87+
SyntheticStmtSourceMap.insert_range(TheCFG->synthetic_stmts());
9088
}
9189

9290
bool ExprSequence::inSequence(const Stmt *Before, const Stmt *After) const {

0 commit comments

Comments
 (0)