From 34a5a051a8b91215ae4f93e5541d43c33aa887c1 Mon Sep 17 00:00:00 2001
From: Adrian Negreanu <adrian.m.negreanu@intel.com>
Date: Mon, 4 Aug 2014 12:29:01 +0300
Subject: cache anonymous into ClassDefImpl::isAnonymous

---
 src/classdef.cpp | 19 ++++++++++++++++---
 src/classdef.h   |  2 ++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/classdef.cpp b/src/classdef.cpp
index cef4720..88f1497 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -187,6 +187,8 @@ class ClassDefImpl
 
     bool isGeneric;
 
+    bool isAnonymous;
+
     uint64 spec;
 };
 
@@ -248,6 +250,7 @@ void ClassDefImpl::init(const char *defFileName, const char *name,
     isLocal=FALSE;
   }
   isGeneric = lang==SrcLangExt_CSharp && QCString(name).find('<')!=-1;
+  isAnonymous = QCString(name).find('@')!=-1;
 }
 
 ClassDefImpl::ClassDefImpl() : vhdlSummaryTitles(17)
@@ -1772,7 +1775,7 @@ bool ClassDef::visibleInParentsDeclList() const
   static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
   static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
   bool linkable = isLinkable();
-  return (name().find('@')==-1 && !isExtension() &&
+  return (!isAnonymous() && !isExtension() &&
           (protection()!=::Private || extractPrivate) &&
           (linkable || (!hideUndocClasses && (!isLocal() || extractLocalClasses)))
          );
@@ -2597,7 +2600,7 @@ bool ClassDef::isLinkableInProject() const
   {
     return !name().isEmpty() &&                    /* has a name */
       !isArtificial() && !isHidden() &&            /* not hidden */
-      name().find('@')==-1 &&                      /* not anonymous */
+      !isAnonymous() &&                            /* not anonymous */
       protectionLevelVisible(m_impl->prot)      && /* private/internal */
       (!m_impl->isLocal      || extractLocal)   && /* local */
       (hasDocumentation()    || !hideUndoc)     && /* documented */
@@ -2629,7 +2632,7 @@ bool ClassDef::isVisibleInHierarchy()
   return // show all classes or a subclass is visible
       (allExternals || hasNonReferenceSuperClass()) &&
       // and not an anonymous compound
-      name().find('@')==-1 &&
+      !isAnonymous() &&
       // not an artificially introduced class
       /*!isArtificial() &&*/  // 1.8.2: allowed these to appear
       // and not privately inherited
@@ -4603,3 +4606,13 @@ bool ClassDef::subGrouping() const
   return m_impl->subGrouping;
 }
 
+void ClassDef::setName(const char *name)
+{
+  m_impl->isAnonymous = QCString(name).find('@')!=-1;
+  Definition::setName(name);
+}
+
+bool ClassDef::isAnonymous() const
+{
+  return m_impl->isAnonymous;
+}
diff --git a/src/classdef.h b/src/classdef.h
index 8c5bebf..8658413 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -307,6 +307,7 @@ class ClassDef : public Definition
     bool isJavaEnum() const;
 
     bool isGeneric() const;
+    bool isAnonymous() const;
     const ClassSDict *innerClasses() const;
     QCString title() const;
 
@@ -357,6 +358,7 @@ class ClassDef : public Definition
 
     void addTaggedInnerClass(ClassDef *cd);
     void setTagLessReference(ClassDef *cd);
+    void setName(const char *name);
 
     //-----------------------------------------------------------------------------------
     // --- actions ----
-- 
cgit v0.12


From d1e39098f94487f544a068b7864aa8d1b1f345cd Mon Sep 17 00:00:00 2001
From: Dimitri van Heesch <dimitri@stack.nl>
Date: Mon, 4 Aug 2014 20:27:25 +0200
Subject: Made setName() virtual so overloading works

---
 src/definition.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/definition.h b/src/definition.h
index dfd9dad..05ea621 100644
--- a/src/definition.h
+++ b/src/definition.h
@@ -271,7 +271,7 @@ class Definition : public DefinitionIntf
     //-----------------------------------------------------------------------------------
 
     /*! Sets a new \a name for the definition */
-    void setName(const char *name);
+    virtual void setName(const char *name);
 
     /*! Sets a unique id for the symbol. Used for libclang integration. */
     void setId(const char *name);
-- 
cgit v0.12

