/* This file is part of cqual.
   Copyright (C) 2000-2001 The Regents of the University of California.

cqual is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

cqual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with cqual; see the file COPYING.  If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

#ifndef ANALYZE_H
#define ANALYZE_H

#include "parser.h"
#include "c-lex.h"
#include "cqual.h"
#include "linkage.h"

EXTERN_C_BEGIN

/**************************************************************************
 *                                                                        *
 * Analysis Interface                                                     *
 *                                                                        *
 **************************************************************************/

void analyze(declaration program);
qtype analyze_field_declaration(const char *name, field_declaration fd);
void analyze_tag_decl(tag_declaration tdecl);
void init_analyze(void);
void finish_analyze(void);

/**************************************************************************
 *                                                                        *
 * Utilities                                                              *
 *                                                                        *
 **************************************************************************/

void report_qerror(location l, severity sev, const char *format, ...);
location *location_declaration(declaration);
data_declaration root_ddecl(data_declaration ddecl);

/* Return TRUE iff ddecl is used but undefined */
bool is_undefined_global(data_declaration ddecl);

/* Return TRUE iff ddecl is declares a varargs function that
   was not given a type in a prelude file */
bool is_unannotated_global(data_declaration ddecl);

/* Apply f to one ddecl for each global */
void traverse_globals(void (*f)(data_declaration, void *), void *arg);

EXTERN_C_END

#endif
