rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.
LGTM.
================
Comment at: lib/Sema/SemaCast.cpp:125
+ assert(Self.getLangOpts().ObjCAutoRefCount ||
+ Self.getLangOpts().ObjCWeak);
----------------
bkelley wrote:
> 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.
There's probably two main reasons for that:
- Often, when there's a feature that cuts across different language
configurations, there's also a specific language option for it.
- People are too reticent about adding derived state functions to LangOpts. :)
https://reviews.llvm.org/D31006
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits