Author: Kazu Hirata
Date: 2025-03-31T22:11:06-07:00
New Revision: ee3c892b3570281698170130a435f9c6b32c3ef5

URL: 
https://github.com/llvm/llvm-project/commit/ee3c892b3570281698170130a435f9c6b32c3ef5
DIFF: 
https://github.com/llvm/llvm-project/commit/ee3c892b3570281698170130a435f9c6b32c3ef5.diff

LOG: [clang-tidy] Use DenseMap::insert_range (NFC) (#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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp 
b/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
index 145a5fe378b3e..685277d8bfbca 100644
--- a/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
+++ b/clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
@@ -84,9 +84,7 @@ getAllInitListForms(const InitListExpr *InitList) {
 ExprSequence::ExprSequence(const CFG *TheCFG, const Stmt *Root,
                            ASTContext *TheContext)
     : Context(TheContext), Root(Root) {
-  for (const auto &SyntheticStmt : TheCFG->synthetic_stmts()) {
-    SyntheticStmtSourceMap[SyntheticStmt.first] = SyntheticStmt.second;
-  }
+  SyntheticStmtSourceMap.insert_range(TheCFG->synthetic_stmts());
 }
 
 bool ExprSequence::inSequence(const Stmt *Before, const Stmt *After) const {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to