Permalink
Browse files

Added declfile, declline, and declcolumn attributes to the location e…

…lement in the XML output
  • Loading branch information...
doxygen committed Jan 12, 2019
1 parent 121ec25 commit 7f40e488e27bcea4bb15045df05479dc5fbd9d6d
@@ -57,6 +57,7 @@ class DefinitionImpl
DefinitionImpl();
~DefinitionImpl();
void init(const char *df, const char *n);
void setDefFileName(const QCString &df);

SectionDict *sectionDict; // dictionary of all sections, not accessible

@@ -82,7 +83,7 @@ class DefinitionImpl

Definition *outerScope; // not owner

// where the item was found
// where the item was defined
QCString defFileName;
QCString defFileExt;

@@ -112,14 +113,19 @@ DefinitionImpl::~DefinitionImpl()
delete inbodyDocs;
}

void DefinitionImpl::init(const char *df, const char *n)
void DefinitionImpl::setDefFileName(const QCString &df)
{
defFileName = df;
int lastDot = defFileName.findRev('.');
if (lastDot!=-1)
{
defFileExt = defFileName.mid(lastDot);
}
}

void DefinitionImpl::init(const char *df, const char *n)
{
setDefFileName(df);
QCString name = n;
if (name!="<globalScope>")
{
@@ -147,6 +153,13 @@ void DefinitionImpl::init(const char *df, const char *n)
lang = SrcLangExt_Unknown;
}

void Definition::setDefFile(const QCString &df,int defLine,int defCol)
{
m_impl->setDefFileName(df);
m_defLine = defLine;
m_defColumn = defCol;
}

//-----------------------------------------------------------------------------------------

static bool matchExcludedSymbols(const char *name)
@@ -288,6 +288,9 @@ class Definition : public DefinitionIntf
/*! Sets a unique id for the symbol. Used for libclang integration. */
void setId(const char *name);

/*! Set a new file name and position */
void setDefFile(const QCString& df,int defLine,int defColumn);

/*! Sets the documentation of this definition to \a d. */
virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE);

