[clang] [clang][DependencyScanning] Track dependencies from prebuilt modules to determine IsInStableDir (PR #132237)
Cyndy Ishida via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 11:36:53 PDT 2025
================
@@ -5834,9 +5834,13 @@ bool ASTReader::readASTFileControlBlock(
break;
case INPUT_FILE:
bool Overridden = static_cast<bool>(Record[3]);
+ size_t FilenameLen = ModuleDir.size() + Record[7] + 1;
auto Filename = ResolveImportedPath(PathBuf, Blob, ModuleDir);
+ StringRef FilenameAsRequested = Filename->substr(0, FilenameLen);
+ StringRef ExternalFilename = Filename->substr(FilenameLen);
----------------
cyndyishida wrote:
> IIRC Blob is the concatenation of the as-requested name and the name.
That is correct.
Basically `Record[7]` encodes the length of the basename (or filename without the full path) of the vfs version of the file. https://github.com/llvm/llvm-project/blob/main/clang/lib/Serialization/ASTWriter.cpp#L1902
`ModuleDir` is the directory of the vfs-version of the directory those vfs mapped files live in. https://github.com/llvm/llvm-project/pull/132237/files#diff-c61a3cce4bfa099b5af032fa83cbf1563f0af4bf58dc112b39571d74b6b681c1R5784
With that combination I derived the full length of of the vfs file path. The external path is the rest.
https://github.com/llvm/llvm-project/pull/132237
More information about the cfe-commits
mailing list