r231008 - [SDK modernizer]. Patch fixes driver's lack of

Chandler Carruth chandlerc at google.com
Tue Mar 3 01:28:19 PST 2015


On Mon, Mar 2, 2015 at 12:43 PM, Fariborz Jahanian <fjahanian at apple.com>
wrote:

> Author: fjahanian
> Date: Mon Mar  2 14:43:32 2015
> New Revision: 231008
>
> URL: http://llvm.org/viewvc/llvm-project?rev=231008&view=rev
> Log:
> [SDK modernizer]. Patch fixes driver's lack of
> recognition of mernizer's -objcmt-migrate-property-dot-syntax
> option. rdar://19994452
>
> Modified:
>     cfe/trunk/lib/Driver/Tools.cpp
>     cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m
>     cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m.result
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=231008&r1=231007&r2=231008&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Mar  2 14:43:32 2015
> @@ -3448,6 +3448,7 @@ void Clang::ConstructJob(Compilation &C,
>      Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_all);
>      Args.AddLastArg(CmdArgs,
> options::OPT_objcmt_migrate_readonly_property);
>      Args.AddLastArg(CmdArgs,
> options::OPT_objcmt_migrate_readwrite_property);
> +    Args.AddLastArg(CmdArgs,
> options::OPT_objcmt_migrate_property_dot_syntax);
>      Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_annotation);
>      Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_instancetype);
>      Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_nsmacros);
>
> Modified: cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-
> property-dot-syntax.m?rev=231008&r1=231007&r2=231008&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m (original)
> +++ cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m Mon Mar  2 14:43:32
> 2015
> @@ -2,6 +2,8 @@
>  // RUN: %clang_cc1 -objcmt-migrate-property-dot-syntax
> -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak
> -fobjc-arc -triple x86_64-apple-darwin11
>  // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test
> -verify-transformed-files %s.result
>  // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only
> -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
> +// RUN: rm -rf %t.1
> +// RUN: %clang -fsyntax-only -objcmt-migrate-property-dot-syntax -Xclang
> -mt-migrate-directory -Xclang %t.1 %s -fobjc-arc -Xclang -triple -Xclang
> x86_64-apple-darwin11
>
>  // rdar://18498572
>  @interface NSObject @end
>
> Modified: cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m.result
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-
> property-dot-syntax.m.result?rev=231008&r1=231007&r2=231008&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m.result (original)
> +++ cfe/trunk/test/ARCMT/objcmt-property-dot-syntax.m.result Mon Mar  2
> 14:43:32 2015
> @@ -2,6 +2,8 @@
>  // RUN: %clang_cc1 -objcmt-migrate-property-dot-syntax
> -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak
> -fobjc-arc -triple x86_64-apple-darwin11
>  // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test
> -verify-transformed-files %s.result
>  // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only
> -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
> +// RUN: rm -rf %t.1
> +// RUN: %clang -fsyntax-only -objcmt-migrate-property-dot-syntax -Xclang
> -mt-migrate-directory -Xclang %t.1 %s -fobjc-arc -Xclang -triple -Xclang
> x86_64-apple-darwin11
>

This isn't really the right way to test the driver.

We usually test changes to the driver by adding a test under 'test/Driver'
and using '-###' in conjunction with FileCheck to assert on the commandline
formed by the driver.

Among other things, by using the driver here rather than the cc1 layer you
have the following problems:

- you have to carefully manage the -fobc-arc flags as you've already had to
tweak in subsequent commits
- on non-x86 platforms the driver may end up producing very flawed cc1
invocations in conjunction with the hard-coded cc1 flags of '-Xclang
-triple -Xclang x86_64-apple-darwin11'

At least for non-x86 platforms, this is actually a breaking change and we
need to revert it to get builds green again.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150303/3ae78bc3/attachment.html>


More information about the cfe-commits mailing list