[clang] [clang] [NFC] explicitly check if ParentMap contains key (PR #121736)

Sameer Sahasrabuddhe via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 6 22:55:25 PST 2025


================
@@ -34,13 +34,13 @@ static void BuildParentMap(MapTy& M, Stmt* S,
   case Stmt::PseudoObjectExprClass: {
     PseudoObjectExpr *POE = cast<PseudoObjectExpr>(S);
 
-    if (OVMode == OV_Opaque && M[POE->getSyntacticForm()])
+    if (OVMode == OV_Opaque && M.contains(POE->getSyntacticForm()))
----------------
ssahasra wrote:

Fixed with try_emplace() to avoid the second lookup as well, which inserts when the key is already present.

https://github.com/llvm/llvm-project/pull/121736


More information about the cfe-commits mailing list