[PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use

Matthias Gehre via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 15 14:14:04 PDT 2015


mgehre created this revision.
mgehre added reviewers: alexfh, sbenza, bkramer, aaron.ballman.
mgehre added a subscriber: cfe-commits.

This check flags all calls to c-style vararg functions.

Passing to varargs assumes the correct type will be read. This is
fragile because it cannot generally be enforced to be safe in the
language and so relies on programmer discipline to get it right.

This rule is part of the "Type safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead

http://reviews.llvm.org/D13787

Files:
  clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tidy/cppcoreguidelines/ProTypeVarargUseCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeVarargUseCheck.h
  docs/clang-tidy/checks/cppcoreguidelines-pro-type-vararg-use.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cppcoreguidelines-pro-type-vararg-use.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13787.37520.patch
Type: text/x-patch
Size: 6118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151015/5ec19b15/attachment-0001.bin>


More information about the cfe-commits mailing list