[cfe-commits] r88934 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Parse/Parser.h lib/Parse/ParseObjc.cpp lib/Sema/ParseAST.cpp lib/Sema/SemaDeclObjC.cpp test/Analysis/NSString.m test/Analysis/PR3991.m test/Analysis/misc-ps.m test/Analysis/pr4209.m test/Analysis/region-1.m test/CodeGenObjC/missing-atend-metadata.m test/SemaObjC/compare-qualified-id.m test/SemaObjC/method-arg-decay.m

Douglas Gregor dgregor at apple.com
Tue Nov 17 09:39:14 PST 2009


On Nov 17, 2009, at 9:22 AM, Fariborz Jahanian wrote:

>
> On Nov 16, 2009, at 8:25 PM, Douglas Gregor wrote:
>
>>
>> On Nov 16, 2009, at 10:57 AM, Fariborz Jahanian wrote:
>>
>>> Author: fjahanian
>>> Date: Mon Nov 16 12:57:01 2009
>>> New Revision: 88934
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=88934&view=rev
>>> Log:
>>> Handle case of missing '@end' in implementation context
>>> gracefully, on par with gcc, by: Issuing a warning,
>>> doing final sematinc check of its definitions and generating
>>> its meta-data.
>>>
>>> =
>>> =
>>> ====================================================================
>>> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Nov 16 12:57:01 2009
>>> @@ -1559,12 +1559,17 @@
>>> // should be true.
>>> if (!ClassDecl)
>>>   return;
>>> -
>>> +
>>> bool isInterfaceDeclKind =
>>>       isa<ObjCInterfaceDecl>(ClassDecl) || isa<ObjCCategoryDecl> 
>>> (ClassDecl)
>>>        || isa<ObjCProtocolDecl>(ClassDecl);
>>> bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
>>>
>>> +  if (!isInterfaceDeclKind && AtEndLoc.isInvalid()) {
>>> +    AtEndLoc = ClassDecl->getLocation();
>>> +    Diag(AtEndLoc, diag::warn_missing_atend);
>>> +  }
>>
>> Is there any way for us to guess where the @end should go, with  
>> high probability? If so, we should add a fix-it.
> This could be tricky. Just about anything can be embedded in an  
> @implementation; including c-style declarations. @end with
> certainty should come before objective-c directives; such as  
> @protocol, @interface, another @implementation and eof.
> We can add a fix-it based on these four tokens. But I am not sure  
> how high the probability of a correct fix-it would be.
> If you think it is high enough, I will investigate.

It does not sound like the probability of getting it right is high  
enough; it isn't worth spending time on.

Thanks, Fariborz!

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091117/2d6aa82a/attachment.html>


More information about the cfe-commits mailing list