llvm-project/clang/lib
Bruno Cardoso Lopes edf3d81cbf [Sema] Add sizeof diagnostics for bzero
For memset (and others) we can get diagnostics like:

  struct stat { int x; };
  void foo(struct stat *stamps) {
    bzero(stamps, sizeof(stamps));
    memset(stamps, 0, sizeof(stamps));
  }

  t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess]
    memset(stamps, 0, sizeof(stamps));
           ~~~~~~            ^~~~~~
  t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset(stamps, 0, sizeof(stamps));
                             ^~~~~~

This patch implements the same class of warnings for bzero.

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

rdar://problem/18963514

llvm-svn: 277787
2016-08-04 23:55:22 +00:00
..
ARCMigrate [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
AST [Sema] Add sizeof diagnostics for bzero 2016-08-04 23:55:22 +00:00
ASTMatchers [ASTMatcher] Add templateName matcher. 2016-07-29 15:45:11 +00:00
Analysis [analyzer] Make CloneDetector recognize different variable patterns. 2016-08-04 19:37:00 +00:00
Basic [OpenCL] Fix size of image type 2016-08-03 20:38:06 +00:00
CodeGen [OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins. 2016-08-04 18:06:27 +00:00
Driver [CUDA] Fix libdevice selection. 2016-08-02 23:12:51 +00:00
Edit [OpenCL] Generate opaque type for sampler_t and function call for the initializer 2016-07-28 19:26:30 +00:00
Format Implement tooling::Replacements as a class. 2016-08-01 10:16:37 +00:00
Frontend Initial vectorization support for svml calls (short vector math library). 2016-07-29 16:44:24 +00:00
FrontendTool Make it possible for AST plugins to enable themselves by default 2016-03-15 12:51:40 +00:00
Headers [OpenCL] Remove extra native_ functions from opencl-c.h 2016-08-04 19:30:54 +00:00
Index [index] Fix crash with indexing designated init expressions inside templates. 2016-08-03 05:38:53 +00:00
Lex Revert r276973 "Adjust Registry interface to not require plugins to export a registry" 2016-07-28 17:17:22 +00:00
Parse [Parse] Let declarations follow labels in -fms-extensions mode 2016-08-01 16:39:29 +00:00
Rewrite Remove use of builtin comma operator. 2016-02-18 22:34:54 +00:00
Sema [Sema] Add sizeof diagnostics for bzero 2016-08-04 23:55:22 +00:00
Serialization Reapply r276069 with workaround for MSVC 2013 2016-07-30 22:33:34 +00:00
StaticAnalyzer [analyzer] Update two comments in MPI-Checker. NFC. 2016-08-02 23:24:40 +00:00
Tooling Fix bug in conflict check for Replacements::add(). 2016-08-03 15:12:00 +00:00
CMakeLists.txt Fix build with various feature flag combinations 2014-07-14 22:17:22 +00:00