Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/CodeGen/CodeGenerator.cc	(revision bc934cdf996407585b93e9a16c83c1d2c2e8fc06)
@@ -10,5 +10,5 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Mar 30 16:38:01 2017
+// Last Modified On : Tus May  9 10:51:00 2017
 // Update Count     : 482
 //
@@ -41,4 +41,17 @@
 namespace CodeGen {
 	int CodeGenerator::tabsize = 4;
+
+	// Pseudo Function: output << lineDirective(*currentNode);
+    struct lineDirective {
+        CodeLocation const & loc;
+		lineDirective(CodeLocation const & location) : loc(location) {}
+		lineDirective(BaseSyntaxNode const * node) : loc(node->location) {}
+	};
+	std::ostream & operator<<(std::ostream & out, lineDirective const & ld) {
+		if (ld.loc.isSet())
+			return out << "\n# " << ld.loc.linenumber << " \""
+				<< ld.loc.filename << "\"\n";
+		return out << "\n// Unset Location\n";
+	}
 
 	// the kinds of statements that would ideally be followed by whitespace
@@ -128,5 +141,5 @@
 
 
-	//*** Declarations
+	// *** Declarations
 	void CodeGenerator::visit( FunctionDecl * functionDecl ) {
 		extension( functionDecl );
@@ -182,5 +195,5 @@
 		}
 
-		output << kind;
+		output << lineDirective( aggDecl ) << kind;
 		if ( aggDecl->get_name() != "" )
 			output << aggDecl->get_name();
@@ -192,5 +205,5 @@
 			cur_indent += CodeGenerator::tabsize;
 			for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++ ) {
-				output << indent;
+				output << lineDirective( *i ) << indent;
 				(*i)->accept( *this );
 				output << ";" << endl;
@@ -215,4 +228,5 @@
 	void CodeGenerator::visit( EnumDecl * enumDecl ) {
 		extension( enumDecl );
+		output << lineDirective ( enumDecl );
 		output << "enum ";
 		genAttributes( enumDecl->get_attributes() );
@@ -230,5 +244,5 @@
 				ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
 				assert( obj );
-				output << indent << mangleName( obj );
+				output << lineDirective( obj ) << indent << mangleName( obj );
 				if ( obj->get_init() ) {
 					output << " = ";
@@ -248,4 +262,5 @@
 	void CodeGenerator::visit( TypedefDecl * typeDecl ) {
 		assertf( ! genC, "Typedefs are removed and substituted in earlier passes." );
+		output << lineDirective( typeDecl );
 		output << "typedef ";
 		output << genType( typeDecl->get_base(), typeDecl->get_name(), pretty, genC ) << endl;
@@ -319,5 +334,5 @@
 	}
 
-	//*** Expressions
+	// *** Expressions
 	void CodeGenerator::visit( ApplicationExpr * applicationExpr ) {
 		extension( applicationExpr );
@@ -722,10 +737,11 @@
 	void CodeGenerator::visit( StmtExpr * stmtExpr ) {
 		std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
-		output << "({" << std::endl;
+		output << lineDirective( stmtExpr) << "({" << std::endl;
 		cur_indent += CodeGenerator::tabsize;
 		unsigned int numStmts = stmts.size();
 		unsigned int i = 0;
 		for ( Statement * stmt : stmts ) {
-			output << indent << printLabels( stmt->get_labels() );
+			output << lineDirective( stmt ) << indent;
+            output << printLabels( stmt->get_labels() );
 			if ( i+1 == numStmts ) {
 				// last statement in a statement expression needs to be handled specially -
@@ -749,5 +765,5 @@
 	}
 
-	//*** Statements
+	// *** Statements
 	void CodeGenerator::visit( CompoundStmt * compoundStmt ) {
 		std::list<Statement*> ks = compoundStmt->get_kids();
@@ -813,4 +829,5 @@
 
 	void CodeGenerator::visit( IfStmt * ifStmt ) {
+		output << lineDirective( ifStmt );
 		output << "if ( ";
 		ifStmt->get_condition()->accept( *this );
@@ -826,4 +843,5 @@
 
 	void CodeGenerator::visit( SwitchStmt * switchStmt ) {
+		output << lineDirective( switchStmt );
 		output << "switch ( " ;
 		switchStmt->get_condition()->accept( *this );
@@ -838,4 +856,5 @@
 
 	void CodeGenerator::visit( CaseStmt * caseStmt ) {
+		output << lineDirective( caseStmt );
 		output << indent;
 		if ( caseStmt->isDefault()) {
Index: src/CodeGen/LineStream.cc
===================================================================
--- src/CodeGen/LineStream.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/CodeGen/LineStream.cc	(revision bc934cdf996407585b93e9a16c83c1d2c2e8fc06)
@@ -10,5 +10,5 @@
 // Created On       : Thr May 4 13:15:00 2017
 // Last Modified By : Andrew Beach
-// Last Modified On : Fri May 5 14:29:00 2017
+// Last Modified On : Mon May 8 12:08:00 2017
 // Update Count     : 0
 //
@@ -17,8 +17,4 @@
 
 namespace CodeGen {
-
-	LineStream::LineStream(std::ostream & baseStream, bool insertLines) :
-		baseStream(baseStream), insertLines(insertLines)
-	{}
 
 	void LineStream::printLineDirective(CodeLocation const & location) {
@@ -44,5 +40,5 @@
 		actualLocation.unset();
 
-		if (addNewLine) {
+		if (addNewline) {
 			expectedLocation.linenumber += 1;
 			buffer.put('\n');
@@ -79,5 +75,5 @@
 
 	LineStream & LineStream::operator<<(StreamFlag flag) {
-		static StringFlag const endlCopy = std::endl;
+		static StreamFlag const endlCopy = std::endl;
 		if (!insertLines) {
 			baseStream << flag;
Index: src/CodeGen/LineStream.h
===================================================================
--- src/CodeGen/LineStream.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/CodeGen/LineStream.h	(revision bc934cdf996407585b93e9a16c83c1d2c2e8fc06)
@@ -10,5 +10,5 @@
 // Created On       : Wed May 4 09:15:00 2017
 // Last Modified By : Andrew Beach
-// Last Modified On : Fri May 5 14:29:00 2017
+// Last Modified On : Mon May 8 14:03:00 2017
 // Update Count     : 1
 //
@@ -25,5 +25,5 @@
 namespace CodeGen {
 
-	class LineStream : public std::ostream {
+	class LineStream {
 		std::ostream & baseStream;
 		std::ostringstream buffer;
@@ -49,7 +49,10 @@
 
 		/// Formated output is buffered until flushed.
-		std::ostream & operator<<(char const *str);
-		std::ostream & operator<<(std::string str);
-		std::ostream & operator<<(StreamFlag flag);
+		LineStream & operator<<(char const *str);
+		LineStream & operator<<(std::string const & str);
+		LineStream & operator<<(StreamFlag flag);
+
+		/// Flush all buffered output.
+		LineStream & flush();
 
 	}; // LineStream
