aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-23 18:28:10 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-23 18:28:10 -0400
commitfd634f3db35791ea904e82a525e4f49f4c5b67a8 (patch)
treeb6e44cde3540f2ecf26724e830a8110020546d25 /src/analyze.cpp
parentd6856859d3082d9b66aac7c25ceb2abcd13e2f7c (diff)
downloadzig-fd634f3db35791ea904e82a525e4f49f4c5b67a8.tar.gz
zig-fd634f3db35791ea904e82a525e4f49f4c5b67a8.zip
don't mangle symbols with underscores
closes #275
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp10
1 files changed, 10 insertions, 0 deletions
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;