forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -69,6 +69,4 @@ private:
|
||||
std::vector<CXCursor> cxCursor;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const TokenInfos &marks);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Reference in New Issue
Block a user