This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Disable misc-definitions-in-headers for declarations in anonymous namespaces
ClosedPublic

Authored by carlosgalvezp on Apr 1 2023, 8:30 AM.

Details

Summary

Anonymous namespaces are another way of providing internal linkage,
and the check already ignores other cases of internal linkage in
headers, via "static" or "const".

Anonymous namespaces in headers are definitely a source of pitfalls,
but it's not the responsibility of this check to cover that. Instead,
google-build-namespaces will specifically warn about this issue.

Fixes https://github.com/llvm/llvm-project/issues/61471

Diff Detail

Event Timeline

carlosgalvezp created this revision.Apr 1 2023, 8:30 AM
Herald added a project: Restricted Project. · View Herald Transcript
carlosgalvezp requested review of this revision.Apr 1 2023, 8:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2023, 8:30 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Eugene.Zelenko accepted this revision.Apr 1 2023, 9:14 AM

Looks OK for me, but will be good idea to wait for other reviewers.

This revision is now accepted and ready to land.Apr 1 2023, 9:14 AM