Skip to content

Commit edd7fed

Browse files
committed
[llvm][vfs] NFCI: Remove const from VFS::getRealPath()
This is an NFC change split from llvm#68645.
1 parent fe59cb2 commit edd7fed

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

llvm/include/llvm/Support/VirtualFileSystem.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
298298
/// symlinks. For real file system, this uses `llvm::sys::fs::real_path`.
299299
/// This returns errc::operation_not_permitted if not implemented by subclass.
300300
virtual std::error_code getRealPath(const Twine &Path,
301-
SmallVectorImpl<char> &Output) const;
301+
SmallVectorImpl<char> &Output);
302302

303303
/// Check whether a file exists. Provided for convenience.
304304
bool exists(const Twine &Path);
@@ -393,7 +393,7 @@ class OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSystem> {
393393
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
394394
std::error_code isLocal(const Twine &Path, bool &Result) override;
395395
std::error_code getRealPath(const Twine &Path,
396-
SmallVectorImpl<char> &Output) const override;
396+
SmallVectorImpl<char> &Output) override;
397397

398398
using iterator = FileSystemList::reverse_iterator;
399399
using const_iterator = FileSystemList::const_reverse_iterator;
@@ -453,7 +453,7 @@ class ProxyFileSystem : public RTTIExtends<ProxyFileSystem, FileSystem> {
453453
return FS->setCurrentWorkingDirectory(Path);
454454
}
455455
std::error_code getRealPath(const Twine &Path,
456-
SmallVectorImpl<char> &Output) const override {
456+
SmallVectorImpl<char> &Output) override {
457457
return FS->getRealPath(Path, Output);
458458
}
459459
std::error_code isLocal(const Twine &Path, bool &Result) override {
@@ -622,7 +622,7 @@ class InMemoryFileSystem : public RTTIExtends<InMemoryFileSystem, FileSystem> {
622622
/// This doesn't resolve symlinks as they are not supported in in-memory file
623623
/// system.
624624
std::error_code getRealPath(const Twine &Path,
625-
SmallVectorImpl<char> &Output) const override;
625+
SmallVectorImpl<char> &Output) override;
626626
std::error_code isLocal(const Twine &Path, bool &Result) override;
627627
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
628628

@@ -1047,7 +1047,7 @@ class RedirectingFileSystem
10471047
ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) override;
10481048

10491049
std::error_code getRealPath(const Twine &Path,
1050-
SmallVectorImpl<char> &Output) const override;
1050+
SmallVectorImpl<char> &Output) override;
10511051

10521052
llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override;
10531053

llvm/lib/Support/FileCollector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class FileCollectorFileSystem : public vfs::FileSystem {
281281
}
282282

283283
std::error_code getRealPath(const Twine &Path,
284-
SmallVectorImpl<char> &Output) const override {
284+
SmallVectorImpl<char> &Output) override {
285285
auto EC = FS->getRealPath(Path, Output);
286286
if (!EC) {
287287
Collector->addFile(Path);

llvm/lib/Support/VirtualFileSystem.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ std::error_code FileSystem::makeAbsolute(SmallVectorImpl<char> &Path) const {
138138
}
139139

140140
std::error_code FileSystem::getRealPath(const Twine &Path,
141-
SmallVectorImpl<char> &Output) const {
141+
SmallVectorImpl<char> &Output) {
142142
return errc::operation_not_permitted;
143143
}
144144

@@ -275,7 +275,7 @@ class RealFileSystem : public FileSystem {
275275
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
276276
std::error_code isLocal(const Twine &Path, bool &Result) override;
277277
std::error_code getRealPath(const Twine &Path,
278-
SmallVectorImpl<char> &Output) const override;
278+
SmallVectorImpl<char> &Output) override;
279279

280280
protected:
281281
void printImpl(raw_ostream &OS, PrintType Type,
@@ -357,9 +357,8 @@ std::error_code RealFileSystem::isLocal(const Twine &Path, bool &Result) {
357357
return llvm::sys::fs::is_local(adjustPath(Path, Storage), Result);
358358
}
359359

360-
std::error_code
361-
RealFileSystem::getRealPath(const Twine &Path,
362-
SmallVectorImpl<char> &Output) const {
360+
std::error_code RealFileSystem::getRealPath(const Twine &Path,
361+
SmallVectorImpl<char> &Output) {
363362
SmallString<256> Storage;
364363
return llvm::sys::fs::real_path(adjustPath(Path, Storage), Output);
365364
}
@@ -471,9 +470,8 @@ std::error_code OverlayFileSystem::isLocal(const Twine &Path, bool &Result) {
471470
return errc::no_such_file_or_directory;
472471
}
473472

474-
std::error_code
475-
OverlayFileSystem::getRealPath(const Twine &Path,
476-
SmallVectorImpl<char> &Output) const {
473+
std::error_code OverlayFileSystem::getRealPath(const Twine &Path,
474+
SmallVectorImpl<char> &Output) {
477475
for (const auto &FS : FSList)
478476
if (FS->exists(Path))
479477
return FS->getRealPath(Path, Output);
@@ -1157,9 +1155,8 @@ std::error_code InMemoryFileSystem::setCurrentWorkingDirectory(const Twine &P) {
11571155
return {};
11581156
}
11591157

1160-
std::error_code
1161-
InMemoryFileSystem::getRealPath(const Twine &Path,
1162-
SmallVectorImpl<char> &Output) const {
1158+
std::error_code InMemoryFileSystem::getRealPath(const Twine &Path,
1159+
SmallVectorImpl<char> &Output) {
11631160
auto CWD = getCurrentWorkingDirectory();
11641161
if (!CWD || CWD->empty())
11651162
return errc::operation_not_permitted;
@@ -2535,7 +2532,7 @@ RedirectingFileSystem::openFileForRead(const Twine &OriginalPath) {
25352532

25362533
std::error_code
25372534
RedirectingFileSystem::getRealPath(const Twine &OriginalPath,
2538-
SmallVectorImpl<char> &Output) const {
2535+
SmallVectorImpl<char> &Output) {
25392536
SmallString<256> Path;
25402537
OriginalPath.toVector(Path);
25412538

llvm/unittests/Support/VirtualFileSystemTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class DummyFileSystem : public vfs::FileSystem {
8282
}
8383
// Map any symlink to "/symlink".
8484
std::error_code getRealPath(const Twine &Path,
85-
SmallVectorImpl<char> &Output) const override {
85+
SmallVectorImpl<char> &Output) override {
8686
auto I = findEntry(Path);
8787
if (I == FilesAndDirs.end())
8888
return make_error_code(llvm::errc::no_such_file_or_directory);

0 commit comments

Comments
 (0)