[cfe-commits] r149735 - in /cfe/trunk: include/clang/Basic/LangOptions.def include/clang/Driver/CC1Options.td lib/Frontend/CompilerInvocation.cpp lib/Sema/SemaExprCXX.cpp test/SemaObjC/debugger-cast-result-to-id.m test/SemaObjC/unknown-anytype.m

Chad Rosier mcrosier at apple.com
Fri Feb 3 18:18:00 PST 2012


Hi Sean,
This commit is causing failures on our internal build bots.
Looks like you fixed the ObjC version, but not the ObjCXX.
******************** TEST 'Clang :: SemaObjCXX/unknown-anytype.mm' FAILED ********************Script:
--
Exit Code: 1
Command Output (stderr):
--
error: 'error' diagnostics seen but not expected: 
  Line 7: no known method '-foo'; cast the message send to the method's return type
1 error generated.
--

********************
You have no verifier checks for this new test case.  You're also running the test 3 times, which isn't necessary.
******************** TEST 'Clang :: SemaObjC/debugger-cast-result-to-id.m' FAILED ********************Script:
--
Exit Code: 1
Command Output (stderr):
--
error: 'error' diagnostics seen but not expected: 
  Line 12: redefinition of 'test0' with a different type
  Line 13: conflicting types for 'test1'
  Line 15: redefinition of 'test_unknown_anytype_receiver'
  Line 21: redefinition of 'test0' with a different type
  Line 22: conflicting types for 'test1'
  Line 24: redefinition of 'test_unknown_anytype_receiver'
error: 'note' diagnostics seen but not expected: 
  Line 3: previous definition is here
  Line 4: previous declaration is here
  Line 6: previous definition is here
  Line 3: previous definition is here
  Line 4: previous declaration is here
  Line 15: previous definition is here
12 errors generated.
--

********************
 Chad

On Feb 3, 2012, at 5:29 PM, Sean Callanan <scallanan at apple.com> wrote:

