[clang] [clang] Rebuild implicit modules when #embed files change (PR #248220)
Qiongsi Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 3 12:53:48 PST 2026
================
@@ -1961,6 +1962,33 @@ void ASTWriter::WriteInputFiles(SourceManager &SourceMgr) {
UserFiles.push_back(Entry);
}
+ // Files referenced by #embed or __has_embed are not sloc entries, but their
+ // contents affect the AST.
+ for (FileEntryRef File : PP->getEmbeddedFiles()) {
+ InputFileEntry Entry(File);
+ Entry.IsTopLevel = false;
+ Entry.IsModuleMap = false;
+ // Embed does not differentiate user/system; treating as a user file is more
+ // conservative here, and matches what dependency files do.
+ Entry.IsSystemFile = false;
+ if (SourceMgr.hasFileInfo(File)) {
----------------
qiongsiwu wrote:
Is my understanding correct that we are using `SourceMgr.hasFileInfo(File)` to differentiate `#embed` from `__has_embed`? Could you help me understand why we can use `SourceMgr.hasFileInfo(File)` to do that?
https://github.com/llvm/llvm-project/pull/248220
More information about the cfe-commits
mailing list