aaron.ballman added a comment.

In D142123#4066564 <https://reviews.llvm.org/D142123#4066564>, @KyleFromKitware 
wrote:

> In terms of a "generic check", there is already the `HeaderGuardCheck`, but 
> that has to be extended to be specific to the project's naming convention. 
> And I don't think there can be a generic check that converts `#pragma once` 
> to a header guard - when it adds the header guard, what does it name it? It 
> has to know the project's naming convention.

It doesn't have to -- for example, we can name the guard based on the path to 
the header. e.g., `foo/include/bar/baz.h` could use `FOO_INCLUDE_BAR_BAZ_H` as 
the header guard.

> If we want a check that replaces `#pragma once` with a header guard, our best 
> bet would be modifying `HeaderGuardCheck` to do this, since it already does 
> most of the needed work. However, such functionality is orthogonal to my 
> proposal here.

It's orthogonal except for the design concerns. Basically, I don't think we 
should have one check for "go to header guards" and another check for "go to 
pragma once" -- IMO we should have one check to do either approach. @njames93 
is correct that a common use case for clang-tidy is "enable all checks" so 
having two checks that do opposite things gets awkward in practice.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142123/new/

https://reviews.llvm.org/D142123

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to