[PATCH] D78660: [SemaObjC] Add a warning for dictionary literals with duplicate keys

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 5 10:14:22 PDT 2020


rjmccall accepted this revision.
rjmccall added a comment.

Anyway, LGTM.



================
Comment at: clang/lib/Sema/SemaExprObjC.cpp:948
+        checkOneKey(IntegralKeys, Result.Val.getInt(), Loc);
+      }
+    }
----------------
erik.pilkington wrote:
> bendjones wrote:
> > rjmccall wrote:
> > > Does `EvaluateAsInt` really just fail cleanly if the argument doesn't have integral type?
> > I thought it fails if a type can’t be “some how” converted to an integral type.  The loose quotes are key here. 
> Yeah, it checks if the expression has an integral type before evaluating: https://github.com/llvm/llvm-project/blob/1de4e5693317c1e34cae4740d6c9c6733e5ed3fd/clang/lib/AST/ExprConstant.cpp#L13830
Alright.  That's interesting, I would've given even odds that it would assert.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78660/new/

https://reviews.llvm.org/D78660





More information about the cfe-commits mailing list