[PATCH] D51680: [analyzer][UninitializedObjectChecker] New flag to ignore union-like constructs

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 04:47:10 PDT 2018


Szelethus created this revision.
Szelethus added reviewers: george.karpenkov, NoQ, rnkovacs, xazax.hun.
Herald added subscribers: cfe-commits, mikhail.ramalho, a.sidorin, szepet, whisperity.

Based on a suggestion from @george.karpenkov.

In some cases, structs are used as unions with a help of a tag/kind field. This patch adds a new flag, which will ignore these constructs when enabled.

I decided to set this to false by default, out of fear that fields like this might refer to the dynamic type of the object.

For more info refer to http://lists.llvm.org/pipermail/cfe-dev/2018-August/058906.html and to the responses to that, especially http://lists.llvm.org/pipermail/cfe-dev/2018-August/059215.html.


Repository:
  rC Clang

https://reviews.llvm.org/D51680

Files:
  lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
  lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
  test/Analysis/cxx-uninitialized-object-unionlike-constructs.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51680.164011.patch
Type: text/x-patch
Size: 5745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180905/5668e4bf/attachment-0001.bin>


More information about the cfe-commits mailing list