summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Bolinder <hasse@erlang.org>2020-10-21 11:45:15 +0200
committerHans Bolinder <hasse@erlang.org>2021-01-26 11:57:13 +0100
commitfd88dd5d1301888217759cca623d270b85de2d24 (patch)
treef22c8d0aa81003dc02f4bbbf63a267a419b1bf4d
parentfa161793ed4e4020458c27c992a7f16b1a4ebfe3 (diff)
downloaderlang-fd88dd5d1301888217759cca623d270b85de2d24.tar.gz
compiler: Make minimal adjustments for column numbers
-rw-r--r--lib/compiler/src/beam_kernel_to_ssa.erl6
-rw-r--r--lib/compiler/src/core_pp.erl4
-rw-r--r--lib/compiler/src/sys_core_fold.erl1
-rw-r--r--lib/compiler/src/v3_core.erl4
-rw-r--r--lib/compiler/src/v3_kernel.erl1
-rw-r--r--lib/compiler/src/v3_kernel_pp.erl2
6 files changed, 16 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_kernel_to_ssa.erl b/lib/compiler/src/beam_kernel_to_ssa.erl
index 2d3e6b730a..e104a1e0d6 100644
--- a/lib/compiler/src/beam_kernel_to_ssa.erl
+++ b/lib/compiler/src/beam_kernel_to_ssa.erl
@@ -1276,6 +1276,9 @@ new_label(#cg{lcount=Next}=St) ->
line_anno([Line,{file,Name}]) when is_integer(Line) ->
line_anno_1(Name, Line);
+line_anno([{Line,Column},{file,Name}]) when is_integer(Line),
+ is_integer(Column) ->
+ line_anno_1(Name, Line);
line_anno([_|_]=A) ->
{Name,Line} = find_loc(A, no_file, 0),
line_anno_1(Name, Line);
@@ -1292,6 +1295,9 @@ line_anno_1(Name, Line) ->
find_loc([Line|T], File, _) when is_integer(Line) ->
find_loc(T, File, Line);
+find_loc([{Line, Column}|T], File, _) when is_integer(Line),
+ is_integer(Column) ->
+ find_loc(T, File, Line);
find_loc([{file,File}|T], _, Line) ->
find_loc(T, File, Line);
find_loc([_|T], File, Line) ->
diff --git a/lib/compiler/src/core_pp.erl b/lib/compiler/src/core_pp.erl
index 19fa11235c..ab92f3dfce 100644
--- a/lib/compiler/src/core_pp.erl
+++ b/lib/compiler/src/core_pp.erl
@@ -101,6 +101,8 @@ format_anno_list([H], Ctxt) ->
strip_line([A | As]) when is_integer(A) ->
strip_line(As);
+strip_line([{A,C} | As]) when is_integer(A), is_integer(C) ->
+ strip_line(As);
strip_line([{file,_File} | As]) ->
strip_line(As);
strip_line([A | As]) ->
@@ -110,6 +112,8 @@ strip_line([]) ->
get_line([L | _As]) when is_integer(L) ->
L;
+get_line([{L, _Column} | _As]) when is_integer(L) ->
+ L;
get_line([_ | As]) ->
get_line(As);
get_line([]) ->
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index 704bddc2ac..ce440eb28a 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -2739,6 +2739,7 @@ add_warning(Core, Term) ->
end.
get_line([Line|_]) when is_integer(Line) -> Line;
+get_line([{Line, _Column} | _T]) when is_integer(Line) -> Line;
get_line([_|T]) -> get_line(T);
get_line([]) -> none.
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index d4ee6053ab..b10b2a0164 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -3389,10 +3389,10 @@ full_anno(L, #core{wanted=true}=St) ->
lineno_anno(L, St).
lineno_anno(L, St) ->
- Line = erl_anno:line(L),
+ Location = erl_anno:location(L),
Generated = erl_anno:generated(L),
CompilerGenerated = [compiler_generated || Generated],
- [Line] ++ St#core.file ++ CompilerGenerated.
+ [Location] ++ St#core.file ++ CompilerGenerated.
get_lineno_anno(Ce) ->
case get_anno(Ce) of
diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl
index eb04a2c916..2e7101fcd6 100644
--- a/lib/compiler/src/v3_kernel.erl
+++ b/lib/compiler/src/v3_kernel.erl
@@ -1076,6 +1076,7 @@ maybe_add_warning(Ke, MatchAnno, St) ->
end.
get_line([Line|_]) when is_integer(Line) -> Line;
+get_line([{Line, _Column} | _T]) when is_integer(Line) -> Line;
get_line([_|T]) -> get_line(T);
get_line([]) -> none.
diff --git a/lib/compiler/src/v3_kernel_pp.erl b/lib/compiler/src/v3_kernel_pp.erl
index f7479e6b15..5a4e6fa788 100644
--- a/lib/compiler/src/v3_kernel_pp.erl
+++ b/lib/compiler/src/v3_kernel_pp.erl
@@ -57,6 +57,8 @@ format(Node, Ctxt) ->
format_1(Node, Ctxt);
[L,{file,_}] when is_integer(L) ->
format_1(Node, Ctxt);
+ [{L,C},{file,_}] when is_integer(L), is_integer(C) ->
+ format_1(Node, Ctxt);
List ->
format_anno(List, Ctxt, fun (Ctxt1) ->
format_1(Node, Ctxt1)