summaryrefslogtreecommitdiff
path: root/gcc/d/d-frontend.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/d-frontend.cc')
-rw-r--r--gcc/d/d-frontend.cc119
1 files changed, 3 insertions, 116 deletions
diff --git a/gcc/d/d-frontend.cc b/gcc/d/d-frontend.cc
index 30fc6d435d0..522095f12c5 100644
--- a/gcc/d/d-frontend.cc
+++ b/gcc/d/d-frontend.cc
@@ -27,116 +27,11 @@ along with GCC; see the file COPYING3. If not see
#include "dmd/scope.h"
#include "tree.h"
-#include "options.h"
#include "fold-const.h"
#include "diagnostic.h"
#include "d-tree.h"
-
-/* Implements the Global interface defined by the frontend.
- Used for managing the state of the current compilation. */
-
-Global global;
-
-void
-Global::_init (void)
-{
- this->mars_ext = "d";
- this->hdr_ext = "di";
- this->doc_ext = "html";
- this->ddoc_ext = "ddoc";
- this->json_ext = "json";
- this->obj_ext = "o";
-
- this->run_noext = true;
- this->version = "v"
-#include "verstr.h"
- ;
-
- this->stdmsg = stderr;
-}
-
-/* Start gagging. Return the current number of gagged errors. */
-
-unsigned
-Global::startGagging (void)
-{
- this->gag++;
- return this->gaggedErrors;
-}
-
-/* End gagging, restoring the old gagged state. Return true if errors
- occured while gagged. */
-
-bool
-Global::endGagging (unsigned oldGagged)
-{
- bool anyErrs = (this->gaggedErrors != oldGagged);
- this->gag--;
-
- /* Restore the original state of gagged errors; set total errors
- to be original errors + new ungagged errors. */
- this->errors -= (this->gaggedErrors - oldGagged);
- this->gaggedErrors = oldGagged;
-
- return anyErrs;
-}
-
-/* Increment the error count to record that an error has occured in the
- current context. An error message may or may not have been printed. */
-
-void
-Global::increaseErrorCount (void)
-{
- if (gag)
- this->gaggedErrors++;
-
- this->errors++;
-}
-
-
-/* Implements the Loc interface defined by the frontend.
- Used for keeping track of current file/line position in code. */
-
-Loc::Loc (const char *filename, unsigned linnum, unsigned charnum)
-{
- this->linnum = linnum;
- this->charnum = charnum;
- this->filename = filename;
-}
-
-const char *
-Loc::toChars (void) const
-{
- OutBuffer buf;
-
- if (this->filename)
- buf.printf ("%s", this->filename);
-
- if (this->linnum)
- {
- buf.printf (":%u", this->linnum);
- if (this->charnum)
- buf.printf (":%u", this->charnum);
- }
-
- return buf.extractChars ();
-}
-
-bool
-Loc::equals (const Loc &loc)
-{
- if (this->linnum != loc.linnum || this->charnum != loc.charnum)
- return false;
-
- if (!FileName::equals (this->filename, loc.filename))
- return false;
-
- return true;
-}
-
-
/* Implements back-end specific interfaces used by the frontend. */
/* Determine if function FD is a builtin one that we can evaluate in CTFE. */
@@ -144,7 +39,7 @@ Loc::equals (const Loc &loc)
BUILTIN
isBuiltin (FuncDeclaration *fd)
{
- if (fd->builtin != BUILTINunknown)
+ if (fd->builtin != BUILTIN::unknown)
return fd->builtin;
maybe_set_intrinsic (fd);
@@ -158,7 +53,7 @@ isBuiltin (FuncDeclaration *fd)
Expression *
eval_builtin (Loc loc, FuncDeclaration *fd, Expressions *arguments)
{
- if (fd->builtin == BUILTINunimp)
+ if (fd->builtin == BUILTIN::unimp)
return NULL;
tree decl = get_symbol_decl (fd);
@@ -185,16 +80,8 @@ eval_builtin (Loc loc, FuncDeclaration *fd, Expressions *arguments)
Type *
getTypeInfoType (Loc loc, Type *type, Scope *sc)
{
- gcc_assert (type->ty != Terror);
+ gcc_assert (type->ty != TY::Terror);
check_typeinfo_type (loc, sc);
create_typeinfo (type, sc ? sc->_module->importedFrom : NULL);
return type->vtinfo->type;
}
-
-/* Return an inlined copy of a default argument for a function parameter. */
-
-Expression *
-inlineCopy (Expression *e, Scope *)
-{
- return e->copy ();
-}