[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 15:34:55 PDT 2017


rjmccall added a comment.

Just a couple of minor requests.



================
Comment at: lib/Sema/SemaExpr.cpp:708
+  if (getLangOpts().ObjCWeak &&
       E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
     Cleanup.setExprNeedsCleanups(true);
----------------
Much like the other patches, it's probably more efficient to just check the qualifier here instead of testing the language option first.


================
Comment at: lib/Sema/SemaExpr.cpp:2513
+      if (getLangOpts().ObjCWeak) {
         if (IV->getType().getObjCLifetime() == Qualifiers::OCL_Weak) {
           if (!Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, Loc))
----------------
Same thing.


================
Comment at: lib/Sema/SemaExprMember.cpp:1506
+    if (S.getLangOpts().ObjCWeak) {
       if (IV->getType().getObjCLifetime() == Qualifiers::OCL_Weak) {
         if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, MemberLoc))
----------------
Same.


================
Comment at: lib/Sema/SemaPseudoObject.cpp:846
       Qualifiers::ObjCLifetime LT = propType.getObjCLifetime();
       if (LT == Qualifiers::OCL_Weak)
         if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, RefExpr->getLocation()))
----------------
Same.


https://reviews.llvm.org/D31005





More information about the cfe-commits mailing list