[llvm-dev] Coding standards: duplicating method comments?
Alex Bradbury via llvm-dev
llvm-dev at lists.llvm.org
Tue Jan 30 11:56:02 PST 2018
A quick coding standards question. The current coding standards doc
has helpful guidance on Doxygen comments and the like:
https://llvm.org/docs/CodingStandards.html#source-code-formatting
One aspect which isn't explicit is the policy on duplicating code
comments for subclasses. To modify an example from that doc:
"""
// In Something.h:
/// An abstraction for some complicated thing.
class Something {
public:
/// Does foo and bar.
virtual void fooBar();
};
"""
Suppose we define TargetSomething.h, and give the same comment for fooBar there:
"""
class TargetSomething : public Something {
public:
/// Does foo and bar.
void fooBar() override;
};
"""
Is this bad style? It seems the current codebase is inconsistent on
this point. The upside of such duplication is that it reduces the need
to cross-reference to other files when using a dumb editor. The
disadvantage is that duplicated comments add maintenance burden just
like duplicated code.
Thanks,
Alex
More information about the llvm-dev
mailing list