forked from qt-creator/qt-creator
Clang: Rename HighlightingInformation to HighlightingMark
Change-Id: I3954c7c9abe593ea04092337f48ac2b153e883ba Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -23,8 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
#define CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
#pragma once
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
|
||||
@@ -63,5 +62,3 @@ CMBIPC_EXPORT void PrintTo(HighlightingType highlightingType, ::std::ostream *os
|
||||
void PrintTo(const HighlightingMarkContainer &container, ::std::ostream *os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
|
||||
@@ -27,12 +27,12 @@ HEADERS += $$PWD/clangipcserver.h \
|
||||
$$PWD/translationunitalreadyexistsexception.h \
|
||||
$$PWD/commandlinearguments.h \
|
||||
$$PWD/cursor.h \
|
||||
$$PWD/highlightinginformations.h \
|
||||
$$PWD/highlightinginformation.h \
|
||||
$$PWD/highlightinginformationsiterator.h \
|
||||
$$PWD/skippedsourceranges.h \
|
||||
$$PWD/clangtranslationunit.h \
|
||||
$$PWD/clangtype.h
|
||||
$$PWD/clangtype.h \
|
||||
$$PWD/highlightingmark.h \
|
||||
$$PWD/highlightingmarks.h \
|
||||
$$PWD/highlightingmarksiterator.h
|
||||
|
||||
SOURCES += $$PWD/clangipcserver.cpp \
|
||||
$$PWD/codecompleter.cpp \
|
||||
@@ -60,8 +60,8 @@ SOURCES += $$PWD/clangipcserver.cpp \
|
||||
$$PWD/translationunitalreadyexistsexception.cpp \
|
||||
$$PWD/commandlinearguments.cpp \
|
||||
$$PWD/cursor.cpp \
|
||||
$$PWD/highlightinginformations.cpp \
|
||||
$$PWD/highlightinginformation.cpp \
|
||||
$$PWD/skippedsourceranges.cpp \
|
||||
$$PWD/clangtranslationunit.cpp \
|
||||
$$PWD/clangtype.cpp
|
||||
$$PWD/clangtype.cpp \
|
||||
$$PWD/highlightingmark.cpp \
|
||||
$$PWD/highlightingmarks.cpp
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "clangfilesystemwatcher.h"
|
||||
#include "codecompleter.h"
|
||||
#include "diagnosticset.h"
|
||||
#include "highlightinginformations.h"
|
||||
#include "highlightingmarks.h"
|
||||
#include "projectpartsdonotexistexception.h"
|
||||
#include "skippedsourceranges.h"
|
||||
#include "translationunitdoesnotexistexception.h"
|
||||
@@ -288,7 +288,7 @@ void ClangIpcServer::requestHighlighting(const RequestHighlightingMessage &messa
|
||||
message.fileContainer().projectPartId());
|
||||
|
||||
client()->highlightingChanged(HighlightingChangedMessage(translationUnit.fileContainer(),
|
||||
translationUnit.highlightingInformations().toHighlightingMarksContainers(),
|
||||
translationUnit.highlightingMarks().toHighlightingMarksContainers(),
|
||||
translationUnit.skippedSourceRanges().toSourceRangeContainers()));
|
||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "skippedsourceranges.h"
|
||||
#include "sourcelocation.h"
|
||||
#include "sourcerange.h"
|
||||
#include "highlightinginformations.h"
|
||||
#include "highlightingmarks.h"
|
||||
#include "translationunitfilenotexitexception.h"
|
||||
#include "translationunitisnullexception.h"
|
||||
#include "translationunitparseerrorexception.h"
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
uint documentRevision = 0;
|
||||
bool needsToBeReparsed = false;
|
||||
bool hasNewDiagnostics = true;
|
||||
bool hasNewHighlightingInformations = true;
|
||||
bool hasNewHighlightingMarks = true;
|
||||
bool isUsedByCurrentEditor = false;
|
||||
bool isVisibleInEditor = false;
|
||||
};
|
||||
@@ -247,9 +247,9 @@ bool TranslationUnit::hasNewDiagnostics() const
|
||||
return d->hasNewDiagnostics;
|
||||
}
|
||||
|
||||
bool TranslationUnit::hasNewHighlightingInformations() const
|
||||
bool TranslationUnit::hasNewHighlightingMarks() const
|
||||
{
|
||||
return d->hasNewHighlightingInformations;
|
||||
return d->hasNewHighlightingMarks;
|
||||
}
|
||||
|
||||
DiagnosticSet TranslationUnit::diagnostics() const
|
||||
@@ -319,14 +319,14 @@ Cursor TranslationUnit::cursor() const
|
||||
return clang_getTranslationUnitCursor(cxTranslationUnit());
|
||||
}
|
||||
|
||||
HighlightingInformations TranslationUnit::highlightingInformations() const
|
||||
HighlightingMarks TranslationUnit::highlightingMarks() const
|
||||
{
|
||||
d->hasNewHighlightingInformations = false;
|
||||
d->hasNewHighlightingMarks = false;
|
||||
|
||||
return highlightingInformationsInRange(cursor().sourceRange());
|
||||
return highlightingMarksInRange(cursor().sourceRange());
|
||||
}
|
||||
|
||||
HighlightingInformations TranslationUnit::highlightingInformationsInRange(const SourceRange &range) const
|
||||
HighlightingMarks TranslationUnit::highlightingMarksInRange(const SourceRange &range) const
|
||||
{
|
||||
CXToken *cxTokens = 0;
|
||||
uint cxTokensCount = 0;
|
||||
@@ -334,7 +334,7 @@ HighlightingInformations TranslationUnit::highlightingInformationsInRange(const
|
||||
|
||||
clang_tokenize(translationUnit, range, &cxTokens, &cxTokensCount);
|
||||
|
||||
return HighlightingInformations(translationUnit, cxTokens, cxTokensCount);
|
||||
return HighlightingMarks(translationUnit, cxTokens, cxTokensCount);
|
||||
}
|
||||
|
||||
SkippedSourceRanges TranslationUnit::skippedSourceRanges() const
|
||||
@@ -376,7 +376,7 @@ void TranslationUnit::setDirty()
|
||||
{
|
||||
d->needsToBeReparsed = true;
|
||||
d->hasNewDiagnostics = true;
|
||||
d->hasNewHighlightingInformations = true;
|
||||
d->hasNewHighlightingMarks = true;
|
||||
}
|
||||
|
||||
bool TranslationUnit::isMainFileAndExistsOrIsOtherFile(const Utf8String &filePath) const
|
||||
|
||||
@@ -48,7 +48,7 @@ class ProjectPart;
|
||||
class DiagnosticContainer;
|
||||
class DiagnosticSet;
|
||||
class FileContainer;
|
||||
class HighlightingInformations;
|
||||
class HighlightingMarks;
|
||||
class TranslationUnits;
|
||||
class CommandLineArguments;
|
||||
class Cursor;
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
bool isNeedingReparse() const;
|
||||
bool hasNewDiagnostics() const;
|
||||
bool hasNewHighlightingInformations() const;
|
||||
bool hasNewHighlightingMarks() const;
|
||||
|
||||
DiagnosticSet diagnostics() const;
|
||||
QVector<DiagnosticContainer> mainFileDiagnostics() const;
|
||||
@@ -134,8 +134,8 @@ public:
|
||||
Cursor cursorAt(const Utf8String &filePath, uint line, uint column) const;
|
||||
Cursor cursor() const;
|
||||
|
||||
HighlightingInformations highlightingInformations() const;
|
||||
HighlightingInformations highlightingInformationsInRange(const SourceRange &range) const;
|
||||
HighlightingMarks highlightingMarks() const;
|
||||
HighlightingMarks highlightingMarksInRange(const SourceRange &range) const;
|
||||
|
||||
SkippedSourceRanges skippedSourceRanges() const;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "clangstring.h"
|
||||
#include "cursor.h"
|
||||
#include "highlightinginformation.h"
|
||||
#include "highlightingmark.h"
|
||||
#include "sourcelocation.h"
|
||||
#include "sourcerange.h"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
HighlightingInformation::HighlightingInformation(const CXCursor &cxCursor,
|
||||
HighlightingMark::HighlightingMark(const CXCursor &cxCursor,
|
||||
CXToken *cxToken,
|
||||
CXTranslationUnit cxTranslationUnit)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ HighlightingInformation::HighlightingInformation(const CXCursor &cxCursor,
|
||||
type = kind(cxToken, originalCursor);
|
||||
}
|
||||
|
||||
HighlightingInformation::HighlightingInformation(uint line, uint column, uint length, HighlightingType type)
|
||||
HighlightingMark::HighlightingMark(uint line, uint column, uint length, HighlightingType type)
|
||||
: line(line),
|
||||
column(column),
|
||||
length(length),
|
||||
@@ -61,24 +61,24 @@ HighlightingInformation::HighlightingInformation(uint line, uint column, uint le
|
||||
{
|
||||
}
|
||||
|
||||
bool HighlightingInformation::hasType(HighlightingType type) const
|
||||
bool HighlightingMark::hasType(HighlightingType type) const
|
||||
{
|
||||
return this->type == type;
|
||||
}
|
||||
|
||||
bool HighlightingInformation::hasFunctionArguments() const
|
||||
bool HighlightingMark::hasFunctionArguments() const
|
||||
{
|
||||
return originalCursor.argumentCount() > 0;
|
||||
}
|
||||
|
||||
QVector<HighlightingInformation> HighlightingInformation::outputFunctionArguments() const
|
||||
QVector<HighlightingMark> HighlightingMark::outputFunctionArguments() const
|
||||
{
|
||||
QVector<HighlightingInformation> outputFunctionArguments;
|
||||
QVector<HighlightingMark> outputFunctionArguments;
|
||||
|
||||
return outputFunctionArguments;
|
||||
}
|
||||
|
||||
HighlightingInformation::operator HighlightingMarkContainer() const
|
||||
HighlightingMark::operator HighlightingMarkContainer() const
|
||||
{
|
||||
return HighlightingMarkContainer(line, column, length, type);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ bool isFunctionInFinalClass(const Cursor &cursor)
|
||||
}
|
||||
}
|
||||
|
||||
HighlightingType HighlightingInformation::memberReferenceKind(const Cursor &cursor) const
|
||||
HighlightingType HighlightingMark::memberReferenceKind(const Cursor &cursor) const
|
||||
{
|
||||
if (cursor.isDynamicCall()) {
|
||||
if (isFinalFunction(cursor) || isFunctionInFinalClass(cursor))
|
||||
@@ -117,7 +117,7 @@ HighlightingType HighlightingInformation::memberReferenceKind(const Cursor &curs
|
||||
|
||||
}
|
||||
|
||||
HighlightingType HighlightingInformation::referencedTypeKind(const Cursor &cursor) const
|
||||
HighlightingType HighlightingMark::referencedTypeKind(const Cursor &cursor) const
|
||||
{
|
||||
const Cursor referencedCursor = cursor.referenced();
|
||||
|
||||
@@ -135,7 +135,7 @@ HighlightingType HighlightingInformation::referencedTypeKind(const Cursor &curso
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
HighlightingType HighlightingInformation::variableKind(const Cursor &cursor) const
|
||||
HighlightingType HighlightingMark::variableKind(const Cursor &cursor) const
|
||||
{
|
||||
if (cursor.isLocalVariable())
|
||||
return HighlightingType::LocalVariable;
|
||||
@@ -143,7 +143,7 @@ HighlightingType HighlightingInformation::variableKind(const Cursor &cursor) con
|
||||
return HighlightingType::GlobalVariable;
|
||||
}
|
||||
|
||||
bool HighlightingInformation::isVirtualMethodDeclarationOrDefinition(const Cursor &cursor) const
|
||||
bool HighlightingMark::isVirtualMethodDeclarationOrDefinition(const Cursor &cursor) const
|
||||
{
|
||||
return cursor.isVirtualMethod()
|
||||
&& (originalCursor.isDeclaration() || originalCursor.isDefinition());
|
||||
@@ -155,13 +155,13 @@ bool isNotFinalFunction(const Cursor &cursor)
|
||||
}
|
||||
|
||||
}
|
||||
bool HighlightingInformation::isRealDynamicCall(const Cursor &cursor) const
|
||||
bool HighlightingMark::isRealDynamicCall(const Cursor &cursor) const
|
||||
{
|
||||
|
||||
return originalCursor.isDynamicCall() && isNotFinalFunction(cursor);
|
||||
}
|
||||
|
||||
HighlightingType HighlightingInformation::functionKind(const Cursor &cursor) const
|
||||
HighlightingType HighlightingMark::functionKind(const Cursor &cursor) const
|
||||
{
|
||||
if (isRealDynamicCall(cursor) || isVirtualMethodDeclarationOrDefinition(cursor))
|
||||
return HighlightingType::VirtualFunction;
|
||||
@@ -169,7 +169,7 @@ HighlightingType HighlightingInformation::functionKind(const Cursor &cursor) con
|
||||
return HighlightingType::Function;
|
||||
}
|
||||
|
||||
HighlightingType HighlightingInformation::identifierKind(const Cursor &cursor) const
|
||||
HighlightingType HighlightingMark::identifierKind(const Cursor &cursor) const
|
||||
{
|
||||
switch (cursor.kind()) {
|
||||
case CXCursor_Destructor:
|
||||
@@ -268,7 +268,7 @@ HighlightingType punctationKind(const Cursor &cursor)
|
||||
}
|
||||
|
||||
}
|
||||
HighlightingType HighlightingInformation::kind(CXToken *cxToken, const Cursor &cursor) const
|
||||
HighlightingType HighlightingMark::kind(CXToken *cxToken, const Cursor &cursor) const
|
||||
{
|
||||
auto cxTokenKind = clang_getTokenKind(*cxToken);
|
||||
|
||||
@@ -283,7 +283,7 @@ HighlightingType HighlightingInformation::kind(CXToken *cxToken, const Cursor &c
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
void PrintTo(const HighlightingInformation &information, ::std::ostream *os)
|
||||
void PrintTo(const HighlightingMark &information, ::std::ostream *os)
|
||||
{
|
||||
*os << "type: ";
|
||||
PrintTo(information.type, os);
|
||||
@@ -23,8 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLANGBACKEND_HIGHLIGHTINGINFORMATION_H
|
||||
#define CLANGBACKEND_HIGHLIGHTINGINFORMATION_H
|
||||
#pragma once
|
||||
|
||||
#include <clangbackendipc_global.h>
|
||||
#include <highlightingmarkcontainer.h>
|
||||
@@ -35,18 +34,18 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class HighlightingInformation
|
||||
class HighlightingMark
|
||||
{
|
||||
friend bool operator==(const HighlightingInformation &first, const HighlightingInformation &second);
|
||||
friend void PrintTo(const HighlightingInformation& highlightingInformation, ::std::ostream *os);
|
||||
friend bool operator==(const HighlightingMark &first, const HighlightingMark &second);
|
||||
friend void PrintTo(const HighlightingMark& highlightingMark, ::std::ostream *os);
|
||||
|
||||
public:
|
||||
HighlightingInformation(const CXCursor &cxCursor, CXToken *cxToken, CXTranslationUnit cxTranslationUnit);
|
||||
HighlightingInformation(uint line, uint column, uint length, HighlightingType type);
|
||||
HighlightingMark(const CXCursor &cxCursor, CXToken *cxToken, CXTranslationUnit cxTranslationUnit);
|
||||
HighlightingMark(uint line, uint column, uint length, HighlightingType type);
|
||||
|
||||
bool hasType(HighlightingType type) const;
|
||||
bool hasFunctionArguments() const;
|
||||
QVector<HighlightingInformation> outputFunctionArguments() const;
|
||||
QVector<HighlightingMark> outputFunctionArguments() const;
|
||||
|
||||
operator HighlightingMarkContainer() const;
|
||||
|
||||
@@ -68,9 +67,9 @@ private:
|
||||
HighlightingType type;
|
||||
};
|
||||
|
||||
void PrintTo(const HighlightingInformation& highlightingInformation, ::std::ostream *os);
|
||||
void PrintTo(const HighlightingMark& highlightingMark, ::std::ostream *os);
|
||||
|
||||
inline bool operator==(const HighlightingInformation &first, const HighlightingInformation &second)
|
||||
inline bool operator==(const HighlightingMark &first, const HighlightingMark &second)
|
||||
{
|
||||
return first.line == second.line
|
||||
&& first.column == second.column
|
||||
@@ -79,5 +78,3 @@ inline bool operator==(const HighlightingInformation &first, const HighlightingI
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGINFORMATION_H
|
||||
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "highlightinginformations.h"
|
||||
#include "highlightingmarks.h"
|
||||
|
||||
#include "highlightingmarkcontainer.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
HighlightingInformations::HighlightingInformations(CXTranslationUnit cxTranslationUnit, CXToken *tokens, uint tokensCount)
|
||||
HighlightingMarks::HighlightingMarks(CXTranslationUnit cxTranslationUnit, CXToken *tokens, uint tokensCount)
|
||||
: cxTranslationUnit(cxTranslationUnit),
|
||||
cxToken(tokens),
|
||||
cxTokenCount(tokensCount)
|
||||
@@ -40,27 +40,27 @@ HighlightingInformations::HighlightingInformations(CXTranslationUnit cxTranslati
|
||||
clang_annotateTokens(cxTranslationUnit, cxToken, cxTokenCount, cxCursor.data());
|
||||
}
|
||||
|
||||
HighlightingInformations::~HighlightingInformations()
|
||||
HighlightingMarks::~HighlightingMarks()
|
||||
{
|
||||
clang_disposeTokens(cxTranslationUnit, cxToken, cxTokenCount);
|
||||
}
|
||||
|
||||
HighlightingInformations::const_iterator HighlightingInformations::begin() const
|
||||
HighlightingMarks::const_iterator HighlightingMarks::begin() const
|
||||
{
|
||||
return const_iterator(cxCursor.cbegin(), cxToken, cxTranslationUnit);
|
||||
}
|
||||
|
||||
HighlightingInformations::const_iterator HighlightingInformations::end() const
|
||||
HighlightingMarks::const_iterator HighlightingMarks::end() const
|
||||
{
|
||||
return const_iterator(cxCursor.cend(), cxToken + cxTokenCount, cxTranslationUnit);
|
||||
}
|
||||
|
||||
QVector<HighlightingMarkContainer> HighlightingInformations::toHighlightingMarksContainers() const
|
||||
QVector<HighlightingMarkContainer> HighlightingMarks::toHighlightingMarksContainers() const
|
||||
{
|
||||
QVector<HighlightingMarkContainer> containers;
|
||||
containers.reserve(size());
|
||||
|
||||
const auto isValidHighlightMark = [] (const HighlightingInformation &highlightMark) {
|
||||
const auto isValidHighlightMark = [] (const HighlightingMark &highlightMark) {
|
||||
return !highlightMark.hasType(HighlightingType::Invalid);
|
||||
};
|
||||
|
||||
@@ -69,24 +69,24 @@ QVector<HighlightingMarkContainer> HighlightingInformations::toHighlightingMarks
|
||||
return containers;
|
||||
}
|
||||
|
||||
bool HighlightingInformations::isEmpty() const
|
||||
bool HighlightingMarks::isEmpty() const
|
||||
{
|
||||
return cxTokenCount == 0;
|
||||
}
|
||||
|
||||
bool ClangBackEnd::HighlightingInformations::isNull() const
|
||||
bool ClangBackEnd::HighlightingMarks::isNull() const
|
||||
{
|
||||
return cxToken == nullptr;
|
||||
}
|
||||
|
||||
uint HighlightingInformations::size() const
|
||||
uint HighlightingMarks::size() const
|
||||
{
|
||||
return cxTokenCount;
|
||||
}
|
||||
|
||||
HighlightingInformation HighlightingInformations::operator[](size_t index) const
|
||||
HighlightingMark HighlightingMarks::operator[](size_t index) const
|
||||
{
|
||||
return HighlightingInformation(cxCursor[index], cxToken + index, cxTranslationUnit);
|
||||
return HighlightingMark(cxCursor[index], cxToken + index, cxTranslationUnit);
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
@@ -23,10 +23,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLANGBACKEND_HIGHLIGHTINGINFORMATIONS_H
|
||||
#define CLANGBACKEND_HIGHLIGHTINGINFORMATIONS_H
|
||||
#pragma once
|
||||
|
||||
#include "highlightinginformationsiterator.h"
|
||||
#include "highlightingmarksiterator.h"
|
||||
|
||||
#include <clang-c/Index.h>
|
||||
|
||||
@@ -37,22 +36,22 @@ namespace ClangBackEnd {
|
||||
using uint = unsigned int;
|
||||
class HighlightingMarkContainer;
|
||||
|
||||
class HighlightingInformations
|
||||
class HighlightingMarks
|
||||
{
|
||||
public:
|
||||
using const_iterator = HighlightingInformationsIterator;
|
||||
using value_type = HighlightingInformation;
|
||||
using const_iterator = HighlightingMarksIterator;
|
||||
using value_type = HighlightingMark;
|
||||
|
||||
public:
|
||||
HighlightingInformations() = default;
|
||||
HighlightingInformations(CXTranslationUnit cxTranslationUnit, CXToken *tokens, uint tokensCount);
|
||||
~HighlightingInformations();
|
||||
HighlightingMarks() = default;
|
||||
HighlightingMarks(CXTranslationUnit cxTranslationUnit, CXToken *tokens, uint tokensCount);
|
||||
~HighlightingMarks();
|
||||
|
||||
bool isEmpty() const;
|
||||
bool isNull() const;
|
||||
uint size() const;
|
||||
|
||||
HighlightingInformation operator[](size_t index) const;
|
||||
HighlightingMark operator[](size_t index) const;
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
@@ -68,5 +67,3 @@ private:
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGINFORMATIONS_H
|
||||
@@ -23,10 +23,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef HIGHLIGHTINGINFORMATIONSITERATOR_H
|
||||
#define HIGHLIGHTINGINFORMATIONSITERATOR_H
|
||||
#pragma once
|
||||
|
||||
#include "highlightinginformation.h"
|
||||
#include "highlightingmark.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
@@ -40,10 +39,10 @@ using uint = unsigned int;
|
||||
class DiagnosticSet;
|
||||
class Diagnostic;
|
||||
|
||||
class HighlightingInformationsIterator : public std::iterator<std::forward_iterator_tag, HighlightingInformation, uint>
|
||||
class HighlightingMarksIterator : public std::iterator<std::forward_iterator_tag, HighlightingMark, uint>
|
||||
{
|
||||
public:
|
||||
HighlightingInformationsIterator(std::vector<CXCursor>::const_iterator cxCursorIterator,
|
||||
HighlightingMarksIterator(std::vector<CXCursor>::const_iterator cxCursorIterator,
|
||||
CXToken *cxToken,
|
||||
CXTranslationUnit cxTranslationUnit)
|
||||
: cxCursorIterator(cxCursorIterator),
|
||||
@@ -51,7 +50,7 @@ public:
|
||||
cxTranslationUnit(cxTranslationUnit)
|
||||
{}
|
||||
|
||||
HighlightingInformationsIterator& operator++()
|
||||
HighlightingMarksIterator& operator++()
|
||||
{
|
||||
++cxCursorIterator;
|
||||
++cxToken;
|
||||
@@ -59,24 +58,24 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
HighlightingInformationsIterator operator++(int)
|
||||
HighlightingMarksIterator operator++(int)
|
||||
{
|
||||
return HighlightingInformationsIterator(cxCursorIterator++, cxToken++, cxTranslationUnit);
|
||||
return HighlightingMarksIterator(cxCursorIterator++, cxToken++, cxTranslationUnit);
|
||||
}
|
||||
|
||||
bool operator==(HighlightingInformationsIterator other) const
|
||||
bool operator==(HighlightingMarksIterator other) const
|
||||
{
|
||||
return cxCursorIterator == other.cxCursorIterator;
|
||||
}
|
||||
|
||||
bool operator!=(HighlightingInformationsIterator other) const
|
||||
bool operator!=(HighlightingMarksIterator other) const
|
||||
{
|
||||
return cxCursorIterator != other.cxCursorIterator;
|
||||
}
|
||||
|
||||
HighlightingInformation operator*()
|
||||
HighlightingMark operator*()
|
||||
{
|
||||
return HighlightingInformation(*cxCursorIterator, cxToken, cxTranslationUnit);
|
||||
return HighlightingMark(*cxCursorIterator, cxToken, cxTranslationUnit);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -86,5 +85,3 @@ private:
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
#endif // HIGHLIGHTINGINFORMATIONSITERATOR_H
|
||||
@@ -37,7 +37,6 @@ class SourceRange
|
||||
friend class Diagnostic;
|
||||
friend class FixIt;
|
||||
friend class Cursor;
|
||||
friend class HighlightingInformation;
|
||||
friend bool operator==(const SourceRange &first, const SourceRange &second);
|
||||
|
||||
public:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <diagnosticschangedmessage.h>
|
||||
#include <diagnosticset.h>
|
||||
#include <highlightingchangedmessage.h>
|
||||
#include <highlightinginformations.h>
|
||||
#include <highlightingmarks.h>
|
||||
#include <projectpartsdonotexistexception.h>
|
||||
#include <projects.h>
|
||||
#include <skippedsourceranges.h>
|
||||
@@ -199,7 +199,7 @@ namespace {
|
||||
|
||||
bool translationUnitHasNewDocumentAnnotations(const TranslationUnit &translationUnit)
|
||||
{
|
||||
return translationUnit.hasNewDiagnostics() || translationUnit.hasNewHighlightingInformations();
|
||||
return translationUnit.hasNewDiagnostics() || translationUnit.hasNewHighlightingMarks();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -365,7 +365,7 @@ void TranslationUnits::sendDocumentAnnotations(const TranslationUnit &translatio
|
||||
DiagnosticsChangedMessage diagnosticsMessage(fileContainer,
|
||||
translationUnit.mainFileDiagnostics());
|
||||
HighlightingChangedMessage highlightingsMessage(fileContainer,
|
||||
translationUnit.highlightingInformations().toHighlightingMarksContainers(),
|
||||
translationUnit.highlightingMarks().toHighlightingMarksContainers(),
|
||||
translationUnit.skippedSourceRanges().toSourceRangeContainers());
|
||||
|
||||
sendDocumentAnnotationsCallback(std::move(diagnosticsMessage),
|
||||
|
||||
@@ -236,7 +236,7 @@ void f11()
|
||||
MacroDefinition(2, 4);
|
||||
}
|
||||
|
||||
#include "highlightinginformations.h"
|
||||
#include "highlightingmarks.h"
|
||||
|
||||
void f12() {
|
||||
GOTO_LABEL:
|
||||
@@ -286,7 +286,7 @@ void f12()
|
||||
OutputParameter(One, 2);
|
||||
}
|
||||
|
||||
#include <highlightinginformations.h>
|
||||
#include <highlightingmarks.h>
|
||||
|
||||
#define FOREACH(variable, container) \
|
||||
variable; \
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@
|
||||
#include "gtest-qt-printing.h"
|
||||
|
||||
using ClangBackEnd::Cursor;
|
||||
using ClangBackEnd::HighlightingInformations;
|
||||
using ClangBackEnd::HighlightingMarks;
|
||||
using ClangBackEnd::HighlightingMarkContainer;
|
||||
using ClangBackEnd::HighlightingType;
|
||||
using ClangBackEnd::TranslationUnit;
|
||||
@@ -54,7 +54,7 @@ struct Data {
|
||||
ProjectParts projects;
|
||||
UnsavedFiles unsavedFiles;
|
||||
TranslationUnits translationUnits{projects, unsavedFiles};
|
||||
TranslationUnit translationUnit{Utf8StringLiteral(TESTDATA_DIR"/highlightinginformations.cpp"),
|
||||
TranslationUnit translationUnit{Utf8StringLiteral(TESTDATA_DIR"/highlightingmarks.cpp"),
|
||||
ProjectPart(Utf8StringLiteral("projectPartId"),
|
||||
{Utf8StringLiteral("-std=c++14")}),
|
||||
{},
|
||||
|
||||
990
tests/unit/unittest/highlightingmarkstest.cpp
Normal file
990
tests/unit/unittest/highlightingmarkstest.cpp
Normal file
@@ -0,0 +1,990 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <cursor.h>
|
||||
#include <clangbackendipc_global.h>
|
||||
#include <clangstring.h>
|
||||
#include <projectpart.h>
|
||||
#include <projects.h>
|
||||
#include <sourcelocation.h>
|
||||
#include <sourcerange.h>
|
||||
#include <highlightingmark.h>
|
||||
#include <highlightingmarks.h>
|
||||
#include <clangtranslationunit.h>
|
||||
#include <translationunits.h>
|
||||
#include <unsavedfiles.h>
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "gtest-qt-printing.h"
|
||||
|
||||
using ClangBackEnd::Cursor;
|
||||
using ClangBackEnd::HighlightingMark;
|
||||
using ClangBackEnd::HighlightingMarks;
|
||||
using ClangBackEnd::HighlightingType;
|
||||
using ClangBackEnd::TranslationUnit;
|
||||
using ClangBackEnd::UnsavedFiles;
|
||||
using ClangBackEnd::ProjectPart;
|
||||
using ClangBackEnd::TranslationUnits;
|
||||
using ClangBackEnd::ClangString;
|
||||
using ClangBackEnd::SourceRange;
|
||||
|
||||
using testing::PrintToString;
|
||||
using testing::IsNull;
|
||||
using testing::NotNull;
|
||||
using testing::Gt;
|
||||
using testing::Contains;
|
||||
using testing::EndsWith;
|
||||
using testing::AllOf;
|
||||
using testing::Not;
|
||||
using testing::IsEmpty;
|
||||
using testing::SizeIs;
|
||||
|
||||
namespace {
|
||||
|
||||
MATCHER_P4(IsHighlightingMark, line, column, length, type,
|
||||
std::string(negation ? "isn't " : "is ")
|
||||
+ PrintToString(HighlightingMark(line, column, length, type))
|
||||
)
|
||||
{
|
||||
const HighlightingMark expected(line, column, length, type);
|
||||
|
||||
return arg == expected;
|
||||
}
|
||||
|
||||
MATCHER_P(HasType, type,
|
||||
std::string(negation ? "isn't " : "is ")
|
||||
+ PrintToString(type)
|
||||
)
|
||||
{
|
||||
return arg.hasType(type);
|
||||
}
|
||||
|
||||
struct Data {
|
||||
ClangBackEnd::ProjectParts projects;
|
||||
ClangBackEnd::UnsavedFiles unsavedFiles;
|
||||
ClangBackEnd::TranslationUnits translationUnits{projects, unsavedFiles};
|
||||
TranslationUnit translationUnit{Utf8StringLiteral(TESTDATA_DIR"/highlightingmarks.cpp"),
|
||||
ProjectPart(Utf8StringLiteral("projectPartId"), {Utf8StringLiteral("-std=c++14")}),
|
||||
{},
|
||||
translationUnits};
|
||||
};
|
||||
|
||||
class HighlightingMarks : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
|
||||
SourceRange sourceRange(uint line, uint columnEnd) const;
|
||||
|
||||
protected:
|
||||
static Data *d;
|
||||
const TranslationUnit &translationUnit = d->translationUnit;
|
||||
};
|
||||
|
||||
TEST_F(HighlightingMarks, CreateNullInformations)
|
||||
{
|
||||
::HighlightingMarks infos;
|
||||
|
||||
ASSERT_TRUE(infos.isNull());
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NullInformationsAreEmpty)
|
||||
{
|
||||
::HighlightingMarks infos;
|
||||
|
||||
ASSERT_TRUE(infos.isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, IsNotNull)
|
||||
{
|
||||
const auto aRange = translationUnit.sourceRange(3, 1, 5, 1);
|
||||
|
||||
const auto infos = translationUnit.highlightingMarksInRange(aRange);
|
||||
|
||||
ASSERT_FALSE(infos.isNull());
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, IteratorBeginEnd)
|
||||
{
|
||||
const auto aRange = translationUnit.sourceRange(3, 1, 5, 1);
|
||||
const auto infos = translationUnit.highlightingMarksInRange(aRange);
|
||||
|
||||
const auto endIterator = std::next(infos.begin(), infos.size());
|
||||
|
||||
ASSERT_THAT(infos.end(), endIterator);
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ForFullTranslationUnitRange)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarks();
|
||||
|
||||
ASSERT_THAT(infos, AllOf(Contains(IsHighlightingMark(1u, 1u, 4u, HighlightingType::Keyword)),
|
||||
Contains(IsHighlightingMark(277u, 5u, 15u, HighlightingType::Function))));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, Size)
|
||||
{
|
||||
const auto range = translationUnit.sourceRange(5, 5, 5, 10);
|
||||
|
||||
const auto infos = translationUnit.highlightingMarksInRange(range);
|
||||
|
||||
ASSERT_THAT(infos.size(), 1);
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_Keyword)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(5, 12));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(5u, 5u, 6u, HighlightingType::Keyword));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StringLiteral)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(1, 29));
|
||||
|
||||
ASSERT_THAT(infos[4], IsHighlightingMark(1u, 24u, 10u, HighlightingType::StringLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, Utf8StringLiteral)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(2, 33));
|
||||
|
||||
ASSERT_THAT(infos[4], IsHighlightingMark(2u, 24u, 12u, HighlightingType::StringLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, RawStringLiteral)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(3, 34));
|
||||
|
||||
ASSERT_THAT(infos[4], IsHighlightingMark(3u, 24u, 13u, HighlightingType::StringLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, CharacterLiteral)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(4, 28));
|
||||
|
||||
ASSERT_THAT(infos[3], IsHighlightingMark(4u, 24u, 3u, HighlightingType::StringLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, IntegerLiteral)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(23, 26));
|
||||
|
||||
ASSERT_THAT(infos[3], IsHighlightingMark(23u, 24u, 1u, HighlightingType::NumberLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FloatLiteral)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(24, 29));
|
||||
|
||||
ASSERT_THAT(infos[3], IsHighlightingMark(24u, 24u, 4u, HighlightingType::NumberLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FunctionDefinition)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(45, 20));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(45u, 5u, 8u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, MemberFunctionDefinition)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(52, 29));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(52u, 10u, 14u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FunctionDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(55, 32));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(55u, 5u, 19u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, MemberFunctionDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(59, 27));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(59u, 10u, 14u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, MemberFunctionReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(104, 35));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(104u, 9u, 23u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FunctionCall)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(64, 16));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(64u, 5u, 8u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TypeConversionFunction)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(68, 20));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(68u, 14u, 3u, HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, InbuiltTypeConversionFunction)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(69, 20));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(69u, 14u, 3u, HighlightingType::Keyword));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TypeReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(74, 13));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(74u, 5u, 3u, HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, LocalVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(79, 13));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, LocalVariableDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(79, 13));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, LocalVariableReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(81, 26));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(81u, 5u, 3u, HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, LocalVariableFunctionArgumentDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(84, 45));
|
||||
|
||||
ASSERT_THAT(infos[5], IsHighlightingMark(84u, 41u, 3u, HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, LocalVariableFunctionArgumentReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(86, 26));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(86u, 5u, 3u, HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassVariableDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(90, 21));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(90u, 9u, 11u, HighlightingType::Field));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassVariableReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(94, 23));
|
||||
|
||||
ASSERT_THAT(infos[0], IsHighlightingMark(94u, 9u, 11u, HighlightingType::Field));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StaticMethodDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(110, 25));
|
||||
|
||||
ASSERT_THAT(infos[1], IsHighlightingMark(110u, 10u, 12u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StaticMethodReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(114, 30));
|
||||
|
||||
ASSERT_THAT(infos[2], IsHighlightingMark(114u, 15u, 12u, HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, Enumeration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(118, 17));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, Enumerator)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(120, 15));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Enumeration));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, EnumerationReferenceDeclarationType)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(125, 28));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, EnumerationReferenceDeclarationVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(125, 28));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, EnumerationReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(127, 30));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, EnumeratorReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(127, 30));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Enumeration));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassForwardDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(130, 12));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ConstructorDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(134, 13));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DestructorDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(135, 15));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassForwardDeclarationReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(138, 23));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassTypeReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(140, 32));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ConstructorReferenceVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(140, 32));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, UnionDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(145, 12));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, UnionDeclarationReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(150, 33));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, GlobalVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(150, 33));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::GlobalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StructDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(50, 11));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NameSpace)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(160, 22));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NameSpaceAlias)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(164, 38));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, UsingStructInNameSpace)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(165, 36));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NameSpaceReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(166, 35));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StructInNameSpaceReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(166, 35));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, VirtualFunction)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(170, 35));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::VirtualFunction));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCall)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(177, 46));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCallPointer)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(180, 54));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, VirtualFunctionCallPointer)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(192, 51));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::VirtualFunction));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FinalVirtualFunctionCallPointer)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(202, 61));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NonFinalVirtualFunctionCallPointer)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(207, 61));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::VirtualFunction));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PlusOperator)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(224, 49));
|
||||
|
||||
ASSERT_THAT(infos[6], HasType(HighlightingType::Operator));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PlusAssignOperator)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(226, 24));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Operator));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, Comment)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(229, 14));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Comment));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessingDirective)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(231, 37));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Preprocessor));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessorMacroDefinition)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(231, 37));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::PreprocessorDefinition));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessorFunctionMacroDefinition)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(232, 47));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::PreprocessorDefinition));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessorMacroExpansion)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(236, 27));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::PreprocessorExpansion));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessorMacroExpansionArgument)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(236, 27));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::NumberLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessorInclusionDirective)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(239, 18));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::StringLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, GotoLabelStatement)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(242, 12));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Label));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, GotoLabelStatementReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(244, 21));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Label));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(254, 25));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTypeParameter)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateDefaultParameter)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||
|
||||
ASSERT_THAT(infos[5], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NonTypeTemplateParameter)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||
|
||||
ASSERT_THAT(infos[8], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterDefaultArgument)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||
|
||||
ASSERT_THAT(infos[10], HasType(HighlightingType::NumberLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTemplateParameter)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||
|
||||
ASSERT_THAT(infos[17], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTemplateParameterDefaultArgument)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||
|
||||
ASSERT_THAT(infos[19], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateFunctionDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(266, 63));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTypeParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTypeParameterDeclarationReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterReferenceReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTemplateParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTemplateContainerParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateTemplateParameterReferenceVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||
|
||||
ASSERT_THAT(infos[4], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCallPointer)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(212, 61));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCall)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(277, 23));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, HasFunctionArguments)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(286, 29));
|
||||
|
||||
ASSERT_TRUE(infos[1].hasFunctionArguments());
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NoOutputFunctionArguments)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(285, 13));
|
||||
|
||||
auto outputFunctionArguments = infos[1].outputFunctionArguments();
|
||||
|
||||
ASSERT_THAT(outputFunctionArguments, IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_OneOutputFunctionArguments)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(285, 13));
|
||||
|
||||
auto outputFunctionArguments = infos[1].outputFunctionArguments();
|
||||
|
||||
ASSERT_THAT(outputFunctionArguments, SizeIs(1));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PreprocessorInclusionDirectiveWithAngleBrackets )
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(289, 38));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::StringLiteral));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ArgumentInMacroExpansionIsKeyword)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Keyword));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_FirstArgumentInMacroExpansionIsLocalVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsLocalVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
|
||||
|
||||
ASSERT_THAT(infos[5], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsField)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(310, 40));
|
||||
|
||||
ASSERT_THAT(infos[5], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_EnumerationType)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(316, 30));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TypeInStaticCast)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
|
||||
|
||||
ASSERT_THAT(infos[4], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StaticCastIsKeyword)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Keyword));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, StaticCastPunctationIsInvalid)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Invalid));
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::Invalid));
|
||||
ASSERT_THAT(infos[5], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TypeInReinterpretCast)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(329, 69));
|
||||
|
||||
ASSERT_THAT(infos[4], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, IntegerAliasDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(333, 41));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, IntegerAlias)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(341, 31));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, SecondIntegerAlias)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(342, 43));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, IntegerTypedef)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(343, 35));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FunctionAlias)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(344, 16));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FriendTypeDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(350, 28));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FriendArgumentTypeDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(351, 65));
|
||||
|
||||
ASSERT_THAT(infos[6], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FriendArgumentDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(351, 65));
|
||||
|
||||
ASSERT_THAT(infos[8], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, FieldInitialization)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(358, 18));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Field));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateFunctionCall)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(372, 29));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplatedType)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(377, 21));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplatedTypeDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(384, 49));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NoOperator)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(389, 24));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ScopeOperator)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(400, 33));
|
||||
|
||||
ASSERT_THAT(infos[1], HasType(HighlightingType::Invalid));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateClassNamespace)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateClass)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateClassParameter)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||
|
||||
ASSERT_THAT(infos[4], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TemplateClassDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||
|
||||
ASSERT_THAT(infos[6], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TypeDefDeclaration)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(418, 36));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, TypeDefDeclarationUsage)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(419, 48));
|
||||
|
||||
ASSERT_THAT(infos[0], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_EnumerationTypeDef)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(424, 41));
|
||||
|
||||
ASSERT_THAT(infos[3], HasType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
// QTCREATORBUG-15473
|
||||
TEST_F(HighlightingMarks, DISABLED_ArgumentToUserDefinedIndexOperator)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(434, 19));
|
||||
|
||||
ASSERT_THAT(infos[2], HasType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
Data *HighlightingMarks::d;
|
||||
|
||||
void HighlightingMarks::SetUpTestCase()
|
||||
{
|
||||
d = new Data;
|
||||
}
|
||||
|
||||
void HighlightingMarks::TearDownTestCase()
|
||||
{
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
ClangBackEnd::SourceRange HighlightingMarks::sourceRange(uint line, uint columnEnd) const
|
||||
{
|
||||
return translationUnit.sourceRange(line, 1, line, columnEnd);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <diagnosticset.h>
|
||||
#include <filecontainer.h>
|
||||
#include <highlightingchangedmessage.h>
|
||||
#include <highlightinginformations.h>
|
||||
#include <highlightingmarks.h>
|
||||
#include <projectpartcontainer.h>
|
||||
#include <projectpart.h>
|
||||
#include <projectpartsdonotexistexception.h>
|
||||
@@ -217,30 +217,30 @@ TEST_F(TranslationUnits, RemoveFileAndCheckForDiagnostics)
|
||||
ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewDiagnostics());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnits, UpdateUnsavedFileAndCheckForHighlightingInformations)
|
||||
TEST_F(TranslationUnits, UpdateUnsavedFileAndCheckForHighlightingMarks)
|
||||
{
|
||||
ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, Utf8StringVector(), 74u);
|
||||
ClangBackEnd::FileContainer headerContainer(headerPath, projectPartId, Utf8StringVector(), 74u);
|
||||
ClangBackEnd::FileContainer headerContainerWithUnsavedContent(headerPath, projectPartId, Utf8String(), true, 75u);
|
||||
translationUnits.create({fileContainer, headerContainer});
|
||||
translationUnits.translationUnit(filePath, projectPartId).highlightingInformations();
|
||||
translationUnits.translationUnit(filePath, projectPartId).highlightingMarks();
|
||||
|
||||
translationUnits.update({headerContainerWithUnsavedContent});
|
||||
|
||||
ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewHighlightingInformations());
|
||||
ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnits, RemoveFileAndCheckForHighlightingInformations)
|
||||
TEST_F(TranslationUnits, RemoveFileAndCheckForHighlightingMarks)
|
||||
{
|
||||
ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, Utf8StringVector(), 74u);
|
||||
ClangBackEnd::FileContainer headerContainer(headerPath, projectPartId, Utf8StringVector(), 74u);
|
||||
ClangBackEnd::FileContainer headerContainerWithUnsavedContent(headerPath, projectPartId, Utf8String(), true, 75u);
|
||||
translationUnits.create({fileContainer, headerContainer});
|
||||
translationUnits.translationUnit(filePath, projectPartId).highlightingInformations();
|
||||
translationUnits.translationUnit(filePath, projectPartId).highlightingMarks();
|
||||
|
||||
translationUnits.remove({headerContainerWithUnsavedContent});
|
||||
|
||||
ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewHighlightingInformations());
|
||||
ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnits, DontGetNewerFileContainerIfRevisionIsTheSame)
|
||||
@@ -402,7 +402,7 @@ TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsAfterGettingDocumentAnnotat
|
||||
auto translationUnit = translationUnits.translationUnit(fileContainer);
|
||||
translationUnit.setIsVisibleInEditor(true);
|
||||
translationUnit.diagnostics(); // Reset
|
||||
translationUnit.highlightingInformations(); // Reset
|
||||
translationUnit.highlightingMarks(); // Reset
|
||||
|
||||
EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(0);
|
||||
|
||||
@@ -435,7 +435,7 @@ TEST_F(TranslationUnits, DoNotSendDocumentAnnotationsForCurrentEditorAfterGettin
|
||||
auto translationUnit = translationUnits.translationUnit(fileContainer);
|
||||
translationUnit.setIsUsedByCurrentEditor(true);
|
||||
translationUnit.diagnostics(); // Reset
|
||||
translationUnit.highlightingInformations(); // Reset
|
||||
translationUnit.highlightingMarks(); // Reset
|
||||
|
||||
EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(0);
|
||||
|
||||
@@ -472,7 +472,7 @@ TEST_F(TranslationUnits, SendDocumentAnnotationsOnlyOnceForVisibleEditor)
|
||||
auto headerTranslationUnit = translationUnits.translationUnit(headerContainer);
|
||||
headerTranslationUnit.setIsVisibleInEditor(true);
|
||||
headerTranslationUnit.diagnostics(); // Reset
|
||||
headerTranslationUnit.highlightingInformations(); // Reset
|
||||
headerTranslationUnit.highlightingMarks(); // Reset
|
||||
|
||||
EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(1);
|
||||
|
||||
@@ -485,7 +485,7 @@ TEST_F(TranslationUnits, SendDocumentAnnotationsAfterProjectPartChange)
|
||||
auto fileTranslationUnit = translationUnits.translationUnit(fileContainer);
|
||||
fileTranslationUnit.setIsVisibleInEditor(true);
|
||||
fileTranslationUnit.diagnostics(); // Reset
|
||||
fileTranslationUnit.highlightingInformations(); // Reset
|
||||
fileTranslationUnit.highlightingMarks(); // Reset
|
||||
projects.createOrUpdate({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DNEW")})});
|
||||
translationUnits.setTranslationUnitsDirtyIfProjectPartChanged();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <commandlinearguments.h>
|
||||
#include <diagnosticset.h>
|
||||
#include <highlightinginformations.h>
|
||||
#include <highlightingmarks.h>
|
||||
#include <filecontainer.h>
|
||||
#include <projectpart.h>
|
||||
#include <projectpartcontainer.h>
|
||||
@@ -289,49 +289,49 @@ TEST_F(TranslationUnit, HasNoNewDiagnosticsAfterGettingDiagnostics)
|
||||
ASSERT_FALSE(translationUnit.hasNewDiagnostics());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnit, HasNewHighlightingInformationsAfterCreation)
|
||||
TEST_F(TranslationUnit, HasNewHighlightingMarksAfterCreation)
|
||||
{
|
||||
translationUnit.cxTranslationUnit();
|
||||
|
||||
ASSERT_TRUE(translationUnit.hasNewHighlightingInformations());
|
||||
ASSERT_TRUE(translationUnit.hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnit, HasNewHighlightingInformationsForMainFile)
|
||||
TEST_F(TranslationUnit, HasNewHighlightingMarksForMainFile)
|
||||
{
|
||||
translationUnit.cxTranslationUnit();
|
||||
|
||||
translationUnit.setDirtyIfDependencyIsMet(translationUnitFilePath);
|
||||
|
||||
ASSERT_TRUE(translationUnit.hasNewHighlightingInformations());
|
||||
ASSERT_TRUE(translationUnit.hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnit, HasNoNewHighlightingInformationsForIndependendFile)
|
||||
TEST_F(TranslationUnit, HasNoNewHighlightingMarksForIndependendFile)
|
||||
{
|
||||
translationUnit.cxTranslationUnit();
|
||||
translationUnit.highlightingInformations();
|
||||
translationUnit.highlightingMarks();
|
||||
|
||||
translationUnit.setDirtyIfDependencyIsMet(Utf8StringLiteral(TESTDATA_DIR"/otherfiles.h"));
|
||||
|
||||
ASSERT_FALSE(translationUnit.hasNewHighlightingInformations());
|
||||
ASSERT_FALSE(translationUnit.hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnit, HasNewHighlightingInformationsForDependendFile)
|
||||
TEST_F(TranslationUnit, HasNewHighlightingMarksForDependendFile)
|
||||
{
|
||||
translationUnit.cxTranslationUnit();
|
||||
|
||||
translationUnit.setDirtyIfDependencyIsMet(Utf8StringLiteral(TESTDATA_DIR"/translationunits.h"));
|
||||
|
||||
ASSERT_TRUE(translationUnit.hasNewHighlightingInformations());
|
||||
ASSERT_TRUE(translationUnit.hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnit, HasNoNewHighlightingInformationsAfterGettingHighlightingInformations)
|
||||
TEST_F(TranslationUnit, HasNoNewHighlightingMarksAfterGettingHighlightingMarks)
|
||||
{
|
||||
translationUnit.cxTranslationUnit();
|
||||
translationUnit.setDirtyIfDependencyIsMet(translationUnitFilePath);
|
||||
|
||||
translationUnit.highlightingInformations();
|
||||
translationUnit.highlightingMarks();
|
||||
|
||||
ASSERT_FALSE(translationUnit.hasNewHighlightingInformations());
|
||||
ASSERT_FALSE(translationUnit.hasNewHighlightingMarks());
|
||||
}
|
||||
|
||||
TEST_F(TranslationUnit, SetDirtyIfProjectPartIsOutdated)
|
||||
|
||||
@@ -61,13 +61,13 @@ SOURCES += \
|
||||
utf8test.cpp \
|
||||
senddocumenttrackertest.cpp \
|
||||
cursortest.cpp \
|
||||
highlightinginformationstest.cpp \
|
||||
skippedsourcerangestest.cpp \
|
||||
highlightingmarksreportertest.cpp \
|
||||
chunksreportedmonitor.cpp \
|
||||
unsavedfiletest.cpp \
|
||||
clangisdiagnosticrelatedtolocationtest.cpp \
|
||||
smallstringtest.cpp \
|
||||
highlightingmarkstest.cpp \
|
||||
sizedarraytest.cpp
|
||||
|
||||
exists($$GOOGLEBENCHMARK_DIR) {
|
||||
|
||||
Reference in New Issue
Block a user