aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-06-05 13:42:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-06-05 13:42:57 +0000
commitf115c9b536ee5e88ca72c94762974459e8d1cc06 (patch)
tree6edad1d702f54c1dcc2d0d132fca1b0a9ac8b6f1 /gcc/lto
parent05f9a806ee423a6dc7995c1c1bfe18c97c80c5c4 (diff)
downloadgcc-f115c9b536ee5e88ca72c94762974459e8d1cc06.zip
gcc-f115c9b536ee5e88ca72c94762974459e8d1cc06.tar.gz
gcc-f115c9b536ee5e88ca72c94762974459e8d1cc06.tar.bz2
lto.c (cmp_type_location): Expand locations only once.
2018-06-05 Richard Biener <rguenther@suse.de> * lto.c (cmp_type_location): Expand locations only once. From-SVN: r261201
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/lto/lto.c22
2 files changed, 13 insertions, 13 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 5e1e0a9..f77634a 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-05 Richard Biener <rguenther@suse.de>
+
+ * lto.c (cmp_type_location): Expand locations only once.
+
2018-05-30 Jan Hubicka <hubicka@ucw.cz>
* lang.opt (lto_linker_output): Add nolto-rel.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 86f3fe4..1763479 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1707,23 +1707,19 @@ cmp_type_location (const void *p1_, const void *p2_)
tree tname1 = TYPE_NAME (*p1);
tree tname2 = TYPE_NAME (*p2);
+ expanded_location xloc1 = expand_location (DECL_SOURCE_LOCATION (tname1));
+ expanded_location xloc2 = expand_location (DECL_SOURCE_LOCATION (tname2));
- const char *f1 = DECL_SOURCE_FILE (tname1);
- const char *f2 = DECL_SOURCE_FILE (tname2);
-
+ const char *f1 = lbasename (xloc1.file);
+ const char *f2 = lbasename (xloc2.file);
int r = strcmp (f1, f2);
if (r == 0)
{
- int l1 = DECL_SOURCE_LINE (tname1);
- int l2 = DECL_SOURCE_LINE (tname2);
- if (l1 == l2)
- {
- int l1 = DECL_SOURCE_COLUMN (tname1);
- int l2 = DECL_SOURCE_COLUMN (tname2);
- return l1 - l2;
- }
- else
- return l1 - l2;
+ int l1 = xloc1.line;
+ int l2 = xloc2.line;
+ if (l1 != l2)
+ return l1 - l2;
+ return xloc1.column - xloc2.column;
}
else
return r;