105436638acc7c010349a69c3395f1a57c642dc62Ying Wang/* Named symbol references for Bison
205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   Copyright (C) 2009-2012 Free Software Foundation, Inc.
405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This file is part of Bison, the GNU Compiler Compiler.
605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is free software: you can redistribute it and/or modify
805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   it under the terms of the GNU General Public License as published by
905436638acc7c010349a69c3395f1a57c642dc62Ying Wang   the Free Software Foundation, either version 3 of the License, or
1005436638acc7c010349a69c3395f1a57c642dc62Ying Wang   (at your option) any later version.
1105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1205436638acc7c010349a69c3395f1a57c642dc62Ying Wang   This program is distributed in the hope that it will be useful,
1305436638acc7c010349a69c3395f1a57c642dc62Ying Wang   but WITHOUT ANY WARRANTY; without even the implied warranty of
1405436638acc7c010349a69c3395f1a57c642dc62Ying Wang   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1505436638acc7c010349a69c3395f1a57c642dc62Ying Wang   GNU General Public License for more details.
1605436638acc7c010349a69c3395f1a57c642dc62Ying Wang
1705436638acc7c010349a69c3395f1a57c642dc62Ying Wang   You should have received a copy of the GNU General Public License
1805436638acc7c010349a69c3395f1a57c642dc62Ying Wang   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2005436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include <config.h>
2105436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include "system.h"
2205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2305436638acc7c010349a69c3395f1a57c642dc62Ying Wang#include "named-ref.h"
2405436638acc7c010349a69c3395f1a57c642dc62Ying Wang
2505436638acc7c010349a69c3395f1a57c642dc62Ying Wangnamed_ref *
2605436638acc7c010349a69c3395f1a57c642dc62Ying Wangnamed_ref_new (uniqstr id, location loc)
2705436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
2805436638acc7c010349a69c3395f1a57c642dc62Ying Wang  named_ref *res = xmalloc (sizeof *res);
2905436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3005436638acc7c010349a69c3395f1a57c642dc62Ying Wang  res->id = id;
3105436638acc7c010349a69c3395f1a57c642dc62Ying Wang  res->loc = loc;
3205436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3305436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return res;
3405436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
3505436638acc7c010349a69c3395f1a57c642dc62Ying Wang
3605436638acc7c010349a69c3395f1a57c642dc62Ying Wangnamed_ref *
3705436638acc7c010349a69c3395f1a57c642dc62Ying Wangnamed_ref_copy (const named_ref *r)
3805436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
3905436638acc7c010349a69c3395f1a57c642dc62Ying Wang  return named_ref_new (r->id, r->loc);
4005436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
4105436638acc7c010349a69c3395f1a57c642dc62Ying Wang
4205436638acc7c010349a69c3395f1a57c642dc62Ying Wangvoid
4305436638acc7c010349a69c3395f1a57c642dc62Ying Wangnamed_ref_free (named_ref *r)
4405436638acc7c010349a69c3395f1a57c642dc62Ying Wang{
4505436638acc7c010349a69c3395f1a57c642dc62Ying Wang  free (r);
4605436638acc7c010349a69c3395f1a57c642dc62Ying Wang}
47