[PATCH] D19146: [clang-tidy] New checker to detect suspicious string constructor.

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 20:29:55 PDT 2016


etienneb created this revision.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.

Checker to validate string constructor parameters.

A common mistake is to swap parameter for the fill-constructor.
```
  std::string str('x', 4);
  std::string str('4', x);
```

http://reviews.llvm.org/D19146

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/StringConstructorCheck.cpp
  clang-tidy/misc/StringConstructorCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  test/clang-tidy/misc-string-constructor.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19146.53834.patch
Type: text/x-patch
Size: 13031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160415/aa95606e/attachment.bin>


More information about the cfe-commits mailing list