From 4775a87104b6bc4ec460228ae92b4c0a230c8b92 Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Mon, 19 Jan 2015 17:22:27 +0100 Subject: [PATCH] data: elaborated type name usage fix * fixed node name hierarchy creation for elaborated type names (like when using the class namespaceA::B) --- src/lib/data/Storage.cpp | 6 ------ src/lib/data/parser/cxx/utilityCxx.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index bb2e422b..995576f6 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -883,13 +883,7 @@ Edge* Storage::addTypeEdge(Node* node, Edge::EdgeType edgeType, const ParseTypeU return nullptr; } - // FIXME: For some reason the TypeNameHierarchy is not always split up properly by the Parser. This might happen - // when a Type declaration is in a different file than it's usage, but this oberservation is not reliable. std::vector nameHierarchy = typeUsage.dataType.getTypeNameHierarchy(); - if (nameHierarchy.size() == 1 && nameHierarchy[0].find('<') == std::string::npos) - { - nameHierarchy = utility::splitToVector(nameHierarchy[0], "::"); - } Node* typeNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, nameHierarchy); if (!typeNode) diff --git a/src/lib/data/parser/cxx/utilityCxx.cpp b/src/lib/data/parser/cxx/utilityCxx.cpp index e4fd956f..e397e6b7 100644 --- a/src/lib/data/parser/cxx/utilityCxx.cpp +++ b/src/lib/data/parser/cxx/utilityCxx.cpp @@ -63,6 +63,12 @@ namespace utility { const clang::Type* type = qualType.getUnqualifiedType().getTypePtr(); + if (clang::isa(type)) // get the real type here + { + const clang::ElaboratedType* et = clang::dyn_cast(type); + type = et->getNamedType().getUnqualifiedType().getTypePtr(); + } + if (clang::isa(type)) { typeNameHerarchy = getDeclNameHierarchy(clang::dyn_cast(type)->getDecl());