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

Jay Foad via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 6 01:02:09 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()))
----------------
jayfoad wrote:

Could put this and the next `if` inside one big `if (M.contains)` check to avoid a duplicated map lookup.

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


More information about the cfe-commits mailing list