[PATCH] D31006: [Objective-C] Fix "weak-unavailable" warning with -fobjc-weak
Brian T. Kelley via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 17 16:05:32 PDT 2017
bkelley marked an inline comment as done.
bkelley added inline comments.
================
Comment at: lib/Sema/SemaCast.cpp:125
+ assert(Self.getLangOpts().ObjCAutoRefCount ||
+ Self.getLangOpts().ObjCWeak);
----------------
rjmccall wrote:
> 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;
> }
Thanks for the suggestion. I was hesitant to add a method to LangOpts since it has so few derived state functions, but it certainly makes everything else cleaner.
https://reviews.llvm.org/D31006
More information about the cfe-commits
mailing list