sheredom closed this revision.
sheredom added a comment.
Thanks!
http://reviews.llvm.org/D19478
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
sheredom created this revision.
sheredom added reviewers: Anastasia, yaxunl, pxli168.
sheredom added a subscriber: cfe-commits.
Remove an assert mandating that OpenCL must be used with the SPIR target. We
need to be able to use the SPIR target with non-OpenCL inputs, which worked
perfectly well
sheredom added a comment.
So we build a bunch of internal libraries in a mix of OpenCL and C++, and then
link them all together to create SPIR libraries that can be fed to calls to
clLinkProgram and linked against user kernels.
I don't have commit writes to Clang - if the patch is ok to go coul
https://github.com/sheredom updated
https://github.com/llvm/llvm-project/pull/106577
>From 2d73b6c8463a36ec087fe66c2a48c3ae8fe5b05e Mon Sep 17 00:00:00 2001
From: Neil Henning
Date: Thu, 29 Aug 2024 13:15:49 +0100
Subject: [PATCH] Make PCH's respect any VFS specified.
We want to be able to gen
https://github.com/sheredom created
https://github.com/llvm/llvm-project/pull/106577
We want to be able to generate a PCH against one file-system path, and then
re-use that PCH when the file-system path is different (but the sources are the
same). We also do not know when generating the PCH wh
https://github.com/sheredom updated
https://github.com/llvm/llvm-project/pull/106577
>From 774ca72fd61c98a830930dab9c60e16fcc6782a9 Mon Sep 17 00:00:00 2001
From: Neil Henning
Date: Thu, 29 Aug 2024 13:15:49 +0100
Subject: [PATCH] Make PCH's respect any VFS specified.
We want to be able to gen
sheredom wrote:
> Instead of using VFS overlays to make the AST file relocatable, have you
> considered making use of `adjustFilenameForRelocatableAST()` (i.e. storing
> relative paths to the AST file) and then setting the CWD accordingly when
> loading?
The problem we've got is that while we
@@ -4772,6 +4772,23 @@ bool
ASTWriter::PreparePathForOutput(SmallVectorImpl &Path) {
Changed = true;
}
+ // If we are generating a normal PCH (EG. not a C++ module).
+ if (!WritingModule) {
sheredom wrote:
Note that without this guard the following t
@@ -1115,13 +1115,13 @@ void ASTWriter::WriteBlockInfoBlock() {
}
/// Prepares a path for being written to an AST file by converting it
-/// to an absolute path and removing nested './'s.
+/// to an absolute path and removing nested './'s and '../'s.
///
/// \return \c true
@@ -1115,13 +1115,13 @@ void ASTWriter::WriteBlockInfoBlock() {
}
/// Prepares a path for being written to an AST file by converting it
-/// to an absolute path and removing nested './'s.
+/// to an absolute path and removing nested './'s and '../'s.
///
/// \return \c true
@@ -4772,6 +4772,23 @@ bool
ASTWriter::PreparePathForOutput(SmallVectorImpl &Path) {
Changed = true;
}
+ // If we are generating a normal PCH (EG. not a C++ module).
+ if (!WritingModule) {
+// Use the vfs overlay if it exists to translate paths.
+auto &FileSy
@@ -0,0 +1,26 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/From
+// RUN: mkdir -p %t/To
+// RUN: echo '#pragma once' > %t/From/B.h
sheredom wrote:
Never knew that existed and haven't used it before. But happy to port over for
sure!
https://github.com/llvm/llvm-pr
@@ -1115,13 +1115,13 @@ void ASTWriter::WriteBlockInfoBlock() {
}
/// Prepares a path for being written to an AST file by converting it
-/// to an absolute path and removing nested './'s.
+/// to an absolute path and removing nested './'s and '../'s.
///
/// \return \c true
@@ -4772,6 +4772,23 @@ bool
ASTWriter::PreparePathForOutput(SmallVectorImpl &Path) {
Changed = true;
}
+ // If we are generating a normal PCH (EG. not a C++ module).
+ if (!WritingModule) {
+// Use the vfs overlay if it exists to translate paths.
+auto &FileSy
@@ -1115,13 +1115,13 @@ void ASTWriter::WriteBlockInfoBlock() {
}
/// Prepares a path for being written to an AST file by converting it
-/// to an absolute path and removing nested './'s.
+/// to an absolute path and removing nested './'s and '../'s.
///
/// \return \c true
@@ -1115,13 +1115,13 @@ void ASTWriter::WriteBlockInfoBlock() {
}
/// Prepares a path for being written to an AST file by converting it
-/// to an absolute path and removing nested './'s.
+/// to an absolute path and removing nested './'s and '../'s.
///
/// \return \c true
https://github.com/sheredom updated
https://github.com/llvm/llvm-project/pull/106577
>From 588d45ef291997bc6df487ce9562768d92bff14d Mon Sep 17 00:00:00 2001
From: Neil Henning
Date: Thu, 29 Aug 2024 13:15:49 +0100
Subject: [PATCH] Make PCH's respect any VFS specified.
We want to be able to gen
@@ -0,0 +1,26 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/From
+// RUN: mkdir -p %t/To
+// RUN: echo '#pragma once' > %t/From/B.h
sheredom wrote:
Done!
https://github.com/llvm/llvm-project/pull/106577
___
cfe-commits ma
@@ -1115,13 +1115,13 @@ void ASTWriter::WriteBlockInfoBlock() {
}
/// Prepares a path for being written to an AST file by converting it
-/// to an absolute path and removing nested './'s.
+/// to an absolute path and removing nested './'s and '../'s.
///
/// \return \c true
https://github.com/sheredom updated
https://github.com/llvm/llvm-project/pull/106577
>From bbf433a5f56db6375e132b27bd4f7cd58feafe7b Mon Sep 17 00:00:00 2001
From: Neil Henning
Date: Thu, 29 Aug 2024 13:15:49 +0100
Subject: [PATCH] Make PCH's respect any VFS specified.
We want to be able to gen
sheredom wrote:
Ok already need some advice after hacking!
- `-working-directory` is only used by the **non** `-cc1` clang driver path.
- But the VFS is only initialized way deep once you are in the `-cc1` path.
- The problem is that just after `-working-directory` is set, we then use it to
que
sheredom wrote:
> Right, that's what I meant by "Is it trying to set it too early before the
> VFS is created or something?". We could make the driver setup the VFS like
> the frontend would and do that before checking the -working-directory; not
> sure if there's a reason we don't do that alr
sheredom wrote:
> > We tried setting -working-directory=Z:/working, but the VFS requires that
> > this is a real path.
>
> What error are you seeing if it's not? Is it trying to set it too early
> before the VFS is created or something?
The VFS doesn't actually override the set current workin
sheredom wrote:
So you can see [in
Driver.cpp:1292](https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/Driver.cpp#L1292)
that it will pass on any set `-working-directory` option to the VFS, but at
this point the VFS is a `RealFileSystem`, which means it gets to
[VirtualFileSystem
sheredom wrote:
> > `-emit-pch -o "%t.pch" %t/From/../From/B.h`
>
> > `'could not find file
> > 'D:\llvm-project\build\tools\clang\test\VFS\Output\remap-to-fake.c.tmp\From\..\From\B.h'`
>
> Isn't that the same issue I mentioned, that it doesn't appear to work for the
> main PCH input file? If
sheredom wrote:
> > Build machine A with a path E:/foo/header.h which wants to make a PCH from
> > it. We want it to remap E:/foo -> Z:/fake.
>
> What I have in mind is that you have a VFS on build machine A that maps
> Z:/fake (virtual path) -> E:/foo (external path), with use-external-names:
sheredom wrote:
Ok by specifying `-resource-dir=Z:/resource` and adding it a VFS made that
work. But we are seeing a single stray original path in the source files that
we think is related to the working directory. We tried setting
`-working-directory=Z:/working`, but the VFS requires that thi
sheredom wrote:
So we've been digging a bit further - I think its the `ResourceDir` path that
is getting messed up. Even with the VFS it is using the location of clang to
get the clang headers, which don't then get remapped. Will try and make a test
for it.
https://github.com/llvm/llvm-projec
sheredom wrote:
> I think it's something much earlier in clang is not using the VFS at all when
> looking up the main input path, so then it only knows the external path for
> that case. My guess is that if that were fixed then the ASTWriter/Reader
> would do the right thing here.
I don't thi
sheredom wrote:
> > If the goal is to put virtual paths in the PCH so that you can map them
> > somewhere else in the consuming compiler's VFS, does
> > the`RedirectingFileSystem` setting `'use-external-names': false` do what
> > you need? The idea behind that setting is that we would use the
sheredom wrote:
Any other comments or can I land this then? 😄
https://github.com/llvm/llvm-project/pull/106577
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
sheredom wrote:
> Sorry for being slow to look at this in more detail:
No bother!
> > When generating a PCH map the original directory to some fake directory.
> > You could imagine D:/Foo being mapped to Z:/Foo for instance.
>
> Can you clarify what this means? Is `Z:/Foo` a virtual-only pat
sheredom wrote:
> It looks like it almost works: if I create a module in a virtual path and use
> `use-external-names: false`, then the module stores the virtual path for its
> input files.
>
> E.g.
>
> ```
> {
> "version": 0,
> "use-external-names": false,
> "roots": [
> {
>
33 matches
Mail list logo