summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-12 18:25:21 +0800
committerGitHub <[email protected]>2025-08-12 18:25:21 +0800
commit56fc5bda0b0485574de751caa871f67e4cb174be (patch)
tree88260fba81f4a331dec05c44f4f39840d27e28f4
parent85ab10a30b800e921a25413b33c889ff65226d6b (diff)
parent4a07f767a33e03b234408ab8db1269355363f196 (diff)
Merge pull request #6698 from Arthapz/fix-module-support
fix(c++ modules) handle empty modules
-rw-r--r--xmake/rules/c++/modules/mapper.lua22
1 files changed, 12 insertions, 10 deletions
diff --git a/xmake/rules/c++/modules/mapper.lua b/xmake/rules/c++/modules/mapper.lua
index db709192c..d8e9075b4 100644
--- a/xmake/rules/c++/modules/mapper.lua
+++ b/xmake/rules/c++/modules/mapper.lua
@@ -85,16 +85,18 @@ function feed(target, modules, sourcefiles)
local reused, from = support.is_reused(target, sourcefile)
if reused then
local module = get(from, sourcefile)
- mapper[module.name] = module
- for dep_name, dep_module in pairs(module.deps) do
- if dep_module.headerunit then
- local key = dep_name .. dep_module.key
- mapper[key] = get(from, key)
- local sourcefile = mapper[key].sourcefile
- mapper[sourcefile .. dep_module.key] = table.clone(mapper[key])
- mapper[sourcefile .. dep_module.key].alias = false
- end
- end
+ if module.name then
+ mapper[module.name] = module
+ for dep_name, dep_module in pairs(module.deps) do
+ if dep_module.headerunit then
+ local key = dep_name .. dep_module.key
+ mapper[key] = get(from, key)
+ local sourcefile = mapper[key].sourcefile
+ mapper[sourcefile .. dep_module.key] = table.clone(mapper[key])
+ mapper[sourcefile .. dep_module.key].alias = false
+ end
+ end
+ end
end
end
end