The header is BugReporterVisitor.h, yet the implementation is BugReporterVisitorS.cpp.
The discrepancy sometimes confuses the tooling and hinders code comprehension.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
The header declares and the cpp file defines multiple visitors. However, unless you are the BugReporter, you only care about the possibility of defining their own visitor, and don't care about re-using other visitors. I guess that's how these names came to be.
However, right now the header is only included from BugReporter.h, and the idea i described above makes no sense.
So i feel it'd be nicer to rename the header (and it's also not too hard).
Please make sure to think these header rename changes through carefully. In clang/LLVM we do not have a 1-1 correspondence between classes and headers; nor between classes and implementations files. This is especially true for headers in 'include' (as compared to headers in 'lib') since those headers form the interface of the library and clang is designed to be used as individual libraries. For example, AnalysisContext.h declared multiple forms of context, including AnalysisDeclContext but also LocationContext. When you renamed it to 'AnalysisDeclContext.h' you changed a header that clients of the 'Analysis' library would use to include all the forms of analysis context to have a name that indicates it only includes one class.
My advice when making these changes to headers in 'include' is to consider whether the rename makes sense for clients of the library.
@dcoughlin right, I agree that changing headers is very annoying for users, so that's why I've proposed renaming implementation first.
In clang/LLVM we do not have a 1-1 correspondence between classes and headers; nor between classes and implementations files.
But very often it does, and it does improve code comprehension.
When you renamed it to 'AnalysisDeclContext.h' you changed a header that clients of the 'Analysis' library would use to include all the forms of analysis context to have a name that indicates it only includes one class
Right, maybe it was problematic, in that case my bad, but can that be discussed separately from this change?
My advice when making these changes to headers in 'include' is to consider whether the rename makes sense for clients of the library.
In this case BugReporterVisitor.h does have a number of visitor classes, so I think the plural is appropriate.
Yep all right with me :)
include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h | ||
---|---|---|
15–16 ↗ | (On Diff #115681) | The routine comment about include guards^^ |