[clang] [c-index-test] Avoid loading a module input file when we need a file name only. (PR #182426)
Volodymyr Sapsai via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 20 10:01:53 PST 2026
https://github.com/vsapsai updated https://github.com/llvm/llvm-project/pull/182426
>From fd6d7c78169da03d4d4c59c171b1a6b32d0ae41d Mon Sep 17 00:00:00 2001
From: Volodymyr Sapsai <vsapsai at apple.com>
Date: Thu, 19 Feb 2026 18:08:16 -0800
Subject: [PATCH] [c-index-test] Avoid loading a module input file when we need
a file name only.
Loading a module input file triggers its validation. Avoid this process
when we need only a file name.
rdar://167647519
---
clang/tools/c-index-test/core_main.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/clang/tools/c-index-test/core_main.cpp b/clang/tools/c-index-test/core_main.cpp
index c67479fd130ca..923609276eee8 100644
--- a/clang/tools/c-index-test/core_main.cpp
+++ b/clang/tools/c-index-test/core_main.cpp
@@ -206,12 +206,17 @@ class PrintIndexDataConsumer : public IndexDataConsumer {
static void dumpModuleFileInputs(serialization::ModuleFile &Mod,
ASTReader &Reader,
raw_ostream &OS) {
+ SmallString<0> PathBuf;
+ PathBuf.reserve(256);
OS << "---- Module Inputs ----\n";
- Reader.visitInputFiles(Mod, /*IncludeSystem=*/true, /*Complain=*/false,
- [&](const serialization::InputFile &IF, bool isSystem) {
- OS << (isSystem ? "system" : "user") << " | ";
- OS << IF.getFile()->getName() << '\n';
- });
+ Reader.visitInputFileInfos(
+ Mod, /*IncludeSystem=*/true,
+ [&](const serialization::InputFileInfo &IFI, bool isSystem) {
+ OS << (isSystem ? "system" : "user") << " | ";
+ auto Filename = ASTReader::ResolveImportedPath(
+ PathBuf, IFI.UnresolvedImportedFilenameAsRequested, Mod);
+ OS << *Filename << '\n';
+ });
}
static bool printSourceSymbols(const char *Executable,
More information about the cfe-commits
mailing list