@@ -2449,7 +2449,8 @@ static MemberDef *addVariableToFile(
Entry *root = rootNav->entry();
Debug::print(Debug::Variables,0,
" global variable:\n"
" type=`%s' scope=`%s' name=`%s' args=`%s' prot=`%d mtype=%d lang=%d\n",
" file='%s' type=`%s' scope=`%s' name=`%s' args=`%s' prot=`%d mtype=%d lang=%d\n",
qPrint(root->fileName),
qPrint(root->type),
qPrint(scope),
qPrint(name),
@@ -2593,11 +2594,23 @@ static MemberDef *addVariableToFile(
)
// not a php array variable
{

Debug::print(Debug::Variables,0,
" variable already found: scope=%s\n",qPrint(md->getOuterScope()->name()));
addMemberDocs(rootNav,md,def,0,FALSE);
md->setRefItems(root->sli);
// if md is a variable forward declaration and root is the definition that
// turn md into the defintion
if (!root->explicitExternal && md->isExternal())
{
md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn());
md->setExplicitExternal(FALSE,root->fileName,root->startLine,root->startColumn);
}
// if md is the definition and root point at a declaration, then add the
// declaration info
else if (root->explicitExternal && !md->isExternal())
{
md->setDeclFile(root->fileName,root->startLine,root->startColumn);
}
return md;
}
}
@@ -2636,7 +2649,7 @@ static MemberDef *addVariableToFile(
md->enableCallerGraph(root->callerGraph);
md->enableReferencedByRelation(root->referencedByRelation);
md->enableReferencesRelation(root->referencesRelation);
md->setExplicitExternal(root->explicitExternal);
md->setExplicitExternal(root->explicitExternal,fileName,root->startLine,root->startColumn);
//md->setOuterScope(fd);
if (!root->explicitExternal)
{
@@ -3752,7 +3765,13 @@ static void buildFunctionList(EntryNav *rootNav)
// definition, then turn md into a definition.
if (md->isPrototype() && !root->proto)
{
md->setPrototype(FALSE);
md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn());
md->setPrototype(FALSE,root->fileName,root->startLine,root->startColumn);
}
// if md is already the definition, then add the declaration info
else if (!md->isPrototype() && root->proto)
{
md->setDeclFile(root->fileName,root->startLine,root->startColumn);
}
}
}
@@ -3781,7 +3800,7 @@ static void buildFunctionList(EntryNav *rootNav)
md->setDocumentation(root->doc,root->docFile,root->docLine);
md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
md->setPrototype(root->proto);
md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
md->setDocsForDefinition(!root->proto);
md->setTypeConstraints(root->typeConstr);
//md->setBody(root->body);
@@ -6544,7 +6563,7 @@ static void findMember(EntryNav *rootNav,
md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
md->setDocsForDefinition(!root->proto);
md->setPrototype(root->proto);
md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
md->addSectionsToDefinition(root->anchors);
md->setBodySegment(root->bodyLine,root->endBodyLine);
FileDef *fd=rootNav->fileDef();
@@ -6614,7 +6633,7 @@ static void findMember(EntryNav *rootNav,
md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
md->setDocsForDefinition(!root->proto);
md->setPrototype(root->proto);
md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
md->addSectionsToDefinition(root->anchors);
md->setBodySegment(root->bodyLine,root->endBodyLine);
FileDef *fd=rootNav->fileDef();
@@ -6816,7 +6835,7 @@ static void findMember(EntryNav *rootNav,
md->setDocumentation(root->doc,root->docFile,root->docLine);
md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
md->setDocsForDefinition(!root->proto);
md->setPrototype(root->proto);
md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
md->addSectionsToDefinition(root->anchors);
md->setMemberGroupId(root->mGrpId);
@@ -6891,7 +6910,7 @@ static void findMember(EntryNav *rootNav,
md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
md->setDocsForDefinition(!root->proto);
md->setPrototype(root->proto);
md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn);
md->addSectionsToDefinition(root->anchors);
md->setBodySegment(root->bodyLine,root->endBodyLine);
FileDef *fd=rootNav->fileDef();
@@ -7452,7 +7471,7 @@ static void addEnumValuesToEnums(EntryNav *rootNav)
fmd->setInitializer(root->initializer);
fmd->setMaxInitLines(root->initLines);
fmd->setMemberGroupId(root->mGrpId);
fmd->setExplicitExternal(root->explicitExternal);
fmd->setExplicitExternal(root->explicitExternal,fileName,root->startLine,root->startColumn);
fmd->setRefItems(root->sli);
fmd->setAnchor();
md->insertEnumField(fmd);
@@ -596,6 +596,9 @@ class MemberDefImpl
// FALSE => block is put before declaration.
ClassDef *category;
MemberDef *categoryRelation;
QCString declFileName;
int declLine;
int declColumn;
};

MemberDefImpl::MemberDefImpl() :
@@ -609,7 +612,9 @@ MemberDefImpl::MemberDefImpl() :
defTmpArgLists(0),
classSectionSDict(0),
category(0),
categoryRelation(0)
categoryRelation(0),
declLine(-1),
declColumn(-1)
{
}

@@ -4740,6 +4745,24 @@ MemberDef *MemberDef::getGroupAlias() const
return m_impl->groupAlias;
}

QCString MemberDef::getDeclFileName() const
{
return m_impl->declFileName;
}

int MemberDef::getDeclLine() const
{
return m_impl->declLine;
}

int MemberDef::getDeclColumn() const
{
return m_impl->declColumn;
}


//----------------------------------------------

void MemberDef::setMemberType(MemberType t)
{
m_impl->mtype=t;
@@ -4788,11 +4811,6 @@ void MemberDef::setMaxInitLines(int lines)
}
}

void MemberDef::setExplicitExternal(bool b)
{
m_impl->explExt=b;
}

void MemberDef::setReadAccessor(const char *r)
{
m_impl->read=r;
@@ -4862,9 +4880,38 @@ void MemberDef::setAnonymousEnumType(MemberDef *md)
m_impl->annEnumType = md;
}

void MemberDef::setPrototype(bool p)
void MemberDef::setPrototype(bool p,const QCString &df,int line,int column)
{
m_impl->proto=p;
if (p)
{
setDeclFile(df,line,column);
}
else
{
setDefFile(df,line,column);
}
}

void MemberDef::setExplicitExternal(bool b,const QCString &df,int line,int column)
{
m_impl->explExt=b;
if (b)
{
setDeclFile(df,line,column);
}
else
{
setDefFile(df,line,column);
}
}


void MemberDef::setDeclFile(const QCString &df,int line,int column)
{
m_impl->declFileName = df;
m_impl->declLine = line;
m_impl->declColumn = column;
}

