Skip to content

Commit 3c63c4c

Browse files
jansvoboda11artemcm
authored andcommitted
[llvm][vfs] NFCI: Remove const from VFS::getRealPath()
This is an NFC change split from llvm#68645. (cherry picked from commit edd7fed)
1 parent 098932f commit 3c63c4c

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
@@ -319,7 +319,7 @@ class FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
319319
/// symlinks. For real file system, this uses `llvm::sys::fs::real_path`.
320320
/// This returns errc::operation_not_permitted if not implemented by subclass.
321321
virtual std::error_code getRealPath(const Twine &Path,
322-
SmallVectorImpl<char> &Output) const;
322+
SmallVectorImpl<char> &Output);
323323

324324
/// Gets access to the directory entry for \p Path. Among other things, this
325325
/// exposes the filesystem tree's actual path to \p Path.
@@ -459,7 +459,7 @@ class OverlayFileSystem : public RTTIExtends<OverlayFileSystem, FileSystem> {
459459
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
460460
std::error_code isLocal(const Twine &Path, bool &Result) override;
461461
std::error_code getRealPath(const Twine &Path,
462-
SmallVectorImpl<char> &Output) const override;
462+
SmallVectorImpl<char> &Output) override;
463463

464464
using iterator = FileSystemList::reverse_iterator;
465465
using const_iterator = FileSystemList::const_reverse_iterator;
@@ -520,7 +520,7 @@ class ProxyFileSystem : public RTTIExtends<ProxyFileSystem, FileSystem> {
520520
return FS->setCurrentWorkingDirectory(Path);
521521
}
522522
std::error_code getRealPath(const Twine &Path,
523-
SmallVectorImpl<char> &Output) const override {
523+
SmallVectorImpl<char> &Output) override {
524524
return FS->getRealPath(Path, Output);
525525
}
526526
std::error_code isLocal(const Twine &Path, bool &Result) override {
@@ -689,7 +689,7 @@ class InMemoryFileSystem : public RTTIExtends<InMemoryFileSystem, FileSystem> {
689689
/// This doesn't resolve symlinks as they are not supported in in-memory file
690690
/// system.
691691
std::error_code getRealPath(const Twine &Path,
692-
SmallVectorImpl<char> &Output) const override;
692+
SmallVectorImpl<char> &Output) override;
693693
std::error_code isLocal(const Twine &Path, bool &Result) override;
694694
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
695695

@@ -1120,7 +1120,7 @@ class RedirectingFileSystem
11201120
ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) override;
11211121

11221122
std::error_code getRealPath(const Twine &Path,
1123-
SmallVectorImpl<char> &Output) const override;
1123+
SmallVectorImpl<char> &Output) override;
11241124

11251125
llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override;
11261126

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
@@ -158,7 +158,7 @@ std::error_code FileSystem::makeAbsolute(SmallVectorImpl<char> &Path) const {
158158
}
159159

160160
std::error_code FileSystem::getRealPath(const Twine &Path,
161-
SmallVectorImpl<char> &Output) const {
161+
SmallVectorImpl<char> &Output) {
162162
return errc::operation_not_permitted;
163163
}
164164

@@ -295,7 +295,7 @@ class RealFileSystem : public FileSystem {
295295
std::error_code setCurrentWorkingDirectory(const Twine &Path) override;
296296
std::error_code isLocal(const Twine &Path, bool &Result) override;
297297
std::error_code getRealPath(const Twine &Path,
298-
SmallVectorImpl<char> &Output) const override;
298+
SmallVectorImpl<char> &Output) override;
299299

300300
protected:
301301
void printImpl(raw_ostream &OS, PrintType Type,
@@ -377,9 +377,8 @@ std::error_code RealFileSystem::isLocal(const Twine &Path, bool &Result) {
377377
return llvm::sys::fs::is_local(adjustPath(Path, Storage), Result);
378378
}
379379

380-
std::error_code
381-
RealFileSystem::getRealPath(const Twine &Path,
382-
SmallVectorImpl<char> &Output) const {
380+
std::error_code RealFileSystem::getRealPath(const Twine &Path,
381+
SmallVectorImpl<char> &Output) {
383382
SmallString<256> Storage;
384383
return llvm::sys::fs::real_path(adjustPath(Path, Storage), Output);
385384
}
@@ -500,9 +499,8 @@ std::error_code OverlayFileSystem::isLocal(const Twine &Path, bool &Result) {
500499
return errc::no_such_file_or_directory;
501500
}
502501

503-
std::error_code
504-
OverlayFileSystem::getRealPath(const Twine &Path,
505-
SmallVectorImpl<char> &Output) const {
502+
std::error_code OverlayFileSystem::getRealPath(const Twine &Path,
503+
SmallVectorImpl<char> &Output) {
506504
for (const auto &FS : FSList)
507505
if (FS->exists(Path))
508506
return FS->getRealPath(Path, Output);
@@ -1186,9 +1184,8 @@ std::error_code InMemoryFileSystem::setCurrentWorkingDirectory(const Twine &P) {
11861184
return {};
11871185
}
11881186

1189-
std::error_code
1190-
InMemoryFileSystem::getRealPath(const Twine &Path,
1191-
SmallVectorImpl<char> &Output) const {
1187+
std::error_code InMemoryFileSystem::getRealPath(const Twine &Path,
1188+
SmallVectorImpl<char> &Output) {
11921189
auto CWD = getCurrentWorkingDirectory();
11931190
if (!CWD || CWD->empty())
11941191
return errc::operation_not_permitted;
@@ -2612,7 +2609,7 @@ RedirectingFileSystem::openFileForRead(const Twine &OriginalPath) {
26122609

26132610
std::error_code
26142611
RedirectingFileSystem::getRealPath(const Twine &OriginalPath,
2615-
SmallVectorImpl<char> &Output) const {
2612+
SmallVectorImpl<char> &Output) {
26162613
SmallString<256> Path;
26172614
OriginalPath.toVector(Path);
26182615

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)