diff options
Diffstat (limited to 'source/slang/ir-link.cpp')
| -rw-r--r-- | source/slang/ir-link.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/slang/ir-link.cpp b/source/slang/ir-link.cpp index 231ee81d2..610658d51 100644 --- a/source/slang/ir-link.cpp +++ b/source/slang/ir-link.cpp @@ -855,7 +855,15 @@ bool isBetterForTarget( if(newLevel != oldLevel) return UInt(newLevel) > UInt(oldLevel); - // All other factors being equal, a definition is + // All preceding factors being equal, an `[export]` is better + // than an `[import]`. + // + bool newIsExport = newVal->findDecoration<IRExportDecoration>() != nullptr; + bool oldIsExport = oldVal->findDecoration<IRExportDecoration>() != nullptr; + if(newIsExport != oldIsExport) + return newIsExport; + + // All preceding factors being equal, a definition is // better than a declaration. auto newIsDef = isDefinition(newVal); auto oldIsDef = isDefinition(oldVal); |
