Author: epilk Date: Tue Oct 30 13:31:30 2018 New Revision: 345637 URL: http://llvm.org/viewvc/llvm-project?rev=345637&view=rev Log: NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)
We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp?rev=345637&r1=345636&r2=345637&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp Tue Oct 30 13:31:30 2018 @@ -101,7 +101,7 @@ void AvoidCStyleCastsCheck::check(const // The rest of this check is only relevant to C++. // We also disable it for Objective-C++. - if (!getLangOpts().CPlusPlus || getLangOpts().ObjC1 || getLangOpts().ObjC2) + if (!getLangOpts().CPlusPlus || getLangOpts().ObjC) return; // Ignore code inside extern "C" {} blocks. if (!match(expr(hasAncestor(linkageSpecDecl())), *CastExpr, *Result.Context) Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp?rev=345637&r1=345636&r2=345637&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp Tue Oct 30 13:31:30 2018 @@ -20,9 +20,8 @@ namespace objc { void AvoidThrowingObjCExceptionCheck::registerMatchers(MatchFinder *Finder) { // this check should only be applied to ObjC sources. - if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) { + if (!getLangOpts().ObjC) return; - } Finder->addMatcher(objcThrowStmt().bind("throwStmt"), this); Finder->addMatcher( Modified: clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp?rev=345637&r1=345636&r2=345637&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp Tue Oct 30 13:31:30 2018 @@ -55,9 +55,9 @@ FixItHint generateFixItHint(const VarDec void GlobalVariableDeclarationCheck::registerMatchers(MatchFinder *Finder) { // The relevant Style Guide rule only applies to Objective-C. - if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) { + if (!getLangOpts().ObjC) return; - } + // need to add two matchers since we need to bind different ids to distinguish // constants and variables. Since bind() can only be called on node matchers, // we cannot make it in one matcher. Modified: clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp?rev=345637&r1=345636&r2=345637&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp Tue Oct 30 13:31:30 2018 @@ -19,9 +19,9 @@ namespace objc { void AvoidNSErrorInitCheck::registerMatchers(MatchFinder *Finder) { // this check should only be applied to ObjC sources. - if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) { + if (!getLangOpts().ObjC) return; - } + Finder->addMatcher(objcMessageExpr(hasSelector("init"), hasReceiverType(asString("NSError *"))) .bind("nserrorInit"), Modified: clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp?rev=345637&r1=345636&r2=345637&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp Tue Oct 30 13:31:30 2018 @@ -78,9 +78,9 @@ ForbiddenSubclassingCheck::ForbiddenSubc void ForbiddenSubclassingCheck::registerMatchers(MatchFinder *Finder) { // this check should only be applied to ObjC sources. - if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) { + if (!getLangOpts().ObjC) return; - } + Finder->addMatcher( objcInterfaceDecl( isSubclassOf( Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=345637&r1=345636&r2=345637&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Tue Oct 30 13:31:30 2018 @@ -201,9 +201,9 @@ PropertyDeclarationCheck::PropertyDeclar void PropertyDeclarationCheck::registerMatchers(MatchFinder *Finder) { // this check should only be applied to ObjC sources. - if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) { + if (!getLangOpts().ObjC) return; - } + if (IncludeDefaultAcronyms) { EscapedAcronyms.reserve(llvm::array_lengthof(DefaultSpecialAcronyms) + SpecialAcronyms.size()); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits