summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-12-08 10:18:56 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-12-08 10:18:56 (GMT)
commit6d4835dbe01a27923db8a1e4559b61da5065cb7a (patch)
tree9369a394c03978c79e20ec905cbd892e27fabdd6
parent4a4fcdf7931efba208a57b658185de689f2ef7fb (diff)
downloadDoxygen-6d4835dbe01a27923db8a1e4559b61da5065cb7a.zip
Doxygen-6d4835dbe01a27923db8a1e4559b61da5065cb7a.tar.gz
Doxygen-6d4835dbe01a27923db8a1e4559b61da5065cb7a.tar.bz2
Changed std::unique_ptr<Entry> to std::shared_ptr<Entry> at avoid use after free issues
-rw-r--r--src/code.l4
-rw-r--r--src/doxygen.cpp32
-rw-r--r--src/entry.cpp26
-rw-r--r--src/entry.h12
-rw-r--r--src/fortranscanner.h2
-rw-r--r--src/fortranscanner.l95
-rw-r--r--src/markdown.cpp4
-rw-r--r--src/markdown.h2
-rw-r--r--src/parserintf.h2
-rw-r--r--src/pyscanner.h2
-rw-r--r--src/pyscanner.l34
-rw-r--r--src/scanner.h2
-rw-r--r--src/scanner.l91
-rw-r--r--src/tagreader.cpp32
-rw-r--r--src/tagreader.h2
-rw-r--r--src/tclscanner.h2
-rw-r--r--src/tclscanner.l2
-rw-r--r--src/vhdldocgen.cpp8
-rw-r--r--src/vhdljjparser.cpp20
-rw-r--r--src/vhdljjparser.h4
-rw-r--r--vhdlparser/VhdlParser.cc2
-rw-r--r--vhdlparser/VhdlParser.h3
-rw-r--r--vhdlparser/vhdlparser.jj5
23 files changed, 193 insertions, 195 deletions
diff --git a/src/code.l b/src/code.l
index c0db62b..fb609e5 100644
--- a/src/code.l
+++ b/src/code.l
@@ -3877,6 +3877,10 @@ CCodeParser::CCodeParser() : p(std::make_unique<CCodeParser::Private>())
CCodeParser::~CCodeParser()
{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->classScopeLengthStack.clear();
+ delete yyextra->codeClassSDict;
+ yyextra->codeClassSDict=0;
codeYYlex_destroy(p->yyscanner);
}
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index f29b2f8..fd4341c 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -422,9 +422,9 @@ static STLInfo g_stlinfo[] =
{ 0, 0, 0, 0, 0, 0, 0, FALSE, FALSE }
};
-static void addSTLMember(const std::unique_ptr<Entry> &root,const char *type,const char *name)
+static void addSTLMember(const std::shared_ptr<Entry> &root,const char *type,const char *name)
{
- std::unique_ptr<Entry> memEntry = std::make_unique<Entry>();
+ std::shared_ptr<Entry> memEntry = std::make_shared<Entry>();
memEntry->name = name;
memEntry->type = type;
memEntry->protection = Public;
@@ -435,9 +435,9 @@ static void addSTLMember(const std::unique_ptr<Entry> &root,const char *type,con
root->moveToSubEntryAndKeep(memEntry);
}
-static void addSTLIterator(const std::unique_ptr<Entry> &classEntry,const char *name)
+static void addSTLIterator(const std::shared_ptr<Entry> &classEntry,const char *name)
{
- std::unique_ptr<Entry> iteratorClassEntry = std::make_unique<Entry>();
+ std::shared_ptr<Entry> iteratorClassEntry = std::make_shared<Entry>();
iteratorClassEntry->fileName = "[STL]";
iteratorClassEntry->startLine = 1;
iteratorClassEntry->name = name;
@@ -448,14 +448,14 @@ static void addSTLIterator(const std::unique_ptr<Entry> &classEntry,const char *
classEntry->moveToSubEntryAndKeep(iteratorClassEntry);
}
-static void addSTLClass(const std::unique_ptr<Entry> &root,const STLInfo *info)
+static void addSTLClass(const std::shared_ptr<Entry> &root,const STLInfo *info)
{
//printf("Adding STL class %s\n",info->className);
QCString fullName = info->className;
fullName.prepend("std::");
// add fake Entry for the class
- std::unique_ptr<Entry> classEntry = std::make_unique<Entry>();
+ std::shared_ptr<Entry> classEntry = std::make_shared<Entry>();
classEntry->fileName = "[STL]";
classEntry->startLine = 1;
classEntry->name = fullName;
@@ -490,9 +490,9 @@ static void addSTLClass(const std::unique_ptr<Entry> &root,const STLInfo *info)
addSTLMember(classEntry,info->templType2,info->templName2);
}
if (fullName=="std::auto_ptr" || fullName=="std::smart_ptr" || fullName=="std::shared_ptr" ||
- fullName=="std::unique_ptr" || fullName=="std::weak_ptr")
+ fullName=="std::shared_ptr" || fullName=="std::weak_ptr")
{
- std::unique_ptr<Entry> memEntry = std::make_unique<Entry>();
+ std::shared_ptr<Entry> memEntry = std::make_shared<Entry>();
memEntry->name = "operator->";
memEntry->args = "()";
memEntry->type = "T*";
@@ -523,9 +523,9 @@ static void addSTLClass(const std::unique_ptr<Entry> &root,const STLInfo *info)
}
-static void addSTLClasses(const std::unique_ptr<Entry> &root)
+static void addSTLClasses(const std::shared_ptr<Entry> &root)
{
- std::unique_ptr<Entry> namespaceEntry = std::make_unique<Entry>();
+ std::shared_ptr<Entry> namespaceEntry = std::make_shared<Entry>();
namespaceEntry->fileName = "[STL]";
namespaceEntry->startLine = 1;
namespaceEntry->name = "std";
@@ -9201,7 +9201,7 @@ static void compareDoxyfile()
//----------------------------------------------------------------------------
-static void readTagFile(const std::unique_ptr<Entry> &root,const char *tl)
+static void readTagFile(const std::shared_ptr<Entry> &root,const char *tl)
{
QCString tagLine = tl;
QCString fileName;
@@ -9370,7 +9370,7 @@ static OutlineParserInterface &getParserForFile(const char *fn)
}
static void parseFile(OutlineParserInterface &parser,
- const std::unique_ptr<Entry> &root,FileDef *fd,const char *fn,
+ const std::shared_ptr<Entry> &root,FileDef *fd,const char *fn,
bool sameTu,QStrList &filesInSameTu)
{
#if USE_LIBCLANG
@@ -9423,7 +9423,7 @@ static void parseFile(OutlineParserInterface &parser,
fd->getAllIncludeFilesRecursively(filesInSameTu);
}
- std::unique_ptr<Entry> fileRoot = std::make_unique<Entry>();
+ std::shared_ptr<Entry> fileRoot = std::make_shared<Entry>();
// use language parse to parse the file
parser.parseInput(fileName,convBuf.data(),fileRoot,sameTu,filesInSameTu);
fileRoot->setFileDef(fd);
@@ -9431,7 +9431,7 @@ static void parseFile(OutlineParserInterface &parser,
}
//! parse the list of input files
-static void parseFiles(const std::unique_ptr<Entry> &root)
+static void parseFiles(const std::shared_ptr<Entry> &root)
{
#if USE_LIBCLANG
static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING);
@@ -10076,7 +10076,7 @@ class NullOutlineParser : public OutlineParserInterface
public:
void startTranslationUnit(const char *) {}
void finishTranslationUnit() {}
- void parseInput(const char *, const char *,const std::unique_ptr<Entry> &, bool, QStrList &) {}
+ void parseInput(const char *, const char *,const std::shared_ptr<Entry> &, bool, QStrList &) {}
bool needsPreprocessing(const QCString &) const { return FALSE; }
void parsePrototype(const char *) {}
};
@@ -11266,7 +11266,7 @@ void parseInput()
* Handle Tag Files *
**************************************************************************/
- std::unique_ptr<Entry> root = std::make_unique<Entry>();
+ std::shared_ptr<Entry> root = std::make_shared<Entry>();
msg("Reading and parsing tag files\n");
QStrList &tagFileList = Config_getList(TAGFILES);
diff --git a/src/entry.cpp b/src/entry.cpp
index 066c4a0..cc8cd1f 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -116,7 +116,7 @@ Entry::Entry(const Entry &e)
m_sublist.reserve(e.m_sublist.size());
for (const auto &cur : e.m_sublist)
{
- m_sublist.push_back(std::make_unique<Entry>(*cur));
+ m_sublist.push_back(std::make_shared<Entry>(*cur));
}
}
@@ -136,11 +136,11 @@ void Entry::moveToSubEntryAndRefresh(Entry *&current)
current = new Entry;
}
-void Entry::moveToSubEntryAndRefresh(std::unique_ptr<Entry> &current)
+void Entry::moveToSubEntryAndRefresh(std::shared_ptr<Entry> &current)
{
current->m_parent=this;
- m_sublist.push_back(std::move(current));
- current = std::make_unique<Entry>();
+ m_sublist.push_back(current);
+ current = std::make_shared<Entry>();
}
void Entry::moveToSubEntryAndKeep(Entry *current)
@@ -149,10 +149,10 @@ void Entry::moveToSubEntryAndKeep(Entry *current)
m_sublist.emplace_back(current);
}
-void Entry::moveToSubEntryAndKeep(std::unique_ptr<Entry> &current)
+void Entry::moveToSubEntryAndKeep(std::shared_ptr<Entry> &current)
{
current->m_parent=this;
- m_sublist.push_back(std::move(current));
+ m_sublist.push_back(current);
}
void Entry::copyToSubEntry(Entry *current)
@@ -162,20 +162,20 @@ void Entry::copyToSubEntry(Entry *current)
m_sublist.emplace_back(copy);
}
-void Entry::copyToSubEntry(const std::unique_ptr<Entry> &current)
+void Entry::copyToSubEntry(const std::shared_ptr<Entry> &current)
{
- std::unique_ptr<Entry> copy = std::make_unique<Entry>(*current);
+ std::shared_ptr<Entry> copy = std::make_shared<Entry>(*current);
copy->m_parent=this;
- m_sublist.push_back(std::move(copy));
+ m_sublist.push_back(copy);
}
-void Entry::moveFromSubEntry(const Entry *child,std::unique_ptr<Entry> &moveTo)
+void Entry::moveFromSubEntry(const Entry *child,std::shared_ptr<Entry> &moveTo)
{
auto it = std::find_if(m_sublist.begin(),m_sublist.end(),
- [child](const std::unique_ptr<Entry>&elem) { return elem.get()==child; });
+ [child](const std::shared_ptr<Entry>&elem) { return elem.get()==child; });
if (it!=m_sublist.end())
{
- moveTo = std::move(*it);
+ moveTo = *it;
m_sublist.erase(it);
}
else
@@ -187,7 +187,7 @@ void Entry::moveFromSubEntry(const Entry *child,std::unique_ptr<Entry> &moveTo)
void Entry::removeSubEntry(const Entry *e)
{
auto it = std::find_if(m_sublist.begin(),m_sublist.end(),
- [e](const std::unique_ptr<Entry>&elem) { return elem.get()==e; });
+ [e](const std::shared_ptr<Entry>&elem) { return elem.get()==e; });
if (it!=m_sublist.end())
{
m_sublist.erase(it);
diff --git a/src/entry.h b/src/entry.h
index 9d4ae9d..0391075 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -202,26 +202,26 @@ class Entry
/*! Returns the list of children for this Entry
* @see addSubEntry() and removeSubEntry()
*/
- const std::vector< std::unique_ptr<Entry> > &children() const { return m_sublist; }
+ const std::vector< std::shared_ptr<Entry> > &children() const { return m_sublist; }
/*! @name add entry as a child and pass ownership.
* @note This makes the entry passed invalid! (TODO: tclscanner.l still has use after move!)
* @{
*/
void moveToSubEntryAndKeep(Entry* e);
- void moveToSubEntryAndKeep(std::unique_ptr<Entry> &e);
+ void moveToSubEntryAndKeep(std::shared_ptr<Entry> &e);
/*! @} */
/*! @name add entry as a child, pass ownership and reinitialize entry */
void moveToSubEntryAndRefresh(Entry* &e);
- void moveToSubEntryAndRefresh(std::unique_ptr<Entry> &e);
+ void moveToSubEntryAndRefresh(std::shared_ptr<Entry> &e);
/*! take \a child of of to list of children and move it into \a moveTo */
- void moveFromSubEntry(const Entry *child,std::unique_ptr<Entry> &moveTo);
+ void moveFromSubEntry(const Entry *child,std::shared_ptr<Entry> &moveTo);
/*! make a copy of \a e and add it as a child to this entry */
void copyToSubEntry (Entry* e);
- void copyToSubEntry (const std::unique_ptr<Entry> &e);
+ void copyToSubEntry (const std::shared_ptr<Entry> &e);
/*! Removes entry \a e from the list of children.
* The entry will be deleted if found.
@@ -332,7 +332,7 @@ class Entry
private:
Entry *m_parent; //!< parent node in the tree
- std::vector< std::unique_ptr<Entry> > m_sublist;
+ std::vector< std::shared_ptr<Entry> > m_sublist;
Entry &operator=(const Entry &);
FileDef *m_fileDef;
};
diff --git a/src/fortranscanner.h b/src/fortranscanner.h
index 7038882..7a13f47 100644
--- a/src/fortranscanner.h
+++ b/src/fortranscanner.h
@@ -32,7 +32,7 @@ class FortranOutlineParser : public OutlineParserInterface
void finishTranslationUnit() {}
void parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit);
bool needsPreprocessing(const QCString &extension) const;
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 9178f80..08c7a6a 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -145,7 +145,7 @@ static QCString inputStringSemi; ///< Input string after command separat
static unsigned int inputPositionPrepass;
static int lineCountPrepass = 0;
-static QList<Entry> subrCurrent;
+static std::vector< std::shared_ptr<Entry> > subrCurrent;
struct CommentInPrepass {
int column;
@@ -162,14 +162,15 @@ static QFile inputFile;
static QCString yyFileName;
static int yyLineNr = 1 ;
static int yyColNr = 0 ;
-static Entry* current_root = 0 ;
-static Entry* global_root = 0 ;
-static Entry* file_root = 0 ;
-static Entry* last_entry = 0 ;
-static Entry* last_enum = 0 ;
-static std::unique_ptr<Entry> current;
+static Entry *current_root = 0;
+static Entry *global_scope = 0;
+static std::shared_ptr<Entry> global_root;
+static std::shared_ptr<Entry> file_root;
+static std::shared_ptr<Entry> last_entry;
+static std::shared_ptr<Entry> last_enum;
+static std::shared_ptr<Entry> current;
static ScanVar v_type = V_IGNORE; // type of parsed variable
-static std::vector<Entry*> moduleProcedures; // list of all interfaces which contain unresolved
+static std::vector<std::shared_ptr<Entry> > moduleProcedures; // list of all interfaces which contain unresolved
// module procedures
static QCString docBlock;
static bool docBlockInBody = FALSE;
@@ -202,7 +203,6 @@ static SymbolModifiers currentModifiers;
//! Holds program scope->symbol name->symbol modifiers.
static QMap<Entry*,QMap<QCString,SymbolModifiers> > modifiers;
-static Entry *global_scope = 0;
static int anonCount = 0 ;
//-----------------------------------------------------------------------------
@@ -491,13 +491,13 @@ SCOPENAME ({ID}{BS}"::"{BS})*
QCString name = QCString(yytext).stripWhiteSpace();
name = name.right(name.length() - 9).stripWhiteSpace().lower();
addInterface(name, ifType);
- startScope(last_entry);
+ startScope(last_entry.get());
}
}
<InterfaceBody>^{BS}end{BS}interface({BS_}{ID})? {
// end scope only if GENERIC interface
- if (ifType == IF_GENERIC)last_entry->parent()->endBodyLine = yyLineNr - 1;
+ if (ifType == IF_GENERIC) last_entry->parent()->endBodyLine = yyLineNr - 1;
if (ifType == IF_GENERIC && !endScope(current_root))
yyterminate();
@@ -510,12 +510,12 @@ SCOPENAME ({ID}{BS}"::"{BS})*
<ModuleProcedure>{ID} { if (ifType == IF_ABSTRACT || ifType == IF_SPECIFIC)
{
addInterface(yytext, ifType);
- startScope(last_entry);
+ startScope(last_entry.get());
}
current->section = Entry::FUNCTION_SEC ;
current->name = yytext;
- moduleProcedures.push_back(current.get());
+ moduleProcedures.push_back(current);
addCurrentEntry(true);
}
<ModuleProcedure>"\n" { yyColNr -= 1;
@@ -639,7 +639,7 @@ private {
current->startLine = yyLineNr;
/* if type is part of a module, mod name is necessary for output */
- if ((current_root) &&
+ if (current_root &&
(current_root->section == Entry::CLASS_SEC
|| current_root->section == Entry::NAMESPACE_SEC))
{
@@ -647,7 +647,7 @@ private {
}
addCurrentEntry(true);
- startScope(last_entry);
+ startScope(last_entry.get());
BEGIN(TypedefBody);
}
}
@@ -727,7 +727,7 @@ private {
if (!endScope(current_root))
yyterminate();
- subrCurrent.remove(0u);
+ subrCurrent.pop_back();
yy_pop_state() ;
}
<BlockData>{
@@ -736,7 +736,7 @@ private {
}
<Start,ModuleBody,TypedefBody,SubprogBody,Enum>{
^{BS}{TYPE_SPEC}/{SEPARATE} {
- last_enum = 0;
+ last_enum.reset();
if (YY_START == Enum)
{
argType = "@"; // enum marker
@@ -867,7 +867,7 @@ private {
{
current_root->copyToSubEntry(current);
// add to the scope surrounding the enum (copy!)
- last_enum = current.get();
+ last_enum = current;
current_root->parent()->moveToSubEntryAndRefresh(current);
initEntry();
}
@@ -1066,7 +1066,7 @@ private {
}
addCurrentEntry(true);
- startScope(last_entry);
+ startScope(last_entry.get());
BEGIN( Enum ) ;
}
<Enum>"end"{BS}"enum" {
@@ -1083,7 +1083,7 @@ private {
if (ifType == IF_ABSTRACT || ifType == IF_SPECIFIC)
{
addInterface("$interface$", ifType);
- startScope(last_entry);
+ startScope(last_entry.get());
}
// TYPE_SPEC is for old function style function result
@@ -1109,7 +1109,7 @@ private {
if (ifType == IF_ABSTRACT || ifType == IF_SPECIFIC)
{
addInterface("$interface$", ifType);
- startScope(last_entry);
+ startScope(last_entry.get());
}
result = QCString(yytext).stripWhiteSpace();
@@ -1136,7 +1136,7 @@ private {
current->args += ")";
current->args = removeRedundantWhiteSpace(current->args);
addCurrentEntry(true);
- startScope(last_entry);
+ startScope(last_entry.get());
BEGIN(SubprogBody);
}
<Parameterlist>{COMMA}|{BS} { current->args += yytext;
@@ -1162,7 +1162,7 @@ private {
newLine();
//printf("3=========> without parameterlist \n");
addCurrentEntry(true);
- startScope(last_entry);
+ startScope(last_entry.get());
BEGIN(SubprogBody);
}
<SubprogBody>result{BS}\({BS}{ID} {
@@ -1214,20 +1214,19 @@ private {
unput(*yytext);
if (v_type == V_VARIABLE)
{
- std::unique_ptr<Entry> tmp_entry;
- current.swap(tmp_entry);
+ std::shared_ptr<Entry> tmp_entry = current;
// temporarily switch to the previous entry
if (last_enum)
{
- current.reset(last_enum);
+ current = last_enum;
}
else
{
- current.reset(last_entry);
+ current = last_entry;
}
handleCommentBlock(docBlock,TRUE);
// switch back
- tmp_entry.swap(current);
+ current = tmp_entry;
}
else if (v_type == V_PARAMETER)
{
@@ -1779,7 +1778,7 @@ static void popBuffer() {
}
/** used to copy entry to an interface module procedure */
-static void copyEntry(Entry *dest, const std::unique_ptr<Entry> &src)
+static void copyEntry(std::shared_ptr<Entry> dest, const std::shared_ptr<Entry> &src)
{
dest->type = src->type;
dest->fileName = src->fileName;
@@ -2306,7 +2305,7 @@ static int yyread(char *buf,int max_size)
static void initParser()
{
- last_entry = 0;
+ last_entry.reset();
}
static void initEntry()
@@ -2333,7 +2332,7 @@ static void addCurrentEntry(bool case_insens)
{
if (case_insens) current->name = current->name.lower();
//printf("===Adding entry %s to %s\n", current->name.data(), current_root->name.data());
- last_entry = current.get();
+ last_entry = current;
current_root->moveToSubEntryAndRefresh(current);
initEntry();
}
@@ -2367,14 +2366,14 @@ static void addModule(const char *name, bool isModule)
current->startLine = yyLineNr;
current->protection = Public ;
addCurrentEntry(true);
- startScope(last_entry);
+ startScope(last_entry.get());
}
static void addSubprogram(const char *text)
{
DBG_CTX((stderr,"1=========> got subprog, type: %s\n",text));
- subrCurrent.prepend(current.get());
+ subrCurrent.push_back(current);
current->section = Entry::FUNCTION_SEC ;
QCString subtype = text; subtype=subtype.lower().stripWhiteSpace();
functionLine = (subtype.find("function") != -1);
@@ -2487,7 +2486,7 @@ static void handleCommentBlock(const QCString &doc,bool brief)
QCString processedDoc = preprocessCommentBlock(doc,yyFileName,lineNr);
while (parseCommentBlock(
g_thisParser,
- docBlockInBody ? subrCurrent.getFirst() : current.get(),
+ docBlockInBody ? subrCurrent.back().get() : current.get(),
processedDoc, // text
yyFileName, // file
lineNr,
@@ -2515,9 +2514,8 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief)
QCString loc_doc;
loc_doc = doc.stripWhiteSpace();
- std::unique_ptr<Entry> tmp_entry;
- current.swap(tmp_entry);
- current.reset(subrCurrent.getFirst()); // temporarily switch to the entry of the subroutine / function
+ std::shared_ptr<Entry> tmp_entry = current;
+ current = subrCurrent.back(); // temporarily switch to the entry of the subroutine / function
// Still in the specification section so no inbodyDocs yet, but parameter documentation
current->inbodyDocs = "";
@@ -2566,7 +2564,7 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief)
loc_doc.stripWhiteSpace();
if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower()))
{
- tmp_entry.swap(current);
+ current = tmp_entry;
return;
}
handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::OUT] + " " +
@@ -2610,7 +2608,7 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief)
}
// reset current back to the part inside the routine
- tmp_entry.swap(current);
+ current = tmp_entry;
}
//----------------------------------------------------------------------------
/// Handle result description as defined after the declaration of the parameter
@@ -2619,9 +2617,8 @@ static void subrHandleCommentBlockResult(const QCString &doc,bool brief)
QCString loc_doc;
loc_doc = doc.stripWhiteSpace();
- std::unique_ptr<Entry> tmp_entry;
- current.swap(tmp_entry);
- current.reset(subrCurrent.getFirst()); // temporarily switch to the entry of the subroutine / function
+ std::shared_ptr<Entry> tmp_entry = current;
+ current = subrCurrent.back(); // temporarily switch to the entry of the subroutine / function
// Still in the specification section so no inbodyDocs yet, but parameter documentation
current->inbodyDocs = "";
@@ -2640,7 +2637,7 @@ static void subrHandleCommentBlockResult(const QCString &doc,bool brief)
}
// reset current back to the part inside the routine
- tmp_entry.swap(current);
+ current = tmp_entry;
}
//----------------------------------------------------------------------------
@@ -2661,7 +2658,7 @@ level--;
static void parseMain(const char *fileName,const char *fileBuf,
- const std::unique_ptr<Entry> &rt, FortranFormat format)
+ const std::shared_ptr<Entry> &rt, FortranFormat format)
{
char *tmpBuf = NULL;
initParser();
@@ -2677,7 +2674,7 @@ static void parseMain(const char *fileName,const char *fileBuf,
gstat = FALSE;
virt = Normal;
current_root = rt.get();
- global_root = rt.get();
+ global_root = rt;
inputFile.setName(fileName);
if (inputFile.open(IO_ReadOnly))
{
@@ -2719,11 +2716,11 @@ static void parseMain(const char *fileName,const char *fileBuf,
Doxygen::docGroup.enterFile(yyFileName,yyLineNr);
// add entry for the file
- current = std::make_unique<Entry>();
+ current = std::make_shared<Entry>();
current->lang = SrcLangExt_Fortran;
current->name = yyFileName;
current->section = Entry::SOURCE_SEC;
- file_root = current.get();
+ file_root = current;
current_root->moveToSubEntryAndRefresh(current);
current->lang = SrcLangExt_Fortran;
@@ -2759,7 +2756,7 @@ static void parseMain(const char *fileName,const char *fileBuf,
void FortranOutlineParser::parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
{
@@ -2799,7 +2796,7 @@ static void scanner_abort()
for (const auto &ce : global_root->children())
{
- if (ce.get() == file_root) start=TRUE;
+ if (ce == file_root) start=TRUE;
if (start) ce->reset();
}
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 8511da3..42ea2ff 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -2578,11 +2578,11 @@ QCString markdownFileNameToId(const QCString &fileName)
void MarkdownOutlineParser::parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
{
- std::unique_ptr<Entry> current = std::make_unique<Entry>();
+ std::shared_ptr<Entry> current = std::make_shared<Entry>();
current->lang = SrcLangExt_Markdown;
current->fileName = fileName;
current->docFile = fileName;
diff --git a/src/markdown.h b/src/markdown.h
index 4ce2f62..3ffd155 100644
--- a/src/markdown.h
+++ b/src/markdown.h
@@ -33,7 +33,7 @@ class MarkdownOutlineParser : public OutlineParserInterface
void finishTranslationUnit() {}
void parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit);
bool needsPreprocessing(const QCString &) const { return FALSE; }
diff --git a/src/parserintf.h b/src/parserintf.h
index ddf2624..5095a1e 100644
--- a/src/parserintf.h
+++ b/src/parserintf.h
@@ -70,7 +70,7 @@ class OutlineParserInterface
*/
virtual void parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit) = 0;
diff --git a/src/pyscanner.h b/src/pyscanner.h
index 73e1679..6cfadf6 100644
--- a/src/pyscanner.h
+++ b/src/pyscanner.h
@@ -38,7 +38,7 @@ class PythonOutlineParser : public OutlineParserInterface
void finishTranslationUnit() {}
void parseInput(const char * fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit);
bool needsPreprocessing(const QCString &extension) const;
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 963b4e8..efdc943 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -72,10 +72,10 @@ static QFile inputFile;
static Protection protection;
-static Entry* current_root = 0 ;
-static std::unique_ptr<Entry> current;
-static Entry* previous = 0 ;
-static Entry* bodyEntry = 0 ;
+static std::shared_ptr<Entry> current_root;
+static std::shared_ptr<Entry> current;
+static std::shared_ptr<Entry> previous;
+static std::shared_ptr<Entry> bodyEntry;
static int yyLineNr = 1 ;
static QCString yyFileName;
static MethodTypes mtype;
@@ -151,7 +151,7 @@ static void initEntry()
static void newEntry()
{
- previous = current.get();
+ previous = current;
current_root->moveToSubEntryAndRefresh(current);
initEntry();
}
@@ -292,7 +292,7 @@ static void handleCommentBlock(const QCString &doc,bool brief)
QCString processedDoc = preprocessCommentBlock(doc,yyFileName,lineNr);
while (parseCommentBlock(
g_thisParser,
- (docBlockInBody && previous) ? previous : current.get(),
+ (docBlockInBody && previous) ? previous.get() : current.get(),
processedDoc, // text
yyFileName, // file
lineNr,
@@ -913,7 +913,7 @@ STARTDOCSYMS "##"
}
{B}":"{B} { // function without arguments
g_specialBlock = TRUE; // expecting a docstring
- bodyEntry = current.get();
+ bodyEntry = current;
BEGIN(FunctionBody);
}
@@ -1300,7 +1300,7 @@ STARTDOCSYMS "##"
current->program+=yytext;
//current->startLine = yyLineNr;
g_curIndent=computeIndent(yytext);
- bodyEntry = current.get();
+ bodyEntry = current;
DBG_CTX((stderr,"setting indent %d\n",g_curIndent));
//printf("current->program=[%s]\n",current->program.data());
//g_hideClassDocs = TRUE;
@@ -1706,12 +1706,12 @@ STARTDOCSYMS "##"
//----------------------------------------------------------------------------
-static void parseCompounds(Entry *rt)
+static void parseCompounds(std::shared_ptr<Entry> rt)
{
//printf("parseCompounds(%s)\n",rt->name.data());
for (int i=0; i<rt->children().size(); ++i)
{
- Entry *ce = rt->children()[i].get();
+ std::shared_ptr<Entry> ce = rt->children()[i];
if (!ce->program.isEmpty())
{
//printf("-- %s ---------\n%s\n---------------\n",
@@ -1727,14 +1727,14 @@ static void parseCompounds(Entry *rt)
}
else if (ce->parent())
{
- current_root = ce->parent();
+ current_root = rt;
//printf("Searching for member variables in %s parent=%s\n",
// ce->name.data(),ce->parent->name.data());
BEGIN( SearchMemVars );
}
yyFileName = ce->fileName;
yyLineNr = ce->bodyLine ;
- current = std::make_unique<Entry>();
+ current = std::make_shared<Entry>();
initEntry();
QCString name = ce->name;
@@ -1754,7 +1754,7 @@ static void parseCompounds(Entry *rt)
//----------------------------------------------------------------------------
-static void parseMain(const char *fileName,const char *fileBuf,const std::unique_ptr<Entry> &rt)
+static void parseMain(const char *fileName,const char *fileBuf,const std::shared_ptr<Entry> &rt)
{
initParser();
@@ -1765,7 +1765,7 @@ static void parseMain(const char *fileName,const char *fileBuf,const std::unique
mtype = Method;
gstat = FALSE;
virt = Normal;
- current_root = rt.get();
+ current_root = rt;
g_specialBlock = FALSE;
@@ -1789,7 +1789,7 @@ static void parseMain(const char *fileName,const char *fileBuf,const std::unique
g_moduleScope+=baseName;
}
- current = std::make_unique<Entry>();
+ current = std::make_shared<Entry>();
initEntry();
current->name = g_moduleScope;
current->section = Entry::NAMESPACE_SEC;
@@ -1798,7 +1798,7 @@ static void parseMain(const char *fileName,const char *fileBuf,const std::unique
current->startLine = yyLineNr;
current->bodyLine = yyLineNr;
- current_root = current.get();
+ current_root = current;
rt->moveToSubEntryAndRefresh(current);
@@ -1888,7 +1888,7 @@ void pyscanFreeScanner()
void PythonOutlineParser::parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
{
diff --git a/src/scanner.h b/src/scanner.h
index 1c7a50c..70df660 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -35,7 +35,7 @@ class COutlineParser : public OutlineParserInterface
void finishTranslationUnit();
void parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit);
bool needsPreprocessing(const QCString &extension) const;
diff --git a/src/scanner.l b/src/scanner.l
index ed2c88c..912132c 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -90,12 +90,12 @@ struct scannerYY_state
int curlyCount = 0 ;
int squareCount = 0 ;
int padCount = 0 ;
- std::unique_ptr<Entry> current;
- Entry* current_root = 0 ;
- Entry* previous = 0 ;
- std::unique_ptr<Entry> tempEntry;
- Entry* firstTypedefEntry = 0 ;
- Entry* memspecEntry = 0 ;
+ std::shared_ptr<Entry> current;
+ std::shared_ptr<Entry> current_root;
+ std::shared_ptr<Entry> previous;
+ std::shared_ptr<Entry> tempEntry;
+ std::shared_ptr<Entry> firstTypedefEntry;
+ std::shared_ptr<Entry> memspecEntry;
int yyLineNr = 1 ;
int yyBegLineNr = 1 ;
int yyColNr = 1 ;
@@ -188,7 +188,7 @@ struct scannerYY_state
int fencedSize = 0;
bool nestedComment = 0;
- std::vector< std::pair<Entry*,std::unique_ptr<Entry> > > outerScopeEntries;
+ std::vector< std::pair<Entry*,std::shared_ptr<Entry> > > outerScopeEntries;
};
static const char *stateToString(int state);
@@ -1001,7 +1001,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
lineCount(yyscanner);
}
<PackageName>";" {
- Entry *tmp = yyextra->current.get();
+ std::shared_ptr<Entry> tmp = yyextra->current;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
yyextra->current_root = tmp;
initEntry(yyscanner);
@@ -1684,7 +1684,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
//printf("import name = %s -> %s\n",yytext,yyextra->current->name.data());
yyextra->current->section=Entry::USINGDECL_SEC;
}
- yyextra->previous = yyextra->current.get();
+ yyextra->previous = yyextra->current;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
initEntry(yyscanner);
BEGIN(Using);
@@ -1702,7 +1702,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->fileName = yyextra->yyFileName;
yyextra->current->section=Entry::USINGDECL_SEC;
yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->previous = yyextra->current.get();
+ yyextra->previous = yyextra->current;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
initEntry(yyscanner);
if (yyextra->insideCS) /* Hack: in C# a using declaration and
@@ -2482,7 +2482,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
if (yyextra->previous && yyextra->previous->section==Entry::GROUPDOC_SEC)
{
// link open command to the group defined in the yyextra->previous entry
- Doxygen::docGroup.open(yyextra->previous,yyextra->yyFileName,yyextra->yyLineNr);
+ Doxygen::docGroup.open(yyextra->previous.get(),yyextra->yyFileName,yyextra->yyLineNr);
}
else
{
@@ -3490,7 +3490,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
// add to the scope surrounding the enum (copy!)
// we cannot during it directly as that would invalidate the iterator in parseCompounds.
//printf("*** adding outer scope entry for %s\n",yyextra->current->name.data());
- yyextra->outerScopeEntries.emplace_back(yyextra->current_root->parent(), std::make_unique<Entry>(*yyextra->current));
+ yyextra->outerScopeEntries.emplace_back(yyextra->current_root->parent(), std::make_shared<Entry>(*yyextra->current));
}
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
initEntry(yyscanner);
@@ -3587,7 +3587,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
else
{
yyextra->current->endBodyLine = yyextra->yyLineNr;
- Entry * original_root = yyextra->current_root; // save root this namespace is in
+ std::shared_ptr<Entry> original_root = yyextra->current_root; // save root this namespace is in
if (yyextra->current->section == Entry::NAMESPACE_SEC && yyextra->current->type == "namespace")
{
int split_point;
@@ -3607,16 +3607,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->briefFile = "";
while ((split_point = yyextra->current->name.find("::")) != -1)
{
- std::unique_ptr<Entry> new_current = std::make_unique<Entry>(*yyextra->current);
+ std::shared_ptr<Entry> new_current = std::make_shared<Entry>(*yyextra->current);
yyextra->current->program = "";
new_current->name = yyextra->current->name.mid(split_point + 2);
yyextra->current->name = yyextra->current->name.left(split_point);
if (!yyextra->current_root->name.isEmpty()) yyextra->current->name.prepend(yyextra->current_root->name+"::");
- Entry *tmp = yyextra->current.get();
+ std::shared_ptr<Entry> tmp = yyextra->current;
yyextra->current_root->moveToSubEntryAndKeep(yyextra->current);
yyextra->current_root = tmp;
- yyextra->current.swap(new_current);
+
+ yyextra->current = new_current;
}
// restore documentation values
yyextra->current->doc = doc;
@@ -3658,7 +3659,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
else
{
- yyextra->memspecEntry = yyextra->current.get();
+ yyextra->memspecEntry = yyextra->current;
yyextra->current_root->copyToSubEntry( yyextra->current ) ;
if (yyextra->current->section==Entry::NAMESPACE_SEC ||
(yyextra->current->spec==Entry::Interface) ||
@@ -3669,7 +3670,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->reset();
yyextra->current_root = original_root; // restore scope from before namespace descent
initEntry(yyscanner);
- yyextra->memspecEntry = 0;
+ yyextra->memspecEntry.reset();
BEGIN( FindMembers ) ;
}
else
@@ -3724,7 +3725,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
//printf("Adding compound %s %s %s\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
if (!yyextra->firstTypedefEntry)
{
- yyextra->firstTypedefEntry = yyextra->current.get();
+ yyextra->firstTypedefEntry = yyextra->current;
}
yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
initEntry(yyscanner);
@@ -3740,7 +3741,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
// add compound definition to the tree
yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
- yyextra->memspecEntry = yyextra->current.get();
+ yyextra->memspecEntry = yyextra->current;
yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
initEntry(yyscanner);
unput(';');
@@ -3794,7 +3795,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
// anonymous compound. If so we insert a
// special 'anonymous' variable.
//Entry *p=yyextra->current_root;
- const Entry *p=yyextra->current.get();
+ const Entry *p=yyextra->current.get();
while (p)
{
// only look for class scopes, not namespace scopes
@@ -3812,7 +3813,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
}
//p=p->parent;
- if (p==yyextra->current.get()) p=yyextra->current_root; else p=p->parent();
+ if (p==yyextra->current.get()) p=yyextra->current_root.get(); else p=p->parent();
}
}
//printf("yyextra->msName=%s yyextra->current->name=%s\n",yyextra->msName.data(),yyextra->current->name.data());
@@ -3833,7 +3834,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
else // case 2: create a typedef field
{
- std::unique_ptr<Entry> varEntry=std::make_unique<Entry>();
+ std::shared_ptr<Entry> varEntry=std::make_shared<Entry>();
varEntry->lang = yyextra->language;
varEntry->protection = yyextra->current->protection ;
varEntry->mtype = yyextra->current->mtype;
@@ -3893,8 +3894,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->msName.resize(0);
yyextra->msArgs.resize(0);
yyextra->isTypedef=FALSE;
- yyextra->firstTypedefEntry=0;
- yyextra->memspecEntry=0;
+ yyextra->firstTypedefEntry.reset();
+ yyextra->memspecEntry.reset();
yyextra->current->reset();
initEntry(yyscanner);
BEGIN( FindMembers );
@@ -4825,7 +4826,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
findAndRemoveWord(yyextra->current->type,"function");
}
- yyextra->previous = yyextra->current.get();
+ yyextra->previous = yyextra->current;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
initEntry(yyscanner);
// Objective C 2.0: Required/Optional section
@@ -4919,9 +4920,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
yyextra->current->endBodyLine=yyextra->yyLineNr;
// take yyextra->previous out of yyextra->current_root and move it into yyextra->current
- yyextra->current.swap(yyextra->tempEntry); // remember yyextra->current
- yyextra->current_root->moveFromSubEntry(yyextra->previous,yyextra->current);
- yyextra->previous = 0;
+ yyextra->tempEntry = yyextra->current; // remember yyextra->current
+ yyextra->current_root->moveFromSubEntry(yyextra->previous.get(),yyextra->current);
+ yyextra->previous.reset();
yyextra->docBlockContext = SkipCurlyEndDoc;
yyextra->docBlockInBody = FALSE;
@@ -4963,7 +4964,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
//addToBody("}");
if (yyextra->tempEntry) // we can only switch back to yyextra->current if no new item was created
{
- yyextra->tempEntry.swap(yyextra->current);
+ yyextra->current = yyextra->tempEntry;
yyextra->tempEntry.reset();
}
BEGIN( yyextra->lastCurlyContext );
@@ -6615,8 +6616,8 @@ static void initParser(yyscan_t yyscanner)
yyextra->insideCode=FALSE;
yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
yyextra->previous = 0;
- yyextra->firstTypedefEntry = 0;
- yyextra->memspecEntry =0;
+ yyextra->firstTypedefEntry.reset();
+ yyextra->memspecEntry.reset();
}
static void initEntry(yyscan_t yyscanner)
@@ -6928,13 +6929,13 @@ static void newEntry(yyscan_t yyscanner)
// already added to yyextra->current_root, so we should not add it again
// (see bug723314)
{
- yyextra->previous = yyextra->current.get();
+ yyextra->previous = yyextra->current;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
}
else
{
- yyextra->previous = yyextra->current.get();
- yyextra->tempEntry.swap(yyextra->current);
+ yyextra->previous = yyextra->current;
+ yyextra->current = yyextra->tempEntry;
yyextra->tempEntry.reset();
}
initEntry(yyscanner);
@@ -6949,7 +6950,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start
// fill in inbodyFile && inbodyLine the first time, see bug 633891
- Entry *docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current.get();
+ std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
{
docEntry->inbodyFile = yyextra->yyFileName;
@@ -6961,7 +6962,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
QCString processedDoc = preprocessCommentBlock(stripIndentation(doc),yyextra->yyFileName,lineNr);
while (parseCommentBlock(
yyextra->thisParser,
- yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current.get(),
+ yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
processedDoc, // text
yyextra->yyFileName, // file
lineNr, // line of block start
@@ -7054,7 +7055,7 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al)
//----------------------------------------------------------------------------
-static void parseCompounds(yyscan_t yyscanner,const std::unique_ptr<Entry> &rt)
+static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("parseCompounds(%s)\n",rt->name.data());
@@ -7074,14 +7075,14 @@ static void parseCompounds(yyscan_t yyscanner,const std::unique_ptr<Entry> &rt)
BEGIN( FindFields ) ;
else
BEGIN( FindMembers ) ;
- yyextra->current_root = ce.get() ;
+ yyextra->current_root = ce;
yyextra->yyFileName = ce->fileName;
//setContext();
yyextra->yyLineNr = ce->startLine ;
yyextra->yyColNr = ce->startColumn ;
yyextra->insideObjC = ce->lang==SrcLangExt_ObjC;
//printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
- yyextra->current = std::make_unique<Entry>();
+ yyextra->current = std::make_shared<Entry>();
yyextra->stat = FALSE;
initEntry(yyscanner);
@@ -7169,7 +7170,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::unique_ptr<Entry> &rt)
static void parseMain(yyscan_t yyscanner,
const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &rt,
+ const std::shared_ptr<Entry> &rt,
bool sameTranslationUnit,
QStrList & filesInSameTranslationUnit)
{
@@ -7187,7 +7188,7 @@ static void parseMain(yyscan_t yyscanner,
yyextra->mtype = Method;
yyextra->stat = FALSE;
yyextra->virt = Normal;
- yyextra->current_root = rt.get();
+ yyextra->current_root = rt;
yyextra->yyLineNr= 1 ;
yyextra->yyFileName = fileName;
setContext(yyscanner);
@@ -7206,10 +7207,10 @@ static void parseMain(yyscan_t yyscanner,
rt->lang = yyextra->language;
msg("Parsing file %s...\n",yyextra->yyFileName.data());
- yyextra->current_root = rt.get() ;
+ yyextra->current_root = rt;
initParser(yyscanner);
Doxygen::docGroup.enterFile(yyextra->yyFileName,yyextra->yyLineNr);
- yyextra->current = std::make_unique<Entry>();
+ yyextra->current = std::make_shared<Entry>();
//printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
int sec=guessSection(yyextra->yyFileName);
if (sec)
@@ -7355,7 +7356,7 @@ void COutlineParser::finishTranslationUnit()
void COutlineParser::parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList & filesInSameTranslationUnit)
{
diff --git a/src/tagreader.cpp b/src/tagreader.cpp
index 65336e3..8f85e9d 100644
--- a/src/tagreader.cpp
+++ b/src/tagreader.cpp
@@ -909,12 +909,12 @@ class TagFileParser : public QXmlDefaultHandler
}
void dump();
- void buildLists(const std::unique_ptr<Entry> &root);
+ void buildLists(const std::shared_ptr<Entry> &root);
void addIncludes();
private:
- void buildMemberList(const std::unique_ptr<Entry> &ce,QList<TagMemberInfo> &members);
- void addDocAnchors(const std::unique_ptr<Entry> &e,const TagAnchorInfoList &l);
+ void buildMemberList(const std::shared_ptr<Entry> &ce,QList<TagMemberInfo> &members);
+ void addDocAnchors(const std::shared_ptr<Entry> &e,const TagAnchorInfoList &l);
QList<TagClassInfo> m_tagFileClasses;
QList<TagFileInfo> m_tagFileFiles;
QList<TagNamespaceInfo> m_tagFileNamespaces;
@@ -1139,7 +1139,7 @@ void TagFileParser::dump()
}
}
-void TagFileParser::addDocAnchors(const std::unique_ptr<Entry> &e,const TagAnchorInfoList &l)
+void TagFileParser::addDocAnchors(const std::shared_ptr<Entry> &e,const TagAnchorInfoList &l)
{
QListIterator<TagAnchorInfo> tli(l);
TagAnchorInfo *ta;
@@ -1161,13 +1161,13 @@ void TagFileParser::addDocAnchors(const std::unique_ptr<Entry> &e,const TagAncho
}
}
-void TagFileParser::buildMemberList(const std::unique_ptr<Entry> &ce,QList<TagMemberInfo> &members)
+void TagFileParser::buildMemberList(const std::shared_ptr<Entry> &ce,QList<TagMemberInfo> &members)
{
QListIterator<TagMemberInfo> mii(members);
TagMemberInfo *tmi;
for (;(tmi=mii.current());++mii)
{
- std::unique_ptr<Entry> me = std::make_unique<Entry>();
+ std::shared_ptr<Entry> me = std::make_shared<Entry>();
me->type = tmi->type;
me->name = tmi->name;
me->args = tmi->arglist;
@@ -1182,7 +1182,7 @@ void TagFileParser::buildMemberList(const std::unique_ptr<Entry> &ce,QList<TagMe
TagEnumValueInfo *evi;
for (evii.toFirst();(evi=evii.current());++evii)
{
- std::unique_ptr<Entry> ev = std::make_unique<Entry>();
+ std::shared_ptr<Entry> ev = std::make_shared<Entry>();
ev->type = "@";
ev->name = evi->name;
ev->id = evi->clangid;
@@ -1296,14 +1296,14 @@ static QCString stripPath(const QCString &s)
* This tree contains the information extracted from the input in a
* "unrelated" form.
*/
-void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
+void TagFileParser::buildLists(const std::shared_ptr<Entry> &root)
{
// build class list
QListIterator<TagClassInfo> cit(m_tagFileClasses);
TagClassInfo *tci;
for (cit.toFirst();(tci=cit.current());++cit)
{
- std::unique_ptr<Entry> ce = std::make_unique<Entry>();
+ std::shared_ptr<Entry> ce = std::make_shared<Entry>();
ce->section = Entry::CLASS_SEC;
switch (tci->kind)
{
@@ -1360,7 +1360,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
TagFileInfo *tfi;
for (fit.toFirst();(tfi=fit.current());++fit)
{
- std::unique_ptr<Entry> fe = std::make_unique<Entry>();
+ std::shared_ptr<Entry> fe = std::make_shared<Entry>();
fe->section = guessSection(tfi->name);
fe->name = tfi->name;
addDocAnchors(fe,tfi->docAnchors);
@@ -1396,7 +1396,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
TagNamespaceInfo *tni;
for (nit.toFirst();(tni=nit.current());++nit)
{
- std::unique_ptr<Entry> ne = std::make_unique<Entry>();
+ std::shared_ptr<Entry> ne = std::make_shared<Entry>();
ne->section = Entry::NAMESPACE_SEC;
ne->name = tni->name;
addDocAnchors(ne,tni->docAnchors);
@@ -1414,7 +1414,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
TagPackageInfo *tpgi;
for (pit.toFirst();(tpgi=pit.current());++pit)
{
- std::unique_ptr<Entry> pe = std::make_unique<Entry>();
+ std::shared_ptr<Entry> pe = std::make_shared<Entry>();
pe->section = Entry::PACKAGE_SEC;
pe->name = tpgi->name;
addDocAnchors(pe,tpgi->docAnchors);
@@ -1431,7 +1431,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
TagGroupInfo *tgi;
for (git.toFirst();(tgi=git.current());++git)
{
- std::unique_ptr<Entry> ge = std::make_unique<Entry>();
+ std::shared_ptr<Entry> ge = std::make_shared<Entry>();
ge->section = Entry::GROUPDOC_SEC;
ge->name = tgi->name;
ge->type = tgi->title;
@@ -1455,7 +1455,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
//for (eli.toFirst();(childNode=eli.current());++eli)
const auto &children = root->children();
auto i = std::find_if(children.begin(),children.end(),
- [&](const std::unique_ptr<Entry> &e) { return e->name = *it; });
+ [&](const std::shared_ptr<Entry> &e) { return e->name = *it; });
if (i!=children.end())
{
(*i)->groups.push_back(Grouping(tgi->name,Grouping::GROUPING_INGROUP));
@@ -1468,7 +1468,7 @@ void TagFileParser::buildLists(const std::unique_ptr<Entry> &root)
TagPageInfo *tpi;
for (pgit.toFirst();(tpi=pgit.current());++pgit)
{
- std::unique_ptr<Entry> pe = std::make_unique<Entry>();
+ std::shared_ptr<Entry> pe = std::make_shared<Entry>();
pe->section = tpi->filename=="index" ? Entry::MAINPAGEDOC_SEC : Entry::PAGEDOC_SEC;
pe->name = tpi->name;
pe->args = tpi->title;
@@ -1527,7 +1527,7 @@ void TagFileParser::addIncludes()
}
}
-void parseTagFile(const std::unique_ptr<Entry> &root,const char *fullName)
+void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName)
{
QFileInfo fi(fullName);
if (!fi.exists()) return;
diff --git a/src/tagreader.h b/src/tagreader.h
index 4c09a04..454060b 100644
--- a/src/tagreader.h
+++ b/src/tagreader.h
@@ -23,6 +23,6 @@ class Entry;
#include <memory>
-void parseTagFile(const std::unique_ptr<Entry> &root,const char *fullPathName);
+void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullPathName);
#endif
diff --git a/src/tclscanner.h b/src/tclscanner.h
index 52ff903..cdd56d8 100644
--- a/src/tclscanner.h
+++ b/src/tclscanner.h
@@ -32,7 +32,7 @@ class TclOutlineParser : public OutlineParserInterface
void finishTranslationUnit() {}
void parseInput(const char *fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit);
bool needsPreprocessing(const QCString &extension) const;
diff --git a/src/tclscanner.l b/src/tclscanner.l
index e3fd6f2..49c0807 100644
--- a/src/tclscanner.l
+++ b/src/tclscanner.l
@@ -2966,7 +2966,7 @@ static void tcl_parse(const QCString ns, const QCString cls)
//! Parse text file and build up entry tree.
void TclOutlineParser::parseInput(const char *fileName,
const char *input,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
{
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index ba4d4de..dc39321 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -72,7 +72,7 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStri
static void writeUCFLink(const MemberDef* mdef,OutputList &ol);
static void assignBinding(VhdlConfNode* conf);
static void addInstance(ClassDef* entity, ClassDef* arch, ClassDef *inst,
- const std::unique_ptr<Entry> &cur);
+ const std::shared_ptr<Entry> &cur);
//---------- create svg -------------------------------------------------------------
static void createSVG();
@@ -2535,7 +2535,7 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStr
qcs.stripPrefix("=");
- std::unique_ptr<Entry> current = std::make_unique<Entry>();
+ std::shared_ptr<Entry> current = std::make_shared<Entry>();
current->spec=VhdlDocGen::UCF_CONST;
current->section=Entry::VARIABLE_SEC;
current->bodyLine=line;
@@ -2900,7 +2900,7 @@ void VhdlDocGen::computeVhdlComponentRelations()
}
static void addInstance(ClassDef* classEntity, ClassDef* ar,
- ClassDef *cd , const std::unique_ptr<Entry> &cur)
+ ClassDef *cd , const std::shared_ptr<Entry> &cur)
{
QCString bName,n1;
@@ -3136,7 +3136,7 @@ void VhdlDocGen::createFlowChart(const MemberDef *mdef)
VHDLOutlineParser &intf =dynamic_cast<VHDLOutlineParser&>(Doxygen::parserManager->getOutlineParser(".vhd"));
VhdlDocGen::setFlowMember(mdef);
- std::unique_ptr<Entry> root = std::make_unique<Entry>();
+ std::shared_ptr<Entry> root = std::make_shared<Entry>();
QStrList filesInSameTu;
intf.startTranslationUnit("");
intf.parseInput("",codeFragment.data(),root,FALSE,filesInSameTu);
diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp
index 874980b..8b7ebf6 100644
--- a/src/vhdljjparser.cpp
+++ b/src/vhdljjparser.cpp
@@ -48,16 +48,15 @@ static Entry* oldEntry;
static bool varr=FALSE;
static QCString varName;
-static std::vector< std::unique_ptr<Entry> > instFiles;
-static std::vector< std::unique_ptr<Entry> > libUse;
+static std::vector< std::shared_ptr<Entry> > instFiles;
+static std::vector< std::shared_ptr<Entry> > libUse;
static std::vector<Entry*> lineEntry;
-Entry* VhdlParser::currentCompound=0;
Entry* VhdlParser::tempEntry=0;
Entry* VhdlParser::lastEntity=0 ;
Entry* VhdlParser::lastCompound=0 ;
Entry* VhdlParser::current_root = 0;
-std::unique_ptr<Entry> VhdlParser::current=0;
+std::shared_ptr<Entry> VhdlParser::current=0;
QCString VhdlParser::compSpec;
QCString VhdlParser::currName;
QCString VhdlParser::confName;
@@ -90,7 +89,7 @@ static void insertEntryAtLine(const Entry* ce,int line);
//-------------------------------------
const QList<VhdlConfNode>& getVhdlConfiguration() { return configL; }
-const std::vector<std::unique_ptr<Entry> > &getVhdlInstList() { return instFiles; }
+const std::vector<std::shared_ptr<Entry> > &getVhdlInstList() { return instFiles; }
Entry* getVhdlCompound()
{
@@ -106,7 +105,7 @@ bool isConstraintFile(const QCString &fileName,const QCString &ext)
void VHDLOutlineParser::parseInput(const char *fileName,const char *fileBuf,
- const std::unique_ptr<Entry> &root, bool ,QStrList&)
+ const std::shared_ptr<Entry> &root, bool ,QStrList&)
{
g_thisParser=this;
bool inLine=false;
@@ -140,10 +139,9 @@ void VHDLOutlineParser::parseInput(const char *fileName,const char *fileBuf,
VhdlParser::current_root=root.get();
VhdlParser::lastCompound=0;
VhdlParser::lastEntity=0;
- VhdlParser::currentCompound=0;
VhdlParser::lastEntity=0;
oldEntry = 0;
- VhdlParser::current=std::make_unique<Entry>();
+ VhdlParser::current=std::make_shared<Entry>();
VhdlParser::initEntry(VhdlParser::current.get());
Doxygen::docGroup.enterFile(fileName,yyLineNr);
vhdlFileName = fileName;
@@ -355,10 +353,10 @@ void VhdlParser::addCompInst(const char *n, const char* instName, const char* co
if (true) // !findInstant(current->type))
{
initEntry(current.get());
- instFiles.emplace_back(std::make_unique<Entry>(*current));
+ instFiles.emplace_back(std::make_shared<Entry>(*current));
}
- current=std::make_unique<Entry>();
+ current=std::make_shared<Entry>();
}
else
{
@@ -396,7 +394,7 @@ void VhdlParser::addVhdlType(const char *n,int startLine,int section,
if (!lastCompound && (section==Entry::VARIABLE_SEC) && (spec == VhdlDocGen::USE || spec == VhdlDocGen::LIBRARY) )
{
- libUse.emplace_back(std::make_unique<Entry>(*current));
+ libUse.emplace_back(std::make_shared<Entry>(*current));
current->reset();
}
newEntry();
diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h
index faa0c08..f987e4a 100644
--- a/src/vhdljjparser.h
+++ b/src/vhdljjparser.h
@@ -47,7 +47,7 @@ class VHDLOutlineParser : public OutlineParserInterface
void finishTranslationUnit() {}
void parseInput(const char * fileName,
const char *fileBuf,
- const std::unique_ptr<Entry> &root,
+ const std::shared_ptr<Entry> &root,
bool sameTranslationUnit,
QStrList &filesInSameTranslationUnit);
@@ -82,6 +82,6 @@ struct VhdlConfNode
void vhdlscanFreeScanner();
const QList<VhdlConfNode>& getVhdlConfiguration();
-const std::vector<std::unique_ptr<Entry> >&getVhdlInstList();
+const std::vector<std::shared_ptr<Entry> >&getVhdlInstList();
#endif
diff --git a/vhdlparser/VhdlParser.cc b/vhdlparser/VhdlParser.cc
index 2ed30e2..35f2ff6 100644
--- a/vhdlparser/VhdlParser.cc
+++ b/vhdlparser/VhdlParser.cc
@@ -5891,7 +5891,7 @@ void VhdlParser::package_declaration() {QCString s;
}
if (!hasError) {
lastCompound=current.get();
- std::unique_ptr<Entry> clone=std::make_unique<Entry>(*current);
+ std::shared_ptr<Entry> clone=std::make_shared<Entry>(*current);
clone->section=Entry::NAMESPACE_SEC;
clone->spec=VhdlDocGen::PACKAGE;
clone->name=s;
diff --git a/vhdlparser/VhdlParser.h b/vhdlparser/VhdlParser.h
index a9f14d1..b88f156 100644
--- a/vhdlparser/VhdlParser.h
+++ b/vhdlparser/VhdlParser.h
@@ -8426,7 +8426,7 @@ static Entry* current_root;
static Entry* tempEntry;
static Entry* lastEntity ;
static Entry* lastCompound ;
-static std::unique_ptr<Entry> current;
+static std::shared_ptr<Entry> current;
static QCString compSpec;
static QCString currName;
static int levelCounter;
@@ -8437,7 +8437,6 @@ static QCString forL;
static int param_sec ;
static int parse_sec;
static int currP;
-static Entry* currentCompound;
//----------------------------------------
diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj
index a3d6731..c602396 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 std::unique_ptr<Entry> current;
+static std::shared_ptr<Entry> current;
static QCString compSpec;
static QCString currName;
static int levelCounter;
@@ -42,7 +42,6 @@ static QCString forL;
static int param_sec ;
static int parse_sec;
static int currP;
-static Entry* currentCompound;
//----------------------------------------
@@ -1730,7 +1729,7 @@ void package_declaration(): {QCString s;}
<PACKAGE_T> s=identifier() <IS_T>
{
lastCompound=current.get();
- std::unique_ptr<Entry> clone=std::make_unique<Entry>(*current);
+ std::shared_ptr<Entry> clone=std::make_shared<Entry>(*current);
clone->section=Entry::NAMESPACE_SEC;
clone->spec=VhdlDocGen::PACKAGE;
clone->name=s;