[PATCH] D99500: [analyzer] Support allocClassWithName in OSObjectCStyleCast checker

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 29 05:47:25 PDT 2021


vsavchenko created this revision.
vsavchenko added reviewers: NoQ, steakhal, xazax.hun, ASDenysPetrov.
Herald added subscribers: martong, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
vsavchenko requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

`allocClassWithName` allocates an object with the given type.
The type is actually provided as a string argument (type's name).
This creates a possibility for not particularly useful warnings
from the analyzer.

In order to combat with those, this patch checks for casts of the
`allocClassWithName` results to types mentioned directly as its
argument.  All other uses of this method should be reasoned about
as before.

rdar://72165694


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99500

Files:
  clang/lib/StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp
  clang/test/Analysis/os_object_base.h
  clang/test/Analysis/osobjectcstylecastchecker_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99500.333831.patch
Type: text/x-patch
Size: 4370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210329/59eebd2f/attachment.bin>


More information about the cfe-commits mailing list