Author: compnerd Date: Tue Jan 24 21:36:28 2017 New Revision: 293014 URL: http://llvm.org/viewvc/llvm-project?rev=293014&view=rev Log: Driver: ignore -fno-objc-arc-exception when -fno-objc-arc set
Sometime clang would be supplied -fobjc-arc -f(no)objc-arc-exceptions and then later disable ARC with -fno-objc-arc, which only negate first option, but not the latter, resulting usused argument warning. Silence this warning only when -fno-objc-arc option is present. Patch by Onha Choe! Added: cfe/trunk/test/Driver/no-arc-exception-silence.m Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=293014&r1=293013&r2=293014&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 24 21:36:28 2017 @@ -6018,7 +6018,13 @@ void Clang::ConstructJob(Compilation &C, options::OPT_fno_objc_arc_exceptions, /*default*/ types::isCXX(InputType))) CmdArgs.push_back("-fobjc-arc-exceptions"); + } + // Silence warning for full exception code emission options when explicitly + // set to use no ARC. + if (Args.hasArg(options::OPT_fno_objc_arc)) { + Args.ClaimAllArgs(options::OPT_fobjc_arc_exceptions); + Args.ClaimAllArgs(options::OPT_fno_objc_arc_exceptions); } // -fobjc-infer-related-result-type is the default, except in the Objective-C Added: cfe/trunk/test/Driver/no-arc-exception-silence.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/no-arc-exception-silence.m?rev=293014&view=auto ============================================================================== --- cfe/trunk/test/Driver/no-arc-exception-silence.m (added) +++ cfe/trunk/test/Driver/no-arc-exception-silence.m Tue Jan 24 21:36:28 2017 @@ -0,0 +1,2 @@ +// RUN: %clang -Werror -fobjc-arc -fobjc-arc-exceptions -fno-objc-arc -Xclang -verify -c %s +// expected-no-diagnostics _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits