Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision 262f085f5bcbf8161e794c370badc1a66ccb3991)
+++ src/CodeGen/CodeGenerator.cc	(revision 4810867ae9120aa66ad54ee5b6f46cac5ff27fdf)
@@ -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()) {
