/* Code to maintain a C++ template repository.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1995-2019 Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com)
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
-#include "tree.h"
#include "cp-tree.h"
-#include "input.h"
-#include "obstack.h"
+#include "stringpool.h"
#include "toplev.h"
-#include "diagnostic-core.h"
-#include "flags.h"
static const char *extract_string (const char **);
static const char *get_base_filename (const char *);
static char *afgets (FILE *);
static FILE *reopen_repo_file_for_write (void);
-static GTY(()) VEC(tree,gc) *pending_repo;
+static GTY(()) vec<tree, va_gc> *pending_repo;
static char *repo_name;
static const char *old_args, *old_dir, *old_main;
if (p && ! compiling)
{
- warning (0, "-frepo must be used with -c");
+ warning (0, "%<-frepo%> must be used with %<-c%>");
flag_use_repository = 0;
return NULL;
}
if (repo_file == 0)
{
- error ("can't create repository information file %qs", repo_name);
+ error ("can%'t create repository information file %qs", repo_name);
flag_use_repository = 0;
}
anonymous namespaces will get the same mangling when this
file is recompiled. */
if (!strstr (args, "'-frandom-seed="))
- fprintf (repo_file, " '-frandom-seed=%s'", get_random_seed (false));
+ fprintf (repo_file, " '-frandom-seed=" HOST_WIDE_INT_PRINT_HEX_PURE "'",
+ get_random_seed (false));
fprintf (repo_file, "\n");
}
- FOR_EACH_VEC_ELT_REVERSE (tree, pending_repo, ix, val)
+ FOR_EACH_VEC_SAFE_ELT_REVERSE (pending_repo, ix, val)
{
tree name = DECL_ASSEMBLER_NAME (val);
char type = IDENTIFIER_REPO_CHOSEN (name) ? 'C' : 'O';
{
int ret = 0;
gcc_assert (TREE_PUBLIC (decl));
- gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == VAR_DECL);
- gcc_assert (!DECL_REALLY_EXTERN (decl));
+ gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
+ gcc_assert (!DECL_REALLY_EXTERN (decl)
+ /* A clone might not have its linkage flags updated yet
+ because we call import_export_decl before
+ maybe_clone_body. */
+ || DECL_ABSTRACT_ORIGIN (decl));
/* When not using the repository, emit everything. */
if (!flag_use_repository)
is an artificial restriction; the code in the prelinker and here
will work fine if all entities with vague linkage are managed by
the repository. */
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
{
tree type = NULL_TREE;
if (DECL_VTABLE_OR_VTT_P (decl))
/* For constructors and destructors, the repository contains
information about the clones -- not the original function --
because only the clones are emitted in the object file. */
- if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
- || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
+ if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl))
{
int emit_p = 0;
tree clone;
if (!DECL_REPO_AVAILABLE_P (decl))
{
DECL_REPO_AVAILABLE_P (decl) = 1;
- VEC_safe_push (tree, gc, pending_repo, decl);
+ vec_safe_push (pending_repo, decl);
}
return IDENTIFIER_REPO_CHOSEN (DECL_ASSEMBLER_NAME (decl)) ? 1 : ret;