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

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 26 08:48:46 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:

Applied your suggestion except for calling `ResolveImportedPath` on both parts of the substring. Let me know if I am missing something, but the external path should always be absolute, so I think it would be unnecessary. It also reduces some logic of needing to copy strings since  

> The return value must go out of scope before the next call to \c ResolveImportedPath.

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


More information about the cfe-commits mailing list