Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LLVM #4530

Merged
merged 4 commits into from
Nov 15, 2024
Merged

Update LLVM #4530

merged 4 commits into from
Nov 15, 2024

Conversation

josh11b
Copy link
Contributor

@josh11b josh11b commented Nov 14, 2024

@@ -58,7 +58,8 @@ TEST(ClangRunnerTest, Version) {
const auto install_paths =
InstallPaths::MakeForBazelRunfiles(Testing::GetExePath());
std::string target = llvm::sys::getDefaultTargetTriple();
ClangRunner runner(&install_paths, target, &test_os);
auto VFS = llvm::vfs::getRealFileSystem();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be "vfs", not "VFS", since it's a local variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I copied that from some llvm code. Fixed now.

: installation_(install_paths),
target_(target),
fs_(fs),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use the driver's VFS in other parts, and I'm concerned that an incomplete use will yield inconsistent results. Had you considered using the real filesystem here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change causing this is allowing users to disable warnings on a per-file basis. Carbon would want to honour the same when building the same C++ code with the same paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're arguing a different issue. At present, the clang::Driver invocation doesn't get a VFS passed in, so it's probably using the default (real) VFS. While we might want to pass in the VFS we get from Carbon's driver to clang::Driver (I'm not sure if Chandler had it use the real filesystem deliberately), this change doesn't change what clang::Driver uses. Instead, it only passes it to ProcessWarningOptions.

The end result is that ProcessWarningOptions uses Carbon's VFS, while clang::Driver uses the real filesystem. This is the undesirable inconsistency that I'm concerned with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chandlerc Should we use the real file system for everything or the vfs from the driver_env for everything?

Copy link
Contributor

@jonmeow jonmeow Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be sure, I really think for the update PR you might be best off just maintaining current filesystem behavior, rather than changing it. However, if I'm in the minority here, note that clang::driver::Driver takes a IntrusiveRefCntPtr, so you'll want to change the types you're using for storage on ClangRunner and probably also DriverEnv and the FileTest infrastructure. (which might be the actual reason we haven't done this yet)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that for an LLVM update PR, the smaller change is more appropriate, and any other changes can be done as a follow-up if desired. Updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(agreed about not shuffling anything in the update PR)

For any follow-up change: I think we'll want to pass down the driver_env VFS -- basically, when we reach Clang functionality from the driver, we want Clang to see a consistent world as the non-Clang parts of the driver from a VFS perspective.

@jonmeow jonmeow added this pull request to the merge queue Nov 15, 2024
Merged via the queue into carbon-language:trunk with commit 93169c3 Nov 15, 2024
8 checks passed
@josh11b josh11b deleted the llvm branch November 15, 2024 17:46
github-merge-queue bot pushed a commit that referenced this pull request Nov 18, 2024
As discussed in #4530 . This required switching to using
`llvm::IntrusiveRefCntPtr` in a number of places.

---------

Co-authored-by: Josh L <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants