Skip to content

Conversation

cachemeifyoucan
Copy link

Prototype for gmodule support by switching splitDwarf references to CASIDs of the module/PCH

Also teach dsymutil to support reading from CAS as a prototype for lldb support.

Choose a reason for hiding this comment

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

This would potentially fit better into llvm-project/lldb/packages/Python/lldbsuite/

Copy link
Author

Choose a reason for hiding this comment

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

This is a compiler launcher type of script and requires a just built clang (because it needs clang-scan-deps next to it). I don't what is a good way to hack into lldbsuite or driven from makefile. Let me know if you have any good idea.

@cachemeifyoucan
Copy link
Author

@adrian-prantl @benlangmuir Ping for review

@@ -6150,7 +6168,7 @@ bool ASTReader::readASTFileControlBlock(
auto Filename = ResolveImportedPath(PathBuf, FilenameStr, ModuleDir);
StringRef CacheKey = ReadStringBlob(Record, Idx, Blob);
if (!CacheKey.empty())
Listener.readModuleCacheKey(ModuleName, *Filename, CacheKey);
Listener.readModuleCASID(ModuleName, *Filename, CacheKey);

Choose a reason for hiding this comment

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

How do we know here that this is not a key?

Copy link
Author

@cachemeifyoucan cachemeifyoucan Sep 23, 2025

Choose a reason for hiding this comment

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

This code path is never used tor read scanning module. I will rename the variable. Let me think if there is a way to guard it against using it to read scanning module (other than this callback will fail).

Choose a reason for hiding this comment

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

Would it make sense to store a bit in the pcm for whether it's a key or just an id? Even if it's not strictly necessary it might make it less likely we screw it up in the future

@cachemeifyoucan
Copy link
Author

@swift-ci please test llvm

@cachemeifyoucan
Copy link
Author

@swift-ci please test llvm

@cachemeifyoucan cachemeifyoucan force-pushed the casify-module branch 3 times, most recently from 88f25d5 to 479c33e Compare September 23, 2025 22:24
Teach clang to encode CASID as splitDwarfFilename for gmodule when
clang caching is enabled. This allows the outputs from compiler do not
contain paths to the clang module files, thus allows distributed caching
without the need of a unified clang module cache directory path.
Teach dsymutil how to use CAS and how to load clang modules from CAS
when building dSYM when gmodule is used.
Teach lldb to load clang modules when gmodule + clang caching is used.
Teach SwiftASTContext to load clang module dependencies from CAS instead
of FileSystem.
@cachemeifyoucan
Copy link
Author

@swift-ci please test llvm

}
llvm::sys::path::append(PCM, Mod.getASTFile());

// FIXME: Prefer CASID if exists.

Choose a reason for hiding this comment

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

I'm not clear what this FIXME means

HelpText<"Specify a directory that contain dSYM files to search for.">,
Group<grp_general>;

def cas : Separate<["-", "--"], "cas">,

Choose a reason for hiding this comment

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

Should we provide the additional options needed to configure plugin path and plugin options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants