Significantly reduce the tendrils of DeclSpecs/Declarator/Declaration code

The stuff in decl.h/decl.cpp is messy, largely due to its close mapping
to C-style variable declarations.  This checkin has updated code throughout
all of the declaration statement, variable, and function code that operates
on symbols and types directly.  Thus, Decl* related stuff is now localized
to decl.h/decl.cpp and the parser.

Issue #13.
This commit is contained in:
Matt Pharr
2011-10-18 15:33:18 -07:00
parent 9b8ea3d500
commit f45ab0744e
13 changed files with 562 additions and 498 deletions

View File

@@ -58,13 +58,24 @@ public:
SymbolTable. Returns the number of errors during compilation. */
int CompileFile();
/** Adds the global variable described by the declaration information to
the module. */
void AddGlobal(DeclSpecs *ds, Declarator *decl);
/** Add a named type definition to the module. */
void AddTypeDef(Symbol *sym);
/** Add a new global variable corresponding to the given Symbol to the
module. If non-NULL, initExpr gives the initiailizer expression
for the global's inital value. */
void AddGlobalVariable(Symbol *sym, Expr *initExpr, bool isConst);
/** Add a declaration of the function defined by the given function
symbol with given arguments to the module. */
void AddFunctionDeclaration(Symbol *funSym,
const std::vector<VariableDeclaration> &args,
bool isInline);
/** Adds the function described by the declaration information and the
provided statements to the module. */
void AddFunction(DeclSpecs *ds, Declarator *decl, Stmt *code);
void AddFunctionDefinition(Symbol *sym, const std::vector<Symbol *> &args,
Stmt *code);
/** After a source file has been compiled, output can be generated in a
number of different formats. */