This is an archive of the discontinued LLVM Phabricator instance.

Add clang-tidy check google-global-names-in-headers.
ClosedPublic

Authored by sbenza on Feb 11 2015, 7:32 AM.

Details

Summary

google-global-names-in-headers flags global namespace pollution in header files.
Right now it only triggers on using declarations and directives.

Diff Detail

Repository
rL LLVM

Event Timeline

sbenza updated this revision to Diff 19756.Feb 11 2015, 7:32 AM
sbenza retitled this revision from to Add clang-tidy check google-global-names-in-headers..
sbenza updated this object.
sbenza edited the test plan for this revision. (Show Details)
sbenza added a reviewer: alexfh.
alexfh accepted this revision.Feb 11 2015, 8:01 AM
alexfh edited edge metadata.

Looks good modulo comments. Thanks!

clang-tidy/google/GlobalNamesInHeadersCheck.cpp
31 ↗(On Diff #19756)

nit: const auto*?

36 ↗(On Diff #19756)

nit: I'd put ellipsis in the end of the comment to avoid confusion.

43 ↗(On Diff #19756)

nit: No braces needed in the LLVM style.

49 ↗(On Diff #19756)

The message reads as if clang-tidy didn't find the aforementioned using declaration and wants you to insert one. Maybe "using declarations in the global namespace in headers are prohibited" or something similar? I'd even go with "don't use using declarations in ...", it's an error message, not a novel after all ;)

This revision is now accepted and ready to land.Feb 11 2015, 8:01 AM
sbenza edited edge metadata.Feb 11 2015, 8:29 AM
sbenza added a subscriber: Unknown Object (MLST).
sbenza updated this revision to Diff 19779.Feb 11 2015, 1:20 PM

Minor fixes.

clang-tidy/google/GlobalNamesInHeadersCheck.cpp
31 ↗(On Diff #19756)

Done

36 ↗(On Diff #19756)

Done.

43 ↗(On Diff #19756)

Done.

49 ↗(On Diff #19756)

Done.

This revision was automatically updated to reflect the committed changes.