src: clazy compiler warnings
get rid of most clazy warnings (https://github.com/KDE/clazy) * range loop use refs * qcolor ctor with ints * missing Q_OBJECT macro * use .constfirst instead of .first enabled ccache for unix systems for fasterr recompiling * if ccache is in path we use it now
This commit is contained in:
+1
-12
@@ -277,25 +277,14 @@ void Application::handleMessage(MessageLoadProject* message)
|
||||
|
||||
if (m_project && projectSettingsFilePath == m_project->getProjectSettingsFilePath())
|
||||
{
|
||||
if (message->forceRefresh && m_hasGUI)
|
||||
if (message->forceRefresh)
|
||||
{
|
||||
m_project->setStateSettingsUpdated();
|
||||
refreshProject(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
createAndLoadProject(projectSettingsFilePath);
|
||||
|
||||
if (message->forceRefresh)
|
||||
{
|
||||
refreshProject(true);
|
||||
}
|
||||
else if (!m_hasGUI)
|
||||
{
|
||||
refreshProject(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageRefresh* message)
|
||||
|
||||
@@ -71,7 +71,7 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
|
||||
void ComponentManager::clearComponents()
|
||||
{
|
||||
for (std::shared_ptr<Component> component : m_components)
|
||||
for (const std::shared_ptr<Component>& component : m_components)
|
||||
{
|
||||
Controller* controller = component->getController<Controller>();
|
||||
|
||||
@@ -84,7 +84,7 @@ void ComponentManager::clearComponents()
|
||||
|
||||
void ComponentManager::refreshViews()
|
||||
{
|
||||
for (std::shared_ptr<Component> component : m_components)
|
||||
for (const std::shared_ptr<Component>& component : m_components)
|
||||
{
|
||||
View* view = component->getView<View>();
|
||||
|
||||
@@ -94,12 +94,12 @@ void ComponentManager::refreshViews()
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<CompositeView> view : m_compositeViews)
|
||||
for (const std::shared_ptr<CompositeView>& view : m_compositeViews)
|
||||
{
|
||||
view->refreshView();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<TabbedView> view : m_tabbedViews)
|
||||
for (const std::shared_ptr<TabbedView>& view : m_tabbedViews)
|
||||
{
|
||||
view->refreshView();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
{
|
||||
if (!m_activeEdgeIds.empty())
|
||||
{
|
||||
for (std::shared_ptr<EdgeBookmark> edgeBookmark: getAllEdgeBookmarks())
|
||||
for (const std::shared_ptr<EdgeBookmark>& edgeBookmark: getAllEdgeBookmarks())
|
||||
{
|
||||
if (!m_activeNodeIds.empty() && edgeBookmark->getActiveNodeId() == m_activeNodeIds.front() &&
|
||||
utility::isPermutation(edgeBookmark->getEdgeIds(), m_activeEdgeIds))
|
||||
@@ -87,7 +87,7 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::shared_ptr<NodeBookmark> nodeBookmark: getAllNodeBookmarks())
|
||||
for (const std::shared_ptr<NodeBookmark>& nodeBookmark: getAllNodeBookmarks())
|
||||
{
|
||||
if (utility::isPermutation(nodeBookmark->getNodeIds(), m_activeNodeIds))
|
||||
{
|
||||
@@ -101,7 +101,7 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
|
||||
std::shared_ptr<Bookmark> BookmarkController::getBookmarkForNodeId(Id nodeId) const
|
||||
{
|
||||
for (std::shared_ptr<NodeBookmark> nodeBookmark: getAllNodeBookmarks())
|
||||
for (const std::shared_ptr<NodeBookmark>& nodeBookmark: getAllNodeBookmarks())
|
||||
{
|
||||
if (nodeBookmark->getNodeIds().size() == 1 && nodeBookmark->getNodeIds()[0] == nodeId)
|
||||
{
|
||||
@@ -376,11 +376,11 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getAllBookmarks() con
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> bookmarks;
|
||||
|
||||
for (std::shared_ptr<NodeBookmark> nodeBookmark: getAllNodeBookmarks())
|
||||
for (const std::shared_ptr<NodeBookmark>& nodeBookmark: getAllNodeBookmarks())
|
||||
{
|
||||
bookmarks.push_back(nodeBookmark);
|
||||
}
|
||||
for (std::shared_ptr<EdgeBookmark> edgeBookmark: getAllEdgeBookmarks())
|
||||
for (const std::shared_ptr<EdgeBookmark>& edgeBookmark: getAllEdgeBookmarks())
|
||||
{
|
||||
bookmarks.push_back(edgeBookmark);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(
|
||||
}
|
||||
else if (filter == MessageDisplayBookmarks::BookmarkFilter::NODES)
|
||||
{
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
for (const std::shared_ptr<Bookmark>& bookmark: bookmarks)
|
||||
{
|
||||
if (std::dynamic_pointer_cast<NodeBookmark>(bookmark))
|
||||
{
|
||||
@@ -465,7 +465,7 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(
|
||||
}
|
||||
else if (filter == MessageDisplayBookmarks::BookmarkFilter::EDGES)
|
||||
{
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
for (const std::shared_ptr<Bookmark>& bookmark: bookmarks)
|
||||
{
|
||||
if (std::dynamic_pointer_cast<EdgeBookmark>(bookmark))
|
||||
{
|
||||
|
||||
@@ -431,7 +431,7 @@ void CodeController::expandVisibleSnippets(std::vector<CodeSnippetParams>* snipp
|
||||
continue;
|
||||
}
|
||||
|
||||
for (CodeSnippetParams newSnippet : newSnippets)
|
||||
for (CodeSnippetParams& newSnippet : newSnippets)
|
||||
{
|
||||
newSnippet.isDeclaration = oldSnippet.isDeclaration;
|
||||
newSnippet.isDefinition = oldSnippet.isDefinition;
|
||||
|
||||
@@ -106,7 +106,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
else if (message->isAggregation)
|
||||
{
|
||||
bool isInheritanceChain = true;
|
||||
for (auto edge : m_dummyEdges)
|
||||
for (const auto& edge : m_dummyEdges)
|
||||
{
|
||||
if (!edge->data->isType(Edge::EDGE_INHERITANCE))
|
||||
{
|
||||
@@ -117,7 +117,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
|
||||
if (isInheritanceChain)
|
||||
{
|
||||
for (auto node : m_dummyNodes)
|
||||
for (auto& node : m_dummyNodes)
|
||||
{
|
||||
node->bundleInfo.layoutVertical = true;
|
||||
}
|
||||
@@ -472,7 +472,7 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
|
||||
}
|
||||
);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : dummyNodes)
|
||||
{
|
||||
node->hasParent = false;
|
||||
|
||||
@@ -558,7 +558,7 @@ std::vector<std::shared_ptr<DummyNode>> GraphController::createDummyNodeTopDown(
|
||||
accessKind = access->getAccess();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> dummy : result->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& dummy : result->subNodes)
|
||||
{
|
||||
if (dummy->accessKind == accessKind)
|
||||
{
|
||||
@@ -586,7 +586,7 @@ std::vector<std::shared_ptr<DummyNode>> GraphController::createDummyNodeTopDown(
|
||||
std::vector<Id> GraphController::getExpandedNodeIds() const
|
||||
{
|
||||
std::vector<Id> nodeIds;
|
||||
for (std::pair<Id, std::shared_ptr<DummyNode>> p : m_dummyGraphNodes)
|
||||
for (const std::pair<Id, std::shared_ptr<DummyNode>>& p : m_dummyGraphNodes)
|
||||
{
|
||||
DummyNode* oldNode = p.second.get();
|
||||
if (oldNode->expanded && !oldNode->autoExpanded && oldNode->isGraphNode() &&
|
||||
@@ -634,13 +634,13 @@ bool GraphController::setActive(const std::vector<Id>& activeTokenIds, bool show
|
||||
if (activeTokenIds.size() > 0)
|
||||
{
|
||||
noActive = true;
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
setNodeActiveRecursive(node.get(), activeTokenIds, &noActive);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||
{
|
||||
if (!edge->data)
|
||||
{
|
||||
@@ -673,7 +673,7 @@ void GraphController::setVisibility(bool noActive)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
setNodeVisibilityRecursiveBottomUp(node.get(), noActive);
|
||||
}
|
||||
@@ -700,7 +700,7 @@ void GraphController::setNodeActiveRecursive(DummyNode* node, const std::vector<
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
setNodeActiveRecursive(subNode.get(), activeTokenIds, noActive);
|
||||
}
|
||||
@@ -727,7 +727,7 @@ bool GraphController::setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool n
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (setNodeVisibilityRecursiveBottomUp(subNode.get(), noActive))
|
||||
{
|
||||
@@ -759,7 +759,7 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa
|
||||
if ((node->isGraphNode() && node->isExpanded()) ||
|
||||
(node->isAccessNode() && (node->accessKind == ACCESS_NONE || parentExpanded)))
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->isQualifierNode())
|
||||
{
|
||||
@@ -775,7 +775,7 @@ void GraphController::bundleNodes()
|
||||
TRACE();
|
||||
|
||||
// evaluate top level nodes
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (!node->isGraphNode() || !node->visible)
|
||||
{
|
||||
@@ -876,7 +876,7 @@ void GraphController::bundleNodes()
|
||||
|
||||
// bundle
|
||||
bool fileOrMacroActive = false;
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (node->bundleInfo.isActive && (
|
||||
node->data->isType(Node::NODE_FILE | Node::NODE_MACRO) ||
|
||||
@@ -1045,7 +1045,7 @@ void GraphController::bundleNodesAndEdgesMatching(
|
||||
std::vector<const DummyNode*> bundledNodes = bundleNode->getAllBundledNodes();
|
||||
for (const DummyNode* node : bundledNodes)
|
||||
{
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||
{
|
||||
bool owner = (edge->ownerId == node->data->getId());
|
||||
bool target = (edge->targetId == node->data->getId());
|
||||
@@ -1056,7 +1056,7 @@ void GraphController::bundleNodesAndEdgesMatching(
|
||||
}
|
||||
|
||||
DummyEdge* bundleEdgePtr = nullptr;
|
||||
for (std::shared_ptr<DummyEdge> bundleEdge : bundleEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& bundleEdge : bundleEdges)
|
||||
{
|
||||
if ((owner && bundleEdge->ownerId == edge->targetId) ||
|
||||
(target && bundleEdge->ownerId == edge->ownerId))
|
||||
@@ -1185,7 +1185,7 @@ void GraphController::bundleNodesByType()
|
||||
LOG_ERROR("Nodes left after bundling for overview");
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> bundleNode : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& bundleNode : m_dummyNodes)
|
||||
{
|
||||
if (!bundleNode->isBundleNode())
|
||||
{
|
||||
@@ -1195,7 +1195,7 @@ void GraphController::bundleNodesByType()
|
||||
if (bundleNode->name == "Namespaces")
|
||||
{
|
||||
std::list<std::shared_ptr<DummyNode>> nodes;
|
||||
for (std::shared_ptr<DummyNode> node : bundleNode->bundledNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : bundleNode->bundledNodes)
|
||||
{
|
||||
nodes.push_back(node);
|
||||
}
|
||||
@@ -1210,7 +1210,7 @@ void GraphController::bundleNodesByType()
|
||||
"Anonymous Namespaces"
|
||||
);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : nodes)
|
||||
{
|
||||
bundleNode->bundledNodes.insert(node);
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ void GraphController::addCharacterIndex()
|
||||
{
|
||||
// Remove index characters from last time
|
||||
DummyNode::BundledNodesSet newNodes;
|
||||
for (const std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (!node->isTextNode())
|
||||
{
|
||||
@@ -1266,12 +1266,12 @@ void GraphController::layoutNesting()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
layoutNestingRecursive(node.get());
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
layoutToGrid(node.get());
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
|
||||
// Horizontal layouting is currently not used, but left in place for experimentation.
|
||||
bool layoutHorizontal = false;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible)
|
||||
{
|
||||
@@ -1366,7 +1366,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible || subNode->isExpandToggleNode())
|
||||
{
|
||||
@@ -1417,7 +1417,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
|
||||
node->size.x = margins.left + width + margins.right;
|
||||
node->size.y = margins.top + margins.charHeight + margins.spacingA + y + height + margins.bottom;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible)
|
||||
{
|
||||
@@ -1459,7 +1459,7 @@ void GraphController::addExpandToggleNode(DummyNode* node) const
|
||||
continue;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subSubNode : subNode->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||
{
|
||||
if (subSubNode->visible && (!subSubNode->isGraphNode() || !subSubNode->data->isImplicit()))
|
||||
{
|
||||
@@ -1493,7 +1493,7 @@ void GraphController::layoutToGrid(DummyNode* node) const
|
||||
DummyNode* lastAccessNode = nullptr;
|
||||
DummyNode* expandToggleNode = nullptr;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible)
|
||||
{
|
||||
@@ -1565,7 +1565,7 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (node->tokenId == tokenId)
|
||||
{
|
||||
@@ -1594,7 +1594,7 @@ void GraphController::buildGraph(
|
||||
|
||||
void GraphController::forEachDummyNodeRecursive(std::function<void(DummyNode*)> func)
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
node->forEachDummyNodeRecursive(func);
|
||||
}
|
||||
@@ -1602,7 +1602,7 @@ void GraphController::forEachDummyNodeRecursive(std::function<void(DummyNode*)>
|
||||
|
||||
void GraphController::forEachDummyEdge(std::function<void(DummyEdge*)> func)
|
||||
{
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||
{
|
||||
func(edge.get());
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void LogController::syncLogs()
|
||||
}
|
||||
|
||||
std::vector<Log> logs;
|
||||
for (Log log : m_logs)
|
||||
for (const Log& log : m_logs)
|
||||
{
|
||||
if (log.type & m_logLevel)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ int Bucket::getHeight() const
|
||||
|
||||
bool Bucket::hasNode(std::shared_ptr<DummyNode> node) const
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> n : m_nodes)
|
||||
for (const std::shared_ptr<DummyNode>& n : m_nodes)
|
||||
{
|
||||
if (node == n)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ void Bucket::preLayout(Vec2i viewSize)
|
||||
|
||||
m_height = 0;
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_nodes)
|
||||
{
|
||||
node->position.x = x;
|
||||
node->position.y = y;
|
||||
@@ -93,7 +93,7 @@ void Bucket::layout(int x, int y, int width, int height)
|
||||
int cx = GraphViewStyle::toGridOffset(x + (width - m_width) / 2);
|
||||
int cy = GraphViewStyle::toGridOffset(y + (height - m_height) / 2);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_nodes)
|
||||
{
|
||||
node->position.x = node->position.x + cx;
|
||||
node->position.y = node->position.y + cy;
|
||||
@@ -120,7 +120,7 @@ void BucketLayouter::createBuckets(
|
||||
}
|
||||
|
||||
bool activeNodeAdded = false;
|
||||
for (std::shared_ptr<DummyNode> node : nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : nodes)
|
||||
{
|
||||
if (node->hasActiveSubNode() || !edges.size())
|
||||
{
|
||||
@@ -140,7 +140,7 @@ void BucketLayouter::createBuckets(
|
||||
}
|
||||
|
||||
std::vector<const DummyEdge*> remainingEdges;
|
||||
for (std::shared_ptr<DummyEdge> edge : edges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : edges)
|
||||
{
|
||||
remainingEdges.push_back(edge.get());
|
||||
}
|
||||
@@ -264,7 +264,7 @@ std::vector<std::shared_ptr<DummyNode>> BucketLayouter::getSortedNodes()
|
||||
std::shared_ptr<DummyNode> BucketLayouter::findTopMostDummyNodeRecursive(
|
||||
std::vector<std::shared_ptr<DummyNode>>& nodes, Id tokenId, std::shared_ptr<DummyNode> top
|
||||
){
|
||||
for (std::shared_ptr<DummyNode> node : nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : nodes)
|
||||
{
|
||||
std::shared_ptr<DummyNode> t = (top ? top : node);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
bool hasVisibleSubNode() const
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
if (node->visible)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
if (node->hasActiveSubNode())
|
||||
{
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
count += 1;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
count += node->getActiveSubNodeCount();
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
if (node->hasConnectedSubNode())
|
||||
{
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
nodes.push_back(this);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
utility::append(nodes, node->getConnectedSubNodes());
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
std::vector<const DummyNode*> getAllBundledNodes() const
|
||||
{
|
||||
std::vector<const DummyNode*> nodes;
|
||||
for (std::shared_ptr<DummyNode> node : bundledNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : bundledNodes)
|
||||
{
|
||||
utility::append(nodes, node->getConnectedSubNodes());
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
{
|
||||
func(this);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
node->forEachDummyNodeRecursive(func);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
|
||||
this->bundleId = bundleId;
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : bundledNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : bundledNodes)
|
||||
{
|
||||
bundleId = node->setBundleIdRecursive(bundleId);
|
||||
}
|
||||
@@ -247,11 +247,11 @@ public:
|
||||
}
|
||||
|
||||
size_t subNodeCount = 0;
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subSubNode : subNode->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||
{
|
||||
if (subSubNode->isGraphNode() && !subSubNode->data->isImplicit())
|
||||
{
|
||||
@@ -268,11 +268,11 @@ public:
|
||||
{
|
||||
std::map<Id, std::shared_ptr<DummyNode>> subGraphNodes;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subSubNode : subNode->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||
{
|
||||
if (subSubNode->isGraphNode())
|
||||
{
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
|
||||
void replaceSubGraphNodes(std::map<Id, std::shared_ptr<DummyNode>> subGraphNodes) const
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
std::vector<std::shared_ptr<DummyNode>> getAccessNodes() const
|
||||
{
|
||||
std::vector<std::shared_ptr<DummyNode>> accessNodes;
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
|
||||
@@ -42,12 +42,12 @@ void TrailLayouter::buildGraph(
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& dummyEdges,
|
||||
const std::map<Id, Id>& topLevelAncestorIds)
|
||||
{
|
||||
for (const std::shared_ptr<DummyNode> dummyNode : dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& dummyNode : dummyNodes)
|
||||
{
|
||||
addNode(dummyNode);
|
||||
}
|
||||
|
||||
for (const std::shared_ptr<DummyEdge> dummyEdge : dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& dummyEdge : dummyEdges)
|
||||
{
|
||||
dummyEdge->path.clear();
|
||||
|
||||
@@ -267,7 +267,7 @@ void TrailLayouter::addVirtualNodes()
|
||||
{
|
||||
std::vector<std::shared_ptr<TrailEdge>> newEdges;
|
||||
|
||||
for (std::shared_ptr<TrailEdge> edge : m_allEdges)
|
||||
for (const std::shared_ptr<TrailEdge>& edge : m_allEdges)
|
||||
{
|
||||
for (int i = edge->origin->level + 1; i < edge->target->level; i++)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ void TrailLayouter::addVirtualNodes()
|
||||
|
||||
void TrailLayouter::buildColumns()
|
||||
{
|
||||
for (std::shared_ptr<TrailNode> node : m_allNodes)
|
||||
for (const std::shared_ptr<TrailNode>& node : m_allNodes)
|
||||
{
|
||||
int level = node->level + 1;
|
||||
for (int i = m_nodesPerCol.size(); i <= level; i++)
|
||||
@@ -501,7 +501,7 @@ void TrailLayouter::moveNodesToAveragePosition(std::vector<TrailNode*> nodes, bo
|
||||
}
|
||||
|
||||
int averagePosition = 0;
|
||||
for (std::pair<int, std::vector<TrailNode*>> p : averagePositions)
|
||||
for (const std::pair<int, std::vector<TrailNode*>>& p : averagePositions)
|
||||
{
|
||||
averagePosition += p.first;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void TrailLayouter::moveNodesToAveragePosition(std::vector<TrailNode*> nodes, bo
|
||||
|
||||
void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorIds)
|
||||
{
|
||||
for (std::shared_ptr<TrailNode> node : m_allNodes)
|
||||
for (std::shared_ptr<TrailNode>& node : m_allNodes)
|
||||
{
|
||||
if (node->dummyNode)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorId
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<TrailEdge> edge : m_allEdges)
|
||||
for (std::shared_ptr<TrailEdge>& edge : m_allEdges)
|
||||
{
|
||||
if (edge->virtualNodes.size())
|
||||
{
|
||||
@@ -613,7 +613,7 @@ void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorId
|
||||
void TrailLayouter::print()
|
||||
{
|
||||
std::cout << "graph: " << std::endl;
|
||||
for (std::shared_ptr<TrailNode> node : m_allNodes)
|
||||
for (std::shared_ptr<TrailNode>& node : m_allNodes)
|
||||
{
|
||||
if (node->id)
|
||||
{
|
||||
@@ -624,7 +624,7 @@ void TrailLayouter::print()
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
for (std::shared_ptr<TrailEdge> edge : m_allEdges)
|
||||
for (std::shared_ptr<TrailEdge>& edge : m_allEdges)
|
||||
{
|
||||
if (edge->origin->id || edge->target->id)
|
||||
{
|
||||
@@ -686,7 +686,7 @@ void TrailLayouter::addEdge(const std::shared_ptr<DummyEdge> dummyEdge, const st
|
||||
edge->origin = origin->second;
|
||||
edge->target = target->second;
|
||||
|
||||
for (std::shared_ptr<TrailEdge> e : m_allEdges)
|
||||
for (std::shared_ptr<TrailEdge>& e : m_allEdges)
|
||||
{
|
||||
if ((e->origin == edge->origin && e->target == edge->target) ||
|
||||
(e->origin == edge->target && e->target == edge->origin))
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "data/storage/PersistentStorage.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/messaging/type/MessageQuitApplication.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/utility.h"
|
||||
#include "Application.h"
|
||||
@@ -66,6 +68,19 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
bool interruptedIndexing = false;
|
||||
blackboard->get("interrupted_indexing", interruptedIndexing);
|
||||
|
||||
ErrorCountInfo errorInfo = m_storageAccess->getErrorCount();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Finished indexing: ";
|
||||
ss << indexedSourceFileCount << "/" << sourceFileCount << " source files indexed; ";
|
||||
ss << utility::timeToString(time);
|
||||
ss << "; " << errorInfo.total << " error" << (errorInfo.total != 1 ? "s" : "");
|
||||
if (errorInfo.fatal > 0)
|
||||
{
|
||||
ss << " (" << errorInfo.fatal << " fatal)";
|
||||
}
|
||||
MessageStatus(ss.str(), false, false).dispatch();
|
||||
|
||||
StorageStats stats = m_storageAccess->getStorageStats();
|
||||
dialogView->finishedIndexingDialog(
|
||||
indexedSourceFileCount,
|
||||
@@ -73,7 +88,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
stats.completedFileCount,
|
||||
stats.fileCount,
|
||||
time,
|
||||
m_storageAccess->getErrorCount(),
|
||||
errorInfo,
|
||||
interruptedIndexing
|
||||
);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ std::vector<FullTextSearchResult> FullTextSearchIndex::searchForTerm(const std::
|
||||
|
||||
std::vector<FullTextSearchResult> ret;
|
||||
FullTextSearchResult hit;
|
||||
for (auto f : m_files)
|
||||
for (auto& f : m_files)
|
||||
{
|
||||
hit.fileId = f.fileId;
|
||||
hit.positions = f.array.searchForTerm(term);
|
||||
|
||||
@@ -43,7 +43,7 @@ void Token::removeLocationId(Id locationId)
|
||||
Token::Token(const Token& other)
|
||||
: m_id(other.m_id)
|
||||
{
|
||||
for (std::shared_ptr<TokenComponent> component: other.m_components)
|
||||
for (const std::shared_ptr<TokenComponent>& component: other.m_components)
|
||||
{
|
||||
addComponent(component->copy());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ std::shared_ptr<IntermediateStorage> IndexerComposite::index(
|
||||
|
||||
void IndexerComposite::interrupt()
|
||||
{
|
||||
for (auto it: m_indexers)
|
||||
for (auto& it: m_indexers)
|
||||
{
|
||||
it.second->interrupt();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void InterprocessIndexerCommandManager::setIndexerCommands(
|
||||
const unsigned int overestimationMultiplier = 2;
|
||||
|
||||
size_t estimatedSize = 1048576; /* 1 MB */
|
||||
for (auto command : indexerCommands)
|
||||
for (auto& command : indexerCommands)
|
||||
{
|
||||
estimatedSize += command->getByteSize() + sizeof(SharedIndexerCommand);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void InterprocessIndexerCommandManager::setIndexerCommands(
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto command : indexerCommands)
|
||||
for (auto& command : indexerCommands)
|
||||
{
|
||||
queue->push_back(SharedIndexerCommand(access.getAllocator()));
|
||||
SharedIndexerCommand& sharedCommand = queue->back();
|
||||
|
||||
@@ -176,7 +176,7 @@ std::set<FilePath> InterprocessIndexingStatusManager::getIndexedFiles()
|
||||
return result;
|
||||
}
|
||||
|
||||
for (auto file : *files)
|
||||
for (auto& file : *files)
|
||||
{
|
||||
result.insert(FilePath(file.c_str()));
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void InterprocessIndexingStatusManager::addIndexedFiles(std::set<FilePath> fileP
|
||||
}
|
||||
|
||||
std::set<std::string> oldFiles;
|
||||
for (auto indexedFile : *indexedFiles)
|
||||
for (auto& indexedFile : *indexedFiles)
|
||||
{
|
||||
oldFiles.insert(indexedFile.c_str());
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void InterprocessIndexingStatusManager::addIndexedFiles(std::set<FilePath> fileP
|
||||
}
|
||||
|
||||
size_t estimatedSize = 262144;
|
||||
for (auto newFile : newFiles)
|
||||
for (auto& newFile : newFiles)
|
||||
{
|
||||
estimatedSize += sizeof(std::string) + newFile.size();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const std::map<FilePath, std::shared_ptr<SourceLocationFile>>& SourceLocationCol
|
||||
size_t SourceLocationCollection::getSourceLocationCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
count += p.second->getSourceLocationCount();
|
||||
}
|
||||
@@ -44,7 +44,7 @@ std::shared_ptr<SourceLocationFile> SourceLocationCollection::getSourceLocationF
|
||||
|
||||
SourceLocation* SourceLocationCollection::getSourceLocationById(Id locationId) const
|
||||
{
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
SourceLocation* location = p.second->getSourceLocationById(locationId);
|
||||
if (location)
|
||||
@@ -91,7 +91,7 @@ void SourceLocationCollection::addSourceLocationFile(std::shared_ptr<SourceLocat
|
||||
void SourceLocationCollection::forEachSourceLocationFile(
|
||||
std::function<void(std::shared_ptr<SourceLocationFile>)> func) const
|
||||
{
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
func(p.second);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void SourceLocationCollection::forEachSourceLocationFile(
|
||||
|
||||
void SourceLocationCollection::forEachSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
p.second->forEachSourceLocation(func);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ size_t SourceLocationFile::getSourceLocationCount() const
|
||||
size_t SourceLocationFile::getUnscopedStartLocationCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->isStartLocation() && !location->isScopeLocation())
|
||||
{
|
||||
@@ -129,7 +129,7 @@ SourceLocation* SourceLocationFile::getSourceLocationById(Id locationId) const
|
||||
|
||||
void SourceLocationFile::forEachSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
func(location.get());
|
||||
}
|
||||
@@ -137,7 +137,7 @@ void SourceLocationFile::forEachSourceLocation(std::function<void(SourceLocation
|
||||
|
||||
void SourceLocationFile::forEachStartSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->isStartLocation())
|
||||
{
|
||||
@@ -148,7 +148,7 @@ void SourceLocationFile::forEachStartSourceLocation(std::function<void(SourceLoc
|
||||
|
||||
void SourceLocationFile::forEachEndSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->isEndLocation())
|
||||
{
|
||||
@@ -161,7 +161,7 @@ std::shared_ptr<SourceLocationFile> SourceLocationFile::getFilteredByLines(size_
|
||||
{
|
||||
std::shared_ptr<SourceLocationFile> ret = std::make_shared<SourceLocationFile>(getFilePath(), false, isComplete());
|
||||
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->getLineNumber() >= firstLineNumber && location->getLineNumber() <= lastLineNumber)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ std::shared_ptr<SourceLocationFile> SourceLocationFile::getFilteredByType(Locati
|
||||
{
|
||||
std::shared_ptr<SourceLocationFile> ret = std::make_shared<SourceLocationFile>(getFilePath(), false, isComplete());
|
||||
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->getType() == type)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ void IntermediateStorage::setAllFilesIncomplete()
|
||||
void IntermediateStorage::setFilesWithErrorsIncomplete()
|
||||
{
|
||||
std::set<std::string> errorFileNames;
|
||||
for (StorageError& error : m_errors)
|
||||
for (const StorageError& error : m_errors)
|
||||
{
|
||||
errorFileNames.insert(error.filePath.str());
|
||||
}
|
||||
@@ -373,7 +373,7 @@ std::vector<StorageLocalSymbol> IntermediateStorage::getStorageLocalSymbols() co
|
||||
{
|
||||
std::vector<StorageLocalSymbol> localSymbol;
|
||||
localSymbol.reserve(m_localSymbols.size());
|
||||
for (auto it: m_localSymbols)
|
||||
for (const auto& it: m_localSymbols)
|
||||
{
|
||||
localSymbol.push_back(it.second);
|
||||
}
|
||||
@@ -384,7 +384,7 @@ std::vector<StorageSourceLocation> IntermediateStorage::getStorageSourceLocation
|
||||
{
|
||||
std::vector<StorageSourceLocation> sourceLocations;
|
||||
sourceLocations.reserve(m_sourceLocations.size());
|
||||
for (auto it: m_sourceLocations)
|
||||
for (const auto& it: m_sourceLocations)
|
||||
{
|
||||
sourceLocations.push_back(it.second);
|
||||
}
|
||||
|
||||
@@ -608,12 +608,12 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionSymbolMatches(
|
||||
elementIds.insert(elementIds.end(), result.elementIds.begin(), result.elementIds.end());
|
||||
}
|
||||
|
||||
for (StorageNode& node : m_sqliteIndexStorage.getAllByIds<StorageNode>(elementIds))
|
||||
for (const StorageNode& node : m_sqliteIndexStorage.getAllByIds<StorageNode>(elementIds))
|
||||
{
|
||||
storageNodeMap[node.id] = node;
|
||||
}
|
||||
|
||||
for (StorageSymbol& symbol : m_sqliteIndexStorage.getAllByIds<StorageSymbol>(elementIds))
|
||||
for (const StorageSymbol& symbol : m_sqliteIndexStorage.getAllByIds<StorageSymbol>(elementIds))
|
||||
{
|
||||
storageSymbolMap[symbol.id] = symbol;
|
||||
}
|
||||
@@ -786,7 +786,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
|
||||
std::shared_ptr<Graph> graph = std::make_shared<Graph>();
|
||||
|
||||
std::vector<Id> tokenIds;
|
||||
for (StorageNode node: m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
for (StorageNode& node: m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
{
|
||||
auto it = m_symbolDefinitionKinds.find(node.id);
|
||||
if (it != m_symbolDefinitionKinds.end() && it->second == DEFINITION_EXPLICIT &&
|
||||
@@ -799,7 +799,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
|
||||
}
|
||||
}
|
||||
|
||||
for (auto p : m_fileNodePaths)
|
||||
for (const auto& p : m_fileNodePaths)
|
||||
{
|
||||
tokenIds.push_back(p.first);
|
||||
}
|
||||
@@ -1538,7 +1538,7 @@ std::vector<EdgeBookmark> PersistentStorage::getAllEdgeBookmarks() const
|
||||
std::vector<BookmarkCategory> PersistentStorage::getAllBookmarkCategories() const
|
||||
{
|
||||
std::vector<BookmarkCategory> categories;
|
||||
for (const StorageBookmarkCategory storageBookmarkCategoriy: m_sqliteBookmarkStorage.getAllBookmarkCategories())
|
||||
for (const StorageBookmarkCategory& storageBookmarkCategoriy : m_sqliteBookmarkStorage.getAllBookmarkCategories())
|
||||
{
|
||||
categories.push_back(BookmarkCategory(storageBookmarkCategoriy.id, storageBookmarkCategoriy.name));
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector<Id>&
|
||||
|
||||
info.count = 0;
|
||||
info.countText = "reference";
|
||||
for (auto edge : m_sqliteIndexStorage.getEdgesByTargetId(node.id))
|
||||
for (const auto& edge : m_sqliteIndexStorage.getEdgesByTargetId(node.id))
|
||||
{
|
||||
if (Edge::intToType(edge.type) != Edge::EDGE_MEMBER)
|
||||
{
|
||||
@@ -1659,7 +1659,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
);
|
||||
|
||||
std::vector<Id> typeNodeIds;
|
||||
for (auto edge : m_sqliteIndexStorage.getEdgesBySourceId(node.id))
|
||||
for (const auto& edge : m_sqliteIndexStorage.getEdgesBySourceId(node.id))
|
||||
{
|
||||
if (Edge::intToType(edge.type) == Edge::EDGE_TYPE_USAGE)
|
||||
{
|
||||
@@ -1680,7 +1680,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
);
|
||||
|
||||
typeNames.insert(std::make_pair(nameHierarchy.getQualifiedName(), node.id));
|
||||
for (auto typeNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(typeNodeIds))
|
||||
for (const auto& typeNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(typeNodeIds))
|
||||
{
|
||||
typeNames.insert(std::make_pair(
|
||||
NameHierarchy::deserialize(typeNode.serializedName).getQualifiedName(),
|
||||
@@ -1689,7 +1689,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
}
|
||||
|
||||
std::vector<std::pair<size_t, size_t>> locationRanges;
|
||||
for (auto p : typeNames)
|
||||
for (const auto& p : typeNames)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while (pos != std::string::npos)
|
||||
@@ -1701,7 +1701,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
}
|
||||
|
||||
bool inRange = false;
|
||||
for (auto p : locationRanges)
|
||||
for (const auto& p : locationRanges)
|
||||
{
|
||||
if (pos + 1 >= p.first && pos + 1 <= p.second)
|
||||
{
|
||||
@@ -1747,7 +1747,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
|
||||
{
|
||||
std::vector<Id> tokenIds = getNodeIdsForLocationIds(locationIds);
|
||||
|
||||
for (StorageNode node : m_sqliteIndexStorage.getAllByIds<StorageNode>(tokenIds))
|
||||
for (const StorageNode& node : m_sqliteIndexStorage.getAllByIds<StorageNode>(tokenIds))
|
||||
{
|
||||
TooltipSnippet snippet;
|
||||
|
||||
@@ -1916,7 +1916,7 @@ std::set<Id> PersistentStorage::getReferenced(
|
||||
const std::set<Id>& ids, std::unordered_map<Id, std::set<Id>> idToReferencingIdMap) const
|
||||
{
|
||||
std::unordered_map<Id, std::set<Id>> idToReferencedIdMap;
|
||||
for (auto it: idToReferencingIdMap)
|
||||
for (const auto& it: idToReferencingIdMap)
|
||||
{
|
||||
for (Id referencingId: it.second)
|
||||
{
|
||||
@@ -2223,7 +2223,7 @@ void PersistentStorage::addAggregationEdgesToGraph(
|
||||
|
||||
// add hierarchies of these parents
|
||||
std::vector<Id> nodeIdsToAdd;
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>> p : connectedParentNodeIds)
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>>& p : connectedParentNodeIds)
|
||||
{
|
||||
const Id aggregationTargetNodeId = p.first;
|
||||
if (!graph->getNodeById(aggregationTargetNodeId))
|
||||
@@ -2235,7 +2235,7 @@ void PersistentStorage::addAggregationEdgesToGraph(
|
||||
|
||||
// create aggregation edges between parents and active node
|
||||
Node* sourceNode = graph->getNodeById(nodeId);
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>> p : connectedParentNodeIds)
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>>& p : connectedParentNodeIds)
|
||||
{
|
||||
const Id aggregationTargetNodeId = p.first;
|
||||
|
||||
@@ -2364,14 +2364,14 @@ void PersistentStorage::buildFilePathMaps()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (StorageFile file: m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
for (StorageFile& file: m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
{
|
||||
m_fileNodeIds.emplace(FilePath(file.filePath), file.id);
|
||||
m_fileNodePaths.emplace(file.id, FilePath(file.filePath));
|
||||
m_fileNodeComplete.emplace(file.id, file.complete);
|
||||
}
|
||||
|
||||
for (StorageSymbol symbol : m_sqliteIndexStorage.getAll<StorageSymbol>())
|
||||
for (StorageSymbol& symbol : m_sqliteIndexStorage.getAll<StorageSymbol>())
|
||||
{
|
||||
m_symbolDefinitionKinds.emplace(symbol.id, intToDefinitionKind(symbol.definitionKind));
|
||||
}
|
||||
@@ -2383,7 +2383,7 @@ void PersistentStorage::buildSearchIndex()
|
||||
|
||||
FilePath dbPath = getDbFilePath();
|
||||
|
||||
for (StorageNode node : m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
for (StorageNode& node : m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
{
|
||||
if (Node::intToType(node.type) == Node::NODE_FILE)
|
||||
{
|
||||
@@ -2419,7 +2419,7 @@ void PersistentStorage::buildFullTextSearchIndex() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (StorageFile file : m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
for (StorageFile& file : m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
{
|
||||
m_fullTextSearchIndex.addFile(file.id, m_sqliteIndexStorage.getFileContentById(file.id)->getText());
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void StorageProvider::logCurrentState() const
|
||||
std::string logString = "Storages waiting for injection:";
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_storagesMutex);
|
||||
for (std::shared_ptr<IntermediateStorage> storage: m_storages)
|
||||
for (const std::shared_ptr<IntermediateStorage>& storage: m_storages)
|
||||
{
|
||||
logString += " " + std::to_string(storage->getSourceLocationCount()) + ";";
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ Project::~Project()
|
||||
bool Project::refresh(bool forceRefresh)
|
||||
{
|
||||
if (m_state == PROJECT_STATE_NOT_LOADED)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ bool Project::refresh(bool forceRefresh)
|
||||
m_settings->reload();
|
||||
|
||||
m_sourceGroups = SourceGroupFactory::getInstance()->createSourceGroups(m_settings->getAllSourceGroupSettings());
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
if (!sourceGroup->prepareRefresh())
|
||||
{
|
||||
@@ -275,7 +275,7 @@ void Project::load()
|
||||
bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh)
|
||||
{
|
||||
std::set<FilePath> allSourceFilePaths;
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
if (!sourceGroup->prepareIndexing())
|
||||
{
|
||||
@@ -357,7 +357,7 @@ bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh)
|
||||
}
|
||||
|
||||
std::set<FilePath> filesToIndex;
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
sourceGroup->fetchSourceFilePathsToIndex(staticSourceFilePaths);
|
||||
utility::append(filesToIndex, sourceGroup->getSourceFilePathsToIndex());
|
||||
@@ -432,9 +432,9 @@ void Project::buildIndex(
|
||||
|
||||
std::set<FilePath> filesToIndexTemp = filesToIndex;
|
||||
std::shared_ptr<IndexerCommandList> indexerCommandList = std::make_shared<IndexerCommandList>();
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
|
||||
{
|
||||
for (std::shared_ptr<IndexerCommand> command: sourceGroup->getIndexerCommands(&filesToIndexTemp, fullRefresh))
|
||||
for (const std::shared_ptr<IndexerCommand>& command : sourceGroup->getIndexerCommands(&filesToIndexTemp, fullRefresh))
|
||||
{
|
||||
indexerCommandList->addCommand(command);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void Project::buildIndex(
|
||||
|
||||
bool Project::hasCxxSourceGroup() const
|
||||
{
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
if (sourceGroup->getLanguage() == LANGUAGE_C || sourceGroup->getLanguage() == LANGUAGE_CPP)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ void SourceGroupFactory::addModule(std::shared_ptr<SourceGroupFactoryModule> mod
|
||||
std::vector<std::shared_ptr<SourceGroup>> SourceGroupFactory::createSourceGroups(std::vector<std::shared_ptr<SourceGroupSettings>> allSourceGroupSettings)
|
||||
{
|
||||
std::vector<std::shared_ptr<SourceGroup>> sourceGroups;
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings: allSourceGroupSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& sourceGroupSettings: allSourceGroupSettings)
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup = createSourceGroup(sourceGroupSettings);
|
||||
if (sourceGroup)
|
||||
@@ -36,7 +36,7 @@ std::shared_ptr<SourceGroup> SourceGroupFactory::createSourceGroup(std::shared_p
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup;
|
||||
|
||||
for (std::shared_ptr<SourceGroupFactoryModule> module: m_modules)
|
||||
for (const std::shared_ptr<SourceGroupFactoryModule>& module: m_modules)
|
||||
{
|
||||
if (module->supports(settings->getType()))
|
||||
{
|
||||
|
||||
@@ -377,7 +377,7 @@ std::vector<FilePath> ApplicationSettings::getRecentProjects() const
|
||||
std::vector<FilePath> recentProjects;
|
||||
std::vector<FilePath> loadedRecentProjects = getPathValues("user/recent_projects/recent_project");
|
||||
|
||||
for (FilePath project: loadedRecentProjects)
|
||||
for (const FilePath& project: loadedRecentProjects)
|
||||
{
|
||||
if (project.isAbsolute())
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "utility/utilityUuid.h"
|
||||
|
||||
const size_t ProjectSettings::VERSION = 4;
|
||||
const std::string PROJECT_FILE_EXTENSION = ".srctrlprj";
|
||||
const char PROJECT_FILE_EXTENSION[] = ".srctrlprj";
|
||||
|
||||
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
{
|
||||
@@ -17,7 +17,7 @@ LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.load(filePath);
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings: projectSettings.getAllSourceGroupSettings())
|
||||
for (const std::shared_ptr<SourceGroupSettings>& sourceGroupSettings: projectSettings.getAllSourceGroupSettings())
|
||||
{
|
||||
const LanguageType currentLanguageType = getLanguageTypeForSourceGroupType(sourceGroupSettings->getType());
|
||||
if (languageType == LANGUAGE_UNKNOWN)
|
||||
@@ -63,10 +63,10 @@ bool ProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> mySourceGroup: allMySettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& mySourceGroup : allMySettings)
|
||||
{
|
||||
bool matched = false;
|
||||
for (std::shared_ptr<SourceGroupSettings> otherSourceGroup: allOtherSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& otherSourceGroup : allOtherSettings)
|
||||
{
|
||||
if (mySourceGroup->equals(otherSourceGroup))
|
||||
{
|
||||
@@ -211,7 +211,7 @@ void ProjectSettings::setAllSourceGroupSettings(const std::vector<std::shared_pt
|
||||
m_config->removeValues(key);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> settings: allSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& settings: allSettings)
|
||||
{
|
||||
const std::string key = "source_groups/source_group_" + settings->getId();
|
||||
const SourceGroupType type = settings->getType();
|
||||
|
||||
@@ -113,7 +113,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<int>& values)
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(atoi(valueString.c_str()));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<float>& values
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(static_cast<float>(atof(valueString.c_str())));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<bool>& values)
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(atoi(valueString.c_str()) != 0);
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ void conflicting_options(const boost::program_options::variables_map& vm,
|
||||
std::vector<FilePath> extractPaths(const std::vector<std::string>& vector)
|
||||
{
|
||||
std::vector<FilePath> v;
|
||||
for (std::string s : vector)
|
||||
for (const std::string& s : vector)
|
||||
{
|
||||
std::vector<std::string> temp= utility::splitToVector(s, ',');
|
||||
for (std::string path : temp)
|
||||
for (const std::string& path : temp)
|
||||
{
|
||||
v.push_back(FilePath(path));
|
||||
}
|
||||
}
|
||||
return std::move(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace cmd
|
||||
|
||||
@@ -24,7 +24,7 @@ void FileManager::update(
|
||||
|
||||
m_allSourceFilePaths.clear();
|
||||
|
||||
for (FileInfo fileInfo: FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
|
||||
for (const FileInfo& fileInfo : FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
|
||||
{
|
||||
const FilePath& filePath = fileInfo.path;
|
||||
if (isExcluded(filePath))
|
||||
@@ -76,7 +76,7 @@ std::set<FilePath> FileManager::getAllSourceFilePathsRelative(const FilePath& ba
|
||||
std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
std::vector<FilePath> ret;
|
||||
for (const FilePath filePath: filePaths)
|
||||
for (const FilePath& filePath: filePaths)
|
||||
{
|
||||
ret.push_back(filePath.canonical());
|
||||
}
|
||||
@@ -85,7 +85,7 @@ std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& fi
|
||||
|
||||
bool FileManager::isExcluded(const FilePath& filePath) const
|
||||
{
|
||||
for (FilePath path : m_excludePaths)
|
||||
for (const FilePath& path : m_excludePaths)
|
||||
{
|
||||
if (path == filePath || path.contains(filePath))
|
||||
{
|
||||
|
||||
@@ -322,7 +322,7 @@ FilePath FilePath::replaceExtension(const std::string& extension) const
|
||||
bool FilePath::hasExtension(const std::vector<std::string>& extensions) const
|
||||
{
|
||||
std::string e = extension();
|
||||
for (std::string ext : extensions)
|
||||
for (const std::string& ext : extensions)
|
||||
{
|
||||
if (e == ext)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ bool FileRegisterStateData::fileIsIndexed(const FilePath& filePath) const
|
||||
|
||||
void FileRegisterStateData::setIndexedFiles(const std::set<FilePath>& filePaths)
|
||||
{
|
||||
for (auto path : filePaths)
|
||||
for (auto& path : filePaths)
|
||||
{
|
||||
m_filePaths[path] = STATE_INDEXED;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void Tracer::printTraces()
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
size_t unfinishEvents = 0;
|
||||
for (auto p : m_startedEvents)
|
||||
for (auto& p : m_startedEvents)
|
||||
{
|
||||
unfinishEvents += p.second.size();
|
||||
}
|
||||
@@ -67,11 +67,11 @@ void Tracer::printTraces()
|
||||
std::cout << "-----------------------------------------------------------------";
|
||||
std::cout << "------------------------------------------------------------\n";
|
||||
|
||||
for (auto p : m_events)
|
||||
for (auto& p : m_events)
|
||||
{
|
||||
std::cout << "thread: " << p.first << std::endl;
|
||||
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
for (const std::shared_ptr<TraceEvent>& event : p.second)
|
||||
{
|
||||
std::cout.width(8 + 2 * event->depth);
|
||||
std::cout << std::right << std::setprecision(3) << std::fixed << event->time;
|
||||
@@ -104,9 +104,9 @@ void Tracer::printTraces()
|
||||
|
||||
std::map<std::string, AccumulatedTraceEvent> accumulatedEvents;
|
||||
|
||||
for (auto p : m_events)
|
||||
for (auto& p : m_events)
|
||||
{
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
for (const std::shared_ptr<TraceEvent>& event : p.second)
|
||||
{
|
||||
std::string name = event->eventName + event->functionName + event->locationName;
|
||||
|
||||
@@ -136,7 +136,7 @@ void Tracer::printTraces()
|
||||
}
|
||||
);
|
||||
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent> p : accumulatedEvents)
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent>& p : accumulatedEvents)
|
||||
{
|
||||
sortedEvents.insert(p.second);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace utility
|
||||
{
|
||||
std::deque<std::string> c;
|
||||
|
||||
for (std::string str : list)
|
||||
for (const std::string& str : list)
|
||||
{
|
||||
if (str.size())
|
||||
{
|
||||
@@ -322,7 +322,7 @@ namespace utility
|
||||
}
|
||||
|
||||
paramPart = "";
|
||||
for (std::string str : paramLines)
|
||||
for (const std::string& str : paramLines)
|
||||
{
|
||||
paramPart += "\n\t" + str;
|
||||
size_t length = tabWidth + str.size();
|
||||
|
||||
Reference in New Issue
Block a user