Clang: Move printing functions in clang support to unit tests

The printing functions are only used by the unit tests and they use an
external API. So we can easily move them to the printing functions in
the unit test project. We have to move the TokenInfo print functions too
because the depend on other print functions. The rest of the print
functions will be moved in other patches.

Change-Id: I87c452f8ca40687ec47de675ba6bee13efa5655b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Marco Bubke
2017-11-30 16:11:40 +01:00
parent 8cce4daa80
commit bb62fd3e56
106 changed files with 768 additions and 716 deletions

View File

@@ -32,9 +32,6 @@
#include "sourcerange.h"
#include "sourcerangecontainer.h"
#include <cstring>
#include <ostream>
#include <QDebug>
namespace ClangBackEnd {
@@ -471,15 +468,4 @@ void TokenInfo::collectKinds(CXTranslationUnit cxTranslationUnit,
m_isInclusion = (cursor.kind() == CXCursor_InclusionDirective);
}
std::ostream &operator<<(std::ostream &os, const TokenInfo& tokenInfo)
{
os << "(type: " << tokenInfo.m_types << ", "
<< " line: " << tokenInfo.m_line << ", "
<< " column: " << tokenInfo.m_column << ", "
<< " length: " << tokenInfo.m_length
<< ")";
return os;
}
} // namespace ClangBackEnd

View File

@@ -62,6 +62,26 @@ public:
operator TokenInfoContainer() const;
const HighlightingTypes &types() const
{
return m_types;
}
uint line () const
{
return m_line;
}
uint column() const
{
return m_column;
}
uint length() const
{
return m_length;
}
private:
void identifierKind(const Cursor &cursor, Recursion recursion);
void referencedTypeKind(const Cursor &cursor);
@@ -81,8 +101,6 @@ private:
void filterOutPreviousOutputArguments();
bool isArgumentInCurrentOutputArgumentLocations() const;
friend std::ostream &operator<<(std::ostream &os, const TokenInfo& tokenInfo);
private:
std::vector<CXSourceRange> *m_currentOutputArgumentRanges = nullptr;
Cursor m_originalCursor;

View File

@@ -106,16 +106,4 @@ TokenInfo TokenInfos::operator[](size_t index) const
currentOutputArgumentRanges);
}
std::ostream &operator<<(std::ostream &out, const TokenInfos &marks)
{
out << "[";
for (const TokenInfo entry : marks)
out << entry;
out << "]";
return out;
}
} // namespace ClangBackEnd

View File

@@ -69,6 +69,4 @@ private:
std::vector<CXCursor> cxCursor;
};
std::ostream &operator<<(std::ostream &out, const TokenInfos &marks);
} // namespace ClangBackEnd