diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-10-07 19:01:10 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-10-07 19:01:10 (GMT) |
commit | ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840 (patch) | |
tree | 149ffe4b553dd12d2222445ca8887692ee1a0ae3 /vhdlparser | |
parent | 40f187cc3c6bf8a0599a47557b0c7c60ad1756c9 (diff) | |
download | Doxygen-ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840.zip Doxygen-ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840.tar.gz Doxygen-ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840.tar.bz2 |
Use smartpointers to manage the lifetime of Entry objects
Diffstat (limited to 'vhdlparser')
-rw-r--r-- | vhdlparser/VhdlParser.cc | 22 | ||||
-rw-r--r-- | vhdlparser/VhdlParser.h | 2 | ||||
-rw-r--r-- | vhdlparser/vhdlparser.jj | 22 |
3 files changed, 23 insertions, 23 deletions
diff --git a/vhdlparser/VhdlParser.cc b/vhdlparser/VhdlParser.cc index 4cf8ec0..aa0847a 100644 --- a/vhdlparser/VhdlParser.cc +++ b/vhdlparser/VhdlParser.cc @@ -462,7 +462,7 @@ void VhdlParser::architecture_body() {QCString s,s1;if (!hasError) { QCString t=s1+"::"+s; genLabels.resize(0); pushLabel(genLabels,s1); - lastCompound=current; + lastCompound=current.get(); addVhdlType(t,getLine(ARCHITECTURE_T),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private); } if (!hasError) { @@ -3336,7 +3336,7 @@ void VhdlParser::entity_declaration() {QCString s;if (!hasError) { } if (!hasError) { -lastEntity=current; +lastEntity=current.get(); lastCompound=0; addVhdlType(s.data(),getLine(ENTITY_T),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public); } @@ -4432,7 +4432,7 @@ QCString VhdlParser::full_type_declaration() {Entry *tmpEntry;QCString s,s1,s2;i } if (!hasError) { -tmpEntry=current; +tmpEntry=current.get(); addVhdlType(s.data(),getLine(),Entry::VARIABLE_SEC,VhdlDocGen::RECORD,0,0,Public); } if (!hasError) { @@ -6680,7 +6680,7 @@ void VhdlParser::package_body() {QCString s;if (!hasError) { } if (!hasError) { -lastCompound=current; +lastCompound=current.get(); s.prepend("_"); addVhdlType(s,getLine(),Entry::CLASS_SEC,VhdlDocGen::PACKAGE_BODY,0,0,Protected); } @@ -6875,15 +6875,15 @@ void VhdlParser::package_declaration() {QCString s;if (!hasError) { } if (!hasError) { -lastCompound=current; - Entry *clone=new Entry(*current); +lastCompound=current.get(); + std::unique_ptr<Entry> clone=std::make_unique<Entry>(*current); clone->section=Entry::NAMESPACE_SEC; clone->spec=VhdlDocGen::PACKAGE; clone->name=s; clone->startLine=getLine(PACKAGE_T); clone->bodyLine=getLine(PACKAGE_T); clone->protection=Package; - current_root->addSubEntry(clone); + current_root->moveToSubEntryAndKeep(clone); addVhdlType(s,getLine(PACKAGE_T),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package); } if (!hasError) { @@ -7913,7 +7913,7 @@ if(s.isEmpty()) currName=s; current->name=currName; - tempEntry=current; + tempEntry=current.get(); current->endBodyLine=getLine(); currP=0; if(tok) @@ -9735,7 +9735,7 @@ void VhdlParser::subprogram_specification() {QCString s;Token *tok=0;Token *t; currP=VhdlDocGen::PROCEDURE; createFunction(s.data(),currP,0); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(PROCEDURE_T); current->bodyLine=getLine(PROCEDURE_T); } @@ -9855,7 +9855,7 @@ currP=VhdlDocGen::FUNCTION; createFunction(tok->image.c_str(),currP,s.data()); else createFunction(0,currP,s.data()); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(FUNCTION_T); current->bodyLine=getLine(FUNCTION_T); } @@ -9900,7 +9900,7 @@ param_sec=0; } if (!hasError) { -tempEntry=current; +tempEntry=current.get(); current->type=s; newEntry(); } diff --git a/vhdlparser/VhdlParser.h b/vhdlparser/VhdlParser.h index 3e32daa..3cd383a 100644 --- a/vhdlparser/VhdlParser.h +++ b/vhdlparser/VhdlParser.h @@ -8933,7 +8933,7 @@ static Entry* current_root; static Entry* tempEntry; static Entry* lastEntity ; static Entry* lastCompound ; -static Entry* current; +static std::unique_ptr<Entry> current; static QCString compSpec; static QCString currName; static int levelCounter; diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj index af1bd34..6eb95b4 100644 --- a/vhdlparser/vhdlparser.jj +++ b/vhdlparser/vhdlparser.jj @@ -31,7 +31,7 @@ static Entry* current_root; static Entry* tempEntry; static Entry* lastEntity ; static Entry* lastCompound ; -static Entry* current; +static std::unique_ptr<Entry> current; static QCString compSpec; static QCString currName; static int levelCounter; @@ -409,7 +409,7 @@ void architecture_body() : {QCString s,s1;} QCString t=s1+"::"+s; genLabels.resize(0); pushLabel(genLabels,s1); - lastCompound=current; + lastCompound=current.get(); addVhdlType(t,getLine(ARCHITECTURE_T),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private); } try{ @@ -1012,7 +1012,7 @@ void entity_declaration() : {QCString s;} // try{ <ENTITY_T> s=identifier() <IS_T> { - lastEntity=current; + lastEntity=current.get(); lastCompound=0; addVhdlType(s.data(),getLine(ENTITY_T),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public); } @@ -1209,7 +1209,7 @@ QCString full_type_declaration() : {Entry *tmpEntry;QCString s,s1,s2;} { <TYPE_T> s=identifier() <IS_T> { - tmpEntry=current; + tmpEntry=current.get(); addVhdlType(s.data(),getLine(),Entry::VARIABLE_SEC,VhdlDocGen::RECORD,0,0,Public); } try{ @@ -1693,7 +1693,7 @@ void package_body() : {QCString s;} { <PACKAGE_T> <BODY_T> s=name() <IS_T> { - lastCompound=current; + lastCompound=current.get(); s.prepend("_"); addVhdlType(s,getLine(),Entry::CLASS_SEC,VhdlDocGen::PACKAGE_BODY,0,0,Protected); } @@ -1729,15 +1729,15 @@ void package_declaration(): {QCString s;} <PACKAGE_T> s=identifier() <IS_T> { - lastCompound=current; - Entry *clone=new Entry(*current); + lastCompound=current.get(); + std::unique_ptr<Entry> clone=std::make_unique_ptr<Entry>(*current); clone->section=Entry::NAMESPACE_SEC; clone->spec=VhdlDocGen::PACKAGE; clone->name=s; clone->startLine=getLine(PACKAGE_T); clone->bodyLine=getLine(PACKAGE_T); clone->protection=Package; - current_root->addSubEntry(clone); + current_root->moveToSubEntryAndKeep(clone); addVhdlType(s,getLine(PACKAGE_T),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package); } package_declarative_part() @@ -2292,7 +2292,7 @@ void subprogram_specification() : {QCString s;Token *tok=0;Token *t;} { currP=VhdlDocGen::PROCEDURE; createFunction(s.data(),currP,0); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(PROCEDURE_T); current->bodyLine=getLine(PROCEDURE_T); @@ -2309,14 +2309,14 @@ void subprogram_specification() : {QCString s;Token *tok=0;Token *t;} createFunction(tok->image.c_str(),currP,s.data()); else createFunction(0,currP,s.data()); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(FUNCTION_T); current->bodyLine=getLine(FUNCTION_T); } [{ param_sec=PARAM_SEC; } <LPAREN_T> formal_parameter_list() <RPAREN_T> { param_sec=0; }] <RETURN_T> s=type_mark() { - tempEntry=current; + tempEntry=current.get(); current->type=s; newEntry(); } |