diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/clangparser.cpp | 4 | ||||
-rw-r--r-- | src/memberdef.cpp | 42 | ||||
-rw-r--r-- | src/memberdef.h | 1 | ||||
-rw-r--r-- | src/util.cpp | 39 | ||||
-rw-r--r-- | src/util.h | 2 |
5 files changed, 46 insertions, 42 deletions
diff --git a/src/clangparser.cpp b/src/clangparser.cpp index 76ee426..4a484ff 100644 --- a/src/clangparser.cpp +++ b/src/clangparser.cpp @@ -25,7 +25,8 @@ //-------------------------------------------------------------------------- -std::mutex g_clangMutex; +static std::mutex g_clangMutex; +static std::mutex g_docCrossReferenceMutex; ClangParser *ClangParser::instance() { @@ -696,6 +697,7 @@ void ClangTUParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd, p->currentMemberDef && d->definitionType()==Definition::TypeMember && (p->currentMemberDef!=d || p->currentLine<line)) // avoid self-reference { + std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); addDocCrossReference(toMemberDefMutable(p->currentMemberDef),toMemberDefMutable(d)); } writeMultiLineCodeLink(ol,fd,line,column,d,text); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7fe95db..be57ad9 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -6099,6 +6099,48 @@ bool MemberDefImpl::isReference() const (m_impl->templateMaster && m_impl->templateMaster->isReference()); } +//------------------------------------------------------------------------------- +// Helpers + +void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst) +{ + if (src==0 || dst==0) return; + //printf("--> addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data()); + if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types + if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) && + src->showInCallGraph() + ) + { + dst->addSourceReferencedBy(src); + MemberDefMutable *mdDef = toMemberDefMutable(dst->memberDefinition()); + if (mdDef) + { + mdDef->addSourceReferencedBy(src); + } + MemberDefMutable *mdDecl = toMemberDefMutable(dst->memberDeclaration()); + if (mdDecl) + { + mdDecl->addSourceReferencedBy(src); + } + } + if ((src->hasReferencesRelation() || src->hasCallGraph()) && + src->showInCallGraph() + ) + { + src->addSourceReferences(dst); + MemberDefMutable *mdDef = toMemberDefMutable(src->memberDefinition()); + if (mdDef) + { + mdDef->addSourceReferences(dst); + } + MemberDefMutable *mdDecl = toMemberDefMutable(src->memberDeclaration()); + if (mdDecl) + { + mdDecl->addSourceReferences(dst); + } + } +} + // --- Cast functions // MemberDef *toMemberDef(Definition *d) diff --git a/src/memberdef.h b/src/memberdef.h index d2dd699..11d403c 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -448,5 +448,6 @@ MemberDefMutable *createMemberDef(const char *defFileName,int defLine,int defCol MemberDef *createMemberDefAlias(const Definition *newScope,const MemberDef *aliasMd); void combineDeclarationAndDefinition(MemberDefMutable *mdec,MemberDefMutable *mdef); +void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst); #endif diff --git a/src/util.cpp b/src/util.cpp index c71d3c7..32a47df 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6844,45 +6844,6 @@ bool fileVisibleInIndex(const FileDef *fd,bool &genSourceFile) ); } -void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst) -{ - if (src==0 || dst==0) return; - //printf("--> addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data()); - if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types - if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) && - src->showInCallGraph() - ) - { - dst->addSourceReferencedBy(src); - MemberDefMutable *mdDef = toMemberDefMutable(dst->memberDefinition()); - if (mdDef) - { - mdDef->addSourceReferencedBy(src); - } - MemberDefMutable *mdDecl = toMemberDefMutable(dst->memberDeclaration()); - if (mdDecl) - { - mdDecl->addSourceReferencedBy(src); - } - } - if ((src->hasReferencesRelation() || src->hasCallGraph()) && - src->showInCallGraph() - ) - { - src->addSourceReferences(dst); - MemberDefMutable *mdDef = toMemberDefMutable(src->memberDefinition()); - if (mdDef) - { - mdDef->addSourceReferences(dst); - } - MemberDefMutable *mdDecl = toMemberDefMutable(src->memberDeclaration()); - if (mdDecl) - { - mdDecl->addSourceReferences(dst); - } - } -} - //-------------------------------------------------------------------------------------- /*! @brief Get one unicode character as an unsigned integer from utf-8 string @@ -460,8 +460,6 @@ QCString getDotImageExtension(); bool fileVisibleInIndex(const FileDef *fd,bool &genSourceFile); -void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst); - uint getUtf8Code( const QCString& s, int idx ); uint getUtf8CodeToLower( const QCString& s, int idx ); uint getUtf8CodeToUpper( const QCString& s, int idx ); |