> Author: spyffe
> Date: Fri Feb  3 19:29:37 2012
> New Revision: 149735
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=149735&view=rev
> Log:
> Clang has existing support for debuggers that
> want to provide "po"-like functionality which
> treats the result of an expression implicitly as
> "id" (if it is not otherwise known) and prints
> it as an Objective-C object.
> 
> This has in the past been gated by the
> "DebuggerSupport" language option, but that is
> too general.  Debuggers also provide other commands
> like "print" that do not make any assumptions
> about whether the object is an Objective-C object.
> 
> This patch makes the assumption conditional on a
> new language option: DebuggerCastResultToId.  I
> have also made corresponding modifications to the
> testsuite.
> 
> Added:
>    cfe/trunk/test/SemaObjC/debugger-cast-result-to-id.m
> Modified:
>    cfe/trunk/include/clang/Basic/LangOptions.def
>    cfe/trunk/include/clang/Driver/CC1Options.td
>    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>    cfe/trunk/lib/Sema/SemaExprCXX.cpp
>    cfe/trunk/test/SemaObjC/unknown-anytype.m
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=149735&r1=149734&r2=149735&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.def Fri Feb  3 19:29:37 2012
> @@ -123,6 +123,7 @@
> BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden default visibility for inline C++ methods")
> BENIGN_LANGOPT(ParseUnknownAnytype, 1, 0, "__unknown_anytype")
> BENIGN_LANGOPT(DebuggerSupport , 1, 0, "debugger support")
> +BENIGN_LANGOPT(DebuggerCastResultToId, 1, 0, "for 'po' in the debugger, cast the result to id if it is of unknown type")
> BENIGN_LANGOPT(AddressSanitizer , 1, 0, "AddressSanitizer enabled")
> 
> BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
> 
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=149735&r1=149734&r2=149735&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Feb  3 19:29:37 2012
> @@ -651,6 +651,8 @@
>   HelpText<"Enable parser support for the __unknown_anytype type; for testing purposes only">;
> def fdebugger_support : Flag<"-fdebugger-support">,
>   HelpText<"Enable special debugger support behavior">;
> +def fdebugger_cast_result_to_id : Flag<"-fdebugger-cast-result-to-id">,
> +  HelpText<"Enable casting unknown expression results to id">;
> def fdeprecated_macro : Flag<"-fdeprecated-macro">,
>   HelpText<"Defines the __DEPRECATED macro">;
> def fno_deprecated_macro : Flag<"-fno-deprecated-macro">,
> 
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=149735&r1=149734&r2=149735&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Feb  3 19:29:37 2012
> @@ -826,6 +826,8 @@
>     Res.push_back("-funknown-anytype");
>   if (Opts.DebuggerSupport)
>     Res.push_back("-fdebugger-support");
> +  if (Opts.DebuggerCastResultToId)
> +    Res.push_back("-fdebugger-cast-result-to-id");
>   if (Opts.DelayedTemplateParsing)
>     Res.push_back("-fdelayed-template-parsing");
>   if (Opts.Deprecated)
> @@ -1885,6 +1887,7 @@
>   Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
>   Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
>   Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
> +  Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
>   Opts.AddressSanitizer = Args.hasArg(OPT_faddress_sanitizer);
>   Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
>   Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
> 
> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=149735&r1=149734&r2=149735&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Feb  3 19:29:37 2012
> @@ -4767,7 +4767,7 @@
>     return ExprError();
> 
>   // Top-level message sends default to 'id' when we're in a debugger.
> -  if (getLangOptions().DebuggerSupport &&
> +  if (getLangOptions().DebuggerCastResultToId &&
>       FullExpr.get()->getType() == Context.UnknownAnyTy &&
>       isa<ObjCMessageExpr>(FullExpr.get())) {
>     FullExpr = forceUnknownAnyToType(FullExpr.take(), Context.getObjCIdType());
> 
> Added: cfe/trunk/test/SemaObjC/debugger-cast-result-to-id.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/debugger-cast-result-to-id.m?rev=149735&view=auto
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/debugger-cast-result-to-id.m (added)
> +++ cfe/trunk/test/SemaObjC/debugger-cast-result-to-id.m Fri Feb  3 19:29:37 2012
> @@ -0,0 +1,27 @@
> +// RUN: %clang_cc1 -funknown-anytype -fsyntax-only -fdebugger-support -fdebugger-cast-result-to-id -verify %s
> +
> +extern __unknown_anytype test0;
> +extern __unknown_anytype test1();
> +
> +void test_unknown_anytype_receiver() {
> +  (void)(int)[[test0 unknownMethod] otherUnknownMethod];;
> +  (void)(id)[[test1() unknownMethod] otherUnknownMethod];
> +}
> +// RUN: %clang_cc1 -funknown-anytype -fsyntax-only -fdebugger-support -fdebugger-cast-result-to-id -verify %s
> +
> +extern __unknown_anytype test0;
> +extern __unknown_anytype test1();
> +
> +void test_unknown_anytype_receiver() {
> +  (void)(int)[[test0 unknownMethod] otherUnknownMethod];;
> +  (void)(id)[[test1() unknownMethod] otherUnknownMethod];
> +}
> +// RUN: %clang_cc1 -funknown-anytype -fsyntax-only -fdebugger-support -fdebugger-cast-result-to-id -verify %s
> +
> +extern __unknown_anytype test0;
> +extern __unknown_anytype test1();
> +
> +void test_unknown_anytype_receiver() {
> +  (void)(int)[[test0 unknownMethod] otherUnknownMethod];;
> +  (void)(id)[[test1() unknownMethod] otherUnknownMethod];
> +}
> 
> Modified: cfe/trunk/test/SemaObjC/unknown-anytype.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/unknown-anytype.m?rev=149735&r1=149734&r2=149735&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/unknown-anytype.m (original)
> +++ cfe/trunk/test/SemaObjC/unknown-anytype.m Fri Feb  3 19:29:37 2012
> @@ -17,9 +17,9 @@
>   int *ip = [test0 getIntPtr];
>   float *fp = [test1() getFloatPtr];
>   double *dp = [test1() getSomePtr]; // okay: picks first method found
> -  [[test0 unknownMethod] otherUnknownMethod]; 
> +  [[test0 unknownMethod] otherUnknownMethod]; // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}}
>   (void)(int)[[test0 unknownMethod] otherUnknownMethod];;
> -  [[test1() unknownMethod] otherUnknownMethod];
> +  [[test1() unknownMethod] otherUnknownMethod]; // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}}
>   (void)(id)[[test1() unknownMethod] otherUnknownMethod];
> 
>   if ([[test0 unknownMethod] otherUnknownMethod]) { // expected-error{{no known method '-otherUnknownMethod'; cast the message send to the method's return type}}
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120203/1e8cfd06/attachment.html>


More information about the cfe-commits mailing list