[cfe-commits] r42412 - in /cfe/trunk: AST/Decl.cpp Parse/ParseObjc.cpp Parse/Parser.cpp Sema/Sema.h Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj include/clang/AST/Decl.h include/clang/Basic/DiagnosticKinds.def include/clang/Parse/Action.h include/clang/Parse/Parser.h test/Sema/method-undefined-warn-1.m

Fariborz Jahanian fjahanian at apple.com
Thu Oct 4 12:28:56 PDT 2007


On Oct 4, 2007, at 11:01 AM, Chris Lattner wrote:

> On Sep 27, 2007, at 11:57 AM, Fariborz Jahanian wrote:
>> +  for (int j = 0; j < IDecl->getNumInsMethods(); j++)
>> +    if (!Map.count(methods[j]->getSelector())) {
>> +      llvm::SmallString<128> buf;
>> +      Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
>> +           methods[j]->getSelector()->getName(buf));
>> +    }
>
> This seems awkward: I think it would make sense to add a  
> getNameAsStr() method which returns an std::string directly (or have  
> a getName() which takes no argument).  With the current code, an  
> std::string is being transparently constructed anyway, so there  
> should be no perf penalty.

This is Steve's issue and we already discussed this.

>
>
>> @@ -1560,7 +1603,17 @@
>>                                          
>> static_cast<Decl*>(ClassDecl));
>>     Category->ObjcAddCatMethods(&insMethods[0], insMethods.size(),
>>                                 &clsMethods[0], clsMethods.size());
>> -  }
>> +  }
>> +  else if (isa<ObjcImplementationDecl>(static_cast<Decl  
>> *>(ClassDecl))) {
>> +    ObjcImplementationDecl* ImplClass =  
>> cast<ObjcImplementationDecl>(
>> +                                                
>> static_cast<Decl*>(ClassDecl));
>
> Fariborz, this should use dyn_cast instead of isa + cast.

Patch has since been expanded and I probably can use the dyn_cast on  
the last one, but not this one.

- fj

>
>
> -Chris




More information about the cfe-commits mailing list