[PATCH] D31006: [Objective-C] Fix "weak-unavailable" warning with -fobjc-weak

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 09:53:11 PDT 2017


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaCast.cpp:125
+      assert(Self.getLangOpts().ObjCAutoRefCount ||
+             Self.getLangOpts().ObjCWeak);
 
----------------
Unlike the other patches, we do clearly need to be checking the language options in places like this.  Still, it's a shame to repeat the same condition in a million places.

I think the right thing to do here is to add a helper method to LangOpts:

  /// Returns true if any types in the program might have non-trivial lifetime qualifiers.
  bool allowsNonTrivialObjCLifetimeQualifiers() const {
    return ObjCAutoRefCount || ObjCWeak;
  }


https://reviews.llvm.org/D31006





More information about the cfe-commits mailing list