summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r--src/hir/from_ast.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index 729b0f45..a80ac887 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -1060,6 +1060,19 @@ namespace {
::HIR::Linkage linkage;
+ if( const auto* a = attrs.get("link_name") )
+ {
+ if( !a->has_string() )
+ ERROR(sp, E0000, "#[link_name] requires a string");
+ linkage.name = a->string();
+ }
+ // TODO: Convert #[link/link_name/no_mangle] attributes into linkage
+ // - Also, if there's no code, it's an external linkage?
+ if( linkage.name == "" && ! f.code().is_valid() )
+ {
+ linkage.name = p.get_name();
+ }
+
return ::HIR::Function {
mv$(linkage),
receiver,