Skip to content

Commit 7242afb

Browse files
cleanup: Make normalize method const (#341)
1 parent 3e338db commit 7242afb

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

indexer/Path.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,10 @@ bool AbsolutePathRef::isNormalized() const {
7878
return true;
7979
}
8080

81-
void AbsolutePathRef::normalize(llvm::SmallVectorImpl<char> &newStorage) {
81+
void AbsolutePathRef::normalize(llvm::SmallVectorImpl<char> &newStorage) const {
8282
newStorage.clear();
8383
newStorage.append(this->asStringView().begin(), this->asStringView().end());
8484
llvm::sys::path::remove_dots(newStorage);
85-
*this =
86-
AbsolutePathRef(std::string_view(newStorage.data(), newStorage.size()));
8785
}
8886

8987
std::optional<AbsolutePathRef> AbsolutePathRef::prefix() const {

indexer/Path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class AbsolutePathRef {
7878

7979
bool isNormalized() const;
8080

81-
void normalize(llvm::SmallVectorImpl<char> &newStorage);
81+
void normalize(llvm::SmallVectorImpl<char> &newStorage) const;
8282

8383
PathPrefixIterator<AbsolutePathRef> prefixesBegin() const {
8484
return PathPrefixIterator<AbsolutePathRef>{*this};

0 commit comments

Comments
 (0)