Fix min_location usage in line-map.c (PR preprocessor/90382).
authorMartin Liska <mliska@suse.cz>
Tue, 14 May 2019 11:41:53 +0000 (13:41 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 14 May 2019 11:41:53 +0000 (11:41 +0000)
2019-05-14  Martin Liska  <mliska@suse.cz>

PR preprocessor/90382
* line-map.c (first_map_in_common_1): Handle ADHOC
locations.

From-SVN: r271163

libcpp/ChangeLog
libcpp/line-map.c

index 4969b4a9630cf9326c590b05ce7e061bc92d57cc..317d1bdd208594ce36f41c2704993eb81d2e1277 100644 (file)
@@ -1,3 +1,9 @@
+2019-05-14  Martin Liska  <mliska@suse.cz>
+
+       PR preprocessor/90382
+       * line-map.c (first_map_in_common_1): Handle ADHOC
+       locations.
+
 2019-05-14  Martin Liska  <mliska@suse.cz>
 
        PR preprocessor/90382
index e1fc0e9faf4500dba5d227bea2d0f1133224d424..31439f4aba3d56ce491d470f1ba1a95ecf4f4786 100644 (file)
@@ -1251,8 +1251,13 @@ first_map_in_common_1 (struct line_maps *set,
                       location_t *loc1)
 {
   location_t l0 = *loc0, l1 = *loc1;
-  const struct line_map *map0 = linemap_lookup (set, l0),
-    *map1 = linemap_lookup (set, l1);
+  const struct line_map *map0 = linemap_lookup (set, l0);
+  if (IS_ADHOC_LOC (l0))
+    l0 = get_location_from_adhoc_loc (set, l0);
+
+  const struct line_map *map1 = linemap_lookup (set, l1);
+  if (IS_ADHOC_LOC (l1))
+    l1 = get_location_from_adhoc_loc (set, l1);
 
   while (linemap_macro_expansion_map_p (map0)
         && linemap_macro_expansion_map_p (map1)