This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix redundant-string-init check with msvc 14 headers.
ClosedPublic

Authored by etienneb on Mar 18 2016, 10:03 PM.

Details

Summary

The string constructors are not defined using optional parameters and are not recognized by the redundant-string-init checker.

The following patch fixes the redundant-string-init checker for the Visual Studio 14 headers file.
The matcher now accept both variant (with 1 and 2 parameters).

Also added new unittests.

Similar issue than: review

In the xstring.h header, the constructors are defined this way:

basic_string(const _Myt& _Right) [...]
basic_string(const _Myt& _Right, const _Alloc& _Al) [...]

Diff Detail

Event Timeline

etienneb updated this revision to Diff 51104.Mar 18 2016, 10:03 PM
etienneb retitled this revision from to [clang-tidy] Fix redundant-string-init check with msvc 14 headers..
etienneb updated this object.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.
hokein accepted this revision.Mar 21 2016, 4:41 AM
hokein edited edge metadata.

The patch looks good to me.

This revision is now accepted and ready to land.Mar 21 2016, 4:41 AM
alexfh accepted this revision.Mar 22 2016, 7:34 AM
alexfh edited edge metadata.

LG

etienneb updated this revision to Diff 51298.Mar 22 2016, 10:31 AM
etienneb edited edge metadata.

Rebased + fixing invalid paths.

The diff paths were wrong, invalid diff.

etienneb closed this revision.Mar 22 2016, 10:44 AM