[all-commits] [llvm/llvm-project] a806ec: [analyzer] Refactor codes in findMethodDecl()

smanna12 via All-commits all-commits at lists.llvm.org
Wed Jun 28 20:41:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a806ec4857c2c662c89755edba56d893ae1beeb4
      https://github.com/llvm/llvm-project/commit/a806ec4857c2c662c89755edba56d893ae1beeb4
  Author: Manna, Soumi <soumi.manna at intel.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp

  Log Message:
  -----------
  [analyzer] Refactor codes in findMethodDecl()

In findMethodDecl(clang::ObjCMessageExpr const *, clang::ObjCObjectPointerType const *, clang::ASTContext &), if the MessageExpr->getReceiverKind() is not Instance or Class, we never dereference pointer “ReceiverObjectPtrType”. Also, we don't dereference the pointer “ReceiverObjectPtrType” if ReceiverType is ObjCIdType or ObhjCClassType. So the pointer “ReceiverObjectPtrType”is only used in this branch and the declaration should be here.

This patch directly uses ReceiverType->castAs<ObjCObjectPointerType>() instead of ReceiverObjectPtrType when calling canAssignObjCInterfaces() to express the intent more clearly.

Reviewed By: erichkeane, steakhal

Differential Revision: https://reviews.llvm.org/D152194




More information about the All-commits mailing list