From fd634f3db35791ea904e82a525e4f49f4c5b67a8 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 23 Mar 2017 18:28:10 -0400 Subject: don't mangle symbols with underscores closes #275 --- src/analyze.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 631707c978..d3617ad9c8 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1904,6 +1904,16 @@ static void add_top_level_decl(CodeGen *g, ScopeDecls *decls_scope, Tld *tld) { g->resolve_queue.append(tld); } + if (tld->visib_mod == VisibModExport) { + auto entry = g->external_symbol_names.put_unique(tld->name, tld); + if (entry) { + Tld *other_tld = entry->value; + ErrorMsg *msg = add_node_error(g, tld->source_node, + buf_sprintf("exported symbol collision: '%s'", buf_ptr(tld->name))); + add_error_note(g, msg, other_tld->source_node, buf_sprintf("other symbol is here")); + } + } + auto entry = decls_scope->decl_table.put_unique(tld->name, tld); if (entry) { Tld *other_tld = entry->value; -- cgit v1.2.3