[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [umbrello/Applications/18.08] umbrello/codeimport/kdevcppparser: More robust determination of the na
From:       Ralf Habacker <null () kde ! org>
Date:       2018-08-22 11:40:45
Message-ID: E1fsRVF-0008Fo-Sj () code ! kde ! org
[Download RAW message or body]

Git commit fc7dd9e1578d289a322de12cc33eabf91405b4a2 by Ralf Habacker.
Committed on 22/08/2018 at 11:40.
Pushed by habacker into branch 'Applications/18.08'.

More robust determination of the name of the base class with template parameters \
using the abstract syntax tree

This should also work with multiple template parameters.

CCBUG:397664

M  +8    -14   umbrello/codeimport/kdevcppparser/cpptree2uml.cpp

https://commits.kde.org/umbrello/fc7dd9e1578d289a322de12cc33eabf91405b4a2

diff --git a/umbrello/codeimport/kdevcppparser/cpptree2uml.cpp \
b/umbrello/codeimport/kdevcppparser/cpptree2uml.cpp index dfc1b1c93..e523ea180 100644
--- a/umbrello/codeimport/kdevcppparser/cpptree2uml.cpp
+++ b/umbrello/codeimport/kdevcppparser/cpptree2uml.cpp
@@ -755,23 +755,17 @@ void CppTree2Uml::parseBaseClause(BaseClauseAST * baseClause, \
UMLClassifier* kla  for (int i = 0; i < l.size(); ++i) {
         BaseSpecifierAST* baseSpecifier = l.at(i);
 
-        if (baseSpecifier->name() == 0) {
+        NameAST *name = baseSpecifier->name();
+        if (name == 0) {
                 uDebug() << "baseSpecifier->name() is NULL";
                 continue;
         }
-
-        QString baseName = baseSpecifier->name()->text();
-        // uDebug() << "CppTree2Uml::parseBaseClause : baseSpecifier is " << \
                baseName;
-
-        /* TJansen: For templates we have a basename like "foo< T >". The
-         * original class we want to reference is however called "foo",
-         * therefore strip the template parameters. Works for simple cases,
-         * maybe probematic with multiple template parameters that differ.
-         */
-        int templateIndex = baseName.indexOf(QString::fromLatin1("<"));
-        if (templateIndex > 0)
-            baseName.truncate(templateIndex);
-
+        ClassOrNamespaceNameAST *cons = name->unqualifiedName();
+        if (cons == 0) {
+            uDebug() << "name->unqualifiedName() is NULL";
+            continue;
+        }
+        QString baseName = cons->name()->text();
         Import_Utils::putAtGlobalScope(true);
         UMLObject *c = Import_Utils::createUMLObject(UMLObject::ot_Class, baseName,
                                                      m_currentNamespace[m_nsCnt],


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic