Commit b4fd6ac5 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 739210 - C++11 scoped enums with same name inside different classes are merged if using tagfile

parent cba0d89f
...@@ -7038,7 +7038,7 @@ static void findEnums(EntryNav *rootNav) ...@@ -7038,7 +7038,7 @@ static void findEnums(EntryNav *rootNav)
if (cd && !name.isEmpty()) // found a enum inside a compound if (cd && !name.isEmpty()) // found a enum inside a compound
{ {
//printf("Enum `%s'::`%s'\n",cd->name(),name.data()); //printf("Enum `%s'::`%s'\n",cd->name().data(),name.data());
fd=0; fd=0;
mnsd=Doxygen::memberNameSDict; mnsd=Doxygen::memberNameSDict;
isGlobal=FALSE; isGlobal=FALSE;
...@@ -7071,17 +7071,17 @@ static void findEnums(EntryNav *rootNav) ...@@ -7071,17 +7071,17 @@ static void findEnums(EntryNav *rootNav)
if (!isGlobal) md->setMemberClass(cd); else md->setFileDef(fd); if (!isGlobal) md->setMemberClass(cd); else md->setFileDef(fd);
md->setBodySegment(root->bodyLine,root->endBodyLine); md->setBodySegment(root->bodyLine,root->endBodyLine);
md->setBodyDef(rootNav->fileDef()); md->setBodyDef(rootNav->fileDef());
md->setMemberSpecifiers(root->spec); // UNO IDL "published" md->setMemberSpecifiers(root->spec);
md->setEnumBaseType(root->args); md->setEnumBaseType(root->args);
//printf("Enum %s definition at line %d of %s: protection=%d\n", //printf("Enum %s definition at line %d of %s: protection=%d scope=%s\n",
// root->name.data(),root->bodyLine,root->fileName.data(),root->protection); // root->name.data(),root->bodyLine,root->fileName.data(),root->protection,cd?cd->name().data():"<none>");
md->addSectionsToDefinition(root->anchors); md->addSectionsToDefinition(root->anchors);
md->setMemberGroupId(root->mGrpId); md->setMemberGroupId(root->mGrpId);
md->enableCallGraph(root->callGraph); md->enableCallGraph(root->callGraph);
md->enableCallerGraph(root->callerGraph); md->enableCallerGraph(root->callerGraph);
//printf("%s::setRefItems(%d)\n",md->name().data(),root->sli?root->sli->count():-1); //printf("%s::setRefItems(%d)\n",md->name().data(),root->sli?root->sli->count():-1);
md->setRefItems(root->sli); md->setRefItems(root->sli);
//printf("found enum %s nd=%p\n",name.data(),nd); //printf("found enum %s nd=%p\n",md->name().data(),nd);
bool defSet=FALSE; bool defSet=FALSE;
QCString baseType = root->args; QCString baseType = root->args;
...@@ -7255,23 +7255,27 @@ static void addEnumValuesToEnums(EntryNav *rootNav) ...@@ -7255,23 +7255,27 @@ static void addEnumValuesToEnums(EntryNav *rootNav)
{ {
SrcLangExt sle; SrcLangExt sle;
if ( if (
(sle=rootNav->lang())==SrcLangExt_CSharp || (sle=rootNav->lang())==SrcLangExt_CSharp ||
sle==SrcLangExt_Java || sle==SrcLangExt_Java ||
sle==SrcLangExt_XML || sle==SrcLangExt_XML ||
(root->spec&Entry::Strong) (root->spec&Entry::Strong)
) )
{ {
// Unlike classic C/C++ enums, for C++11, C# & Java enum // Unlike classic C/C++ enums, for C++11, C# & Java enum
// values are only visible inside the enum scope, so we must create // values are only visible inside the enum scope, so we must create
// them here and only add them to the enum // them here and only add them to the enum
e->loadEntry(g_storage); e->loadEntry(g_storage);
Entry *root = e->entry(); Entry *root = e->entry();
//printf("md->qualifiedName()=%s rootNav->name()=%s tagInfo=%p name=%s\n", //printf("md->qualifiedName()=%s rootNav->name()=%s tagInfo=%p name=%s\n",
// md->qualifiedName().data(),rootNav->name().data(),rootNav->tagInfo(),root->name.data()); // md->qualifiedName().data(),rootNav->name().data(),rootNav->tagInfo(),root->name.data());
QCString qualifiedName = substitute(rootNav->name(),"::",".");
if (!scope.isEmpty() && rootNav->tagInfo())
{
qualifiedName=substitute(scope,"::",".")+"."+qualifiedName;
}
if (substitute(md->qualifiedName(),"::",".")== // TODO: add function to get canonical representation if (substitute(md->qualifiedName(),"::",".")== // TODO: add function to get canonical representation
substitute(rootNav->name(),"::",".") || // enum value scope matches that of the enum qualifiedName // enum value scope matches that of the enum
rootNav->tagInfo() // be less strict for tag files as members can have incomplete scope )
)
{ {
MemberDef *fmd=new MemberDef( MemberDef *fmd=new MemberDef(
root->fileName,root->startLine,root->startColumn, root->fileName,root->startLine,root->startColumn,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment