llvm-project/clang
Nico Weber 0e6daefe8f Warn on mismatched parentheses in memcmp and friends.
Thisadds a new warning that warns on code like this:

  if (memcmp(a, b, sizeof(a) != 0))

The warning looks like:

test4.cc:5:30: warning: size argument in 'memcmp' call is a comparison [-Wmemsize-comparison]
  if (memcmp(a, b, sizeof(a) != 0))
                   ~~~~~~~~~~^~~~
test4.cc:5:7: note: did you mean to compare the result of 'memcmp' instead?
  if (memcmp(a, b, sizeof(a) != 0))
      ^                          ~
                            )
test4.cc:5:20: note: explicitly cast the argument to size_t to silence this warning
  if (memcmp(a, b, sizeof(a) != 0))
                   ^
                   (size_t)(     )
1 warning generated.

This found 2 bugs in chromium and has 0 false positives on both chromium and
llvm.

The idea of triggering this warning on a binop in the size argument is due to
rnk.

llvm-svn: 198063
2013-12-26 23:38:39 +00:00
..
INPUTS
bindings [libclang/python] Add CompilationDatabase.getAllCompileCommands to the python bindings. 2013-12-20 01:34:00 +00:00
docs Remove an outdated statement about debugging optimized code. 2013-12-20 17:39:42 +00:00
examples Fix getCustomDiagID() usage in example code 2013-12-21 05:19:58 +00:00
include Warn on mismatched parentheses in memcmp and friends. 2013-12-26 23:38:39 +00:00
lib Warn on mismatched parentheses in memcmp and friends. 2013-12-26 23:38:39 +00:00
runtime Only build ARM-specific runtimes if ARM is enabled 2013-12-11 12:01:21 +00:00
test Warn on mismatched parentheses in memcmp and friends. 2013-12-26 23:38:39 +00:00
tools Move tools/libclang/RecursiveASTVisitor.h -> include/clang/AST/DataRecursiveASTVisitor.h 2013-12-20 02:02:54 +00:00
unittests clang-format: (WebKit) Disallow 1-line constructors with initializers. 2013-12-24 13:31:25 +00:00
utils Teach the diagnostics engine about the Attr type to make reporting on semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting. 2013-12-26 18:30:57 +00:00
www Regenerate DR status page. 2013-12-10 08:26:19 +00:00
.arcconfig
.clang-format Switch the default mode for clang-format to '-file'. Make 'LLVM' the 2013-09-02 07:42:02 +00:00
.gitignore
CMakeLists.txt [CMake] Tweak r197697 to handle CMake finding the wrong llvm-config/tblgen. 2013-12-19 18:39:05 +00:00
CODE_OWNERS.TXT Update contact information. 2013-11-15 17:35:53 +00:00
INSTALL.txt Reverting test commit 2013-06-07 05:33:21 +00:00
LICENSE.TXT
Makefile
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/