void MemberDef::setMemberGroupId(int id)
@@ -274,6 +274,9 @@ class MemberDef : public Definition
QCString fieldType() const;
bool isReference() const;

QCString getDeclFileName() const;
int getDeclLine() const;
int getDeclColumn() const;

//-----------------------------------------------------------------------------------
// ---- setters -----
@@ -297,7 +300,6 @@ class MemberDef : public Definition
void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri,
const QCString &fileName,int startLine,bool hasDocs,
MemberDef *member=0);
void setExplicitExternal(bool b);
void setReadAccessor(const char *r);
void setWriteAccessor(const char *w);
void setTemplateSpecialization(bool b);
@@ -330,7 +332,9 @@ class MemberDef : public Definition
bool addExample(const char *anchor,const char *name,const char *file);

// prototype related members
void setPrototype(bool p);
void setPrototype(bool p,const QCString &df,int line, int column);
void setExplicitExternal(bool b,const QCString &df,int line,int column);
void setDeclFile(const QCString &df,int line,int column);

// argument related members
void setArgumentList(ArgumentList *al);
@@ -975,7 +975,7 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De
{
t << " <location file=\""
<< stripFromPath(md->getDefFileName()) << "\" line=\""
<< md->getDefLine() << "\"" << " column=\""
<< md->getDefLine() << "\" column=\""
<< md->getDefColumn() << "\"" ;
if (md->getStartBodyLine()!=-1)
{
@@ -987,6 +987,12 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De
t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\""
<< md->getEndBodyLine() << "\"";
}
if (md->getDeclLine()!=-1)
{
t << " declfile=\"" << stripFromPath(md->getDeclFileName()) << "\" declline=\""
<< md->getDeclLine() << "\" declcolumn=\""
<< md->getDeclColumn() << "\"";
}
t << "/>" << endl;
}

@@ -302,6 +302,9 @@
<xsd:attribute name="file" type="xsd:string" />
<xsd:attribute name="line" type="xsd:integer" />
<xsd:attribute name="column" type="xsd:integer" use="optional"/>
<xsd:attribute name="declfile" type="xsd:string" use="optional"/>
<xsd:attribute name="declline" type="xsd:integer" use="optional"/>
<xsd:attribute name="declcolumn" type="xsd:integer" use="optional"/>
<xsd:attribute name="bodyfile" type="xsd:string" />
<xsd:attribute name="bodystart" type="xsd:integer" />
<xsd:attribute name="bodyend" type="xsd:integer" />
@@ -20,7 +20,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="016_copydoc.c" line="11" column="1"/>
<location file="016_copydoc.c" line="11" column="1" declfile="016_copydoc.c" declline="11" declcolumn="1"/>
</memberdef>
<memberdef kind="function" id="016__copydoc_8c_1a119dbcf2f0bc3ec1fbf77fcd35dec6df" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>void</type>
@@ -34,7 +34,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="016_copydoc.c" line="14" column="1"/>
<location file="016_copydoc.c" line="14" column="1" declfile="016_copydoc.c" declline="14" declcolumn="1"/>
</memberdef>
<memberdef kind="function" id="016__copydoc_8c_1a3c1e44de2b412b5218b55e216cebb4ac" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>void</type>
@@ -48,7 +48,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="016_copydoc.c" line="17" column="1"/>
<location file="016_copydoc.c" line="17" column="1" declfile="016_copydoc.c" declline="17" declcolumn="1"/>
</memberdef>
<memberdef kind="function" id="016__copydoc_8c_1a2535f29ea009c3d7449264671e15afe9" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>void</type>
@@ -63,7 +63,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="016_copydoc.c" line="22" column="1"/>
<location file="016_copydoc.c" line="22" column="1" declfile="016_copydoc.c" declline="22" declcolumn="1"/>
</memberdef>
</sectiondef>
<briefdescription>
@@ -16,7 +16,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="019_defgroup.c" line="13" column="1"/>
<location file="019_defgroup.c" line="13" column="1" declfile="019_defgroup.c" declline="13" declcolumn="1"/>
</memberdef>
</sectiondef>
<briefdescription>
@@ -17,7 +17,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="019_defgroup.c" line="23" column="1"/>
<location file="019_defgroup.c" line="23" column="1" declfile="019_defgroup.c" declline="23" declcolumn="1"/>
</memberdef>
</sectiondef>
<briefdescription>
Oops, something went wrong.

0 comments on commit 7f40e48

Please sign in to comment.