Clang: Fix unit-tests build for MSVC 2015

Change-Id: If81ad5d8ea704a2714d3088024d701202e9854f2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-02-23 12:28:30 +01:00
parent 39dd8ebc6e
commit d0273f83f9
5 changed files with 16 additions and 12 deletions

View File

@@ -37,8 +37,6 @@
namespace ClangBackEnd { namespace ClangBackEnd {
using uint = unsigned int;
template<class T> template<class T>
class TokenProcessor class TokenProcessor
{ {
@@ -54,7 +52,7 @@ public:
TokenProcessor(CXTranslationUnit cxTranslationUnit, const SourceRange &range) TokenProcessor(CXTranslationUnit cxTranslationUnit, const SourceRange &range)
: cxTranslationUnit(cxTranslationUnit) : cxTranslationUnit(cxTranslationUnit)
{ {
uint cxTokensCount = 0; unsigned cxTokensCount = 0;
clang_tokenize(cxTranslationUnit, range, &cxTokens, &cxTokensCount); clang_tokenize(cxTranslationUnit, range, &cxTokens, &cxTokensCount);
cxCursors.resize(cxTokensCount); cxCursors.resize(cxTokensCount);
clang_annotateTokens(cxTranslationUnit, cxTokens, cxTokensCount, cxCursors.data()); clang_annotateTokens(cxTranslationUnit, cxTokens, cxTokensCount, cxCursors.data());
@@ -72,7 +70,7 @@ public:
{ {
return cxTokens == nullptr; return cxTokens == nullptr;
} }
uint size() const size_t size() const
{ {
return cxCursors.size(); return cxCursors.size();
} }

View File

@@ -34,8 +34,6 @@
namespace ClangBackEnd { namespace ClangBackEnd {
using uint = unsigned int;
class DiagnosticSet; class DiagnosticSet;
class Diagnostic; class Diagnostic;

View File

@@ -227,7 +227,9 @@ TEST_F(ClientServerInProcess, UpdateVisibleTranslationUnitsMessage)
TEST_F(ClientServerInProcess, SendDocumentAnnotationsChangedMessage) TEST_F(ClientServerInProcess, SendDocumentAnnotationsChangedMessage)
{ {
ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, {ClangBackEnd::HighlightingType::Keyword, {}}); ClangBackEnd::HighlightingTypes types;
types.mainHighlightingType = ClangBackEnd::HighlightingType::Keyword;
ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, types);
ClangBackEnd::DiagnosticContainer diagnostic(Utf8StringLiteral("don't do that"), ClangBackEnd::DiagnosticContainer diagnostic(Utf8StringLiteral("don't do that"),
Utf8StringLiteral("warning"), Utf8StringLiteral("warning"),
{Utf8StringLiteral("-Wpadded"), Utf8StringLiteral("-Wno-padded")}, {Utf8StringLiteral("-Wpadded"), Utf8StringLiteral("-Wno-padded")},

View File

@@ -82,7 +82,9 @@ QVector<TokenInfoContainer> generateTokenInfos(uint count)
for (uint i = 0; i < count; ++i) { for (uint i = 0; i < count; ++i) {
const uint line = i + 1; const uint line = i + 1;
container.append(TokenInfoContainer(line, 1, 1, {HighlightingType::Type, {}})); ClangBackEnd::HighlightingTypes types;
types.mainHighlightingType = ClangBackEnd::HighlightingType::Type;
container.append(TokenInfoContainer(line, 1, 1, types));
} }
return container; return container;
@@ -155,10 +157,12 @@ TEST_F(HighlightingResultReporter, ReportSingleChunkAndRest)
TEST_F(HighlightingResultReporter, ReportCompleteLines) TEST_F(HighlightingResultReporter, ReportCompleteLines)
{ {
ClangBackEnd::HighlightingTypes types;
types.mainHighlightingType = ClangBackEnd::HighlightingType::Type;
QVector<TokenInfoContainer> tokenInfos { QVector<TokenInfoContainer> tokenInfos {
TokenInfoContainer(1, 1, 1, {HighlightingType::Type, {}}), TokenInfoContainer(1, 1, 1, types),
TokenInfoContainer(1, 2, 1, {HighlightingType::Type, {}}), TokenInfoContainer(1, 2, 1, types),
TokenInfoContainer(2, 1, 1, {HighlightingType::Type, {}}), TokenInfoContainer(2, 1, 1, types),
}; };
auto reporter = new ClangCodeModel::HighlightingResultReporter(tokenInfos); auto reporter = new ClangCodeModel::HighlightingResultReporter(tokenInfos);
reporter->setChunkSize(1); reporter->setChunkSize(1);

View File

@@ -232,7 +232,9 @@ TEST_F(ReadAndWriteMessageBlock, CompareDocumentAnnotationsChangedMessage)
{}, {},
{}); {});
ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, {ClangBackEnd::HighlightingType::Keyword, {}}); ClangBackEnd::HighlightingTypes types;
types.mainHighlightingType = ClangBackEnd::HighlightingType::Keyword;
ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, types);
CompareMessage(ClangBackEnd::DocumentAnnotationsChangedMessage(fileContainer, CompareMessage(ClangBackEnd::DocumentAnnotationsChangedMessage(fileContainer,
{diagnostic}, {diagnostic},