[clang-tools-extra] [clang-doc] Add Start and End Line Numbers (PR #135081)
Daniel Thornburgh via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 10 15:24:38 PDT 2025
================
@@ -238,31 +238,32 @@ struct MemberTypeInfo : public FieldTypeInfo {
};
struct Location {
- Location(int LineNumber = 0, StringRef Filename = StringRef(),
- bool IsFileInRootDir = false)
- : LineNumber(LineNumber), Filename(Filename),
- IsFileInRootDir(IsFileInRootDir) {}
+ Location(int StartLineNumber = 0, int EndLineNumber = 0,
+ StringRef Filename = StringRef(), bool IsFileInRootDir = false)
+ : StartLineNumber(StartLineNumber), EndLineNumber(EndLineNumber),
+ Filename(Filename), IsFileInRootDir(IsFileInRootDir) {}
bool operator==(const Location &Other) const {
- return std::tie(LineNumber, Filename) ==
- std::tie(Other.LineNumber, Other.Filename);
+ return std::tie(StartLineNumber, EndLineNumber, Filename) ==
+ std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
}
bool operator!=(const Location &Other) const {
- return std::tie(LineNumber, Filename) !=
- std::tie(Other.LineNumber, Other.Filename);
+ return std::tie(StartLineNumber, Filename) !=
----------------
mysterymath wrote:
This has gone out of sync with ==. Maybe it would be better to implement this as `return !(*this == Other)`?
https://github.com/llvm/llvm-project/pull/135081
More information about the cfe-commits
mailing list