[cfe-commits] r145928 - in /cfe/trunk: include/clang/Basic/DiagnosticIDs.h include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/Parse/ParseObjc.cpp lib/Sema/SemaDeclObjC.cpp test/Index/cindex-on-invalid-usrs.m test/Parser/missing-end-2.m test/Parser/missing-end-3.m test/Parser/missing-end.m test/Parser/objc-missing-impl.m test/Parser/objc-quirks.m test/SemaObjC/missing-atend-metadata.m

Erik Verbruggen erikjv at me.com
Thu Dec 8 04:06:39 CST 2011


On 7-12-11 20:27, jahanian wrote:
>
> On Dec 7, 2011, at 11:08 AM, Erik Verbruggen wrote:
>
>>
>> On Dec 7, 2011, at 18:51, jahanian wrote:
>>
>>>
>>> On Dec 6, 2011, at 9:51 AM, jahanian wrote:
>>>
>>>> Looks good. One question below.
>>>> On Dec 6, 2011, at 1:25 AM, Erik Verbruggen wrote:
>>>>
>>>>> Author: erikjv
>>>>> Date: Tue Dec  6 03:25:23 2011
>>>>> New Revision: 145928
>>>>>
>>>>>
>>>>> +void Parser::CheckNestedObjCContexts(SourceLocation AtLoc)
>>>>> +{
>>>>> +  Sema::ObjCContainerKind ock = Actions.getObjCContainerKind();
>>>>> +  if (ock == Sema::OCK_None)
>>>>> +    return;
>>>>> +
>>>>> +  Decl *Decl = Actions.ActOnAtEnd(getCurScope(), AtLoc);
>>>>> +  Diag(AtLoc, diag::err_objc_missing_end)
>>>>> +<<  FixItHint::CreateInsertion(AtLoc, "@end\n");
>>>>> +  if (Decl)
>>>>> +    Diag(Decl->getLocStart(), diag::note_objc_container_start)
>>>>> +<<  (int) ock;
>>>>> +  if (!PendingObjCImpDecl.empty())
>>>>> +    PendingObjCImpDecl.pop_back();
>>>>
>>>> You are assuming that a missing '@end' is for an @implementation here.
>>>> Is this always the case, if so, you may want to assert on oak == OCK_Implementation
>>>> (or its category equivalent).
>>>
>>> Above patch causes a bogus error and a crash in this test case:
>>>
>>> @implementation I
>>> - Meth {}
>>> + Cls {}
>>> @protocol P;
>>> @end

Added it as a test, and fixed the message in r146147. I cannot reproduce 
the crash though...

>> Will fix it. One question: is it allowed to put that @protocol there? (Same for @class of course..) And is the following allowed?
>
> Yes, in implementation it is allowed because you can have private methods which will use them;  as in:
> @interface I @end
>
> @implementation I
> @protocol P;
> @class C;
> - (C<P>*) MyMeth {}
> @end

Added it as a test too.

-- Erik.

>>
>> @interface I {}
>> @protocol P;
>> @end
>>
>> Or:
>>
>> @protocol P
>> @class C;
>> @end
>
> These are not allowed. Generally, they are useless because they cannot be accessed in an implementation
> (and gcc disallows them too).
>
> - Fariborz
>
>>
>> -- Erik.
>>
>>>
>>> - Fariborz
>>>
>>>>
>>>> - fariborz
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>
>



More information about the cfe-commits mailing list