This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] bugprone-string-constructor: Catch string from nullptr.
ClosedPublic

Authored by courbet on Jan 14 2019, 2:31 AM.

Diff Detail

Event Timeline

courbet created this revision.Jan 14 2019, 2:31 AM
courbet updated this revision to Diff 181519.Jan 14 2019, 2:36 AM

Remove commented code.

Eugene.Zelenko added a project: Restricted Project.
aaron.ballman accepted this revision.Jan 15 2019, 12:33 PM

LGTM aside from a nit and a test case request.

clang-tidy/bugprone/StringConstructorCheck.cpp
140

Formatting is wrong here, and you can use const auto * as the type is spelled out in the initialization.

test/clang-tidy/bugprone-string-constructor.cpp
49–50

Can you also add: std::string q7 = 0; as a test case?

This revision is now accepted and ready to land.Jan 15 2019, 12:33 PM
courbet updated this revision to Diff 181985.Jan 16 2019, 12:39 AM
courbet marked 2 inline comments as done.

clang-format + add test

This revision was automatically updated to reflect the committed changes.