Fix auto-indentation of AstCStmts

This commit is contained in:
Wilson Snyder 2009-12-01 21:55:56 -05:00
parent ad0fcb745e
commit 1da07a3b86
9 changed files with 18 additions and 9 deletions

View File

@ -251,7 +251,7 @@ private:
if (!m_scopeFinalp) {
m_scopeFinalp = new AstCFunc(nodep->fileline(), "_final", m_namer.scopep());
m_scopeFinalp->argTypes(EmitCBaseVisitor::symClassVar());
m_scopeFinalp->addInitsp(new AstCStmt(nodep->fileline()," "+EmitCBaseVisitor::symTopAssign()+"\n"));
m_scopeFinalp->addInitsp(new AstCStmt(nodep->fileline(), EmitCBaseVisitor::symTopAssign()+"\n"));
m_scopeFinalp->dontCombine(true);
m_scopeFinalp->formCallTree(true);
m_scopeFinalp->slow(true);

View File

@ -235,7 +235,7 @@ private:
funcp->addInitsp(
new AstCStmt(nodep->fileline(),
" "+EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
funcp->addInitsp(new AstCStmt(nodep->fileline()," "+EmitCBaseVisitor::symTopAssign()+"\n"));
funcp->addInitsp(new AstCStmt(nodep->fileline(), EmitCBaseVisitor::symTopAssign()+"\n"));
m_scopep->addActivep(funcp);
m_finalFuncp = funcp;
}

View File

@ -131,6 +131,7 @@ private:
//--------------------
// Marking of non-static functions (because they might need "this")
// (Here just to avoid another iteration)
void needNonStaticFunc(AstNode* nodep) {
if (!m_funcp) nodep->v3fatalSrc("Non-static accessor not under a function");
if (m_funcp->isStatic()) {

View File

@ -122,7 +122,7 @@ private:
newfuncp->addInitsp(
new AstCStmt(newfuncp->fileline(),
" "+EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
newfuncp->addInitsp(new AstCStmt(newfuncp->fileline()," "+EmitCBaseVisitor::symTopAssign()+"\n"));
newfuncp->addInitsp(new AstCStmt(newfuncp->fileline(), EmitCBaseVisitor::symTopAssign()+"\n"));
topFuncp->addNextHere(newfuncp);
// In the body, call each function if it matches the given scope
for (FuncMmap::iterator eachIt = it; eachIt!=m_modFuncs.end() && eachIt->first==name; ++eachIt) {

View File

@ -415,9 +415,11 @@ public:
ofp()->putsNoTracking(nodep->text());
}
virtual void visit(AstCStmt* nodep, AstNUser*) {
putbs("");
nodep->bodysp()->iterateAndNext(*this);
}
virtual void visit(AstCMath* nodep, AstNUser*) {
putbs("");
nodep->bodysp()->iterateAndNext(*this);
}
virtual void visit(AstUCStmt* nodep, AstNUser*) {
@ -572,6 +574,9 @@ public:
}
// Just iterate
virtual void visit(AstNetlist* nodep, AstNUser*) {
nodep->iterateChildren(*this);
}
virtual void visit(AstTopScope* nodep, AstNUser*) {
nodep->iterateChildren(*this);
}
@ -585,6 +590,7 @@ public:
virtual void visit(AstNodeText*, AstNUser*) {} // Handled outside the Visit class
virtual void visit(AstTraceDecl*, AstNUser*) {} // Handled outside the Visit class
virtual void visit(AstTraceInc*, AstNUser*) {} // Handled outside the Visit class
virtual void visit(AstCFile*, AstNUser*) {} // Handled outside the Visit class
// Default
virtual void visit(AstNode* nodep, AstNUser*) {
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");

View File

@ -72,7 +72,6 @@ struct V3ParseBisonYYSType {
AstPin* pinp;
AstRange* rangep;
AstSenTree* sentreep;
AstTask* taskp;
AstVar* varp;
};
};

View File

@ -540,7 +540,7 @@ private:
// We need to get a pointer to all of our variables (may have eval'ed something else earlier)
cfuncp->addInitsp(
new AstCStmt(nodep->fileline(),
" "+EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
} else {
// Need symbol table
cfuncp->argTypes(EmitCBaseVisitor::symClassVar());

View File

@ -2015,7 +2015,7 @@ lifetime: // ==IEEE: lifetime
| yAUTOMATIC { }
;
taskId<taskp>:
taskId<ftaskp>:
tfIdScoped
{ $$ = new AstTask($<fl>1, *$<strp>1, NULL);
SYMP->pushNewUnder($$, NULL); }

View File

@ -94,7 +94,7 @@ if ($#opt_tests<0) {
mkdir "obj_dir";
mkdir "logs";
my $okcnt=0; my $failcnt=0;
my $leftcnt=0; my $okcnt=0; my $failcnt=0;
my @fails;
foreach my $testpl (@opt_tests) {
@ -108,6 +108,7 @@ $Fork->wait_all(); # Wait for all children to finish
sub one_test {
my @params = @_;
$leftcnt++;
$Fork->schedule
(
run_on_start => sub {
@ -139,6 +140,8 @@ sub one_test {
$failcnt++;
if ($opt_stop) { die "%Error: --stop and errors found\n"; }
}
$leftcnt--;
print "==SUMMARY: Left $leftcnt Passed $okcnt Failed $failcnt\n";
},
)->ready();
}
@ -203,12 +206,12 @@ sub report {
$fh->print("\n");
$fh->print("="x70,"\n");
$fh->print("TESTS Passed $okcnt Failed $failcnt\n");
$fh->print("TESTS Passed $okcnt Failed $failcnt\n");
foreach my $f (@$fails) {
chomp $f;
$fh->print("$f\n");
}
$fh->print("TESTS Passed $okcnt Failed $failcnt\n");
$fh->print("TESTS Passed $okcnt Failed $failcnt\n");
}
#######################################################################