logic: fixed warnings, tests and bugs
* fixed clang warnings * fixed cxxparser tests * added missing checks for valid location in ASTVisitor callbacks for templates * removed warning when statusbar view is removed * made font of activated classes bold * fixed search box not responding to autocompletion tab or enter press * fixed search box not updated when active token changes
This commit is contained in:
@@ -1,4 +1,22 @@
|
||||
ConfigManager.cpp ERROR: value path/to/nowhere is not present in config.
|
||||
Token.cpp ERROR: Location Id was not referenced by this Token.
|
||||
Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class
|
||||
Edge.cpp ERROR: Nodes are not plain copies.
|
||||
Storage.cpp INFO: class: A <input.cc 1:7 1:7>
|
||||
Storage.cpp INFO: method: A::A <input.cc 4:2 4:2>
|
||||
Storage.cpp INFO: global usage: A::A -> A::count <input.cc 5:3 5:7>
|
||||
Storage.cpp INFO: method: A::getCount <input.cc 8:13 8:20>
|
||||
Storage.cpp INFO: global usage: A::getCount -> A::count <input.cc 10:10 10:14>
|
||||
Storage.cpp INFO: method: A::process <input.cc 14:15 14:21>
|
||||
Storage.cpp INFO: field: A::count <input.cc 17:13 17:17>
|
||||
Storage.cpp INFO: class: B <input.cc 20:7 20:7>
|
||||
Storage.cpp INFO: inheritance: B : A <input.cc 21:4 21:11>
|
||||
Storage.cpp INFO: method: B::process <input.cc 24:15 24:21>
|
||||
Storage.cpp INFO: type usage: B::process -> int <input.cc 26:3 26:5>
|
||||
Storage.cpp INFO: function: main <input.cc 30:5 30:8>
|
||||
Storage.cpp INFO: type usage: main -> B <input.cc 32:2 32:2>
|
||||
Storage.cpp INFO: call: main -> B::B <input.cc 32:4 32:4>
|
||||
Storage.cpp INFO: call: main -> A::getCount <input.cc 34:9 34:21>
|
||||
Storage.cpp INFO: class: A <input.cc 1:7 1:7>
|
||||
Storage.cpp INFO: method: A::A <input.cc 4:2 4:2>
|
||||
Storage.cpp INFO: global usage: A::A -> A::count <input.cc 5:3 5:7>
|
||||
@@ -31,24 +49,6 @@ SearchMatch.cpp INFO:
|
||||
237 A::A
|
||||
^^^^
|
||||
|
||||
Storage.cpp INFO: class: A <input.cc 1:7 1:7>
|
||||
Storage.cpp INFO: method: A::A <input.cc 4:2 4:2>
|
||||
Storage.cpp INFO: global usage: A::A -> A::count <input.cc 5:3 5:7>
|
||||
Storage.cpp INFO: method: A::getCount <input.cc 8:13 8:20>
|
||||
Storage.cpp INFO: global usage: A::getCount -> A::count <input.cc 10:10 10:14>
|
||||
Storage.cpp INFO: method: A::process <input.cc 14:15 14:21>
|
||||
Storage.cpp INFO: field: A::count <input.cc 17:13 17:17>
|
||||
Storage.cpp INFO: class: B <input.cc 20:7 20:7>
|
||||
Storage.cpp INFO: inheritance: B : A <input.cc 21:4 21:11>
|
||||
Storage.cpp INFO: method: B::process <input.cc 24:15 24:21>
|
||||
Storage.cpp INFO: type usage: B::process -> int <input.cc 26:3 26:5>
|
||||
Storage.cpp INFO: function: main <input.cc 30:5 30:8>
|
||||
Storage.cpp INFO: type usage: main -> B <input.cc 32:2 32:2>
|
||||
Storage.cpp INFO: call: main -> B::B <input.cc 32:4 32:4>
|
||||
Storage.cpp INFO: call: main -> A::getCount <input.cc 34:9 34:21>
|
||||
Token.cpp ERROR: Location Id was not referenced by this Token.
|
||||
Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class
|
||||
Edge.cpp ERROR: Nodes are not plain copies.
|
||||
Settings.cpp WARNING: File for Settings not found.
|
||||
ConfigManager.cpp ERROR: value Bool is not present in config.
|
||||
ConfigManager.cpp ERROR: value Int is not present in config.
|
||||
@@ -64,7 +64,6 @@ ConfigManager.cpp ERROR: value Int is not present in config.
|
||||
ConfigManager.cpp ERROR: value Float is not present in config.
|
||||
ConfigManager.cpp ERROR: value String is not present in config.
|
||||
ConfigManager.cpp ERROR: value NewBool is not present in config.
|
||||
Graph.cpp ERROR: Can't remove member edge, without removing the child node.
|
||||
Storage.cpp INFO: typedef: type -> int <file.cpp 1:1 1:1>
|
||||
Storage.cpp INFO: class: Class <file.cpp 1:1 1:1>
|
||||
Storage.cpp INFO: struct: Struct <file.cpp 1:1 1:1>
|
||||
@@ -104,6 +103,7 @@ Storage.cpp INFO: global usage: isTrue -> global <file.cpp 1:7 1:7>
|
||||
Storage.cpp INFO: function: isTrue <file.cpp 1:0 1:0>
|
||||
Storage.cpp INFO: struct: Struct <file.cpp 1:0 1:0>
|
||||
Storage.cpp INFO: type usage: isTrue -> Struct <file.cpp 1:0 1:0>
|
||||
Graph.cpp ERROR: Can't remove member edge, without removing the child node.
|
||||
TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 3 > 2
|
||||
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
|
||||
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
|
||||
|
||||
@@ -166,9 +166,6 @@ QtAutocompletionList::QtAutocompletionList(QWidget* parent)
|
||||
|
||||
setCaseSensitivity(Qt::CaseInsensitive);
|
||||
// setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
|
||||
connect(this, SIGNAL(highlighted(const QModelIndex&)), this, SLOT(onHighlighted(const QModelIndex&)), Qt::DirectConnection);
|
||||
connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(onActivated(const QModelIndex&)), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
QtAutocompletionList::~QtAutocompletionList()
|
||||
@@ -202,6 +199,10 @@ void QtAutocompletionList::completeAt(const QPoint& pos, const std::vector<Searc
|
||||
|
||||
list->verticalScrollBar()->setValue(list->verticalScrollBar()->minimum());
|
||||
list->setCurrentIndex(index); // must be set again to avoid flickering
|
||||
|
||||
disconnect(); // must be done because of a bug where signals are no longer received by QtSmartSearchBox
|
||||
connect(this, SIGNAL(highlighted(const QModelIndex&)), this, SLOT(onHighlighted(const QModelIndex&)), Qt::DirectConnection);
|
||||
connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(onActivated(const QModelIndex&)), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
const SearchMatch* QtAutocompletionList::getSearchMatchAt(int idx) const
|
||||
|
||||
@@ -52,9 +52,6 @@ QtSmartSearchBox::QtSmartSearchBox(QWidget* parent)
|
||||
QCompleter* completer = new QtAutocompletionList(this);
|
||||
setCompleter(completer);
|
||||
|
||||
connect(completer, SIGNAL(matchHighlighted(const SearchMatch&)), this, SLOT(onAutocompletionHighlighted(const SearchMatch&)), Qt::DirectConnection);
|
||||
connect(completer, SIGNAL(matchActivated(const SearchMatch&)), this, SLOT(onAutocompletionActivated(const SearchMatch&)), Qt::DirectConnection);
|
||||
|
||||
updatePlaceholder();
|
||||
}
|
||||
|
||||
@@ -66,6 +63,9 @@ void QtSmartSearchBox::setAutocompletionList(const std::vector<SearchMatch>& aut
|
||||
{
|
||||
QtAutocompletionList* completer = dynamic_cast<QtAutocompletionList*>(this->completer());
|
||||
completer->completeAt(QPoint(textMargins().left() + 3, height() + 3), autocompletionList);
|
||||
|
||||
connect(completer, SIGNAL(matchHighlighted(const SearchMatch&)), this, SLOT(onAutocompletionHighlighted(const SearchMatch&)), Qt::DirectConnection);
|
||||
connect(completer, SIGNAL(matchActivated(const SearchMatch&)), this, SLOT(onAutocompletionActivated(const SearchMatch&)), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
void QtSmartSearchBox::setQuery(const std::string& text)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "qt/view/QtMainView.h"
|
||||
|
||||
#include "qt/element/QtMainWindow.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
#include "qt/element/QtMainWindow.h"
|
||||
|
||||
QtMainView::QtMainView()
|
||||
{
|
||||
m_window = std::make_shared<QtMainWindow>();
|
||||
@@ -24,7 +25,6 @@ void QtMainView::removeView(View* view)
|
||||
std::vector<View*>::iterator it = std::find(m_views.begin(), m_views.end(), view);
|
||||
if (it == m_views.end())
|
||||
{
|
||||
LOG_ERROR("View was not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ QFont QtGraphNode::getFontForNodeType(Node::NodeType type)
|
||||
case Node::NODE_CLASS:
|
||||
case Node::NODE_ENUM:
|
||||
case Node::NODE_TYPEDEF:
|
||||
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
|
||||
font.setPixelSize(14);
|
||||
break;
|
||||
|
||||
@@ -284,6 +285,11 @@ void QtGraphNode::setStyle()
|
||||
case Node::NODE_ENUM:
|
||||
case Node::NODE_TYPEDEF:
|
||||
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
|
||||
if (m_isActive)
|
||||
{
|
||||
font.setWeight(QFont::Bold);
|
||||
}
|
||||
|
||||
if (m_isHovering)
|
||||
{
|
||||
m_rect->setShadow(QColor(0, 0, 0, 255), 5);
|
||||
|
||||
@@ -63,8 +63,6 @@ std::shared_ptr<Component> ComponentFactory::createStatusBarComponent()
|
||||
return component;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ComponentFactory::ComponentFactory()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -356,6 +356,7 @@ GraphController::Margins GraphController::getMarginsForDummyNode(DummyNode& node
|
||||
case Node::NODE_CLASS:
|
||||
case Node::NODE_ENUM:
|
||||
case Node::NODE_TYPEDEF:
|
||||
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
|
||||
if (node.subNodes.size())
|
||||
{
|
||||
margins.left = margins.right = 15;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "component/view/SearchView.h"
|
||||
#include "data/access/GraphAccess.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
|
||||
SearchController::SearchController(GraphAccess* graphAccess)
|
||||
: m_graphAccess(graphAccess)
|
||||
@@ -28,6 +27,15 @@ void SearchController::handleMessage(MessageActivateToken* message)
|
||||
m_ignoreNextMessageActivateToken = false;
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageActivateTokens* message)
|
||||
{
|
||||
if (message->tokenIds.size())
|
||||
{
|
||||
MessageActivateToken tokenMessage(message->tokenIds[0]);
|
||||
handleMessage(&tokenMessage);
|
||||
}
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageFind* message)
|
||||
{
|
||||
getView()->setFocus();
|
||||
@@ -47,14 +55,12 @@ void SearchController::handleMessage(MessageSearch* message)
|
||||
m_ignoreNextMessageActivateToken = true;
|
||||
|
||||
std::vector<Id> ids = m_graphAccess->getTokenIdsForQuery(query);
|
||||
if (ids.size())
|
||||
if (!ids.size())
|
||||
{
|
||||
MessageActivateTokens(ids).dispatch();
|
||||
return;
|
||||
ids.push_back(m_graphAccess->getIdForNodeWithName(query));
|
||||
}
|
||||
|
||||
Id nodeId = m_graphAccess->getIdForNodeWithName(query);
|
||||
MessageActivateToken(nodeId).dispatch();
|
||||
MessageActivateTokens(ids).dispatch();
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageSearchAutocomplete* message)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "component/controller/Controller.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageFind.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageSearch.h"
|
||||
@@ -17,6 +18,7 @@ class SearchView;
|
||||
class SearchController
|
||||
: public Controller
|
||||
, public MessageListener<MessageActivateToken>
|
||||
, public MessageListener<MessageActivateTokens>
|
||||
, public MessageListener<MessageFind>
|
||||
, public MessageListener<MessageRefresh>
|
||||
, public MessageListener<MessageSearch>
|
||||
@@ -28,6 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void handleMessage(MessageActivateToken* message);
|
||||
virtual void handleMessage(MessageActivateTokens* message);
|
||||
virtual void handleMessage(MessageFind* message);
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageSearch* message);
|
||||
|
||||
@@ -71,8 +71,6 @@ std::shared_ptr<T> View::createAndDontAddToLayout(ViewLayout* viewLayout)
|
||||
ptr->createWidgetWrapper();
|
||||
ptr->initView();
|
||||
|
||||
//viewLayout->addView(ptr.get());
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,6 @@ Id Storage::onTemplateRecordParameterTypeParsed(
|
||||
Edge* edge = m_graph.createEdge(Edge::EDGE_TEMPLATE_PARAMETER_OF, templateParameterNode, templateRecordNode);
|
||||
//addTokenLocation(edge, location);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -356,6 +355,7 @@ Id Storage::onTemplateRecordSpecializationParsed(
|
||||
|
||||
Node* specializedRecordNode = addNodeHierarchy(specializedRecordNodeType, specializedRecordNameHierarchy);
|
||||
Node* templateRecordNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, templateRecordNameHierarchy);
|
||||
|
||||
Edge* edge = m_graph.createEdge(Edge::EDGE_TEMPLATE_SPECIALIZATION_OF, specializedRecordNode, templateRecordNode);
|
||||
//addTokenLocation(edge, location);
|
||||
|
||||
@@ -388,6 +388,7 @@ Id Storage::onTemplateFunctionSpecializationParsed(
|
||||
|
||||
Node* specializedFunctionNode = addNodeHierarchyWithDistinctSignature(Node::NODE_UNDEFINED_FUNCTION, specializedFunction);
|
||||
Node* templateFunctionNode = addNodeHierarchyWithDistinctSignature(Node::NODE_UNDEFINED_FUNCTION, templateFunction);
|
||||
|
||||
Edge* edge = m_graph.createEdge(Edge::EDGE_TEMPLATE_SPECIALIZATION_OF, specializedFunctionNode, templateFunctionNode);
|
||||
|
||||
return 0;
|
||||
@@ -763,6 +764,11 @@ Edge* Storage::addTypeEdge(Node* node, Edge::EdgeType edgeType, const ParseTypeU
|
||||
}
|
||||
|
||||
Node* typeNode = addNodeHierarchy(Node::NODE_UNDEFINED_TYPE, typeUsage.dataType.getTypeNameHierarchy());
|
||||
if (!typeNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Edge* edge = m_graph.createEdge(edgeType, node, typeNode);
|
||||
addTokenLocation(edge, typeUsage.location);
|
||||
|
||||
|
||||
@@ -157,8 +157,8 @@ bool Edge::checkType() const
|
||||
switch (m_type)
|
||||
{
|
||||
case EDGE_MEMBER:
|
||||
if (!m_from->isType(Node::NODE_UNDEFINED | Node::NODE_CLASS | Node::NODE_STRUCT | Node::NODE_NAMESPACE | Node::NODE_ENUM) ||
|
||||
(m_to->isType(Node::NODE_NAMESPACE) && !m_from->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE)) ||
|
||||
if (!m_from->isType(typeMask | Node::NODE_NAMESPACE) ||
|
||||
(!m_from->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE) && m_to->isType(Node::NODE_NAMESPACE)) ||
|
||||
(m_from->isType(Node::NODE_ENUM) && !m_to->isType(Node::NODE_FIELD)))
|
||||
{
|
||||
break;
|
||||
@@ -208,6 +208,20 @@ bool Edge::checkType() const
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
case EDGE_TEMPLATE_PARAMETER_OF:
|
||||
if (!m_from->isType(Node::NODE_TEMPLATE_PARAMETER_TYPE) || !m_to->isType(typeMask | functionMask))
|
||||
{
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
case EDGE_TEMPLATE_SPECIALIZATION_OF:
|
||||
if (!m_from->isType(typeMask | functionMask) || !m_to->isType(typeMask | functionMask))
|
||||
{
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_ERROR_STREAM(
|
||||
|
||||
@@ -269,98 +269,110 @@ bool ASTVisitor::VisitEnumConstantDecl(clang::EnumConstantDecl* declaration)
|
||||
|
||||
bool ASTVisitor::VisitClassTemplateDecl(clang::ClassTemplateDecl* declaration)
|
||||
{
|
||||
std::vector<std::string> templateRecordNameHierarchy = utility::getDeclNameHierarchy(declaration);
|
||||
|
||||
clang::TemplateParameterList* parameterList = declaration->getTemplateParameters();
|
||||
for (int i = 0; i < parameterList->size(); i++)
|
||||
if (hasValidLocation(declaration))
|
||||
{
|
||||
clang::NamedDecl* namedDecl = parameterList->getParam(i);
|
||||
std::vector<std::string> templateRecordNameHierarchy = utility::getDeclNameHierarchy(declaration);
|
||||
|
||||
if (hasValidLocation(namedDecl))
|
||||
clang::TemplateParameterList* parameterList = declaration->getTemplateParameters();
|
||||
for (size_t i = 0; i < parameterList->size(); i++)
|
||||
{
|
||||
std::string templateParameterTypeName = namedDecl->getNameAsString();
|
||||
clang::NamedDecl* namedDecl = parameterList->getParam(i);
|
||||
|
||||
m_client->onTemplateRecordParameterTypeParsed(
|
||||
getParseLocationForNamedDecl(namedDecl),
|
||||
templateParameterTypeName,
|
||||
templateRecordNameHierarchy
|
||||
if (hasValidLocation(namedDecl))
|
||||
{
|
||||
std::string templateParameterTypeName = namedDecl->getNameAsString();
|
||||
|
||||
m_client->onTemplateRecordParameterTypeParsed(
|
||||
getParseLocationForNamedDecl(namedDecl),
|
||||
templateParameterTypeName,
|
||||
templateRecordNameHierarchy
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (clang::ClassTemplateDecl::spec_iterator it = declaration->specializations().begin(); // template argument as parameter does not work
|
||||
it != declaration->specializations().end(); it++
|
||||
)
|
||||
{
|
||||
ParserClient::RecordType specializedRecordType = it->isStruct() ? ParserClient::RECORD_STRUCT : ParserClient::RECORD_CLASS;
|
||||
std::vector<std::string> specializedRecordNameHierarchy = utility::getDeclNameHierarchy(*(it));
|
||||
m_client->onTemplateRecordSpecializationParsed(
|
||||
getParseLocationForNamedDecl(*it), specializedRecordNameHierarchy, specializedRecordType, templateRecordNameHierarchy
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (clang::ClassTemplateDecl::spec_iterator it = declaration->specializations().begin(); // template argument as parameter does not work
|
||||
it != declaration->specializations().end(); it++
|
||||
)
|
||||
{
|
||||
ParserClient::RecordType specializedRecordType = it->isStruct() ? ParserClient::RECORD_STRUCT : ParserClient::RECORD_CLASS;
|
||||
std::vector<std::string> specializedRecordNameHierarchy = utility::getDeclNameHierarchy(*(it));
|
||||
m_client->onTemplateRecordSpecializationParsed(
|
||||
getParseLocationForNamedDecl(*it), specializedRecordNameHierarchy, specializedRecordType, templateRecordNameHierarchy
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTVisitor::VisitClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl* declaration)
|
||||
{
|
||||
//std::vector<std::string> templateRecordNameHierarchy = utility::splitToVector(
|
||||
// declaration->getQualifiedNameAsString(), "::"
|
||||
//);
|
||||
if (hasValidLocation(declaration))
|
||||
{
|
||||
//std::vector<std::string> templateRecordNameHierarchy = utility::splitToVector(
|
||||
// declaration->getQualifiedNameAsString(), "::"
|
||||
//);
|
||||
|
||||
//clang::ClassTemplateDecl* baseTemplateDecl = declaration->getSpecializedTemplate();
|
||||
//clang::ClassTemplateDecl* baseTemplateDecl = declaration->getSpecializedTemplate();
|
||||
|
||||
//std::string specializedParameterNamePart = "<";
|
||||
//const clang::TemplateArgumentList& templateArgumentList = declaration->getTemplateArgs();
|
||||
//for (int i = 0; i < templateArgumentList.size(); i++)
|
||||
//{
|
||||
// DataType datatype = utility::qualTypeToDataType(templateArgumentList.get(i).getAsType());
|
||||
// if (datatype.isTemplateParameterType())
|
||||
// {
|
||||
// specializedParameterNamePart += baseTemplateDecl->getTemplateParameters()->getParam(i)->getNameAsString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// specializedParameterNamePart += datatype.getFullTypeName();
|
||||
// }
|
||||
// specializedParameterNamePart += (i < templateArgumentList.size() - 1) ? ", " : "";
|
||||
//}
|
||||
//specializedParameterNamePart += ">";
|
||||
//std::string specializedParameterNamePart = "<";
|
||||
//const clang::TemplateArgumentList& templateArgumentList = declaration->getTemplateArgs();
|
||||
//for (int i = 0; i < templateArgumentList.size(); i++)
|
||||
//{
|
||||
// DataType datatype = utility::qualTypeToDataType(templateArgumentList.get(i).getAsType());
|
||||
// if (datatype.isTemplateParameterType())
|
||||
// {
|
||||
// specializedParameterNamePart += baseTemplateDecl->getTemplateParameters()->getParam(i)->getNameAsString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// specializedParameterNamePart += datatype.getFullTypeName();
|
||||
// }
|
||||
// specializedParameterNamePart += (i < templateArgumentList.size() - 1) ? ", " : "";
|
||||
//}
|
||||
//specializedParameterNamePart += ">";
|
||||
|
||||
//int foo = 0;
|
||||
//int foo = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASTVisitor::VisitFunctionTemplateDecl(clang::FunctionTemplateDecl *declaration)
|
||||
{
|
||||
const ParseFunction templateFunction = getParseFunction(declaration->getTemplatedDecl());
|
||||
for (clang::FunctionTemplateDecl::spec_iterator it = declaration->specializations().begin(); it != declaration->specializations().end(); it++)
|
||||
if (hasValidLocation(declaration))
|
||||
{
|
||||
ParseLocation specializedFunctionLocation = getParseLocationForNamedDecl(*(it));
|
||||
ParseFunction specializedFunction = getParseFunction(*(it));
|
||||
m_client->onTemplateFunctionSpecializationParsed(
|
||||
specializedFunctionLocation,
|
||||
specializedFunction,
|
||||
templateFunction);
|
||||
|
||||
m_client->onFunctionParsed(specializedFunctionLocation, specializedFunction, getParseLocationOfFunctionBody(*(it)));
|
||||
}
|
||||
clang::TemplateParameterList* parameterList = declaration->getTemplateParameters();
|
||||
for (int i = 0; i < parameterList->size(); i++)
|
||||
{
|
||||
clang::NamedDecl* namedDecl = parameterList->getParam(i);
|
||||
|
||||
if (hasValidLocation(namedDecl))
|
||||
const ParseFunction templateFunction = getParseFunction(declaration->getTemplatedDecl());
|
||||
for (clang::FunctionTemplateDecl::spec_iterator it = declaration->specializations().begin(); it != declaration->specializations().end(); it++)
|
||||
{
|
||||
std::string templateParameterTypeName = namedDecl->getNameAsString();
|
||||
ParseLocation specializedFunctionLocation = getParseLocationForNamedDecl(*(it));
|
||||
ParseFunction specializedFunction = getParseFunction(*(it));
|
||||
m_client->onTemplateFunctionSpecializationParsed(
|
||||
specializedFunctionLocation,
|
||||
specializedFunction,
|
||||
templateFunction);
|
||||
|
||||
m_client->onTemplateFunctionParameterTypeParsed(
|
||||
getParseLocationForNamedDecl(namedDecl),
|
||||
templateParameterTypeName,
|
||||
templateFunction
|
||||
);
|
||||
m_client->onFunctionParsed(specializedFunctionLocation, specializedFunction, getParseLocationOfFunctionBody(*(it)));
|
||||
}
|
||||
|
||||
clang::TemplateParameterList* parameterList = declaration->getTemplateParameters();
|
||||
for (size_t i = 0; i < parameterList->size(); i++)
|
||||
{
|
||||
clang::NamedDecl* namedDecl = parameterList->getParam(i);
|
||||
|
||||
if (hasValidLocation(namedDecl))
|
||||
{
|
||||
std::string templateParameterTypeName = namedDecl->getNameAsString();
|
||||
|
||||
m_client->onTemplateFunctionParameterTypeParsed(
|
||||
getParseLocationForNamedDecl(namedDecl),
|
||||
templateParameterTypeName,
|
||||
templateFunction
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -600,7 +612,7 @@ std::vector<ParseTypeUsage> ASTVisitor::getParameters(clang::FunctionDecl* decla
|
||||
|
||||
ParseVariable ASTVisitor::getParseVariable(clang::DeclaratorDecl* declaration) const
|
||||
{
|
||||
bool isStatic;
|
||||
bool isStatic = false;
|
||||
std::vector<std::string> hameHierarchy = utility::getDeclNameHierarchy(declaration);
|
||||
if (clang::isa<clang::VarDecl>(declaration))
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace utility
|
||||
{
|
||||
std::string specializedParameterNamePart = "<";
|
||||
const clang::TemplateArgumentList& templateArgumentList = clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(declaration)->getTemplateArgs();
|
||||
for (int i = 0; i < templateArgumentList.size(); i++)
|
||||
for (size_t i = 0; i < templateArgumentList.size(); i++)
|
||||
{
|
||||
DataType datatype = utility::qualTypeToDataType(templateArgumentList.get(i).getAsType());
|
||||
specializedParameterNamePart += datatype.getFullTypeName();
|
||||
@@ -166,7 +166,7 @@ namespace utility
|
||||
{
|
||||
std::string templateParameterNamePart = "<";
|
||||
clang::TemplateParameterList* parameterList = clang::dyn_cast<clang::TemplateDecl>(declaration)->getTemplateParameters();
|
||||
for (int i = 0; i < parameterList->size(); i++)
|
||||
for (size_t i = 0; i < parameterList->size(); i++)
|
||||
{
|
||||
clang::NamedDecl* namedDecl = parameterList->getParam(i);
|
||||
|
||||
|
||||
@@ -1057,7 +1057,7 @@ public:
|
||||
" T foo;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"A<int> a\n"
|
||||
"A<int> a;\n"
|
||||
);
|
||||
|
||||
TS_ASSERT_EQUALS(client->templateSpecializations.size(), 1);
|
||||
@@ -1122,9 +1122,9 @@ public:
|
||||
"template <typename T>\n"
|
||||
"class A\n"
|
||||
"{\n"
|
||||
" Enum TestType\n"
|
||||
" enum TestType\n"
|
||||
" {\n"
|
||||
" TEST_ONE\n"
|
||||
" TEST_ONE,\n"
|
||||
" TEST_TWO\n"
|
||||
" };\n"
|
||||
"};\n"
|
||||
@@ -1140,7 +1140,7 @@ public:
|
||||
"template <typename T>\n"
|
||||
"class A\n"
|
||||
"{\n"
|
||||
" Enum TestType\n"
|
||||
" enum TestType\n"
|
||||
" {\n"
|
||||
" TEST_ONE,\n"
|
||||
" TEST_TWO\n"
|
||||
@@ -1159,7 +1159,7 @@ public:
|
||||
"template <typename T>\n"
|
||||
"class A\n"
|
||||
"{\n"
|
||||
" Enum TestType\n"
|
||||
" enum TestType\n"
|
||||
" {\n"
|
||||
" TEST_ONE,\n"
|
||||
" TEST_TWO\n"
|
||||
|
||||
Reference in New Issue
Block a user