aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGen.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-10-22 14:42:38 -0700
committerGitHub <noreply@github.com>2025-10-22 14:42:38 -0700
commitf5fdd43b16192bb85beb43e6cfe8d5e12a3ba976 (patch)
treec6c28b1fd89087edd48339bb4d0edecb93044934 /llvm/lib/CodeGen/CodeGen.cpp
parenta7672fee0fba5fd673bd17f91d421fc0a896cebc (diff)
downloadllvm-f5fdd43b16192bb85beb43e6cfe8d5e12a3ba976.zip
llvm-f5fdd43b16192bb85beb43e6cfe8d5e12a3ba976.tar.gz
llvm-f5fdd43b16192bb85beb43e6cfe8d5e12a3ba976.tar.bz2
[clang] Refactor `ASTUnit::LoadFromASTFile()` (#164265)
This PR refactors `ASTUnit::LoadFromASTFile()` to be easier to follow. Conceptually, it tries to read an AST file, adopt the serialized options, and set up `Sema` and `ASTContext` to deserialize the AST file contents on-demand. The implementation of this used to be spread across an `ASTReaderListener` and the function in question. Figuring out what listener method gets called when and how it's supposed to interact with the rest of the functionality was very unclear. The `FileManager`'s VFS was being swapped-out during deserialization, the options were being adopted by `Preprocessor` and others just-in-time to pass `ASTReader`'s validation checks, and the target was being initialized somewhere in between all of this. This lead to a very muddy semantics. This PR splits `ASTUnit::LoadFromASTFile()` into three distinct steps: 1. Read out the options from the AST file. 2. Initialize objects from the VFS to the `ASTContext`. 3. Load the AST file and hook it up with the compiler objects. This should be much easier to understand, and I've done my best to clearly document the remaining gotchas. (This was originally motivated by the desire to remove `FileManager::setVirtualFileSystem()` and make it impossible to swap out VFSs from underneath `FileManager` mid-compile.)
Diffstat (limited to 'llvm/lib/CodeGen/CodeGen.cpp')
0 files changed, 0 insertions, 0 deletions