Add experimental (and undocumented for now) export syntax.

This allows adding types to the list that are included in the automatically-generated
header files.

struct Foo { . . . };
struct Bar { . . . };

export { Foo, Bar };
This commit is contained in:
Matt Pharr
2012-06-05 12:51:21 -07:00
parent 96aaf6d53b
commit 592affb984
3 changed files with 64 additions and 0 deletions

View File

@@ -80,6 +80,11 @@ public:
void AddFunctionDefinition(const std::string &name,
const FunctionType *ftype, Stmt *code);
/** Adds the given type to the set of types that have their definitions
included in automatically generated header files. */
void AddExportedTypes(const std::vector<std::pair<const Type *,
SourcePos> > &types);
/** After a source file has been compiled, output can be generated in a
number of different formats. */
enum OutputType { Asm, /** Generate text assembly language output */
@@ -145,6 +150,8 @@ private:
const char *filename;
AST *ast;
std::vector<std::pair<const Type *, SourcePos> > exportedTypes;
/** Write the corresponding output type to the given file. Returns
true on success, false if there has been an error. The given
filename may be NULL, indicating that output should go to standard