<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/unittests/Support/VirtualFileSystemTest.cpp, branch users/MaskRay/spr/main.elf-orphan-placement-remove-hasinputsections-condition</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[clang] Fix handling of adding a file with the same name as an existing dir to VFS (#94461)</title>
<updated>2024-06-06T15:32:50+00:00</updated>
<author>
<name>jensmassberg</name>
<email>87519353+jensmassberg@users.noreply.github.com</email>
</author>
<published>2024-06-06T15:32:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=09f19c7396ecf26623d08c4288b35a60e950fcd8'/>
<id>09f19c7396ecf26623d08c4288b35a60e950fcd8</id>
<content type='text'>
When trying to add a file to clang's VFS via `addFile` and a directory
of the same name already exists, we run into a [out-of-bound
access](https://github.com/llvm/llvm-project/blob/145815c180fc82c5a55bf568d01d98d250490a55/llvm/lib/Support/Path.cpp#L244).

The problem is that the file name is [recognised as existing path](
https://github.com/llvm/llvm-project/blob/145815c180fc82c5a55bf568d01d98d250490a55/llvm/lib/Support/VirtualFileSystem.cpp#L896)
and thus continues to process the next part of the path which doesn't
exist.

This patch adds a check if we have reached the last part of the filename
and return false in that case.
This we reject to add a file if a directory of the same name already
exists.

This is in sync with [this
check](https://github.com/llvm/llvm-project/blob/145815c180fc82c5a55bf568d01d98d250490a55/llvm/lib/Support/VirtualFileSystem.cpp#L903)
that rejects adding a path if a file of the same name already exists.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When trying to add a file to clang's VFS via `addFile` and a directory
of the same name already exists, we run into a [out-of-bound
access](https://github.com/llvm/llvm-project/blob/145815c180fc82c5a55bf568d01d98d250490a55/llvm/lib/Support/Path.cpp#L244).

The problem is that the file name is [recognised as existing path](
https://github.com/llvm/llvm-project/blob/145815c180fc82c5a55bf568d01d98d250490a55/llvm/lib/Support/VirtualFileSystem.cpp#L896)
and thus continues to process the next part of the path which doesn't
exist.

This patch adds a check if we have reached the last part of the filename
and return false in that case.
This we reject to add a file if a directory of the same name already
exists.

This is in sync with [this
check](https://github.com/llvm/llvm-project/blob/145815c180fc82c5a55bf568d01d98d250490a55/llvm/lib/Support/VirtualFileSystem.cpp#L903)
that rejects adding a path if a file of the same name already exists.</pre>
</div>
</content>
</entry>
<entry>
<title>Apply modernize-use-starts-ends-with on llvm-project (#89140)</title>
<updated>2024-04-19T21:00:13+00:00</updated>
<author>
<name>Nicolas van Kempen</name>
<email>nvankemp@gmail.com</email>
</author>
<published>2024-04-19T21:00:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5232cec8f947ed8bff4ca57f990954228d58e66d'/>
<id>5232cec8f947ed8bff4ca57f990954228d58e66d</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][vfs] Make vfs::FileSystem::exists() virtual NFC (#88575)</title>
<updated>2024-04-12T20:34:47+00:00</updated>
<author>
<name>Artem Chikin</name>
<email>achikin@apple.com</email>
</author>
<published>2024-04-12T20:34:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=588987405a979f724ab0aa7ad788cc5e87af3649'/>
<id>588987405a979f724ab0aa7ad788cc5e87af3649</id>
<content type='text'>
Allow a `vfs::FileSystem` to provide a more efficient implementation of
`exists()` if they are able to. The existing `FileSystem`
implementations continue to default to using `status()` except that
overlay, proxy, and redirecting filesystems are taught to forward calls
to `exists()` correctly to their wrapped/external filesystem.

Co-authored-by: Ben Langmuir &lt;blangmuir@apple.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow a `vfs::FileSystem` to provide a more efficient implementation of
`exists()` if they are able to. The existing `FileSystem`
implementations continue to default to using `status()` except that
overlay, proxy, and redirecting filesystems are taught to forward calls
to `exists()` correctly to their wrapped/external filesystem.

Co-authored-by: Ben Langmuir &lt;blangmuir@apple.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][vfs] NFCI: Remove `const` from `VFS::getRealPath()`</title>
<updated>2024-04-12T17:32:58+00:00</updated>
<author>
<name>Jan Svoboda</name>
<email>jan_svoboda@apple.com</email>
</author>
<published>2024-04-12T17:09:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=edd7fed9da48c0e708cce9bd4d305ae43d8bd77c'/>
<id>edd7fed9da48c0e708cce9bd4d305ae43d8bd77c</id>
<content type='text'>
This is an NFC change split from https://github.com/llvm/llvm-project/pull/68645.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is an NFC change split from https://github.com/llvm/llvm-project/pull/68645.
</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][vfs] Preserve paths for fallback/fallthrough in RedirectingFileSystem (#85307)</title>
<updated>2024-03-15T16:01:41+00:00</updated>
<author>
<name>Ben Langmuir</name>
<email>blangmuir@apple.com</email>
</author>
<published>2024-03-15T16:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5a8a7ee9d12d7cd3680c7bc14a4750bd44d99c56'/>
<id>5a8a7ee9d12d7cd3680c7bc14a4750bd44d99c56</id>
<content type='text'>
When we lookup in the external filesystem, do not remove . and ..
components from the original path. For .. this is a correctness issue in
the presence of symlinks, while for . it is simply better practice to
preserve the original path to better match the behaviour of other
filesystems. The only modification we need is to apply the working
directory, since it could differ from the external filesystem.

rdar://123655660</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we lookup in the external filesystem, do not remove . and ..
components from the original path. For .. this is a correctness issue in
the presence of symlinks, while for . it is simply better practice to
preserve the original path to better match the behaviour of other
filesystems. The only modification we need is to apply the working
directory, since it could differ from the external filesystem.

rdar://123655660</pre>
</div>
</content>
</entry>
<entry>
<title>[clang][DependencyScanner] Remove unused -ivfsoverlay files (#73734)</title>
<updated>2024-01-30T23:39:18+00:00</updated>
<author>
<name>Michael Spencer</name>
<email>bigcheesegs@gmail.com</email>
</author>
<published>2024-01-30T23:39:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7847e44594aa932c0a5f5d2cd15940d2a815c059'/>
<id>7847e44594aa932c0a5f5d2cd15940d2a815c059</id>
<content type='text'>
`-ivfsoverlay` files are unused when building most modules. Enable
removing them by,
* adding a way to visit the filesystem tree with extensible RTTI to
  access each `RedirectingFileSystem`.
* Adding tracking to `RedirectingFileSystem` to record when it
  actually redirects a file access.
* Storing this information in each PCM.

Usage tracking is only enabled when iterating over the source manager
and affecting modulemaps. Here each path is stated to cause an access.
During scanning these stats all hit the cache.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`-ivfsoverlay` files are unused when building most modules. Enable
removing them by,
* adding a way to visit the filesystem tree with extensible RTTI to
  access each `RedirectingFileSystem`.
* Adding tracking to `RedirectingFileSystem` to record when it
  actually redirects a file access.
* Storing this information in each PCM.

Usage tracking is only enabled when iterating over the source manager
and affecting modulemaps. Here each path is stated to cause an access.
During scanning these stats all hit the cache.</pre>
</div>
</content>
</entry>
<entry>
<title>[clang] NFC: Remove `{File,Directory}Entry::getName()` (#74910)</title>
<updated>2024-01-24T16:41:14+00:00</updated>
<author>
<name>Jan Svoboda</name>
<email>jan_svoboda@apple.com</email>
</author>
<published>2024-01-24T16:41:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6c1dbd5359c4336d03b11faeaea8459b421f2c5c'/>
<id>6c1dbd5359c4336d03b11faeaea8459b421f2c5c</id>
<content type='text'>
The files and directories that Clang accesses are uniqued by their
inode. For each inode `FileManager` will create exactly one `FileEntry`
or `DirectoryEntry` object, which makes answering the question _"Are
these two files/directories the same?"_ a simple pointer equality check.

However, since the same inode can be accessed through multiple different
paths, asking the `FileEntry` or `DirectoryEntry` object _"What is your
name?"_ doesn't have clear semantics. In c0ff9908 we started reporting
the most recent name used to access the entry, which turned out to be
necessary for Clang modules. However, the long-term solution has always
been to explicitly track the as-requested name. This has been
implemented in 4dc5573a as `FileEntryRef` and `DirectoryEntryRef`.

The `DirectoryEntry::getName()` interface has been deprecated since the
Clang 17 release and `FileEntry::getName()` since Clang 18. We have
replaced uses of these deprecated APIs in `main` with
`DirectoryEntryRef::getName()` and `FileEntryRef::getName()`
respectively.

This makes it possible to remove `{File,Directory}Entry::getName()` for
good along with the `FileManager` code that implements them.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The files and directories that Clang accesses are uniqued by their
inode. For each inode `FileManager` will create exactly one `FileEntry`
or `DirectoryEntry` object, which makes answering the question _"Are
these two files/directories the same?"_ a simple pointer equality check.

However, since the same inode can be accessed through multiple different
paths, asking the `FileEntry` or `DirectoryEntry` object _"What is your
name?"_ doesn't have clear semantics. In c0ff9908 we started reporting
the most recent name used to access the entry, which turned out to be
necessary for Clang modules. However, the long-term solution has always
been to explicitly track the as-requested name. This has been
implemented in 4dc5573a as `FileEntryRef` and `DirectoryEntryRef`.

The `DirectoryEntry::getName()` interface has been deprecated since the
Clang 17 release and `FileEntry::getName()` since Clang 18. We have
replaced uses of these deprecated APIs in `main` with
`DirectoryEntryRef::getName()` and `FileEntryRef::getName()`
respectively.

This makes it possible to remove `{File,Directory}Entry::getName()` for
good along with the `FileManager` code that implements them.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Use StringRef::{starts,ends}_with (NFC)</title>
<updated>2023-12-14T06:46:02+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2023-12-14T06:46:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5c9d82de6b72cc0c037daecce452c450870f0034'/>
<id>5c9d82de6b72cc0c037daecce452c450870f0034</id>
<content type='text'>
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][vfs] For virtual directories, use the virtual path as the real path</title>
<updated>2023-07-10T17:41:15+00:00</updated>
<author>
<name>Jan Svoboda</name>
<email>jan_svoboda@apple.com</email>
</author>
<published>2023-07-10T17:10:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d77588df4553f0e93a74e6eab33e1ce87b576320'/>
<id>d77588df4553f0e93a74e6eab33e1ce87b576320</id>
<content type='text'>
A follow-up to D135841. This patch returns the virtual path for directories from `RedirectingFileSystem`. This ensures the contents of `Path` are the same as the contents of `FS-&gt;getRealPath(Path)`. This also means we can drop the workaround in Clang's module map canonicalization, where we couldn't use the real path for a directory if it resolved to a different `DirectoryEntry`. In addition to that, we can also avoid introducing new workaround for a bug triggered by the newly introduced test case.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D135849
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A follow-up to D135841. This patch returns the virtual path for directories from `RedirectingFileSystem`. This ensures the contents of `Path` are the same as the contents of `FS-&gt;getRealPath(Path)`. This also means we can drop the workaround in Clang's module map canonicalization, where we couldn't use the real path for a directory if it resolved to a different `DirectoryEntry`. In addition to that, we can also avoid introducing new workaround for a bug triggered by the newly introduced test case.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D135849
</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm][test] Skip physical filesystem test if unsupported</title>
<updated>2023-05-03T19:14:00+00:00</updated>
<author>
<name>Ben Langmuir</name>
<email>blangmuir@apple.com</email>
</author>
<published>2023-05-03T16:17:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=562cd31ebd30b604f235a9f48ab0ee8125520f2d'/>
<id>562cd31ebd30b604f235a9f48ab0ee8125520f2d</id>
<content type='text'>
We are relying on deleting the working directory to trigger a later
error in getcwd, but some platforms (e.g. Solaris) disallow deleting the
working directory of the process. Skip the test in that case.

Differential Revision: https://reviews.llvm.org/D149760
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We are relying on deleting the working directory to trigger a later
error in getcwd, but some platforms (e.g. Solaris) disallow deleting the
working directory of the process. Skip the test in that case.

Differential Revision: https://reviews.llvm.org/D149760
</pre>
</div>
</content>
</entry>
</feed>
