This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Ignore forward declarations without definitions in the same translation unit in readability-identifier-naming
ClosedPublic

Authored by jbcoe on Jul 20 2016, 8:02 AM.

Diff Detail

Event Timeline

jbcoe updated this revision to Diff 64691.Jul 20 2016, 8:02 AM
jbcoe retitled this revision from to [clang-tidy] Ignore forward declarations without definitions in the same translation unit in readability-identifier-naming.
jbcoe updated this object.
jbcoe added reviewers: alexfh, aaron.ballman.
aaron.ballman accepted this revision.Jul 21 2016, 8:39 AM
aaron.ballman edited edge metadata.

LGTM!

This revision is now accepted and ready to land.Jul 21 2016, 8:39 AM
mgehre added a subscriber: mgehre.Jul 22 2016, 12:15 PM

I don't see how your fix relates to the 'header-filter' option. I can image the following cases:

  1. a class is forward declared and then a system header (i.e. not in header-filter) is included that defines the class -> should be no warning
  2. a class is forward declared and then a user header (i.e. in header-filter) is included that defines the class -> should be a warning
  3. a class is forward declared and never defined -> should be no warning

It seems that you only consider point 3), correct?

jbcoe added a comment.EditedJul 22 2016, 2:18 PM

@mgehre, you're right. I only consider "a class is forward declared and never defined -> should be no warning" and do not test for classes that are declared in excluded headers or system headers.

jbcoe planned changes to this revision.Jul 22 2016, 2:18 PM
alexfh added a comment.Aug 2 2016, 3:55 AM

I don't see how your fix relates to the 'header-filter' option. I can image the following cases:

  1. a class is forward declared and then a system header (i.e. not in header-filter) is included that defines the class -> should be no warning
  2. a class is forward declared and then a user header (i.e. in header-filter) is included that defines the class -> should be a warning
  3. a class is forward declared and never defined -> should be no warning

It seems that you only consider point 3), correct?

1 and 2 are a part of a more generic problem related to changes that need to be "transactional" (i.e. either all of the changes from a certain group - for example, renaming a certain identifier - need to be applied, or none). And we don't have a good solution to that yet. I don't think this can be properly solved exclusively on the level of the check, there should be some infrastructure support for this as well.

jbcoe updated this revision to Diff 76778.Nov 2 2016, 1:54 PM
jbcoe updated this object.
jbcoe edited edge metadata.

Upload full diff and amend summary.

This revision is now accepted and ready to land.Nov 2 2016, 1:54 PM
This revision was automatically updated to reflect the committed changes.