History log of /external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3ea9e33ea25e0c2b12db56418ba3f994eb662c04 08-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master clang for rebase to r233350

Change-Id: I12d4823f10bc9e445b8b86e7721b71f98d1df442
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
90c78328e70cb376754edf87708505a84c044271 31-May-2012 Anna Zaks <ganna@apple.com> Change wording of 'memcpy' type mismatch warning and remove fixit.

As per comments following r157659.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
dca1761c9b91d0a730ac6368425dc978e8481392 01-Mar-2012 Peter Collingbourne <peter@pcc.me.uk> StmtProfiler: Add a null check for child statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
c36bedc90c687caa71748480c60707ea4608b092 01-Feb-2012 Anna Zaks <ganna@apple.com> Add a new compiler warning, which flags anti-patterns used as the size
argument in strncat.

The warning is ignored by default since it needs more qualification.

TODO: The warning message and the note are messy when
strncat is a builtin due to the macro expansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
cda57822327499aeb6fe606f9cf5903cffca3444 14-Oct-2011 Nico Weber <nicolasweber@gmx.de> Extend -Wno-sizeof-array-argument to strncpy and friends.

This finds 2 bugs in chromium and 1 in hunspell, with 0 false positives.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
cc2f30c4ed7770b6005bd55b529a55c1fcc250fc 05-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Extend memset/memcpy/memmove checking to include memcmp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
000d428347f352979e0f6dffcf0a64e73af0a2b5 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Rework the warning for 'memset(p, 0, sizeof(p))' where 'p' is a pointer
and the programmer intended to write 'sizeof(*p)'. There are several
elements to the new version:

1) The actual expressions are compared in order to more accurately flag
the case where the pattern that works for an array has been used, or
a '*' has been omitted.
2) Only do a loose type-based check for record types. This prevents us
from warning when we happen to be copying around chunks of data the
size of a pointer and the pointer types for the sizeof and
source/dest match.
3) Move all the diagnostics behind the runtime diagnostic filter. Not
sure this is really important for this particular diagnostic, but
almost everything else in SemaChecking.cpp does so.
4) Make the wording of the diagnostic more precise and informative. At
least to my eyes.
5) Provide highlighting for the two expressions which had the unexpected
similarity.
6) Place this diagnostic under a flag: -Wsizeof-pointer-memaccess

This uses the Stmt::Profile system for computing #1. Because of the
potential cost, this is guarded by the warning flag. I'd be interested
in feedback on how bad this is in practice; I would expect it to be
quite cheap in practice. Ideas for a cheaper / better way to do this are
also welcome.

The diagnostic wording could likely use some further wordsmithing.
Suggestions welcome here. The goals I had were to: clarify that its the
interaction of 'memset' and 'sizeof' and give more reasonable
suggestions for a resolution.

An open question is whether these diagnostics should have the note
attached for silencing by casting the dest/source pointer to void*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133155 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
c7b993b4dfc14ca2389087f21467259de8af7e91 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Fix my test case from r133136 so that it actually represents the code
pattern found in the wild where this warning was firing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
5546e69729b9f195afd0410948e013206618b717 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Skip both character pointers and void pointers when diagnosing bad
argument types for mem{set,cpy,move}. Character pointers, much like void
pointers, often point to generic "memory", so trying to check whether
they match the type of the argument to 'sizeof' (or other checks) is
unproductive and often results in false positives.

Nico, please review; does this miss any of the bugs you were trying to
find with this warning? The array test case you had should be caught by
the array-specific sizeof warning I think.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
55080a78c81733021b45fc3a47541619e4470883 15-Jun-2011 Nico Weber <nicolasweber@gmx.de> Build fix attempt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp
e4a1c64700304459ac436fe29cb498f2da3b6194 14-Jun-2011 Nico Weber <nicolasweber@gmx.de> Warn on memset(ptr, 0, sizeof(ptr)). Diagnostic wording by Jordy Rose.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/warn-memset-bad-sizeof.cpp