summaryrefslogtreecommitdiff
path: root/lldb/unittests/Host/FileSystemTest.cpp
AgeCommit message (Collapse)Author
2025-07-31NFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for ↵James Y Knight
llvm::vfs::FileSystem. (#151407) This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>` instead of `FileSystem*` or `FileSystem&`, when dealing with existing objects. Part of cleanup #151026.
2024-09-20Revert "[SystemZ][z/OS] Propagate IsText parameter to open text files as ↵Abhina Sreeskantharajan
text (#107906)" This reverts commit edf3b277a5f2ebe144827ed47463c22743cac5f9.
2024-09-19[SystemZ][z/OS] Propagate IsText parameter to open text files as text (#107906)Abhina Sree
This patch adds an IsText parameter to the following functions openFileForRead, getBufferForFile, getBufferForFileImpl and determines whether a file is text by querying the file tag on z/OS. The default is set to OF_Text instead of OF_None, this change in value does not affect any other platforms other than z/OS.
2024-04-19Apply modernize-use-starts-ends-with on llvm-project (#89140)Nicolas van Kempen
Run `modernize-use-starts-ends-with` on llvm-project. Two instances are flagged, minor readability improvements, extremely minor performance improvements. ``` python3 clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \ -clang-tidy-binary="build/bin/clang-tidy" \ -clang-apply-replacements-binary="build/bin/clang-apply-replacements" \ -checks="-*,modernize-use-starts-ends-with" \ -header-filter=".*" \ -fix -format ``` I am working on some additions to this check, but they don't seem to flag any additional cases anyway.
2024-04-12[lldb] Fix test build failureJan Svoboda
Caused by commit edd7fed9da48c0e708cce9bd4d305ae43d8bd77c
2023-06-26FileSystem::EnumerateDirectory should skip entries w/o Status, not haltJason Molenda
EnumerateDirectory gets the vfs::Status of each directory entry to decide how to process it. If it is unable to get the Status for a directory entry, it will currently halt the directory iteration entirely. It should only skip this entry. Differential Revision: https://reviews.llvm.org/D153822 rdar://110861210
2022-03-14[LLDB] Applying clang-tidy modernize-use-default-member-init over LLDBShafik Yaghmour
Applied modernize-use-default-member-init clang-tidy check over LLDB. It appears in many files we had already switched to in class member init but never updated the constructors to reflect that. This check is already present in the lldb/.clang-tidy config. Differential Revision: https://reviews.llvm.org/D121481
2021-08-09[lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compatMichał Górny
Modify OpenOptions enum to open the future path into synchronizing vFile:open bits with GDB. Currently, LLDB and GDB use different flag models effectively making it impossible to match bits. Notably, LLDB uses two bits to indicate read and write status, and uses union of both for read/write. GDB uses a value of 0 for read-only, 1 for write-only and 2 for read/write. In order to future-proof the code for the GDB variant: 1. Add a distinct eOpenOptionReadWrite constant to be used instead of (eOpenOptionRead | eOpenOptionWrite) when R/W access is required. 2. Rename eOpenOptionRead and eOpenOptionWrite to eOpenOptionReadOnly and eOpenOptionWriteOnly respectively, to make it clear that they do not mean to be combined and require update to all call sites. 3. Use the intersection of all three flags when matching against the three possible values. This commit does not change the actual bits used by LLDB. Differential Revision: https://reviews.llvm.org/D106984
2020-04-03[lldb/Support] Treat empty FileSpec as an invalid file.Jonas Devlieghere
LLDB relies on empty FileSpecs being invalid files, for example, they don't exists. Currently this assumption does not always hold during reproducer replay, because we pass the result of GetPath to the VFS. This is an empty string, which the VFS converts to an absolute directory by prepending the current working directory, before looking it up in the YAML mapping. This means that an empty FileSpec will exist when the current working directory does. This breaks at least one test (TestAddDsymCommand.py) when ran from replay. This patch special cases empty FileSpecs and returns a sensible result before calling GetPath and forwarding the call. Differential revision: https://reviews.llvm.org/D77351
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258
2019-09-26Convert FileSystem::Open() to return Expected<FileUP>Lawrence D'Anna
Summary: This patch converts FileSystem::Open from this prototype: Status Open(File &File, const FileSpec &file_spec, ...); to this one: llvm::Expected<std::unique_ptr<File>> Open(const FileSpec &file_spec, ...); This is beneficial on its own, as llvm::Expected is a more modern and recommended error type than Status. It is also a necessary step towards https://reviews.llvm.org/D67891, and further developments for lldb_private::File. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67996 llvm-svn: 373003
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-11-28[unittests] Fix the File System Test on WindowsStella Stamenova
Two of the file system tests are failing on Windows - this updates them to expect the correct values after the refactor of the file system code. llvm-svn: 347796
2018-11-28[unittest] Fix the FileSystem test on Windows. (Attempt #2)Jonas Devlieghere
This fixes the double escaping and compares FileSpecs instead of strings. llvm-svn: 347725
2018-11-27[unittest] Fix the FileSystem test on Windows.Jonas Devlieghere
On Windows, when using the VFS without going through FileSpec, the absolute path to `/foo` is `\\foo`. This updates the unittest to expect that. llvm-svn: 347712
2018-11-09revert rL346478Kadir Cetinkaya
Summary: Reviewers: Subscribers: llvm-svn: 346502
2018-11-09[lldb] Fix signature in test to match rL346453Kadir Cetinkaya
llvm-svn: 346478
2018-11-09Revert "[FileSystem] Make use of FS in TildeExpressionResolver"Jonas Devlieghere
The whole point of this change was making it possible to resolve paths without depending on the FileSystem, which is not what I did here. Not sure what I was thinking... llvm-svn: 346466
2018-11-09[FileSystem] Make use of FS in TildeExpressionResolverJonas Devlieghere
In order to call real_path from the TildeExpressionResolver we need access to the FileSystem. Since the resolver lives under utility we have to pass in the FS. llvm-svn: 346457
2018-11-01[FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere
This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
2018-11-01[FileSystem] Re-add EnumerateDirectoryJonas Devlieghere
Re-enable EnumerateDirectory now that no_push is available in llvm (r345793). llvm-svn: 345799
2018-10-31[FileSystem] Remove EnumerateDirectoryJonas Devlieghere
The new implementation of EnumerateDirectory relies on `::no_push()` being implemented for the VFS recursive directory iterators. However this patch (D53465) hasn't been landed yet. llvm-svn: 345787
2018-10-31[FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere
This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
2016-11-01Remove TimeValue usage from FileSpec.hPavel Labath
Summary: The only usage there was in GetModificationTime(). I also took the opportunity to move this function from FileSpec to the FileSystem class - since we are using FileSpecs to also represent remote files for which we cannot (easily) retrieve modification time, it makes sense to make the decision to get the modification time more explicit. The new function returns a llvm::sys::TimePoint<>. To aid the transition from TimeValue, I have added a constructor to it which enables implicit conversion from a time_point. Reviewers: zturner, clayborg Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D25392 llvm-svn: 285702