[clang] [clang][DependencyScanning] Track dependencies from prebuilt modules to determine IsInStableDir (PR #132237)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 13:21:47 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);
----------------
jansvoboda11 wrote:

Ok, got it.

What's confusing to me is that `Filename` is essentially `"<ModuleDir>/<FilenameAsRequested><Filename>"`, which doesn't mean anything. And `ExternalFilename` is just `<Filename>`, which is unresolved.

Why don't we split `Blob` like we do elsewhere (`Blob.substr(0, AsRequestedLength)` and `Blob.substr(AsRequestedLength)`) and call `ResolveImportedPath()` on both?

https://github.com/llvm/llvm-project/pull/132237


More information about the cfe-commits mailing list