mirror of
https://github.com/verilator/verilator.git
synced 2025-04-25 10:06:54 +00:00
Fix auto-indentation of AstCStmts
This commit is contained in:
parent
ad0fcb745e
commit
1da07a3b86
@ -251,7 +251,7 @@ private:
|
|||||||
if (!m_scopeFinalp) {
|
if (!m_scopeFinalp) {
|
||||||
m_scopeFinalp = new AstCFunc(nodep->fileline(), "_final", m_namer.scopep());
|
m_scopeFinalp = new AstCFunc(nodep->fileline(), "_final", m_namer.scopep());
|
||||||
m_scopeFinalp->argTypes(EmitCBaseVisitor::symClassVar());
|
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->dontCombine(true);
|
||||||
m_scopeFinalp->formCallTree(true);
|
m_scopeFinalp->formCallTree(true);
|
||||||
m_scopeFinalp->slow(true);
|
m_scopeFinalp->slow(true);
|
||||||
|
@ -235,7 +235,7 @@ private:
|
|||||||
funcp->addInitsp(
|
funcp->addInitsp(
|
||||||
new AstCStmt(nodep->fileline(),
|
new AstCStmt(nodep->fileline(),
|
||||||
" "+EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
|
" "+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_scopep->addActivep(funcp);
|
||||||
m_finalFuncp = funcp;
|
m_finalFuncp = funcp;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +131,7 @@ private:
|
|||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Marking of non-static functions (because they might need "this")
|
// Marking of non-static functions (because they might need "this")
|
||||||
|
// (Here just to avoid another iteration)
|
||||||
void needNonStaticFunc(AstNode* nodep) {
|
void needNonStaticFunc(AstNode* nodep) {
|
||||||
if (!m_funcp) nodep->v3fatalSrc("Non-static accessor not under a function");
|
if (!m_funcp) nodep->v3fatalSrc("Non-static accessor not under a function");
|
||||||
if (m_funcp->isStatic()) {
|
if (m_funcp->isStatic()) {
|
||||||
|
@ -122,7 +122,7 @@ private:
|
|||||||
newfuncp->addInitsp(
|
newfuncp->addInitsp(
|
||||||
new AstCStmt(newfuncp->fileline(),
|
new AstCStmt(newfuncp->fileline(),
|
||||||
" "+EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
|
" "+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);
|
topFuncp->addNextHere(newfuncp);
|
||||||
// In the body, call each function if it matches the given scope
|
// 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) {
|
for (FuncMmap::iterator eachIt = it; eachIt!=m_modFuncs.end() && eachIt->first==name; ++eachIt) {
|
||||||
|
@ -415,9 +415,11 @@ public:
|
|||||||
ofp()->putsNoTracking(nodep->text());
|
ofp()->putsNoTracking(nodep->text());
|
||||||
}
|
}
|
||||||
virtual void visit(AstCStmt* nodep, AstNUser*) {
|
virtual void visit(AstCStmt* nodep, AstNUser*) {
|
||||||
|
putbs("");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCMath* nodep, AstNUser*) {
|
virtual void visit(AstCMath* nodep, AstNUser*) {
|
||||||
|
putbs("");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
||||||
@ -572,6 +574,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Just iterate
|
// Just iterate
|
||||||
|
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
||||||
|
nodep->iterateChildren(*this);
|
||||||
|
}
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
@ -585,6 +590,7 @@ public:
|
|||||||
virtual void visit(AstNodeText*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstNodeText*, AstNUser*) {} // Handled outside the Visit class
|
||||||
virtual void visit(AstTraceDecl*, 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(AstTraceInc*, AstNUser*) {} // Handled outside the Visit class
|
||||||
|
virtual void visit(AstCFile*, AstNUser*) {} // Handled outside the Visit class
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep, AstNUser*) {
|
||||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||||
|
@ -72,7 +72,6 @@ struct V3ParseBisonYYSType {
|
|||||||
AstPin* pinp;
|
AstPin* pinp;
|
||||||
AstRange* rangep;
|
AstRange* rangep;
|
||||||
AstSenTree* sentreep;
|
AstSenTree* sentreep;
|
||||||
AstTask* taskp;
|
|
||||||
AstVar* varp;
|
AstVar* varp;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -540,7 +540,7 @@ private:
|
|||||||
// We need to get a pointer to all of our variables (may have eval'ed something else earlier)
|
// We need to get a pointer to all of our variables (may have eval'ed something else earlier)
|
||||||
cfuncp->addInitsp(
|
cfuncp->addInitsp(
|
||||||
new AstCStmt(nodep->fileline(),
|
new AstCStmt(nodep->fileline(),
|
||||||
" "+EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
|
EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp;\n"));
|
||||||
} else {
|
} else {
|
||||||
// Need symbol table
|
// Need symbol table
|
||||||
cfuncp->argTypes(EmitCBaseVisitor::symClassVar());
|
cfuncp->argTypes(EmitCBaseVisitor::symClassVar());
|
||||||
|
@ -2015,7 +2015,7 @@ lifetime: // ==IEEE: lifetime
|
|||||||
| yAUTOMATIC { }
|
| yAUTOMATIC { }
|
||||||
;
|
;
|
||||||
|
|
||||||
taskId<taskp>:
|
taskId<ftaskp>:
|
||||||
tfIdScoped
|
tfIdScoped
|
||||||
{ $$ = new AstTask($<fl>1, *$<strp>1, NULL);
|
{ $$ = new AstTask($<fl>1, *$<strp>1, NULL);
|
||||||
SYMP->pushNewUnder($$, NULL); }
|
SYMP->pushNewUnder($$, NULL); }
|
||||||
|
@ -94,7 +94,7 @@ if ($#opt_tests<0) {
|
|||||||
mkdir "obj_dir";
|
mkdir "obj_dir";
|
||||||
mkdir "logs";
|
mkdir "logs";
|
||||||
|
|
||||||
my $okcnt=0; my $failcnt=0;
|
my $leftcnt=0; my $okcnt=0; my $failcnt=0;
|
||||||
my @fails;
|
my @fails;
|
||||||
|
|
||||||
foreach my $testpl (@opt_tests) {
|
foreach my $testpl (@opt_tests) {
|
||||||
@ -108,6 +108,7 @@ $Fork->wait_all(); # Wait for all children to finish
|
|||||||
|
|
||||||
sub one_test {
|
sub one_test {
|
||||||
my @params = @_;
|
my @params = @_;
|
||||||
|
$leftcnt++;
|
||||||
$Fork->schedule
|
$Fork->schedule
|
||||||
(
|
(
|
||||||
run_on_start => sub {
|
run_on_start => sub {
|
||||||
@ -139,6 +140,8 @@ sub one_test {
|
|||||||
$failcnt++;
|
$failcnt++;
|
||||||
if ($opt_stop) { die "%Error: --stop and errors found\n"; }
|
if ($opt_stop) { die "%Error: --stop and errors found\n"; }
|
||||||
}
|
}
|
||||||
|
$leftcnt--;
|
||||||
|
print "==SUMMARY: Left $leftcnt Passed $okcnt Failed $failcnt\n";
|
||||||
},
|
},
|
||||||
)->ready();
|
)->ready();
|
||||||
}
|
}
|
||||||
@ -203,12 +206,12 @@ sub report {
|
|||||||
|
|
||||||
$fh->print("\n");
|
$fh->print("\n");
|
||||||
$fh->print("="x70,"\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) {
|
foreach my $f (@$fails) {
|
||||||
chomp $f;
|
chomp $f;
|
||||||
$fh->print("$f\n");
|
$fh->print("$f\n");
|
||||||
}
|
}
|
||||||
$fh->print("TESTS Passed $okcnt Failed $failcnt\n");
|
$fh->print("TESTS Passed $okcnt Failed $failcnt\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user