[clang] f22e586 - [Sema] CheckObjCBridgeNSCast - fix dead code warning. NFCI.

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 19 11:23:29 PDT 2021


Sorry, It's not.

On Thu, 19 Aug 2021 at 11:21, Vitaly Buka <vitalybuka at google.com> wrote:

> Could this be a crash from this patch
> https://lab.llvm.org/buildbot/#/builders/85/builds/6135/steps/10/logs/stdio
> ?
>
> On Wed, 18 Aug 2021 at 03:53, Simon Pilgrim via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>>
>> Author: Simon Pilgrim
>> Date: 2021-08-18T11:53:27+01:00
>> New Revision: f22e5869a012af09e130d804bba441eff261b1fe
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/f22e5869a012af09e130d804bba441eff261b1fe
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/f22e5869a012af09e130d804bba441eff261b1fe.diff
>>
>> LOG: [Sema] CheckObjCBridgeNSCast - fix dead code warning. NFCI.
>>
>> Target is only ever non-null when we find an existing type, so move its
>> declaration inside that case, and remove the dead code where Target was
>> always null.
>>
>> Added:
>>
>>
>> Modified:
>>     clang/lib/Sema/SemaExprObjC.cpp
>>
>> Removed:
>>
>>
>>
>>
>> ################################################################################
>> diff  --git a/clang/lib/Sema/SemaExprObjC.cpp
>> b/clang/lib/Sema/SemaExprObjC.cpp
>> index 8a9c933fc93f..9e46801ea508 100644
>> --- a/clang/lib/Sema/SemaExprObjC.cpp
>> +++ b/clang/lib/Sema/SemaExprObjC.cpp
>> @@ -4015,12 +4015,11 @@ static bool CheckObjCBridgeNSCast(Sema &S,
>> QualType castType, Expr *castExpr,
>>          if (Parm->isStr("id"))
>>            return true;
>>
>> -        NamedDecl *Target = nullptr;
>>          // Check for an existing type with this name.
>>          LookupResult R(S, DeclarationName(Parm), SourceLocation(),
>>                         Sema::LookupOrdinaryName);
>>          if (S.LookupName(R, S.TUScope)) {
>> -          Target = R.getFoundDecl();
>> +          NamedDecl *Target = R.getFoundDecl();
>>            if (Target && isa<ObjCInterfaceDecl>(Target)) {
>>              ObjCInterfaceDecl *ExprClass =
>> cast<ObjCInterfaceDecl>(Target);
>>              if (const ObjCObjectPointerType *InterfacePointerType =
>> @@ -4056,8 +4055,6 @@ static bool CheckObjCBridgeNSCast(Sema &S, QualType
>> castType, Expr *castExpr,
>>                   diag::err_objc_cf_bridged_not_interface)
>>                << castExpr->getType() << Parm;
>>            S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
>> -          if (Target)
>> -            S.Diag(Target->getBeginLoc(), diag::note_declared_at);
>>          }
>>          return true;
>>        }
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210819/d1761a33/attachment-0001.html>


More information about the cfe-commits mailing list