[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:37 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) !=
+ std::tie(Other.StartLineNumber, Other.Filename);
}
// This operator is used to sort a vector of Locations.
// No specific order (attributes more important than others) is required. Any
// sort is enough, the order is only needed to call std::unique after sorting
// the vector.
bool operator<(const Location &Other) const {
----------------
mysterymath wrote:
Similarly, from the comment, it appears that this need to be a strict weak order that respects the equality constraint given above. Accordingly, this should also include EndLineNumber.
https://github.com/llvm/llvm-project/pull/135081
More information about the cfe-commits
mailing list