[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

Fariborz Jahanian fjahanian at apple.com
Tue Nov 17 09:22:47 PST 2009


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.
>
> Cool. This is <rdar://problem/6489099>, right?

Yes. (also radar 7393863 which exposed the need for actually doing the  
work).

>
>
>> +  DeclGroupPtrTy RetreivePendingObjCImpDecl();
>
> Typo "Retreive" in the name of this function.
Thanks, fixed.

>
>
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> = 
>> =====================================================================
>> --- 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.

- Fariborz

>
>
> 	- Doug




More information about the cfe-commits mailing list