src: fixed some clang tidy warnings
* implemented CxxDeclName constructors that just move the members * removed empty destructors because they disable default move constructors * removed some unnecessary code * replaced ".size() == 0" with ".empty()" because it's more explicit
This commit is contained in:
@@ -41,7 +41,7 @@ void Graph::forEachToken(std::function<void(Token*)> func) const
|
||||
forEachEdge(func);
|
||||
}
|
||||
|
||||
Node* Graph::createNode(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined)
|
||||
Node* Graph::createNode(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined)
|
||||
{
|
||||
Node* n = getNodeById(id);
|
||||
if (n)
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
void forEachEdge(std::function<void(Edge*)> func) const;
|
||||
void forEachToken(std::function<void(Token*)> func) const;
|
||||
|
||||
Node* createNode(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined);
|
||||
Node* createNode(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined);
|
||||
Edge* createEdge(Id id, Edge::EdgeType type, Node* from, Node* to);
|
||||
|
||||
size_t getNodeCount() const;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "data/graph/token_component/TokenComponentStatic.h"
|
||||
#include "data/graph/token_component/TokenComponentFilePath.h"
|
||||
|
||||
Node::Node(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined)
|
||||
Node::Node(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined)
|
||||
: Token(id)
|
||||
, m_type(type)
|
||||
, m_nameHierarchy(nameHierarchy)
|
||||
|
||||
@@ -22,7 +22,7 @@ class Node
|
||||
: public Token
|
||||
{
|
||||
public:
|
||||
Node(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined);
|
||||
Node(Id id, NodeType type, const NameHierarchy& nameHierarchy, bool defined);
|
||||
Node(const Node& other);
|
||||
virtual ~Node();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
std::string NameHierarchy::serialize(NameHierarchy nameHierarchy)
|
||||
std::string NameHierarchy::serialize(const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
std::string serializedName = nameDelimiterTypeToString(nameHierarchy.getDelimiter()) + "\tm";
|
||||
for (size_t i = 0; i < nameHierarchy.size(); i++)
|
||||
@@ -75,6 +75,18 @@ NameHierarchy::NameHierarchy(const std::vector<std::string>& names, const NameDe
|
||||
}
|
||||
}
|
||||
|
||||
NameHierarchy::NameHierarchy(const NameHierarchy& other)
|
||||
: m_elements(other.m_elements)
|
||||
, m_delimiter(other.m_delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy::NameHierarchy(NameHierarchy&& other)
|
||||
: m_elements(std::move(other.m_elements))
|
||||
, m_delimiter(other.m_delimiter)
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy::~NameHierarchy()
|
||||
{
|
||||
}
|
||||
@@ -103,6 +115,20 @@ std::shared_ptr<NameElement> NameHierarchy::operator[](size_t pos) const
|
||||
return m_elements[pos];
|
||||
}
|
||||
|
||||
NameHierarchy& NameHierarchy::operator=(const NameHierarchy& other)
|
||||
{
|
||||
m_elements = other.m_elements;
|
||||
m_delimiter = other.m_delimiter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NameHierarchy& NameHierarchy::operator=(NameHierarchy&& other)
|
||||
{
|
||||
m_elements = std::move(other.m_elements);
|
||||
m_delimiter = other.m_delimiter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NameHierarchy NameHierarchy::getRange(size_t first, size_t last) const
|
||||
{
|
||||
NameHierarchy hierarchy(m_delimiter);
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
class NameHierarchy
|
||||
{
|
||||
public:
|
||||
static std::string serialize(NameHierarchy nameHierarchy);
|
||||
static std::string serialize(const NameHierarchy& nameHierarchy);
|
||||
static NameHierarchy deserialize(const std::string& serializedName);
|
||||
|
||||
NameHierarchy(const NameDelimiterType delimiter);
|
||||
NameHierarchy(const std::string& name, const NameDelimiterType delimiter);
|
||||
NameHierarchy(const std::vector<std::string>& names, const NameDelimiterType delimiter);
|
||||
NameHierarchy(const NameHierarchy& other);
|
||||
NameHierarchy(NameHierarchy&& other);
|
||||
~NameHierarchy();
|
||||
|
||||
NameDelimiterType getDelimiter() const;
|
||||
@@ -27,6 +29,8 @@ public:
|
||||
|
||||
std::shared_ptr<NameElement> back() const;
|
||||
std::shared_ptr<NameElement> operator[](size_t pos) const;
|
||||
NameHierarchy& operator=(const NameHierarchy& other);
|
||||
NameHierarchy& operator=(NameHierarchy&& other);
|
||||
|
||||
NameHierarchy getRange(size_t first, size_t last) const;
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ void ParserClientImpl::addAccess(Id nodeId, AccessKind access)
|
||||
}
|
||||
}
|
||||
|
||||
Id ParserClientImpl::addNodeHierarchy(NameHierarchy nameHierarchy, NodeType nodeType)
|
||||
Id ParserClientImpl::addNodeHierarchy(const NameHierarchy& nameHierarchy, NodeType nodeType)
|
||||
{
|
||||
if (nameHierarchy.size() == 0)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ Id ParserClientImpl::addNodeHierarchy(NameHierarchy nameHierarchy, NodeType node
|
||||
return parentNodeId;
|
||||
}
|
||||
|
||||
Id ParserClientImpl::addNode(NodeType nodeType, NameHierarchy nameHierarchy)
|
||||
Id ParserClientImpl::addNode(NodeType nodeType, const NameHierarchy& nameHierarchy)
|
||||
{
|
||||
if (!m_storage)
|
||||
{
|
||||
|
||||
@@ -50,9 +50,9 @@ private:
|
||||
NodeType symbolKindToNodeType(SymbolKind symbolType) const;
|
||||
Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const;
|
||||
void addAccess(Id nodeId, AccessKind access);
|
||||
Id addNodeHierarchy(NameHierarchy nameHierarchy, NodeType nodeType = NodeType::NODE_SYMBOL);
|
||||
Id addNodeHierarchy(const NameHierarchy& nameHierarchy, NodeType nodeType = NodeType::NODE_SYMBOL);
|
||||
|
||||
Id addNode(NodeType nodeType, NameHierarchy nameHierarchy);
|
||||
Id addNode(NodeType nodeType, const NameHierarchy& nameHierarchy);
|
||||
void addFile(Id id, const FilePath& filePath, const std::string& modificationTime);
|
||||
void addSymbol(Id id, DefinitionKind definitionKind);
|
||||
Id addEdge(int type, Id sourceId, Id targetId);
|
||||
|
||||
@@ -84,7 +84,7 @@ FilePath::~FilePath()
|
||||
|
||||
boost::filesystem::path FilePath::getPath() const
|
||||
{
|
||||
return boost::filesystem::path(*(m_path.get()));
|
||||
return *(m_path.get());
|
||||
}
|
||||
|
||||
bool FilePath::empty() const
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
explicit FilePath(const char* filePath);
|
||||
explicit FilePath(const std::string& filePath);
|
||||
explicit FilePath(const boost::filesystem::path& filePath);
|
||||
FilePath(const FilePath& filePath);
|
||||
FilePath(const FilePath& other);
|
||||
FilePath(FilePath&& other);
|
||||
FilePath(const std::string& filePath, const std::string& base);
|
||||
~FilePath();
|
||||
|
||||
@@ -24,7 +24,7 @@ SharedMemoryGarbageCollector* SharedMemoryGarbageCollector::createInstance()
|
||||
s_instance = std::shared_ptr<SharedMemoryGarbageCollector>(new SharedMemoryGarbageCollector());
|
||||
}
|
||||
}
|
||||
catch (boost::interprocess::interprocess_exception& e)
|
||||
catch (boost::interprocess::interprocess_exception)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user