/* Language-independent diagnostic subroutines for the GNU Compiler
Collection that are only for use in the compilers proper and not
the driver or other programs.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "alias.h"
+#include "symtab.h"
+#include "options.h"
#include "tree.h"
#include "diagnostic.h"
#include "tree-pretty-print.h"
#include "dumpfile.h" /* TDF_DIAGNOSTIC */
#include "langhooks.h"
#include "langhooks-def.h"
-#include "vec.h"
#include "intl.h"
/* Prints out, if necessary, the name of the current function
diagnostic_report_current_function (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- diagnostic_report_current_module (context, diagnostic->location);
- lang_hooks.print_error_function (context, input_filename, diagnostic);
+ diagnostic_report_current_module (context, diagnostic_location (diagnostic));
+ lang_hooks.print_error_function (context, LOCATION_FILE (input_location),
+ diagnostic);
}
static void
below. */
typedef struct
{
- const struct line_map *map;
+ const line_map_macro *map;
source_location where;
} loc_map_pair;
source_location where)
{
const struct line_map *map;
- vec<loc_map_pair> loc_vec = vec<loc_map_pair>();
+ vec<loc_map_pair> loc_vec = vNULL;
unsigned ix;
loc_map_pair loc, *iter;
do
{
loc.where = where;
- loc.map = map;
+ loc.map = linemap_check_macro (map);
loc_vec.safe_push (loc);
/* Now map is set to the map of the location in the source that
first triggered the macro expansion. This must be an ordinary map. */
+ const line_map_ordinary *ord_map = linemap_check_ordinary (map);
/* Walk LOC_VEC and print the macro expansion trace, unless the
first macro which expansion triggered this trace was expanded
inside a system header. */
int saved_location_line =
- expand_location_to_spelling_point (diagnostic->location).line;
+ expand_location_to_spelling_point (diagnostic_location (diagnostic)).line;
- if (!LINEMAP_SYSP (map))
+ if (!LINEMAP_SYSP (ord_map))
FOR_EACH_VEC_ELT (loc_vec, ix, iter)
{
/* Sometimes, in the unwound macro expansion trace, we want to
/* Don't print trace for locations that are reserved or from
within a system header. */
- const struct line_map *m = NULL;
+ const line_map_ordinary *m = NULL;
source_location l =
linemap_resolve_location (line_table, resolved_def_loc,
LRK_SPELLING_LOCATION, &m);
diagnostic_info *diagnostic)
{
maybe_unwind_expanded_macro_loc (context, diagnostic,
- diagnostic->location);
+ diagnostic_location (diagnostic));
}
/* Default tree printer. Handles declarations only. */
case 'D':
t = va_arg (*text->args_ptr, tree);
- if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
+ if (TREE_CODE (t) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (t))
t = DECL_DEBUG_EXPR (t);
break;
return false;
}
- if (set_locus && text->locus)
- *text->locus = DECL_SOURCE_LOCATION (t);
+ if (set_locus)
+ text->set_location (0, DECL_SOURCE_LOCATION (t));
if (DECL_P (t))
{