forked from qt-creator/qt-creator
Clang: Rename TranslationUnitCore to TranslationUnit
Change-Id: I03a59ae5d5073c812ad40c7623cfb1fdb80aad80 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -46,7 +46,7 @@ HEADERS += $$PWD/clangcodemodelserver.h \
|
|||||||
$$PWD/clangjobrequest.h \
|
$$PWD/clangjobrequest.h \
|
||||||
$$PWD/clangjobs.h \
|
$$PWD/clangjobs.h \
|
||||||
$$PWD/clangrequestdocumentannotationsjob.h \
|
$$PWD/clangrequestdocumentannotationsjob.h \
|
||||||
$$PWD/clangtranslationunitcore.h \
|
$$PWD/clangtranslationunit.h \
|
||||||
$$PWD/clangunsavedfilesshallowarguments.h \
|
$$PWD/clangunsavedfilesshallowarguments.h \
|
||||||
$$PWD/clangupdatedocumentannotationsjob.h
|
$$PWD/clangupdatedocumentannotationsjob.h
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ SOURCES += $$PWD/clangcodemodelserver.cpp \
|
|||||||
$$PWD/clangjobrequest.cpp \
|
$$PWD/clangjobrequest.cpp \
|
||||||
$$PWD/clangjobs.cpp \
|
$$PWD/clangjobs.cpp \
|
||||||
$$PWD/clangrequestdocumentannotationsjob.cpp \
|
$$PWD/clangrequestdocumentannotationsjob.cpp \
|
||||||
$$PWD/clangtranslationunitcore.cpp \
|
$$PWD/clangtranslationunit.cpp \
|
||||||
$$PWD/clangunsavedfilesshallowarguments.cpp \
|
$$PWD/clangunsavedfilesshallowarguments.cpp \
|
||||||
$$PWD/clangupdatedocumentannotationsjob.cpp \
|
$$PWD/clangupdatedocumentannotationsjob.cpp \
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
static CompleteCodeJob::AsyncResult runAsyncHelper(const TranslationUnitCore &translationUnitCore,
|
static CompleteCodeJob::AsyncResult runAsyncHelper(const TranslationUnit &translationUnit,
|
||||||
UnsavedFiles unsavedFiles,
|
UnsavedFiles unsavedFiles,
|
||||||
quint32 line,
|
quint32 line,
|
||||||
quint32 column)
|
quint32 column)
|
||||||
@@ -43,8 +43,8 @@ static CompleteCodeJob::AsyncResult runAsyncHelper(const TranslationUnitCore &tr
|
|||||||
CompleteCodeJob::AsyncResult asyncResult;
|
CompleteCodeJob::AsyncResult asyncResult;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const TranslationUnitCore::CodeCompletionResult results
|
const TranslationUnit::CodeCompletionResult results
|
||||||
= translationUnitCore.complete(unsavedFiles, line, column);
|
= translationUnit.complete(unsavedFiles, line, column);
|
||||||
|
|
||||||
asyncResult.completions = results.completions;
|
asyncResult.completions = results.completions;
|
||||||
asyncResult.correction = results.correction;
|
asyncResult.correction = results.correction;
|
||||||
@@ -63,12 +63,12 @@ bool CompleteCodeJob::prepareAsyncRun()
|
|||||||
try {
|
try {
|
||||||
m_pinnedDocument = context().documentForJobRequest();
|
m_pinnedDocument = context().documentForJobRequest();
|
||||||
|
|
||||||
const TranslationUnitCore translationUnitCore = m_pinnedDocument.translationUnitCore();
|
const TranslationUnit translationUnit = m_pinnedDocument.translationUnit();
|
||||||
const UnsavedFiles unsavedFiles = *context().unsavedFiles;
|
const UnsavedFiles unsavedFiles = *context().unsavedFiles;
|
||||||
const quint32 line = jobRequest.line;
|
const quint32 line = jobRequest.line;
|
||||||
const quint32 column = jobRequest.column;
|
const quint32 column = jobRequest.column;
|
||||||
setRunner([translationUnitCore, unsavedFiles, line, column]() {
|
setRunner([translationUnit, unsavedFiles, line, column]() {
|
||||||
return runAsyncHelper(translationUnitCore, unsavedFiles, line, column);
|
return runAsyncHelper(translationUnit, unsavedFiles, line, column);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,13 @@
|
|||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
static void runAsyncHelper(const TranslationUnitCore &translationUnitCore,
|
static void runAsyncHelper(const TranslationUnit &translationUnit,
|
||||||
const TranslationUnitUpdateInput &translationUnitUpdateInput)
|
const TranslationUnitUpdateInput &translationUnitUpdateInput)
|
||||||
{
|
{
|
||||||
TIME_SCOPE_DURATION("CreateInitialDocumentPreambleJobRunner");
|
TIME_SCOPE_DURATION("CreateInitialDocumentPreambleJobRunner");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
translationUnitCore.reparse(translationUnitUpdateInput);
|
translationUnit.reparse(translationUnitUpdateInput);
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
qWarning() << "Error in CreateInitialDocumentPreambleJobRunner:" << exception.what();
|
qWarning() << "Error in CreateInitialDocumentPreambleJobRunner:" << exception.what();
|
||||||
}
|
}
|
||||||
@@ -52,10 +52,10 @@ bool CreateInitialDocumentPreambleJob::prepareAsyncRun()
|
|||||||
m_pinnedDocument = context().documentForJobRequest();
|
m_pinnedDocument = context().documentForJobRequest();
|
||||||
m_pinnedFileContainer = m_pinnedDocument.fileContainer();
|
m_pinnedFileContainer = m_pinnedDocument.fileContainer();
|
||||||
|
|
||||||
const TranslationUnitCore translationUnitCore = m_pinnedDocument.translationUnitCore();
|
const TranslationUnit translationUnit = m_pinnedDocument.translationUnit();
|
||||||
const TranslationUnitUpdateInput updateInput = m_pinnedDocument.createUpdateInput();
|
const TranslationUnitUpdateInput updateInput = m_pinnedDocument.createUpdateInput();
|
||||||
setRunner([translationUnitCore, updateInput]() {
|
setRunner([translationUnit, updateInput]() {
|
||||||
return runAsyncHelper(translationUnitCore, updateInput);
|
return runAsyncHelper(translationUnit, updateInput);
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include "translationunitisnullexception.h"
|
#include "translationunitisnullexception.h"
|
||||||
#include "translationunitparseerrorexception.h"
|
#include "translationunitparseerrorexception.h"
|
||||||
#include "translationunitreparseerrorexception.h"
|
#include "translationunitreparseerrorexception.h"
|
||||||
#include "clangtranslationunitcore.h"
|
#include "clangtranslationunit.h"
|
||||||
#include "clangtranslationunitupdater.h"
|
#include "clangtranslationunitupdater.h"
|
||||||
#include "unsavedfiles.h"
|
#include "unsavedfiles.h"
|
||||||
#include "unsavedfile.h"
|
#include "unsavedfile.h"
|
||||||
@@ -318,11 +318,11 @@ void Document::incorporateUpdaterResult(const TranslationUnitUpdateResult &resul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitCore Document::translationUnitCore() const
|
TranslationUnit Document::translationUnit() const
|
||||||
{
|
{
|
||||||
checkIfNull();
|
checkIfNull();
|
||||||
|
|
||||||
return TranslationUnitCore(d->filePath, d->index, d->translationUnit);
|
return TranslationUnit(d->filePath, d->index, d->translationUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::parse() const
|
void Document::parse() const
|
||||||
@@ -330,7 +330,7 @@ void Document::parse() const
|
|||||||
checkIfNull();
|
checkIfNull();
|
||||||
|
|
||||||
const TranslationUnitUpdateInput updateInput = createUpdateInput();
|
const TranslationUnitUpdateInput updateInput = createUpdateInput();
|
||||||
TranslationUnitUpdateResult result = translationUnitCore().parse(updateInput);
|
TranslationUnitUpdateResult result = translationUnit().parse(updateInput);
|
||||||
|
|
||||||
incorporateUpdaterResult(result);
|
incorporateUpdaterResult(result);
|
||||||
}
|
}
|
||||||
@@ -340,7 +340,7 @@ void Document::reparse() const
|
|||||||
checkIfNull();
|
checkIfNull();
|
||||||
|
|
||||||
const TranslationUnitUpdateInput updateInput = createUpdateInput();
|
const TranslationUnitUpdateInput updateInput = createUpdateInput();
|
||||||
TranslationUnitUpdateResult result = translationUnitCore().reparse(updateInput);
|
TranslationUnitUpdateResult result = translationUnit().reparse(updateInput);
|
||||||
|
|
||||||
incorporateUpdaterResult(result);
|
incorporateUpdaterResult(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "clangtranslationunitupdater.h"
|
#include "clangtranslationunitupdater.h"
|
||||||
|
|
||||||
#include "clangtranslationunitcore.h"
|
#include "clangtranslationunit.h"
|
||||||
|
|
||||||
#include <utf8stringvector.h>
|
#include <utf8stringvector.h>
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class Utf8String;
|
|||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
class TranslationUnitCore;
|
class TranslationUnit;
|
||||||
class DocumentData;
|
class DocumentData;
|
||||||
class TranslationUnitUpdateResult;
|
class TranslationUnitUpdateResult;
|
||||||
class ProjectPart;
|
class ProjectPart;
|
||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
TranslationUnitUpdateInput createUpdateInput() const;
|
TranslationUnitUpdateInput createUpdateInput() const;
|
||||||
void incorporateUpdaterResult(const TranslationUnitUpdateResult &result) const;
|
void incorporateUpdaterResult(const TranslationUnitUpdateResult &result) const;
|
||||||
|
|
||||||
TranslationUnitCore translationUnitCore() const;
|
TranslationUnit translationUnit() const;
|
||||||
|
|
||||||
public: // for tests
|
public: // for tests
|
||||||
void parse() const;
|
void parse() const;
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
static RequestDocumentAnnotationsJob::AsyncResult runAsyncHelper(
|
static RequestDocumentAnnotationsJob::AsyncResult runAsyncHelper(
|
||||||
const TranslationUnitCore &translationUnitCore)
|
const TranslationUnit &translationUnit)
|
||||||
{
|
{
|
||||||
TIME_SCOPE_DURATION("RequestDocumentAnnotationsJobRunner");
|
TIME_SCOPE_DURATION("RequestDocumentAnnotationsJobRunner");
|
||||||
|
|
||||||
RequestDocumentAnnotationsJob::AsyncResult asyncResult;
|
RequestDocumentAnnotationsJob::AsyncResult asyncResult;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
translationUnitCore.extractDocumentAnnotations(asyncResult.diagnostics,
|
translationUnit.extractDocumentAnnotations(asyncResult.diagnostics,
|
||||||
asyncResult.highlightingMarks,
|
asyncResult.highlightingMarks,
|
||||||
asyncResult.skippedSourceRanges);
|
asyncResult.skippedSourceRanges);
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
@@ -60,9 +60,9 @@ bool RequestDocumentAnnotationsJob::prepareAsyncRun()
|
|||||||
m_pinnedDocument = context().documentForJobRequest();
|
m_pinnedDocument = context().documentForJobRequest();
|
||||||
m_pinnedFileContainer = m_pinnedDocument.fileContainer();
|
m_pinnedFileContainer = m_pinnedDocument.fileContainer();
|
||||||
|
|
||||||
const TranslationUnitCore translationUnitCore = m_pinnedDocument.translationUnitCore();
|
const TranslationUnit translationUnit = m_pinnedDocument.translationUnit();
|
||||||
setRunner([translationUnitCore]() {
|
setRunner([translationUnit]() {
|
||||||
return runAsyncHelper(translationUnitCore);
|
return runAsyncHelper(translationUnit);
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "clangtranslationunitcore.h"
|
#include "clangtranslationunit.h"
|
||||||
#include "clangtranslationunitupdater.h"
|
#include "clangtranslationunitupdater.h"
|
||||||
|
|
||||||
#include <codecompleter.h>
|
#include <codecompleter.h>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
TranslationUnitCore::TranslationUnitCore(const Utf8String &filepath,
|
TranslationUnit::TranslationUnit(const Utf8String &filepath,
|
||||||
CXIndex &cxIndex,
|
CXIndex &cxIndex,
|
||||||
CXTranslationUnit &cxTranslationUnit)
|
CXTranslationUnit &cxTranslationUnit)
|
||||||
: m_filePath(filepath)
|
: m_filePath(filepath)
|
||||||
@@ -47,27 +47,27 @@ TranslationUnitCore::TranslationUnitCore(const Utf8String &filepath,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslationUnitCore::isNull() const
|
bool TranslationUnit::isNull() const
|
||||||
{
|
{
|
||||||
return !m_cxTranslationUnit || !m_cxIndex || m_filePath.isEmpty();
|
return !m_cxTranslationUnit || !m_cxIndex || m_filePath.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utf8String TranslationUnitCore::filePath() const
|
Utf8String TranslationUnit::filePath() const
|
||||||
{
|
{
|
||||||
return m_filePath;
|
return m_filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
CXIndex &TranslationUnitCore::cxIndex() const
|
CXIndex &TranslationUnit::cxIndex() const
|
||||||
{
|
{
|
||||||
return m_cxIndex;
|
return m_cxIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
CXTranslationUnit &TranslationUnitCore::cxTranslationUnit() const
|
CXTranslationUnit &TranslationUnit::cxTranslationUnit() const
|
||||||
{
|
{
|
||||||
return m_cxTranslationUnit;
|
return m_cxTranslationUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitUpdateResult TranslationUnitCore::update(
|
TranslationUnitUpdateResult TranslationUnit::update(
|
||||||
const TranslationUnitUpdateInput &parseInput) const
|
const TranslationUnitUpdateInput &parseInput) const
|
||||||
{
|
{
|
||||||
TranslationUnitUpdater updater(cxIndex(), cxTranslationUnit(), parseInput);
|
TranslationUnitUpdater updater(cxIndex(), cxTranslationUnit(), parseInput);
|
||||||
@@ -75,7 +75,7 @@ TranslationUnitUpdateResult TranslationUnitCore::update(
|
|||||||
return updater.update(TranslationUnitUpdater::UpdateMode::AsNeeded);
|
return updater.update(TranslationUnitUpdater::UpdateMode::AsNeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitUpdateResult TranslationUnitCore::parse(
|
TranslationUnitUpdateResult TranslationUnit::parse(
|
||||||
const TranslationUnitUpdateInput &parseInput) const
|
const TranslationUnitUpdateInput &parseInput) const
|
||||||
{
|
{
|
||||||
TranslationUnitUpdater updater(cxIndex(), cxTranslationUnit(), parseInput);
|
TranslationUnitUpdater updater(cxIndex(), cxTranslationUnit(), parseInput);
|
||||||
@@ -83,7 +83,7 @@ TranslationUnitUpdateResult TranslationUnitCore::parse(
|
|||||||
return updater.update(TranslationUnitUpdater::UpdateMode::ParseIfNeeded);
|
return updater.update(TranslationUnitUpdater::UpdateMode::ParseIfNeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitUpdateResult TranslationUnitCore::reparse(
|
TranslationUnitUpdateResult TranslationUnit::reparse(
|
||||||
const TranslationUnitUpdateInput &parseInput) const
|
const TranslationUnitUpdateInput &parseInput) const
|
||||||
{
|
{
|
||||||
TranslationUnitUpdater updater(cxIndex(), cxTranslationUnit(), parseInput);
|
TranslationUnitUpdater updater(cxIndex(), cxTranslationUnit(), parseInput);
|
||||||
@@ -91,7 +91,7 @@ TranslationUnitUpdateResult TranslationUnitCore::reparse(
|
|||||||
return updater.update(TranslationUnitUpdater::UpdateMode::ForceReparse);
|
return updater.update(TranslationUnitUpdater::UpdateMode::ForceReparse);
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnitCore::CodeCompletionResult TranslationUnitCore::complete(
|
TranslationUnit::CodeCompletionResult TranslationUnit::complete(
|
||||||
UnsavedFiles &unsavedFiles,
|
UnsavedFiles &unsavedFiles,
|
||||||
uint line,
|
uint line,
|
||||||
uint column) const
|
uint column) const
|
||||||
@@ -104,7 +104,7 @@ TranslationUnitCore::CodeCompletionResult TranslationUnitCore::complete(
|
|||||||
return CodeCompletionResult{completions, correction};
|
return CodeCompletionResult{completions, correction};
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnitCore::extractDocumentAnnotations(
|
void TranslationUnit::extractDocumentAnnotations(
|
||||||
QVector<DiagnosticContainer> &diagnostics,
|
QVector<DiagnosticContainer> &diagnostics,
|
||||||
QVector<HighlightingMarkContainer> &highlightingMarks,
|
QVector<HighlightingMarkContainer> &highlightingMarks,
|
||||||
QVector<SourceRangeContainer> &skippedSourceRanges) const
|
QVector<SourceRangeContainer> &skippedSourceRanges) const
|
||||||
@@ -114,12 +114,12 @@ void TranslationUnitCore::extractDocumentAnnotations(
|
|||||||
skippedSourceRanges = this->skippedSourceRanges().toSourceRangeContainers();
|
skippedSourceRanges = this->skippedSourceRanges().toSourceRangeContainers();
|
||||||
}
|
}
|
||||||
|
|
||||||
DiagnosticSet TranslationUnitCore::diagnostics() const
|
DiagnosticSet TranslationUnit::diagnostics() const
|
||||||
{
|
{
|
||||||
return DiagnosticSet(clang_getDiagnosticSetFromTU(m_cxTranslationUnit));
|
return DiagnosticSet(clang_getDiagnosticSetFromTU(m_cxTranslationUnit));
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<DiagnosticContainer> TranslationUnitCore::mainFileDiagnostics() const
|
QVector<DiagnosticContainer> TranslationUnit::mainFileDiagnostics() const
|
||||||
{
|
{
|
||||||
const auto isMainFileDiagnostic = [this](const Diagnostic &diagnostic) {
|
const auto isMainFileDiagnostic = [this](const Diagnostic &diagnostic) {
|
||||||
return diagnostic.location().filePath() == m_filePath;
|
return diagnostic.location().filePath() == m_filePath;
|
||||||
@@ -128,19 +128,19 @@ QVector<DiagnosticContainer> TranslationUnitCore::mainFileDiagnostics() const
|
|||||||
return diagnostics().toDiagnosticContainers(isMainFileDiagnostic);
|
return diagnostics().toDiagnosticContainers(isMainFileDiagnostic);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation TranslationUnitCore::sourceLocationAt(uint line,uint column) const
|
SourceLocation TranslationUnit::sourceLocationAt(uint line,uint column) const
|
||||||
{
|
{
|
||||||
return SourceLocation(m_cxTranslationUnit, m_filePath, line, column);
|
return SourceLocation(m_cxTranslationUnit, m_filePath, line, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation TranslationUnitCore::sourceLocationAt(const Utf8String &filePath,
|
SourceLocation TranslationUnit::sourceLocationAt(const Utf8String &filePath,
|
||||||
uint line,
|
uint line,
|
||||||
uint column) const
|
uint column) const
|
||||||
{
|
{
|
||||||
return SourceLocation(m_cxTranslationUnit, filePath, line, column);
|
return SourceLocation(m_cxTranslationUnit, filePath, line, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceRange TranslationUnitCore::sourceRange(uint fromLine,
|
SourceRange TranslationUnit::sourceRange(uint fromLine,
|
||||||
uint fromColumn,
|
uint fromColumn,
|
||||||
uint toLine,
|
uint toLine,
|
||||||
uint toColumn) const
|
uint toColumn) const
|
||||||
@@ -149,29 +149,29 @@ SourceRange TranslationUnitCore::sourceRange(uint fromLine,
|
|||||||
sourceLocationAt(toLine, toColumn));
|
sourceLocationAt(toLine, toColumn));
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor TranslationUnitCore::cursorAt(uint line, uint column) const
|
Cursor TranslationUnit::cursorAt(uint line, uint column) const
|
||||||
{
|
{
|
||||||
return clang_getCursor(m_cxTranslationUnit, sourceLocationAt(line, column));
|
return clang_getCursor(m_cxTranslationUnit, sourceLocationAt(line, column));
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor TranslationUnitCore::cursorAt(const Utf8String &filePath,
|
Cursor TranslationUnit::cursorAt(const Utf8String &filePath,
|
||||||
uint line,
|
uint line,
|
||||||
uint column) const
|
uint column) const
|
||||||
{
|
{
|
||||||
return clang_getCursor(m_cxTranslationUnit, sourceLocationAt(filePath, line, column));
|
return clang_getCursor(m_cxTranslationUnit, sourceLocationAt(filePath, line, column));
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor TranslationUnitCore::cursor() const
|
Cursor TranslationUnit::cursor() const
|
||||||
{
|
{
|
||||||
return clang_getTranslationUnitCursor(m_cxTranslationUnit);
|
return clang_getTranslationUnitCursor(m_cxTranslationUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightingMarks TranslationUnitCore::highlightingMarks() const
|
HighlightingMarks TranslationUnit::highlightingMarks() const
|
||||||
{
|
{
|
||||||
return highlightingMarksInRange(cursor().sourceRange());
|
return highlightingMarksInRange(cursor().sourceRange());
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightingMarks TranslationUnitCore::highlightingMarksInRange(const SourceRange &range) const
|
HighlightingMarks TranslationUnit::highlightingMarksInRange(const SourceRange &range) const
|
||||||
{
|
{
|
||||||
CXToken *cxTokens = 0;
|
CXToken *cxTokens = 0;
|
||||||
uint cxTokensCount = 0;
|
uint cxTokensCount = 0;
|
||||||
@@ -181,7 +181,7 @@ HighlightingMarks TranslationUnitCore::highlightingMarksInRange(const SourceRang
|
|||||||
return HighlightingMarks(m_cxTranslationUnit, cxTokens, cxTokensCount);
|
return HighlightingMarks(m_cxTranslationUnit, cxTokens, cxTokensCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkippedSourceRanges TranslationUnitCore::skippedSourceRanges() const
|
SkippedSourceRanges TranslationUnit::skippedSourceRanges() const
|
||||||
{
|
{
|
||||||
return SkippedSourceRanges(m_cxTranslationUnit, m_filePath.constData());
|
return SkippedSourceRanges(m_cxTranslationUnit, m_filePath.constData());
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ class TranslationUnitUpdateInput;
|
|||||||
class TranslationUnitUpdateResult;
|
class TranslationUnitUpdateResult;
|
||||||
class UnsavedFiles;
|
class UnsavedFiles;
|
||||||
|
|
||||||
class TranslationUnitCore
|
class TranslationUnit
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct CodeCompletionResult {
|
struct CodeCompletionResult {
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TranslationUnitCore(const Utf8String &filePath,
|
TranslationUnit(const Utf8String &filePath,
|
||||||
CXIndex &cxIndex,
|
CXIndex &cxIndex,
|
||||||
CXTranslationUnit &cxTranslationUnit);
|
CXTranslationUnit &cxTranslationUnit);
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
static UpdateDocumentAnnotationsJob::AsyncResult runAsyncHelper(
|
static UpdateDocumentAnnotationsJob::AsyncResult runAsyncHelper(
|
||||||
const TranslationUnitCore &translationUnitCore,
|
const TranslationUnit &translationUnit,
|
||||||
const TranslationUnitUpdateInput &translationUnitUpdatInput)
|
const TranslationUnitUpdateInput &translationUnitUpdatInput)
|
||||||
{
|
{
|
||||||
TIME_SCOPE_DURATION("UpdateDocumentAnnotationsJobRunner");
|
TIME_SCOPE_DURATION("UpdateDocumentAnnotationsJobRunner");
|
||||||
@@ -43,10 +43,10 @@ static UpdateDocumentAnnotationsJob::AsyncResult runAsyncHelper(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Update
|
// Update
|
||||||
asyncResult.updateResult = translationUnitCore.update(translationUnitUpdatInput);
|
asyncResult.updateResult = translationUnit.update(translationUnitUpdatInput);
|
||||||
|
|
||||||
// Collect
|
// Collect
|
||||||
translationUnitCore.extractDocumentAnnotations(asyncResult.diagnostics,
|
translationUnit.extractDocumentAnnotations(asyncResult.diagnostics,
|
||||||
asyncResult.highlightingMarks,
|
asyncResult.highlightingMarks,
|
||||||
asyncResult.skippedSourceRanges);
|
asyncResult.skippedSourceRanges);
|
||||||
|
|
||||||
@@ -66,10 +66,10 @@ bool UpdateDocumentAnnotationsJob::prepareAsyncRun()
|
|||||||
m_pinnedDocument = context().documentForJobRequest();
|
m_pinnedDocument = context().documentForJobRequest();
|
||||||
m_pinnedFileContainer = m_pinnedDocument.fileContainer();
|
m_pinnedFileContainer = m_pinnedDocument.fileContainer();
|
||||||
|
|
||||||
const TranslationUnitCore translationUnitCore = m_pinnedDocument.translationUnitCore();
|
const TranslationUnit translationUnit = m_pinnedDocument.translationUnit();
|
||||||
const TranslationUnitUpdateInput updateInput = m_pinnedDocument.createUpdateInput();
|
const TranslationUnitUpdateInput updateInput = m_pinnedDocument.createUpdateInput();
|
||||||
setRunner([translationUnitCore, updateInput]() {
|
setRunner([translationUnit, updateInput]() {
|
||||||
return runAsyncHelper(translationUnitCore, updateInput);
|
return runAsyncHelper(translationUnit, updateInput);
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ CodeCompletions toCodeCompletions(const ClangCodeCompleteResults &results)
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
CodeCompleter::CodeCompleter(const TranslationUnitCore &translationUnitCore,
|
CodeCompleter::CodeCompleter(const TranslationUnit &translationUnit,
|
||||||
const UnsavedFiles &unsavedFiles)
|
const UnsavedFiles &unsavedFiles)
|
||||||
: translationUnitCore(translationUnitCore)
|
: translationUnit(translationUnit)
|
||||||
, unsavedFiles(unsavedFiles)
|
, unsavedFiles(unsavedFiles)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -83,10 +83,10 @@ CompletionCorrection CodeCompleter::neededCorrection() const
|
|||||||
|
|
||||||
ClangCodeCompleteResults CodeCompleter::completeHelper(uint line, uint column)
|
ClangCodeCompleteResults CodeCompleter::completeHelper(uint line, uint column)
|
||||||
{
|
{
|
||||||
const Utf8String nativeFilePath = FilePath::toNativeSeparators(translationUnitCore.filePath());
|
const Utf8String nativeFilePath = FilePath::toNativeSeparators(translationUnit.filePath());
|
||||||
UnsavedFilesShallowArguments unsaved = unsavedFiles.shallowArguments();
|
UnsavedFilesShallowArguments unsaved = unsavedFiles.shallowArguments();
|
||||||
|
|
||||||
return clang_codeCompleteAt(translationUnitCore.cxTranslationUnit(),
|
return clang_codeCompleteAt(translationUnit.cxTranslationUnit(),
|
||||||
nativeFilePath.constData(),
|
nativeFilePath.constData(),
|
||||||
line,
|
line,
|
||||||
column,
|
column,
|
||||||
@@ -110,7 +110,7 @@ uint CodeCompleter::defaultOptions() const
|
|||||||
|
|
||||||
UnsavedFile &CodeCompleter::unsavedFile()
|
UnsavedFile &CodeCompleter::unsavedFile()
|
||||||
{
|
{
|
||||||
return unsavedFiles.unsavedFile(translationUnitCore.filePath());
|
return unsavedFiles.unsavedFile(translationUnit.filePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeCompleter::tryDotArrowCorrectionIfNoResults(ClangCodeCompleteResults &results,
|
void CodeCompleter::tryDotArrowCorrectionIfNoResults(ClangCodeCompleteResults &results,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clangtranslationunitcore.h"
|
#include "clangtranslationunit.h"
|
||||||
#include "unsavedfiles.h"
|
#include "unsavedfiles.h"
|
||||||
|
|
||||||
#include <codecompletion.h>
|
#include <codecompletion.h>
|
||||||
@@ -40,7 +40,7 @@ class CodeCompleter
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodeCompleter() = default;
|
CodeCompleter() = default;
|
||||||
CodeCompleter(const TranslationUnitCore &translationUnitCore,
|
CodeCompleter(const TranslationUnit &translationUnit,
|
||||||
const UnsavedFiles &unsavedFiles);
|
const UnsavedFiles &unsavedFiles);
|
||||||
|
|
||||||
CodeCompletions complete(uint line, uint column);
|
CodeCompletions complete(uint line, uint column);
|
||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
uint dotPosition);
|
uint dotPosition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TranslationUnitCore translationUnitCore;
|
TranslationUnit translationUnit;
|
||||||
UnsavedFiles unsavedFiles;
|
UnsavedFiles unsavedFiles;
|
||||||
CompletionCorrection neededCorrection_ = CompletionCorrection::NoCorrection;
|
CompletionCorrection neededCorrection_ = CompletionCorrection::NoCorrection;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class DiagnosticSetIterator;
|
|||||||
|
|
||||||
class DiagnosticSet
|
class DiagnosticSet
|
||||||
{
|
{
|
||||||
friend class TranslationUnitCore;
|
friend class TranslationUnit;
|
||||||
friend class Diagnostic;
|
friend class Diagnostic;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SourceLocation
|
|||||||
{
|
{
|
||||||
friend class Diagnostic;
|
friend class Diagnostic;
|
||||||
friend class SourceRange;
|
friend class SourceRange;
|
||||||
friend class TranslationUnitCore;
|
friend class TranslationUnit;
|
||||||
friend class Cursor;
|
friend class Cursor;
|
||||||
friend bool operator==(const SourceLocation &first, const SourceLocation &second);
|
friend bool operator==(const SourceLocation &first, const SourceLocation &second);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <clangtranslationunitupdater.h>
|
#include <clangtranslationunitupdater.h>
|
||||||
#include <projectpart.h>
|
#include <projectpart.h>
|
||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
#include <utf8string.h>
|
#include <utf8string.h>
|
||||||
@@ -70,7 +70,7 @@ TEST(ClangCodeCompleteResults, GetData)
|
|||||||
Utf8String nativeFilePath = FilePath::toNativeSeparators(document.filePath());
|
Utf8String nativeFilePath = FilePath::toNativeSeparators(document.filePath());
|
||||||
document.parse();
|
document.parse();
|
||||||
CXCodeCompleteResults *cxCodeCompleteResults =
|
CXCodeCompleteResults *cxCodeCompleteResults =
|
||||||
clang_codeCompleteAt(document.translationUnitCore().cxTranslationUnit(),
|
clang_codeCompleteAt(document.translationUnit().cxTranslationUnit(),
|
||||||
nativeFilePath.constData(),
|
nativeFilePath.constData(),
|
||||||
49, 1, 0, 0,
|
49, 1, 0, 0,
|
||||||
completionOptions());
|
completionOptions());
|
||||||
@@ -102,7 +102,7 @@ TEST(ClangCodeCompleteResults, MoveClangCodeCompleteResults)
|
|||||||
Utf8String nativeFilePath = FilePath::toNativeSeparators(document.filePath());
|
Utf8String nativeFilePath = FilePath::toNativeSeparators(document.filePath());
|
||||||
document.parse();
|
document.parse();
|
||||||
CXCodeCompleteResults *cxCodeCompleteResults =
|
CXCodeCompleteResults *cxCodeCompleteResults =
|
||||||
clang_codeCompleteAt(document.translationUnitCore().cxTranslationUnit(),
|
clang_codeCompleteAt(document.translationUnit().cxTranslationUnit(),
|
||||||
nativeFilePath.constData(),
|
nativeFilePath.constData(),
|
||||||
49, 1, 0, 0,
|
49, 1, 0, 0,
|
||||||
completionOptions());
|
completionOptions());
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <translationunitdoesnotexistexception.h>
|
#include <translationunitdoesnotexistexception.h>
|
||||||
#include <translationunitfilenotexitexception.h>
|
#include <translationunitfilenotexitexception.h>
|
||||||
#include <clangdocument.h>
|
#include <clangdocument.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <translationunitisnullexception.h>
|
#include <translationunitisnullexception.h>
|
||||||
#include <translationunitparseerrorexception.h>
|
#include <translationunitparseerrorexception.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
@@ -125,21 +125,21 @@ TEST_F(Document, ThrowExceptionForGettingIndexForInvalidUnit)
|
|||||||
{
|
{
|
||||||
::Document document;
|
::Document document;
|
||||||
|
|
||||||
ASSERT_THROW(document.translationUnitCore().cxIndex(), ClangBackEnd::TranslationUnitIsNullException);
|
ASSERT_THROW(document.translationUnit().cxIndex(), ClangBackEnd::TranslationUnitIsNullException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, ThrowExceptionForGettingCxTranslationUnitForInvalidUnit)
|
TEST_F(Document, ThrowExceptionForGettingCxTranslationUnitForInvalidUnit)
|
||||||
{
|
{
|
||||||
::Document document;
|
::Document document;
|
||||||
|
|
||||||
ASSERT_THROW(document.translationUnitCore().cxIndex(), ClangBackEnd::TranslationUnitIsNullException);
|
ASSERT_THROW(document.translationUnit().cxIndex(), ClangBackEnd::TranslationUnitIsNullException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, CxTranslationUnitGetterIsNonNullForParsedUnit)
|
TEST_F(Document, CxTranslationUnitGetterIsNonNullForParsedUnit)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
|
|
||||||
ASSERT_THAT(document.translationUnitCore().cxIndex(), NotNull());
|
ASSERT_THAT(document.translationUnit().cxIndex(), NotNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Document, ThrowExceptionIfGettingFilePathForNullUnit)
|
TEST_F(Document, ThrowExceptionIfGettingFilePathForNullUnit)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <projectpart.h>
|
#include <projectpart.h>
|
||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <clangunsavedfilesshallowarguments.h>
|
#include <clangunsavedfilesshallowarguments.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
#include <utf8stringvector.h>
|
#include <utf8stringvector.h>
|
||||||
@@ -692,7 +692,7 @@ ClangCodeCompleteResults CodeCompletionsExtractor::getResults(const Document &do
|
|||||||
const Utf8String nativeFilePath = FilePath::toNativeSeparators(document.filePath());
|
const Utf8String nativeFilePath = FilePath::toNativeSeparators(document.filePath());
|
||||||
UnsavedFilesShallowArguments unsaved = unsavedFiles.shallowArguments();
|
UnsavedFilesShallowArguments unsaved = unsavedFiles.shallowArguments();
|
||||||
|
|
||||||
return ClangCodeCompleteResults(clang_codeCompleteAt(document.translationUnitCore().cxTranslationUnit(),
|
return ClangCodeCompleteResults(clang_codeCompleteAt(document.translationUnit().cxTranslationUnit(),
|
||||||
nativeFilePath.constData(),
|
nativeFilePath.constData(),
|
||||||
line,
|
line,
|
||||||
column,
|
column,
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ void CodeCompleter::SetUp()
|
|||||||
projects.createOrUpdate({projectPart});
|
projects.createOrUpdate({projectPart});
|
||||||
documents.create({mainFileContainer});
|
documents.create({mainFileContainer});
|
||||||
document = documents.document(mainFileContainer);
|
document = documents.document(mainFileContainer);
|
||||||
completer.reset(new ClangBackEnd::CodeCompleter(document.translationUnitCore(),
|
completer.reset(new ClangBackEnd::CodeCompleter(document.translationUnit(),
|
||||||
unsavedFiles));
|
unsavedFiles));
|
||||||
|
|
||||||
copyTargetHeaderToTemporaryIncludeDirecory();
|
copyTargetHeaderToTemporaryIncludeDirecory();
|
||||||
@@ -224,7 +224,7 @@ TEST_F(CodeCompleter, FunctionInUnsavedFile)
|
|||||||
{
|
{
|
||||||
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
||||||
documents.update({unsavedMainFileContainer});
|
documents.update({unsavedMainFileContainer});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(document.translationUnitCore(), unsavedFiles);
|
ClangBackEnd::CodeCompleter myCompleter(document.translationUnit(), unsavedFiles);
|
||||||
|
|
||||||
ASSERT_THAT(myCompleter.complete(27, 1),
|
ASSERT_THAT(myCompleter.complete(27, 1),
|
||||||
AllOf(Contains(IsCodeCompletion(Utf8StringLiteral("FunctionWithArguments"),
|
AllOf(Contains(IsCodeCompletion(Utf8StringLiteral("FunctionWithArguments"),
|
||||||
@@ -243,7 +243,7 @@ TEST_F(CodeCompleter, VariableInUnsavedFile)
|
|||||||
{
|
{
|
||||||
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
||||||
documents.update({unsavedMainFileContainer});
|
documents.update({unsavedMainFileContainer});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(document.translationUnitCore(), unsavedFiles);
|
ClangBackEnd::CodeCompleter myCompleter(document.translationUnit(), unsavedFiles);
|
||||||
|
|
||||||
ASSERT_THAT(myCompleter.complete(27, 1),
|
ASSERT_THAT(myCompleter.complete(27, 1),
|
||||||
Contains(IsCodeCompletion(Utf8StringLiteral("VariableInUnsavedFile"),
|
Contains(IsCodeCompletion(Utf8StringLiteral("VariableInUnsavedFile"),
|
||||||
@@ -254,7 +254,7 @@ TEST_F(CodeCompleter, GlobalVariableInUnsavedFile)
|
|||||||
{
|
{
|
||||||
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
||||||
documents.update({unsavedMainFileContainer});
|
documents.update({unsavedMainFileContainer});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(document.translationUnitCore(), unsavedFiles);
|
ClangBackEnd::CodeCompleter myCompleter(document.translationUnit(), unsavedFiles);
|
||||||
|
|
||||||
ASSERT_THAT(myCompleter.complete(27, 1),
|
ASSERT_THAT(myCompleter.complete(27, 1),
|
||||||
Contains(IsCodeCompletion(Utf8StringLiteral("GlobalVariableInUnsavedFile"),
|
Contains(IsCodeCompletion(Utf8StringLiteral("GlobalVariableInUnsavedFile"),
|
||||||
@@ -265,7 +265,7 @@ TEST_F(CodeCompleter, Macro)
|
|||||||
{
|
{
|
||||||
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
||||||
documents.update({unsavedMainFileContainer});
|
documents.update({unsavedMainFileContainer});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(document.translationUnitCore(), unsavedFiles);
|
ClangBackEnd::CodeCompleter myCompleter(document.translationUnit(), unsavedFiles);
|
||||||
|
|
||||||
ASSERT_THAT(myCompleter.complete(27, 1),
|
ASSERT_THAT(myCompleter.complete(27, 1),
|
||||||
Contains(IsCodeCompletion(Utf8StringLiteral("Macro"),
|
Contains(IsCodeCompletion(Utf8StringLiteral("Macro"),
|
||||||
@@ -290,7 +290,7 @@ TEST_F(CodeCompleter, FunctionInUnsavedIncludedHeader)
|
|||||||
{
|
{
|
||||||
unsavedFiles.createOrUpdate({unsavedTargetHeaderFileContainer});
|
unsavedFiles.createOrUpdate({unsavedTargetHeaderFileContainer});
|
||||||
documents.create({unsavedTargetHeaderFileContainer});
|
documents.create({unsavedTargetHeaderFileContainer});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(document.translationUnitCore(), unsavedFiles);
|
ClangBackEnd::CodeCompleter myCompleter(document.translationUnit(), unsavedFiles);
|
||||||
|
|
||||||
ASSERT_THAT(myCompleter.complete(27, 1),
|
ASSERT_THAT(myCompleter.complete(27, 1),
|
||||||
Contains(IsCodeCompletion(Utf8StringLiteral("FunctionInIncludedHeaderUnsaved"),
|
Contains(IsCodeCompletion(Utf8StringLiteral("FunctionInIncludedHeaderUnsaved"),
|
||||||
@@ -310,7 +310,7 @@ TEST_F(CodeCompleter, DISABLED_FunctionInChangedIncludedHeaderWithUnsavedContent
|
|||||||
{
|
{
|
||||||
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
unsavedFiles.createOrUpdate({unsavedMainFileContainer});
|
||||||
documents.update({unsavedMainFileContainer});
|
documents.update({unsavedMainFileContainer});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(document.translationUnitCore(), unsavedFiles);
|
ClangBackEnd::CodeCompleter myCompleter(document.translationUnit(), unsavedFiles);
|
||||||
|
|
||||||
copyChangedTargetHeaderToTemporaryIncludeDirecory();
|
copyChangedTargetHeaderToTemporaryIncludeDirecory();
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ TEST_F(CodeCompleter, DotToArrowCompletionForPointerInOutdatedDocument)
|
|||||||
fileContainerBeforeTyping.projectPartId());
|
fileContainerBeforeTyping.projectPartId());
|
||||||
document.parse();
|
document.parse();
|
||||||
unsavedFiles.createOrUpdate({dotArrowCorrectionForPointerFileContainerAfterTyping});
|
unsavedFiles.createOrUpdate({dotArrowCorrectionForPointerFileContainerAfterTyping});
|
||||||
ClangBackEnd::CodeCompleter myCompleter(documents.document(dotArrowCorrectionForPointerFileContainerAfterTyping).translationUnitCore(),
|
ClangBackEnd::CodeCompleter myCompleter(documents.document(dotArrowCorrectionForPointerFileContainerAfterTyping).translationUnit(),
|
||||||
unsavedFiles);
|
unsavedFiles);
|
||||||
|
|
||||||
const ClangBackEnd::CodeCompletions completions = myCompleter.complete(5, 9);
|
const ClangBackEnd::CodeCompletions completions = myCompleter.complete(5, 9);
|
||||||
@@ -449,7 +449,7 @@ ClangBackEnd::CodeCompleter CodeCompleter::setupCompleter(
|
|||||||
document.parse();
|
document.parse();
|
||||||
|
|
||||||
ClangBackEnd::Document document = documents.document(fileContainer);
|
ClangBackEnd::Document document = documents.document(fileContainer);
|
||||||
return ClangBackEnd::CodeCompleter(document.translationUnitCore(),
|
return ClangBackEnd::CodeCompleter(document.translationUnit(),
|
||||||
unsavedFiles);
|
unsavedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <sourcelocation.h>
|
#include <sourcelocation.h>
|
||||||
#include <sourcerange.h>
|
#include <sourcerange.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
|
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
using ClangBackEnd::Cursor;
|
using ClangBackEnd::Cursor;
|
||||||
using ClangBackEnd::Document;
|
using ClangBackEnd::Document;
|
||||||
using ClangBackEnd::TranslationUnitCore;
|
using ClangBackEnd::TranslationUnit;
|
||||||
using ClangBackEnd::UnsavedFiles;
|
using ClangBackEnd::UnsavedFiles;
|
||||||
using ClangBackEnd::ProjectPart;
|
using ClangBackEnd::ProjectPart;
|
||||||
using ClangBackEnd::Documents;
|
using ClangBackEnd::Documents;
|
||||||
@@ -66,12 +66,13 @@ struct Data {
|
|||||||
ClangBackEnd::Documents documents{projects, unsavedFiles};
|
ClangBackEnd::Documents documents{projects, unsavedFiles};
|
||||||
Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/cursor.cpp")};
|
Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/cursor.cpp")};
|
||||||
Document document{filePath,
|
Document document{filePath,
|
||||||
ProjectPart(Utf8StringLiteral("projectPartId"), {Utf8StringLiteral("-std=c++11")}),
|
ProjectPart(Utf8StringLiteral("projectPartId"),
|
||||||
|
{Utf8StringLiteral("-std=c++11")}),
|
||||||
{},
|
{},
|
||||||
documents};
|
documents};
|
||||||
TranslationUnitCore translationUnitCore{filePath,
|
TranslationUnit translationUnit{filePath,
|
||||||
document.translationUnitCore().cxIndex(),
|
document.translationUnit().cxIndex(),
|
||||||
document.translationUnitCore().cxTranslationUnit()};
|
document.translationUnit().cxTranslationUnit()};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Cursor : public ::testing::Test
|
class Cursor : public ::testing::Test
|
||||||
@@ -83,7 +84,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static Data *d;
|
static Data *d;
|
||||||
const Document &document = d->document;
|
const Document &document = d->document;
|
||||||
const TranslationUnitCore &translationUnitCore = d->translationUnitCore;
|
const TranslationUnit &translationUnit = d->translationUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(Cursor, CreateNullCursor)
|
TEST_F(Cursor, CreateNullCursor)
|
||||||
@@ -110,14 +111,14 @@ TEST_F(Cursor, IsNotValid)
|
|||||||
|
|
||||||
TEST_F(Cursor, IsValid)
|
TEST_F(Cursor, IsValid)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursor();
|
auto cursor = translationUnit.cursor();
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isValid());
|
ASSERT_TRUE(cursor.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsTranslationUnit)
|
TEST_F(Cursor, IsTranslationUnit)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursor();
|
auto cursor = translationUnit.cursor();
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isTranslationUnit());
|
ASSERT_TRUE(cursor.isTranslationUnit());
|
||||||
}
|
}
|
||||||
@@ -138,29 +139,29 @@ TEST_F(Cursor, UnifiedSymbolResolution)
|
|||||||
|
|
||||||
TEST_F(Cursor, GetCursorAtLocation)
|
TEST_F(Cursor, GetCursorAtLocation)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(3, 6);
|
auto cursor = translationUnit.cursorAt(3, 6);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.unifiedSymbolResolution(), Utf8StringLiteral("c:@F@function#I#"));
|
ASSERT_THAT(cursor.unifiedSymbolResolution(), Utf8StringLiteral("c:@F@function#I#"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, GetCursoSourceLocation)
|
TEST_F(Cursor, GetCursoSourceLocation)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(3, 6);
|
auto cursor = translationUnit.cursorAt(3, 6);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.sourceLocation(), translationUnitCore.sourceLocationAt(3, 6));
|
ASSERT_THAT(cursor.sourceLocation(), translationUnit.sourceLocationAt(3, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, GetCursoSourceRange)
|
TEST_F(Cursor, GetCursoSourceRange)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(3, 6);
|
auto cursor = translationUnit.cursorAt(3, 6);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.sourceRange(), SourceRange(translationUnitCore.sourceLocationAt(3, 1),
|
ASSERT_THAT(cursor.sourceRange(), SourceRange(translationUnit.sourceLocationAt(3, 1),
|
||||||
translationUnitCore.sourceLocationAt(6, 2)));
|
translationUnit.sourceLocationAt(6, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, Mangling)
|
TEST_F(Cursor, Mangling)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(3, 6);
|
auto cursor = translationUnit.cursorAt(3, 6);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_THAT(cursor.mangling().isEmpty(), false);
|
ASSERT_THAT(cursor.mangling().isEmpty(), false);
|
||||||
@@ -168,7 +169,7 @@ TEST_F(Cursor, Mangling)
|
|||||||
|
|
||||||
TEST_F(Cursor, Spelling)
|
TEST_F(Cursor, Spelling)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(3, 6);
|
auto cursor = translationUnit.cursorAt(3, 6);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_THAT(cursor.spelling().cString(), StrEq("function"));
|
ASSERT_THAT(cursor.spelling().cString(), StrEq("function"));
|
||||||
@@ -176,7 +177,7 @@ TEST_F(Cursor, Spelling)
|
|||||||
|
|
||||||
TEST_F(Cursor, DisplayName)
|
TEST_F(Cursor, DisplayName)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(3, 6);
|
auto cursor = translationUnit.cursorAt(3, 6);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_THAT(cursor.displayName(), Utf8StringLiteral("function(int)"));
|
ASSERT_THAT(cursor.displayName(), Utf8StringLiteral("function(int)"));
|
||||||
@@ -184,7 +185,7 @@ TEST_F(Cursor, DisplayName)
|
|||||||
|
|
||||||
TEST_F(Cursor, BriefComment)
|
TEST_F(Cursor, BriefComment)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_THAT(cursor.briefComment(), Utf8StringLiteral("A brief comment"));
|
ASSERT_THAT(cursor.briefComment(), Utf8StringLiteral("A brief comment"));
|
||||||
@@ -192,7 +193,7 @@ TEST_F(Cursor, BriefComment)
|
|||||||
|
|
||||||
TEST_F(Cursor, RawComment)
|
TEST_F(Cursor, RawComment)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_THAT(cursor.rawComment(), Utf8StringLiteral("/**\n * A brief comment\n */"));
|
ASSERT_THAT(cursor.rawComment(), Utf8StringLiteral("/**\n * A brief comment\n */"));
|
||||||
@@ -200,118 +201,118 @@ TEST_F(Cursor, RawComment)
|
|||||||
|
|
||||||
TEST_F(Cursor, CommentRange)
|
TEST_F(Cursor, CommentRange)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
|
|
||||||
ASSERT_THAT(cursor.commentRange(),
|
ASSERT_THAT(cursor.commentRange(),
|
||||||
SourceRange(translationUnitCore.sourceLocationAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 7, 1),
|
SourceRange(translationUnit.sourceLocationAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 7, 1),
|
||||||
translationUnitCore.sourceLocationAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 9, 4)));
|
translationUnit.sourceLocationAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 9, 4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsDefinition)
|
TEST_F(Cursor, IsDefinition)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isDefinition());
|
ASSERT_TRUE(cursor.isDefinition());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, ForwardDeclarationIsNotDefinition)
|
TEST_F(Cursor, ForwardDeclarationIsNotDefinition)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 6, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 6, 7);
|
||||||
|
|
||||||
ASSERT_FALSE(cursor.isDefinition());
|
ASSERT_FALSE(cursor.isDefinition());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, GetDefinitionOfFowardDeclaration)
|
TEST_F(Cursor, GetDefinitionOfFowardDeclaration)
|
||||||
{
|
{
|
||||||
auto forwardDeclarationcursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 6, 7);
|
auto forwardDeclarationcursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 6, 7);
|
||||||
auto definitionCursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto definitionCursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
ASSERT_THAT(forwardDeclarationcursor.definition(), definitionCursor);
|
ASSERT_THAT(forwardDeclarationcursor.definition(), definitionCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, CallToMethodeIsNotDynamic)
|
TEST_F(Cursor, CallToMethodeIsNotDynamic)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(18, 5);
|
auto cursor = translationUnit.cursorAt(18, 5);
|
||||||
|
|
||||||
ASSERT_FALSE(cursor.isDynamicCall());
|
ASSERT_FALSE(cursor.isDynamicCall());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, CallToAbstractVirtualMethodeIsDynamic)
|
TEST_F(Cursor, CallToAbstractVirtualMethodeIsDynamic)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(19, 5);
|
auto cursor = translationUnit.cursorAt(19, 5);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isDynamicCall());
|
ASSERT_TRUE(cursor.isDynamicCall());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, CanonicalCursor)
|
TEST_F(Cursor, CanonicalCursor)
|
||||||
{
|
{
|
||||||
auto forwardDeclarationcursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 6, 7);
|
auto forwardDeclarationcursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 6, 7);
|
||||||
auto definitionCursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto definitionCursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
ASSERT_THAT(definitionCursor.canonical(), forwardDeclarationcursor);
|
ASSERT_THAT(definitionCursor.canonical(), forwardDeclarationcursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, ReferencedCursor)
|
TEST_F(Cursor, ReferencedCursor)
|
||||||
{
|
{
|
||||||
auto functionCallCursor = translationUnitCore.cursorAt(18, 5);
|
auto functionCallCursor = translationUnit.cursorAt(18, 5);
|
||||||
auto functionCursor = translationUnitCore.cursorAt(16, 17);
|
auto functionCursor = translationUnit.cursorAt(16, 17);
|
||||||
|
|
||||||
ASSERT_THAT(functionCallCursor.referenced(), functionCursor);
|
ASSERT_THAT(functionCallCursor.referenced(), functionCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsVirtual)
|
TEST_F(Cursor, IsVirtual)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 15, 17);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 15, 17);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isVirtualMethod());
|
ASSERT_TRUE(cursor.isVirtualMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsNotPureVirtualOnlyVirtual)
|
TEST_F(Cursor, IsNotPureVirtualOnlyVirtual)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 15, 17);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 15, 17);
|
||||||
|
|
||||||
ASSERT_FALSE(cursor.isPureVirtualMethod());
|
ASSERT_FALSE(cursor.isPureVirtualMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsPureVirtual)
|
TEST_F(Cursor, IsPureVirtual)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 16, 17);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 16, 17);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isPureVirtualMethod());
|
ASSERT_TRUE(cursor.isPureVirtualMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, ConstantMethod)
|
TEST_F(Cursor, ConstantMethod)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(31, 18);
|
auto cursor = translationUnit.cursorAt(31, 18);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isConstantMethod());
|
ASSERT_TRUE(cursor.isConstantMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsStaticMethod)
|
TEST_F(Cursor, IsStaticMethod)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(36, 18);
|
auto cursor = translationUnit.cursorAt(36, 18);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isStaticMethod());
|
ASSERT_TRUE(cursor.isStaticMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, TypeSpelling)
|
TEST_F(Cursor, TypeSpelling)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(43, 5);
|
auto cursor = translationUnit.cursorAt(43, 5);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.type().utf8Spelling(), Utf8StringLiteral("lint"));
|
ASSERT_THAT(cursor.type().utf8Spelling(), Utf8StringLiteral("lint"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, CanonicalTypeSpelling)
|
TEST_F(Cursor, CanonicalTypeSpelling)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(43, 5);
|
auto cursor = translationUnit.cursorAt(43, 5);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.type().canonical().utf8Spelling(), Utf8StringLiteral("long long"));
|
ASSERT_THAT(cursor.type().canonical().utf8Spelling(), Utf8StringLiteral("long long"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, CanonicalTypeCStringSpelling)
|
TEST_F(Cursor, CanonicalTypeCStringSpelling)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(43, 5);
|
auto cursor = translationUnit.cursorAt(43, 5);
|
||||||
|
|
||||||
auto spelling = cursor.type().canonical().spelling();
|
auto spelling = cursor.type().canonical().spelling();
|
||||||
|
|
||||||
@@ -320,58 +321,58 @@ TEST_F(Cursor, CanonicalTypeCStringSpelling)
|
|||||||
|
|
||||||
TEST_F(Cursor, CanonicalTypeIsNotType)
|
TEST_F(Cursor, CanonicalTypeIsNotType)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(43, 5);
|
auto cursor = translationUnit.cursorAt(43, 5);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.type().canonical(), Not(cursor.type()));
|
ASSERT_THAT(cursor.type().canonical(), Not(cursor.type()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, TypeDeclartionIsAlias)
|
TEST_F(Cursor, TypeDeclartionIsAlias)
|
||||||
{
|
{
|
||||||
auto declarationCursor = translationUnitCore.cursorAt(41, 5);
|
auto declarationCursor = translationUnit.cursorAt(41, 5);
|
||||||
auto lintCursor = translationUnitCore.cursorAt(39, 11);
|
auto lintCursor = translationUnit.cursorAt(39, 11);
|
||||||
|
|
||||||
ASSERT_THAT(declarationCursor.type().declaration().type(), lintCursor.type());
|
ASSERT_THAT(declarationCursor.type().declaration().type(), lintCursor.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, TypeIsConstantWithoutAliasLookup)
|
TEST_F(Cursor, TypeIsConstantWithoutAliasLookup)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(45, 16);
|
auto cursor = translationUnit.cursorAt(45, 16);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.type().isConstant());
|
ASSERT_TRUE(cursor.type().isConstant());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, ClassIsCompoundType)
|
TEST_F(Cursor, ClassIsCompoundType)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 10, 7);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isCompoundType());
|
ASSERT_TRUE(cursor.isCompoundType());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, StructIsCompoundType)
|
TEST_F(Cursor, StructIsCompoundType)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isCompoundType());
|
ASSERT_TRUE(cursor.isCompoundType());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, UnionIsCompoundType)
|
TEST_F(Cursor, UnionIsCompoundType)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 33, 7);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 33, 7);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isCompoundType());
|
ASSERT_TRUE(cursor.isCompoundType());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsDeclaration)
|
TEST_F(Cursor, IsDeclaration)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(41, 10);
|
auto cursor = translationUnit.cursorAt(41, 10);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isDeclaration());
|
ASSERT_TRUE(cursor.isDeclaration());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, SemanticParent)
|
TEST_F(Cursor, SemanticParent)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(43, 6);
|
auto cursor = translationUnit.cursorAt(43, 6);
|
||||||
auto expectedSemanticParent = translationUnitCore.cursorAt(36, 18);
|
auto expectedSemanticParent = translationUnit.cursorAt(36, 18);
|
||||||
|
|
||||||
auto semanticParent = cursor.semanticParent();
|
auto semanticParent = cursor.semanticParent();
|
||||||
|
|
||||||
@@ -380,117 +381,117 @@ TEST_F(Cursor, SemanticParent)
|
|||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInMethod)
|
TEST_F(Cursor, IsLocalVariableInMethod)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(20, 9);
|
auto cursor = translationUnit.cursorAt(20, 9);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInStaticFunction)
|
TEST_F(Cursor, IsLocalVariableInStaticFunction)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(43, 5);
|
auto cursor = translationUnit.cursorAt(43, 5);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInTemplateFunction)
|
TEST_F(Cursor, IsLocalVariableInTemplateFunction)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(52, 7);
|
auto cursor = translationUnit.cursorAt(52, 7);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInConversionOperator)
|
TEST_F(Cursor, IsLocalVariableInConversionOperator)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(57, 9);
|
auto cursor = translationUnit.cursorAt(57, 9);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInOperator)
|
TEST_F(Cursor, IsLocalVariableInOperator)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(62, 9);
|
auto cursor = translationUnit.cursorAt(62, 9);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInConstructor)
|
TEST_F(Cursor, IsLocalVariableInConstructor)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(13, 9);
|
auto cursor = translationUnit.cursorAt(13, 9);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsLocalVariableInDestructor)
|
TEST_F(Cursor, IsLocalVariableInDestructor)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(69, 9);
|
auto cursor = translationUnit.cursorAt(69, 9);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.isLocalVariable());
|
ASSERT_TRUE(cursor.isLocalVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, FindFunctionCaller)
|
TEST_F(Cursor, FindFunctionCaller)
|
||||||
{
|
{
|
||||||
auto functionCursor = translationUnitCore.cursorAt(92, 24);
|
auto functionCursor = translationUnit.cursorAt(92, 24);
|
||||||
auto structCursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
auto structCursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
||||||
|
|
||||||
ASSERT_THAT(functionCursor.functionBaseDeclaration(), structCursor);
|
ASSERT_THAT(functionCursor.functionBaseDeclaration(), structCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, FindFunctionCallerPointer)
|
TEST_F(Cursor, FindFunctionCallerPointer)
|
||||||
{
|
{
|
||||||
auto functionCursor = translationUnitCore.cursorAt(79, 25);
|
auto functionCursor = translationUnit.cursorAt(79, 25);
|
||||||
auto structCursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
auto structCursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
||||||
|
|
||||||
ASSERT_THAT(functionCursor.functionBaseDeclaration(), structCursor);
|
ASSERT_THAT(functionCursor.functionBaseDeclaration(), structCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, FindFunctionCallerThis)
|
TEST_F(Cursor, FindFunctionCallerThis)
|
||||||
{
|
{
|
||||||
auto functionCursor = translationUnitCore.cursorAt(106, 5);
|
auto functionCursor = translationUnit.cursorAt(106, 5);
|
||||||
auto structCursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 38, 8);
|
auto structCursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 38, 8);
|
||||||
|
|
||||||
ASSERT_THAT(functionCursor.functionBaseDeclaration(), structCursor);
|
ASSERT_THAT(functionCursor.functionBaseDeclaration(), structCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, NonPointerTypeForValue)
|
TEST_F(Cursor, NonPointerTypeForValue)
|
||||||
{
|
{
|
||||||
auto variableCursor = translationUnitCore.cursorAt(101, 10);
|
auto variableCursor = translationUnit.cursorAt(101, 10);
|
||||||
auto variablePointerCursor = translationUnitCore.cursorAt(100, 11);
|
auto variablePointerCursor = translationUnit.cursorAt(100, 11);
|
||||||
|
|
||||||
ASSERT_THAT(variableCursor.nonPointerTupe(), variablePointerCursor.nonPointerTupe());
|
ASSERT_THAT(variableCursor.nonPointerTupe(), variablePointerCursor.nonPointerTupe());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, HasFinalAttributeInFunction)
|
TEST_F(Cursor, HasFinalAttributeInFunction)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 30, 18);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 30, 18);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.hasFinalFunctionAttribute());
|
ASSERT_TRUE(cursor.hasFinalFunctionAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, HasNotFinalAttributeInFunction)
|
TEST_F(Cursor, HasNotFinalAttributeInFunction)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 15, 17);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 15, 17);
|
||||||
|
|
||||||
ASSERT_FALSE(cursor.hasFinalFunctionAttribute());
|
ASSERT_FALSE(cursor.hasFinalFunctionAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, HasFinalAttributeInClass)
|
TEST_F(Cursor, HasFinalAttributeInClass)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 28, 8);
|
||||||
|
|
||||||
ASSERT_TRUE(cursor.hasFinalClassAttribute());
|
ASSERT_TRUE(cursor.hasFinalClassAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, HasNotFinaAttributeInClass)
|
TEST_F(Cursor, HasNotFinaAttributeInClass)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 38, 8);
|
auto cursor = translationUnit.cursorAt(Utf8StringLiteral(TESTDATA_DIR"/cursor.h"), 38, 8);
|
||||||
|
|
||||||
ASSERT_FALSE(cursor.hasFinalClassAttribute());
|
ASSERT_FALSE(cursor.hasFinalClassAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, HasOutputValues)
|
TEST_F(Cursor, HasOutputValues)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(117, 19);
|
auto callExpressionCursor = translationUnit.cursorAt(117, 19);
|
||||||
auto outputArgumentExpectedCursor = translationUnitCore.cursorAt(117, 20);
|
auto outputArgumentExpectedCursor = translationUnit.cursorAt(117, 20);
|
||||||
|
|
||||||
auto outputArguments = callExpressionCursor.outputArguments();
|
auto outputArguments = callExpressionCursor.outputArguments();
|
||||||
|
|
||||||
@@ -500,7 +501,7 @@ TEST_F(Cursor, HasOutputValues)
|
|||||||
|
|
||||||
TEST_F(Cursor, HasOnlyInputValues)
|
TEST_F(Cursor, HasOnlyInputValues)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(118, 18);
|
auto callExpressionCursor = translationUnit.cursorAt(118, 18);
|
||||||
|
|
||||||
auto outputArguments = callExpressionCursor.outputArguments();
|
auto outputArguments = callExpressionCursor.outputArguments();
|
||||||
|
|
||||||
@@ -509,7 +510,7 @@ TEST_F(Cursor, HasOnlyInputValues)
|
|||||||
|
|
||||||
TEST_F(Cursor, ArgumentCountIsZero)
|
TEST_F(Cursor, ArgumentCountIsZero)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(121, 23);
|
auto cursor = translationUnit.cursorAt(121, 23);
|
||||||
|
|
||||||
auto count = cursor.type().argumentCount();
|
auto count = cursor.type().argumentCount();
|
||||||
|
|
||||||
@@ -518,7 +519,7 @@ TEST_F(Cursor, ArgumentCountIsZero)
|
|||||||
|
|
||||||
TEST_F(Cursor, ArgumentCountIsTwo)
|
TEST_F(Cursor, ArgumentCountIsTwo)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(122, 22);
|
auto cursor = translationUnit.cursorAt(122, 22);
|
||||||
|
|
||||||
auto count = cursor.type().argumentCount();
|
auto count = cursor.type().argumentCount();
|
||||||
|
|
||||||
@@ -527,7 +528,7 @@ TEST_F(Cursor, ArgumentCountIsTwo)
|
|||||||
|
|
||||||
TEST_F(Cursor, ArgumentOneIsValue)
|
TEST_F(Cursor, ArgumentOneIsValue)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(122, 22);
|
auto callExpressionCursor = translationUnit.cursorAt(122, 22);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -537,7 +538,7 @@ TEST_F(Cursor, ArgumentOneIsValue)
|
|||||||
|
|
||||||
TEST_F(Cursor, ArgumentTwoIsLValueReference)
|
TEST_F(Cursor, ArgumentTwoIsLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(122, 22);
|
auto callExpressionCursor = translationUnit.cursorAt(122, 22);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(1);
|
auto argument = callExpressionCursor.type().argument(1);
|
||||||
|
|
||||||
@@ -546,7 +547,7 @@ TEST_F(Cursor, ArgumentTwoIsLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, ArgumentTwoIsConstantReference)
|
TEST_F(Cursor, ArgumentTwoIsConstantReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(122, 22);
|
auto callExpressionCursor = translationUnit.cursorAt(122, 22);
|
||||||
|
|
||||||
auto argumentPointee = callExpressionCursor.type().argument(1);
|
auto argumentPointee = callExpressionCursor.type().argument(1);
|
||||||
|
|
||||||
@@ -555,7 +556,7 @@ TEST_F(Cursor, ArgumentTwoIsConstantReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, CursorArgumentCount)
|
TEST_F(Cursor, CursorArgumentCount)
|
||||||
{
|
{
|
||||||
auto cursor = translationUnitCore.cursorAt(117, 19);
|
auto cursor = translationUnit.cursorAt(117, 19);
|
||||||
|
|
||||||
ASSERT_THAT(cursor.kind(), CXCursor_CallExpr);
|
ASSERT_THAT(cursor.kind(), CXCursor_CallExpr);
|
||||||
ASSERT_THAT(cursor.argumentCount(), 4);
|
ASSERT_THAT(cursor.argumentCount(), 4);
|
||||||
@@ -563,15 +564,15 @@ TEST_F(Cursor, CursorArgumentCount)
|
|||||||
|
|
||||||
TEST_F(Cursor, CursorArgumentInputValue)
|
TEST_F(Cursor, CursorArgumentInputValue)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(117, 19);
|
auto callExpressionCursor = translationUnit.cursorAt(117, 19);
|
||||||
auto declarationReferenceExpressionCursor = translationUnitCore.cursorAt(117, 20);
|
auto declarationReferenceExpressionCursor = translationUnit.cursorAt(117, 20);
|
||||||
|
|
||||||
ASSERT_THAT(callExpressionCursor.argument(0), declarationReferenceExpressionCursor);
|
ASSERT_THAT(callExpressionCursor.argument(0), declarationReferenceExpressionCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(Cursor, IsConstantLValueReference)
|
TEST_F(Cursor, IsConstantLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(125, 26);
|
auto callExpressionCursor = translationUnit.cursorAt(125, 26);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -580,7 +581,7 @@ TEST_F(Cursor, IsConstantLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, LValueReferenceIsNotConstantLValueReference)
|
TEST_F(Cursor, LValueReferenceIsNotConstantLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(124, 21);
|
auto callExpressionCursor = translationUnit.cursorAt(124, 21);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -589,7 +590,7 @@ TEST_F(Cursor, LValueReferenceIsNotConstantLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, ValueIsNotConstantLValueReference)
|
TEST_F(Cursor, ValueIsNotConstantLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(123, 18);
|
auto callExpressionCursor = translationUnit.cursorAt(123, 18);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -598,7 +599,7 @@ TEST_F(Cursor, ValueIsNotConstantLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerToConstantNotConstantLValueReference)
|
TEST_F(Cursor, PointerToConstantNotConstantLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(126, 20);
|
auto callExpressionCursor = translationUnit.cursorAt(126, 20);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -607,7 +608,7 @@ TEST_F(Cursor, PointerToConstantNotConstantLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, IsLValueReference)
|
TEST_F(Cursor, IsLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(124, 21);
|
auto callExpressionCursor = translationUnit.cursorAt(124, 21);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -616,7 +617,7 @@ TEST_F(Cursor, IsLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstantLValueReferenceIsLValueReference)
|
TEST_F(Cursor, ConstantLValueReferenceIsLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(125, 26);
|
auto callExpressionCursor = translationUnit.cursorAt(125, 26);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -625,7 +626,7 @@ TEST_F(Cursor, ConstantLValueReferenceIsLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, ValueIsNotLValueReference)
|
TEST_F(Cursor, ValueIsNotLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(123, 18);
|
auto callExpressionCursor = translationUnit.cursorAt(123, 18);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -634,7 +635,7 @@ TEST_F(Cursor, ValueIsNotLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerIsNotLValueReference)
|
TEST_F(Cursor, PointerIsNotLValueReference)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(126, 20);
|
auto callExpressionCursor = translationUnit.cursorAt(126, 20);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -643,7 +644,7 @@ TEST_F(Cursor, PointerIsNotLValueReference)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerToConstant)
|
TEST_F(Cursor, PointerToConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(126, 20);
|
auto callExpressionCursor = translationUnit.cursorAt(126, 20);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -652,7 +653,7 @@ TEST_F(Cursor, PointerToConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, ValueIsNotPointerToConstant)
|
TEST_F(Cursor, ValueIsNotPointerToConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(123, 18);
|
auto callExpressionCursor = translationUnit.cursorAt(123, 18);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -661,7 +662,7 @@ TEST_F(Cursor, ValueIsNotPointerToConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerNotPointerToConstant)
|
TEST_F(Cursor, PointerNotPointerToConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(127, 13);
|
auto callExpressionCursor = translationUnit.cursorAt(127, 13);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -670,7 +671,7 @@ TEST_F(Cursor, PointerNotPointerToConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstantLValueReferenceIsNotPointerToConstant)
|
TEST_F(Cursor, ConstantLValueReferenceIsNotPointerToConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(125, 26);
|
auto callExpressionCursor = translationUnit.cursorAt(125, 26);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -679,7 +680,7 @@ TEST_F(Cursor, ConstantLValueReferenceIsNotPointerToConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, IsConstantPointer)
|
TEST_F(Cursor, IsConstantPointer)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(128, 21);
|
auto callExpressionCursor = translationUnit.cursorAt(128, 21);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -688,7 +689,7 @@ TEST_F(Cursor, IsConstantPointer)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerToConstantIsNotConstantPointer)
|
TEST_F(Cursor, PointerToConstantIsNotConstantPointer)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(126, 20);
|
auto callExpressionCursor = translationUnit.cursorAt(126, 20);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -697,7 +698,7 @@ TEST_F(Cursor, PointerToConstantIsNotConstantPointer)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstValueIsNotConstantPointer)
|
TEST_F(Cursor, ConstValueIsNotConstantPointer)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(129, 23);
|
auto callExpressionCursor = translationUnit.cursorAt(129, 23);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -706,7 +707,7 @@ TEST_F(Cursor, ConstValueIsNotConstantPointer)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerToConstantIsReferencingConstant)
|
TEST_F(Cursor, PointerToConstantIsReferencingConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(126, 20);
|
auto callExpressionCursor = translationUnit.cursorAt(126, 20);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -715,7 +716,7 @@ TEST_F(Cursor, PointerToConstantIsReferencingConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstantReferenceIsReferencingConstant)
|
TEST_F(Cursor, ConstantReferenceIsReferencingConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(125, 26);
|
auto callExpressionCursor = translationUnit.cursorAt(125, 26);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -724,7 +725,7 @@ TEST_F(Cursor, ConstantReferenceIsReferencingConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, LValueReferenceIsNotReferencingConstant)
|
TEST_F(Cursor, LValueReferenceIsNotReferencingConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(124, 21);
|
auto callExpressionCursor = translationUnit.cursorAt(124, 21);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -733,7 +734,7 @@ TEST_F(Cursor, LValueReferenceIsNotReferencingConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, ValueIsNotReferencingConstant)
|
TEST_F(Cursor, ValueIsNotReferencingConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(123, 18);
|
auto callExpressionCursor = translationUnit.cursorAt(123, 18);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -742,7 +743,7 @@ TEST_F(Cursor, ValueIsNotReferencingConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerIsNotRefencingConstant)
|
TEST_F(Cursor, PointerIsNotRefencingConstant)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(127, 13);
|
auto callExpressionCursor = translationUnit.cursorAt(127, 13);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -751,7 +752,7 @@ TEST_F(Cursor, PointerIsNotRefencingConstant)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerIsOutputParameter)
|
TEST_F(Cursor, PointerIsOutputParameter)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(127, 13);
|
auto callExpressionCursor = translationUnit.cursorAt(127, 13);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -760,7 +761,7 @@ TEST_F(Cursor, PointerIsOutputParameter)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstantReferenceIsNotOutputParameter)
|
TEST_F(Cursor, ConstantReferenceIsNotOutputParameter)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(125, 26);
|
auto callExpressionCursor = translationUnit.cursorAt(125, 26);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -769,7 +770,7 @@ TEST_F(Cursor, ConstantReferenceIsNotOutputParameter)
|
|||||||
|
|
||||||
TEST_F(Cursor, PointerToConstantIsNotOutputParameter)
|
TEST_F(Cursor, PointerToConstantIsNotOutputParameter)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(126, 20);
|
auto callExpressionCursor = translationUnit.cursorAt(126, 20);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -778,7 +779,7 @@ TEST_F(Cursor, PointerToConstantIsNotOutputParameter)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstantPointerIsNotOutputParameter)
|
TEST_F(Cursor, ConstantPointerIsNotOutputParameter)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(128, 21);
|
auto callExpressionCursor = translationUnit.cursorAt(128, 21);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -787,7 +788,7 @@ TEST_F(Cursor, ConstantPointerIsNotOutputParameter)
|
|||||||
|
|
||||||
TEST_F(Cursor, ReferenceIsOutputParameter)
|
TEST_F(Cursor, ReferenceIsOutputParameter)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(124, 21);
|
auto callExpressionCursor = translationUnit.cursorAt(124, 21);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
@@ -796,7 +797,7 @@ TEST_F(Cursor, ReferenceIsOutputParameter)
|
|||||||
|
|
||||||
TEST_F(Cursor, ConstReferenceIsNotOutputParameter)
|
TEST_F(Cursor, ConstReferenceIsNotOutputParameter)
|
||||||
{
|
{
|
||||||
auto callExpressionCursor = translationUnitCore.cursorAt(125, 26);
|
auto callExpressionCursor = translationUnit.cursorAt(125, 26);
|
||||||
|
|
||||||
auto argument = callExpressionCursor.type().argument(0);
|
auto argument = callExpressionCursor.type().argument(0);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include <sourcelocation.h>
|
#include <sourcelocation.h>
|
||||||
#include <sourcelocationcontainer.h>
|
#include <sourcelocationcontainer.h>
|
||||||
#include <sourcerangecontainer.h>
|
#include <sourcerangecontainer.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ protected:
|
|||||||
TEST_F(DiagnosticSet, SetHasContent)
|
TEST_F(DiagnosticSet, SetHasContent)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
const auto set = document.translationUnitCore().diagnostics();
|
const auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
ASSERT_THAT(set.size(), 1);
|
ASSERT_THAT(set.size(), 1);
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ TEST_F(DiagnosticSet, SetHasContent)
|
|||||||
TEST_F(DiagnosticSet, MoveConstructor)
|
TEST_F(DiagnosticSet, MoveConstructor)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
auto set = document.translationUnitCore().diagnostics();
|
auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
const auto set2 = std::move(set);
|
const auto set2 = std::move(set);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ TEST_F(DiagnosticSet, MoveConstructor)
|
|||||||
TEST_F(DiagnosticSet, MoveAssigment)
|
TEST_F(DiagnosticSet, MoveAssigment)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
auto set = document.translationUnitCore().diagnostics();
|
auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
auto set2 = std::move(set);
|
auto set2 = std::move(set);
|
||||||
set = std::move(set2);
|
set = std::move(set2);
|
||||||
@@ -118,7 +118,7 @@ TEST_F(DiagnosticSet, MoveAssigment)
|
|||||||
TEST_F(DiagnosticSet, MoveSelfAssigment)
|
TEST_F(DiagnosticSet, MoveSelfAssigment)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
auto set = document.translationUnitCore().diagnostics();
|
auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
set = std::move(set);
|
set = std::move(set);
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ TEST_F(DiagnosticSet, MoveSelfAssigment)
|
|||||||
TEST_F(DiagnosticSet, FirstElementEqualBegin)
|
TEST_F(DiagnosticSet, FirstElementEqualBegin)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
auto set = document.translationUnitCore().diagnostics();
|
auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
ASSERT_TRUE(set.front() == *set.begin());
|
ASSERT_TRUE(set.front() == *set.begin());
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ TEST_F(DiagnosticSet, FirstElementEqualBegin)
|
|||||||
TEST_F(DiagnosticSet, BeginIsUnequalEnd)
|
TEST_F(DiagnosticSet, BeginIsUnequalEnd)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
auto set = document.translationUnitCore().diagnostics();
|
auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
ASSERT_TRUE(set.begin() != set.end());
|
ASSERT_TRUE(set.begin() != set.end());
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ TEST_F(DiagnosticSet, BeginIsUnequalEnd)
|
|||||||
TEST_F(DiagnosticSet, BeginPlusOneIsEqualEnd)
|
TEST_F(DiagnosticSet, BeginPlusOneIsEqualEnd)
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
auto set = document.translationUnitCore().diagnostics();
|
auto set = document.translationUnit().diagnostics();
|
||||||
|
|
||||||
ASSERT_TRUE(++set.begin() == set.end());
|
ASSERT_TRUE(++set.begin() == set.end());
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ TEST_F(DiagnosticSet, ToDiagnosticContainersLetThroughByDefault)
|
|||||||
const auto diagnosticContainerWithoutChild = expectedDiagnostic(WithChild);
|
const auto diagnosticContainerWithoutChild = expectedDiagnostic(WithChild);
|
||||||
documentMainFile.parse();
|
documentMainFile.parse();
|
||||||
|
|
||||||
const auto diagnostics = documentMainFile.translationUnitCore().diagnostics().toDiagnosticContainers();
|
const auto diagnostics = documentMainFile.translationUnit().diagnostics().toDiagnosticContainers();
|
||||||
|
|
||||||
ASSERT_THAT(diagnostics, Contains(IsDiagnosticContainer(diagnosticContainerWithoutChild)));
|
ASSERT_THAT(diagnostics, Contains(IsDiagnosticContainer(diagnosticContainerWithoutChild)));
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ TEST_F(DiagnosticSet, ToDiagnosticContainersLetThroughByDefault)
|
|||||||
TEST_F(DiagnosticSet, ToDiagnosticContainersFiltersOutTopLevelItem)
|
TEST_F(DiagnosticSet, ToDiagnosticContainersFiltersOutTopLevelItem)
|
||||||
{
|
{
|
||||||
documentMainFile.parse();
|
documentMainFile.parse();
|
||||||
const ::DiagnosticSet diagnosticSetWithChildren{documentMainFile.translationUnitCore().diagnostics()};
|
const ::DiagnosticSet diagnosticSetWithChildren{documentMainFile.translationUnit().diagnostics()};
|
||||||
const auto acceptNoDiagnostics = [](const Diagnostic &) { return false; };
|
const auto acceptNoDiagnostics = [](const Diagnostic &) { return false; };
|
||||||
|
|
||||||
const auto diagnostics = diagnosticSetWithChildren.toDiagnosticContainers(acceptNoDiagnostics);
|
const auto diagnostics = diagnosticSetWithChildren.toDiagnosticContainers(acceptNoDiagnostics);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <projectpart.h>
|
#include <projectpart.h>
|
||||||
#include <clangdocument.h>
|
#include <clangdocument.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
#include <sourcelocation.h>
|
#include <sourcelocation.h>
|
||||||
@@ -82,7 +82,7 @@ MATCHER_P4(IsSourceLocation, filePath, line, column, offset,
|
|||||||
|
|
||||||
struct DiagnosticData {
|
struct DiagnosticData {
|
||||||
DiagnosticData(Document &document)
|
DiagnosticData(Document &document)
|
||||||
: diagnosticSet{document.translationUnitCore().diagnostics()}
|
: diagnosticSet{document.translationUnit().diagnostics()}
|
||||||
, diagnostic{diagnosticSet.front()}
|
, diagnostic{diagnosticSet.front()}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <clangdocument.h>
|
#include <clangdocument.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
#include <sourcelocation.h>
|
#include <sourcelocation.h>
|
||||||
#include <sourcerange.h>
|
#include <sourcerange.h>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
using ClangBackEnd::DiagnosticSet;
|
using ClangBackEnd::DiagnosticSet;
|
||||||
using ClangBackEnd::Document;
|
using ClangBackEnd::Document;
|
||||||
using ClangBackEnd::TranslationUnitCore;
|
using ClangBackEnd::TranslationUnit;
|
||||||
using ClangBackEnd::ProjectPart;
|
using ClangBackEnd::ProjectPart;
|
||||||
using ClangBackEnd::UnsavedFiles;
|
using ClangBackEnd::UnsavedFiles;
|
||||||
using ClangBackEnd::Diagnostic;
|
using ClangBackEnd::Diagnostic;
|
||||||
@@ -72,8 +72,8 @@ MATCHER_P4(IsSourceLocation, filePath, line, column, offset,
|
|||||||
|
|
||||||
struct FixItData
|
struct FixItData
|
||||||
{
|
{
|
||||||
FixItData(TranslationUnitCore &translationUnitCore)
|
FixItData(TranslationUnit &translationUnit)
|
||||||
: diagnosticSet{translationUnitCore.diagnostics()}
|
: diagnosticSet{translationUnit.diagnostics()}
|
||||||
, diagnostic{diagnosticSet.front()}
|
, diagnostic{diagnosticSet.front()}
|
||||||
, fixIt{diagnostic.fixIts().front()}
|
, fixIt{diagnostic.fixIts().front()}
|
||||||
{
|
{
|
||||||
@@ -89,7 +89,7 @@ struct Data
|
|||||||
Data()
|
Data()
|
||||||
{
|
{
|
||||||
document.parse();
|
document.parse();
|
||||||
d.reset(new FixItData(translationUnitCore));
|
d.reset(new FixItData(translationUnit));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId")};
|
ProjectPart projectPart{Utf8StringLiteral("projectPartId")};
|
||||||
@@ -100,7 +100,7 @@ struct Data
|
|||||||
projectPart,
|
projectPart,
|
||||||
Utf8StringVector(),
|
Utf8StringVector(),
|
||||||
documents};
|
documents};
|
||||||
TranslationUnitCore translationUnitCore{document.translationUnitCore()};
|
TranslationUnit translationUnit{document.translationUnit()};
|
||||||
std::unique_ptr<FixItData> d;
|
std::unique_ptr<FixItData> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <clangdocument.h>
|
#include <clangdocument.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
#include <clangbackendipc_global.h>
|
#include <clangbackendipc_global.h>
|
||||||
#include <clangstring.h>
|
#include <clangstring.h>
|
||||||
@@ -51,7 +51,7 @@ using ClangBackEnd::HighlightingMarks;
|
|||||||
using ClangBackEnd::HighlightingType;
|
using ClangBackEnd::HighlightingType;
|
||||||
using ClangBackEnd::Document;
|
using ClangBackEnd::Document;
|
||||||
using ClangBackEnd::Documents;
|
using ClangBackEnd::Documents;
|
||||||
using ClangBackEnd::TranslationUnitCore;
|
using ClangBackEnd::TranslationUnit;
|
||||||
using ClangBackEnd::UnsavedFiles;
|
using ClangBackEnd::UnsavedFiles;
|
||||||
using ClangBackEnd::ProjectPart;
|
using ClangBackEnd::ProjectPart;
|
||||||
using ClangBackEnd::ClangString;
|
using ClangBackEnd::ClangString;
|
||||||
@@ -113,9 +113,9 @@ struct Data {
|
|||||||
{Utf8StringLiteral("-std=c++14")}),
|
{Utf8StringLiteral("-std=c++14")}),
|
||||||
{},
|
{},
|
||||||
documents};
|
documents};
|
||||||
TranslationUnitCore translationUnitCore{filePath,
|
TranslationUnit translationUnit{filePath,
|
||||||
document.translationUnitCore().cxIndex(),
|
document.translationUnit().cxIndex(),
|
||||||
document.translationUnitCore().cxTranslationUnit()};
|
document.translationUnit().cxTranslationUnit()};
|
||||||
};
|
};
|
||||||
|
|
||||||
class HighlightingMarks : public ::testing::Test
|
class HighlightingMarks : public ::testing::Test
|
||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static Data *d;
|
static Data *d;
|
||||||
const TranslationUnitCore &translationUnitCore = d->translationUnitCore;
|
const TranslationUnit &translationUnit = d->translationUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, CreateNullInformations)
|
TEST_F(HighlightingMarks, CreateNullInformations)
|
||||||
@@ -147,17 +147,17 @@ TEST_F(HighlightingMarks, NullInformationsAreEmpty)
|
|||||||
|
|
||||||
TEST_F(HighlightingMarks, IsNotNull)
|
TEST_F(HighlightingMarks, IsNotNull)
|
||||||
{
|
{
|
||||||
const auto aRange = translationUnitCore.sourceRange(3, 1, 5, 1);
|
const auto aRange = translationUnit.sourceRange(3, 1, 5, 1);
|
||||||
|
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(aRange);
|
const auto infos = translationUnit.highlightingMarksInRange(aRange);
|
||||||
|
|
||||||
ASSERT_FALSE(infos.isNull());
|
ASSERT_FALSE(infos.isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, IteratorBeginEnd)
|
TEST_F(HighlightingMarks, IteratorBeginEnd)
|
||||||
{
|
{
|
||||||
const auto aRange = translationUnitCore.sourceRange(3, 1, 5, 1);
|
const auto aRange = translationUnit.sourceRange(3, 1, 5, 1);
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(aRange);
|
const auto infos = translationUnit.highlightingMarksInRange(aRange);
|
||||||
|
|
||||||
const auto endIterator = std::next(infos.begin(), infos.size());
|
const auto endIterator = std::next(infos.begin(), infos.size());
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ TEST_F(HighlightingMarks, IteratorBeginEnd)
|
|||||||
|
|
||||||
TEST_F(HighlightingMarks, ForFullTranslationUnitRange)
|
TEST_F(HighlightingMarks, ForFullTranslationUnitRange)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarks();
|
const auto infos = translationUnit.highlightingMarks();
|
||||||
|
|
||||||
ASSERT_THAT(infos, AllOf(Contains(IsHighlightingMark(1u, 1u, 4u, HighlightingType::Keyword)),
|
ASSERT_THAT(infos, AllOf(Contains(IsHighlightingMark(1u, 1u, 4u, HighlightingType::Keyword)),
|
||||||
Contains(IsHighlightingMark(277u, 5u, 15u, HighlightingType::Function))));
|
Contains(IsHighlightingMark(277u, 5u, 15u, HighlightingType::Function))));
|
||||||
@@ -174,611 +174,611 @@ TEST_F(HighlightingMarks, ForFullTranslationUnitRange)
|
|||||||
|
|
||||||
TEST_F(HighlightingMarks, Size)
|
TEST_F(HighlightingMarks, Size)
|
||||||
{
|
{
|
||||||
const auto range = translationUnitCore.sourceRange(5, 5, 5, 10);
|
const auto range = translationUnit.sourceRange(5, 5, 5, 10);
|
||||||
|
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(range);
|
const auto infos = translationUnit.highlightingMarksInRange(range);
|
||||||
|
|
||||||
ASSERT_THAT(infos.size(), 1);
|
ASSERT_THAT(infos.size(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_Keyword)
|
TEST_F(HighlightingMarks, DISABLED_Keyword)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(5, 12));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(5, 12));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], IsHighlightingMark(5u, 5u, 6u, HighlightingType::Keyword));
|
ASSERT_THAT(infos[0], IsHighlightingMark(5u, 5u, 6u, HighlightingType::Keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StringLiteral)
|
TEST_F(HighlightingMarks, StringLiteral)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(1, 29));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(1, 29));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], IsHighlightingMark(1u, 24u, 10u, HighlightingType::StringLiteral));
|
ASSERT_THAT(infos[4], IsHighlightingMark(1u, 24u, 10u, HighlightingType::StringLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, Utf8StringLiteral)
|
TEST_F(HighlightingMarks, Utf8StringLiteral)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(2, 33));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(2, 33));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], IsHighlightingMark(2u, 24u, 12u, HighlightingType::StringLiteral));
|
ASSERT_THAT(infos[4], IsHighlightingMark(2u, 24u, 12u, HighlightingType::StringLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, RawStringLiteral)
|
TEST_F(HighlightingMarks, RawStringLiteral)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(3, 34));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(3, 34));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], IsHighlightingMark(3u, 24u, 13u, HighlightingType::StringLiteral));
|
ASSERT_THAT(infos[4], IsHighlightingMark(3u, 24u, 13u, HighlightingType::StringLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, CharacterLiteral)
|
TEST_F(HighlightingMarks, CharacterLiteral)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(4, 28));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(4, 28));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], IsHighlightingMark(4u, 24u, 3u, HighlightingType::StringLiteral));
|
ASSERT_THAT(infos[3], IsHighlightingMark(4u, 24u, 3u, HighlightingType::StringLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, IntegerLiteral)
|
TEST_F(HighlightingMarks, IntegerLiteral)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(23, 26));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(23, 26));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], IsHighlightingMark(23u, 24u, 1u, HighlightingType::NumberLiteral));
|
ASSERT_THAT(infos[3], IsHighlightingMark(23u, 24u, 1u, HighlightingType::NumberLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FloatLiteral)
|
TEST_F(HighlightingMarks, FloatLiteral)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(24, 29));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(24, 29));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], IsHighlightingMark(24u, 24u, 4u, HighlightingType::NumberLiteral));
|
ASSERT_THAT(infos[3], IsHighlightingMark(24u, 24u, 4u, HighlightingType::NumberLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FunctionDefinition)
|
TEST_F(HighlightingMarks, FunctionDefinition)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(45, 20));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(45, 20));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, MemberFunctionDefinition)
|
TEST_F(HighlightingMarks, MemberFunctionDefinition)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(52, 29));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(52, 29));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FunctionDeclaration)
|
TEST_F(HighlightingMarks, FunctionDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(55, 32));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(55, 32));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, MemberFunctionDeclaration)
|
TEST_F(HighlightingMarks, MemberFunctionDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(59, 27));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(59, 27));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, MemberFunctionReference)
|
TEST_F(HighlightingMarks, MemberFunctionReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(104, 35));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(104, 35));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], IsHighlightingMark(104u, 9u, 23u, HighlightingType::Function));
|
ASSERT_THAT(infos[0], IsHighlightingMark(104u, 9u, 23u, HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FunctionCall)
|
TEST_F(HighlightingMarks, FunctionCall)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(64, 16));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(64, 16));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TypeConversionFunction)
|
TEST_F(HighlightingMarks, TypeConversionFunction)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(68, 20));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(68, 20));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], IsHighlightingMark(68u, 14u, 3u, HighlightingType::Type));
|
ASSERT_THAT(infos[1], IsHighlightingMark(68u, 14u, 3u, HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, InbuiltTypeConversionFunction)
|
TEST_F(HighlightingMarks, InbuiltTypeConversionFunction)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(69, 20));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(69, 20));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], IsHighlightingMark(69u, 14u, 3u, HighlightingType::Keyword));
|
ASSERT_THAT(infos[1], IsHighlightingMark(69u, 14u, 3u, HighlightingType::Keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TypeReference)
|
TEST_F(HighlightingMarks, TypeReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(74, 13));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(74, 13));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], IsHighlightingMark(74u, 5u, 3u, HighlightingType::Type));
|
ASSERT_THAT(infos[0], IsHighlightingMark(74u, 5u, 3u, HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, LocalVariable)
|
TEST_F(HighlightingMarks, LocalVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(79, 13));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(79, 13));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, LocalVariableDeclaration)
|
TEST_F(HighlightingMarks, LocalVariableDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(79, 13));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(79, 13));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[1], IsHighlightingMark(79u, 9u, 3u, HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, LocalVariableReference)
|
TEST_F(HighlightingMarks, LocalVariableReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(81, 26));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(81, 26));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], IsHighlightingMark(81u, 5u, 3u, HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[0], IsHighlightingMark(81u, 5u, 3u, HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, LocalVariableFunctionArgumentDeclaration)
|
TEST_F(HighlightingMarks, LocalVariableFunctionArgumentDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(84, 45));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(84, 45));
|
||||||
|
|
||||||
ASSERT_THAT(infos[5], IsHighlightingMark(84u, 41u, 3u, HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[5], IsHighlightingMark(84u, 41u, 3u, HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, LocalVariableFunctionArgumentReference)
|
TEST_F(HighlightingMarks, LocalVariableFunctionArgumentReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(86, 26));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(86, 26));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], IsHighlightingMark(86u, 5u, 3u, HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[0], IsHighlightingMark(86u, 5u, 3u, HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassVariableDeclaration)
|
TEST_F(HighlightingMarks, ClassVariableDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(90, 21));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(90, 21));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], IsHighlightingMark(90u, 9u, 11u, HighlightingType::Field));
|
ASSERT_THAT(infos[1], IsHighlightingMark(90u, 9u, 11u, HighlightingType::Field));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassVariableReference)
|
TEST_F(HighlightingMarks, ClassVariableReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(94, 23));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(94, 23));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], IsHighlightingMark(94u, 9u, 11u, HighlightingType::Field));
|
ASSERT_THAT(infos[0], IsHighlightingMark(94u, 9u, 11u, HighlightingType::Field));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StaticMethodDeclaration)
|
TEST_F(HighlightingMarks, StaticMethodDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(110, 25));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(110, 25));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StaticMethodReference)
|
TEST_F(HighlightingMarks, StaticMethodReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(114, 30));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(114, 30));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, Enumeration)
|
TEST_F(HighlightingMarks, Enumeration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(118, 17));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(118, 17));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, Enumerator)
|
TEST_F(HighlightingMarks, Enumerator)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(120, 15));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(120, 15));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Enumeration));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Enumeration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, EnumerationReferenceDeclarationType)
|
TEST_F(HighlightingMarks, EnumerationReferenceDeclarationType)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(125, 28));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(125, 28));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, EnumerationReferenceDeclarationVariable)
|
TEST_F(HighlightingMarks, EnumerationReferenceDeclarationVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(125, 28));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(125, 28));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, EnumerationReference)
|
TEST_F(HighlightingMarks, EnumerationReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(127, 30));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(127, 30));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, EnumeratorReference)
|
TEST_F(HighlightingMarks, EnumeratorReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(127, 30));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(127, 30));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Enumeration));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Enumeration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassForwardDeclaration)
|
TEST_F(HighlightingMarks, ClassForwardDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(130, 12));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(130, 12));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ConstructorDeclaration)
|
TEST_F(HighlightingMarks, ConstructorDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(134, 13));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(134, 13));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[0], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DestructorDeclaration)
|
TEST_F(HighlightingMarks, DestructorDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(135, 15));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(135, 15));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
ASSERT_THAT(infos[1], HasTwoTypes(HighlightingType::Function, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassForwardDeclarationReference)
|
TEST_F(HighlightingMarks, ClassForwardDeclarationReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(138, 23));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(138, 23));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassTypeReference)
|
TEST_F(HighlightingMarks, ClassTypeReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(140, 32));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(140, 32));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ConstructorReferenceVariable)
|
TEST_F(HighlightingMarks, ConstructorReferenceVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(140, 32));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(140, 32));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, UnionDeclaration)
|
TEST_F(HighlightingMarks, UnionDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(145, 12));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(145, 12));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, UnionDeclarationReference)
|
TEST_F(HighlightingMarks, UnionDeclarationReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(150, 33));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(150, 33));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, GlobalVariable)
|
TEST_F(HighlightingMarks, GlobalVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(150, 33));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(150, 33));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::GlobalVariable));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::GlobalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StructDeclaration)
|
TEST_F(HighlightingMarks, StructDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(50, 11));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(50, 11));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NameSpace)
|
TEST_F(HighlightingMarks, NameSpace)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(160, 22));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(160, 22));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NameSpaceAlias)
|
TEST_F(HighlightingMarks, NameSpaceAlias)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(164, 38));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(164, 38));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, UsingStructInNameSpace)
|
TEST_F(HighlightingMarks, UsingStructInNameSpace)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(165, 36));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(165, 36));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NameSpaceReference)
|
TEST_F(HighlightingMarks, NameSpaceReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(166, 35));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(166, 35));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StructInNameSpaceReference)
|
TEST_F(HighlightingMarks, StructInNameSpaceReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(166, 35));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(166, 35));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, VirtualFunctionDeclaration)
|
TEST_F(HighlightingMarks, VirtualFunctionDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(170, 35));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(170, 35));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasTwoTypes(HighlightingType::VirtualFunction, HighlightingType::Declaration));
|
ASSERT_THAT(infos[2], HasTwoTypes(HighlightingType::VirtualFunction, HighlightingType::Declaration));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCall)
|
TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCall)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(177, 46));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(177, 46));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCallPointer)
|
TEST_F(HighlightingMarks, DISABLED_NonVirtualFunctionCallPointer)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(180, 54));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(180, 54));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, VirtualFunctionCallPointer)
|
TEST_F(HighlightingMarks, VirtualFunctionCallPointer)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(192, 51));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(192, 51));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::VirtualFunction));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::VirtualFunction));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FinalVirtualFunctionCallPointer)
|
TEST_F(HighlightingMarks, FinalVirtualFunctionCallPointer)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(202, 61));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(202, 61));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NonFinalVirtualFunctionCallPointer)
|
TEST_F(HighlightingMarks, NonFinalVirtualFunctionCallPointer)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(207, 61));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(207, 61));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::VirtualFunction));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::VirtualFunction));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PlusOperator)
|
TEST_F(HighlightingMarks, PlusOperator)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(224, 49));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(224, 49));
|
||||||
|
|
||||||
ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Operator));
|
ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Operator));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PlusAssignOperator)
|
TEST_F(HighlightingMarks, PlusAssignOperator)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(226, 24));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(226, 24));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Operator));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Operator));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, Comment)
|
TEST_F(HighlightingMarks, Comment)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(229, 14));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(229, 14));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Comment));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Comment));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessingDirective)
|
TEST_F(HighlightingMarks, PreprocessingDirective)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(231, 37));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(231, 37));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessorMacroDefinition)
|
TEST_F(HighlightingMarks, PreprocessorMacroDefinition)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(231, 37));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(231, 37));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PreprocessorDefinition));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PreprocessorDefinition));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessorFunctionMacroDefinition)
|
TEST_F(HighlightingMarks, PreprocessorFunctionMacroDefinition)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(232, 47));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(232, 47));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PreprocessorDefinition));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::PreprocessorDefinition));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessorMacroExpansion)
|
TEST_F(HighlightingMarks, PreprocessorMacroExpansion)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(236, 27));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(236, 27));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::PreprocessorExpansion));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::PreprocessorExpansion));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessorMacroExpansionArgument)
|
TEST_F(HighlightingMarks, PreprocessorMacroExpansionArgument)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(236, 27));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(236, 27));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::NumberLiteral));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::NumberLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessorInclusionDirective)
|
TEST_F(HighlightingMarks, PreprocessorInclusionDirective)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(239, 18));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(239, 18));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::StringLiteral));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::StringLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, GotoLabelStatement)
|
TEST_F(HighlightingMarks, GotoLabelStatement)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(242, 12));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(242, 12));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Label));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Label));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, GotoLabelStatementReference)
|
TEST_F(HighlightingMarks, GotoLabelStatementReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(244, 21));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(244, 21));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Label));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Label));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateReference)
|
TEST_F(HighlightingMarks, TemplateReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(254, 25));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(254, 25));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTypeParameter)
|
TEST_F(HighlightingMarks, TemplateTypeParameter)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(265, 135));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateDefaultParameter)
|
TEST_F(HighlightingMarks, TemplateDefaultParameter)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(265, 135));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||||
|
|
||||||
ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NonTypeTemplateParameter)
|
TEST_F(HighlightingMarks, NonTypeTemplateParameter)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(265, 135));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||||
|
|
||||||
ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterDefaultArgument)
|
TEST_F(HighlightingMarks, NonTypeTemplateParameterDefaultArgument)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(265, 135));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||||
|
|
||||||
ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::NumberLiteral));
|
ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::NumberLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTemplateParameter)
|
TEST_F(HighlightingMarks, TemplateTemplateParameter)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(265, 135));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||||
|
|
||||||
ASSERT_THAT(infos[17], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[17], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTemplateParameterDefaultArgument)
|
TEST_F(HighlightingMarks, TemplateTemplateParameterDefaultArgument)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(265, 135));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(265, 135));
|
||||||
|
|
||||||
ASSERT_THAT(infos[19], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[19], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateFunctionDeclaration)
|
TEST_F(HighlightingMarks, TemplateFunctionDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(266, 63));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(266, 63));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTypeParameterReference)
|
TEST_F(HighlightingMarks, TemplateTypeParameterReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(268, 58));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTypeParameterDeclarationReference)
|
TEST_F(HighlightingMarks, TemplateTypeParameterDeclarationReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(268, 58));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterReference)
|
TEST_F(HighlightingMarks, NonTypeTemplateParameterReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(269, 71));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterReferenceReference)
|
TEST_F(HighlightingMarks, NonTypeTemplateParameterReferenceReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(269, 71));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTemplateParameterReference)
|
TEST_F(HighlightingMarks, TemplateTemplateParameterReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(270, 89));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTemplateContainerParameterReference)
|
TEST_F(HighlightingMarks, TemplateTemplateContainerParameterReference)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(270, 89));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateTemplateParameterReferenceVariable)
|
TEST_F(HighlightingMarks, TemplateTemplateParameterReferenceVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(270, 89));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCallPointer)
|
TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCallPointer)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(212, 61));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(212, 61));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCall)
|
TEST_F(HighlightingMarks, ClassFinalVirtualFunctionCall)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(277, 23));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(277, 23));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, HasFunctionArguments)
|
TEST_F(HighlightingMarks, HasFunctionArguments)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(286, 29));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(286, 29));
|
||||||
|
|
||||||
ASSERT_TRUE(infos[1].hasFunctionArguments());
|
ASSERT_TRUE(infos[1].hasFunctionArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, PreprocessorInclusionDirectiveWithAngleBrackets )
|
TEST_F(HighlightingMarks, PreprocessorInclusionDirectiveWithAngleBrackets )
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(289, 38));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(289, 38));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::StringLiteral));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::StringLiteral));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ArgumentInMacroExpansionIsKeyword)
|
TEST_F(HighlightingMarks, ArgumentInMacroExpansionIsKeyword)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(302, 36));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Keyword));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_FirstArgumentInMacroExpansionIsLocalVariable)
|
TEST_F(HighlightingMarks, DISABLED_FirstArgumentInMacroExpansionIsLocalVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(302, 36));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsLocalVariable)
|
TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsLocalVariable)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(302, 36));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(302, 36));
|
||||||
|
|
||||||
ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsField)
|
TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsField)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(310, 40));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(310, 40));
|
||||||
|
|
||||||
ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[5], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
@@ -786,28 +786,28 @@ TEST_F(HighlightingMarks, DISABLED_SecondArgumentInMacroExpansionIsField)
|
|||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_EnumerationType)
|
TEST_F(HighlightingMarks, DISABLED_EnumerationType)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(316, 30));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(316, 30));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TypeInStaticCast)
|
TEST_F(HighlightingMarks, TypeInStaticCast)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(328, 64));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StaticCastIsKeyword)
|
TEST_F(HighlightingMarks, StaticCastIsKeyword)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(328, 64));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Keyword));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, StaticCastPunctationIsInvalid)
|
TEST_F(HighlightingMarks, StaticCastPunctationIsInvalid)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(328, 64));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(328, 64));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Invalid));
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Invalid));
|
||||||
@@ -816,154 +816,154 @@ TEST_F(HighlightingMarks, StaticCastPunctationIsInvalid)
|
|||||||
|
|
||||||
TEST_F(HighlightingMarks, TypeInReinterpretCast)
|
TEST_F(HighlightingMarks, TypeInReinterpretCast)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(329, 69));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(329, 69));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, IntegerAliasDeclaration)
|
TEST_F(HighlightingMarks, IntegerAliasDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(333, 41));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(333, 41));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, IntegerAlias)
|
TEST_F(HighlightingMarks, IntegerAlias)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(341, 31));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(341, 31));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, SecondIntegerAlias)
|
TEST_F(HighlightingMarks, SecondIntegerAlias)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(342, 43));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(342, 43));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, IntegerTypedef)
|
TEST_F(HighlightingMarks, IntegerTypedef)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(343, 35));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(343, 35));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FunctionAlias)
|
TEST_F(HighlightingMarks, FunctionAlias)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(344, 16));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(344, 16));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FriendTypeDeclaration)
|
TEST_F(HighlightingMarks, FriendTypeDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(350, 28));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(350, 28));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FriendArgumentTypeDeclaration)
|
TEST_F(HighlightingMarks, FriendArgumentTypeDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(351, 65));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(351, 65));
|
||||||
|
|
||||||
ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FriendArgumentDeclaration)
|
TEST_F(HighlightingMarks, FriendArgumentDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(351, 65));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(351, 65));
|
||||||
|
|
||||||
ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, FieldInitialization)
|
TEST_F(HighlightingMarks, FieldInitialization)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(358, 18));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(358, 18));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Field));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Field));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateFunctionCall)
|
TEST_F(HighlightingMarks, TemplateFunctionCall)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(372, 29));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(372, 29));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Function));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplatedType)
|
TEST_F(HighlightingMarks, TemplatedType)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(377, 21));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(377, 21));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplatedTypeDeclaration)
|
TEST_F(HighlightingMarks, TemplatedTypeDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(384, 49));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(384, 49));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, NoOperator)
|
TEST_F(HighlightingMarks, NoOperator)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(389, 24));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(389, 24));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, ScopeOperator)
|
TEST_F(HighlightingMarks, ScopeOperator)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(400, 33));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(400, 33));
|
||||||
|
|
||||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Invalid));
|
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateClassNamespace)
|
TEST_F(HighlightingMarks, TemplateClassNamespace)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(413, 78));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateClass)
|
TEST_F(HighlightingMarks, TemplateClass)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(413, 78));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateClassParameter)
|
TEST_F(HighlightingMarks, TemplateClassParameter)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(413, 78));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||||
|
|
||||||
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[4], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TemplateClassDeclaration)
|
TEST_F(HighlightingMarks, TemplateClassDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(413, 78));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(413, 78));
|
||||||
|
|
||||||
ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[6], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TypeDefDeclaration)
|
TEST_F(HighlightingMarks, TypeDefDeclaration)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(418, 36));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(418, 36));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, TypeDefDeclarationUsage)
|
TEST_F(HighlightingMarks, TypeDefDeclarationUsage)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(419, 48));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(419, 48));
|
||||||
|
|
||||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HighlightingMarks, DISABLED_EnumerationTypeDef)
|
TEST_F(HighlightingMarks, DISABLED_EnumerationTypeDef)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(424, 41));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(424, 41));
|
||||||
|
|
||||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::Type));
|
||||||
}
|
}
|
||||||
@@ -971,7 +971,7 @@ TEST_F(HighlightingMarks, DISABLED_EnumerationTypeDef)
|
|||||||
// QTCREATORBUG-15473
|
// QTCREATORBUG-15473
|
||||||
TEST_F(HighlightingMarks, DISABLED_ArgumentToUserDefinedIndexOperator)
|
TEST_F(HighlightingMarks, DISABLED_ArgumentToUserDefinedIndexOperator)
|
||||||
{
|
{
|
||||||
const auto infos = translationUnitCore.highlightingMarksInRange(sourceRange(434, 19));
|
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(434, 19));
|
||||||
|
|
||||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::LocalVariable));
|
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::LocalVariable));
|
||||||
}
|
}
|
||||||
@@ -991,7 +991,7 @@ void HighlightingMarks::TearDownTestCase()
|
|||||||
|
|
||||||
ClangBackEnd::SourceRange HighlightingMarks::sourceRange(uint line, uint columnEnd) const
|
ClangBackEnd::SourceRange HighlightingMarks::sourceRange(uint line, uint columnEnd) const
|
||||||
{
|
{
|
||||||
return translationUnitCore.sourceRange(line, 1, line, columnEnd);
|
return translationUnit.sourceRange(line, 1, line, columnEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <clangdocument.h>
|
#include <clangdocument.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <clangstring.h>
|
#include <clangstring.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <projectpart.h>
|
#include <projectpart.h>
|
||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <skippedsourceranges.h>
|
#include <skippedsourceranges.h>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
using ClangBackEnd::Cursor;
|
using ClangBackEnd::Cursor;
|
||||||
using ClangBackEnd::Document;
|
using ClangBackEnd::Document;
|
||||||
using ClangBackEnd::Documents;
|
using ClangBackEnd::Documents;
|
||||||
using ClangBackEnd::TranslationUnitCore;
|
using ClangBackEnd::TranslationUnit;
|
||||||
using ClangBackEnd::UnsavedFiles;
|
using ClangBackEnd::UnsavedFiles;
|
||||||
using ClangBackEnd::ProjectPart;
|
using ClangBackEnd::ProjectPart;
|
||||||
using ClangBackEnd::ClangString;
|
using ClangBackEnd::ClangString;
|
||||||
@@ -101,9 +101,9 @@ struct Data {
|
|||||||
Utf8StringLiteral("-DBLAH")}),
|
Utf8StringLiteral("-DBLAH")}),
|
||||||
{},
|
{},
|
||||||
documents};
|
documents};
|
||||||
TranslationUnitCore translationUnitCore{filePath,
|
TranslationUnit translationUnit{filePath,
|
||||||
document.translationUnitCore().cxIndex(),
|
document.translationUnit().cxIndex(),
|
||||||
document.translationUnitCore().cxTranslationUnit()};
|
document.translationUnit().cxTranslationUnit()};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkippedSourceRanges : public ::testing::Test
|
class SkippedSourceRanges : public ::testing::Test
|
||||||
@@ -114,9 +114,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static Data *d;
|
static Data *d;
|
||||||
const TranslationUnitCore &translationUnitCore = d->translationUnitCore;
|
const TranslationUnit &translationUnit = d->translationUnit;
|
||||||
const Utf8String &filePath = d->filePath;
|
const Utf8String &filePath = d->filePath;
|
||||||
const ::SkippedSourceRanges skippedSourceRanges{d->translationUnitCore.skippedSourceRanges()};
|
const ::SkippedSourceRanges skippedSourceRanges{d->translationUnit.skippedSourceRanges()};
|
||||||
};
|
};
|
||||||
|
|
||||||
Data *SkippedSourceRanges::d;
|
Data *SkippedSourceRanges::d;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <projects.h>
|
#include <projects.h>
|
||||||
#include <clangdocument.h>
|
#include <clangdocument.h>
|
||||||
#include <clangdocuments.h>
|
#include <clangdocuments.h>
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <unsavedfiles.h>
|
#include <unsavedfiles.h>
|
||||||
#include <sourcelocation.h>
|
#include <sourcelocation.h>
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace {
|
|||||||
|
|
||||||
struct SourceLocationData {
|
struct SourceLocationData {
|
||||||
SourceLocationData(Document &document)
|
SourceLocationData(Document &document)
|
||||||
: diagnosticSet{document.translationUnitCore().diagnostics()}
|
: diagnosticSet{document.translationUnit().diagnostics()}
|
||||||
, diagnostic{diagnosticSet.front()}
|
, diagnostic{diagnosticSet.front()}
|
||||||
, sourceLocation{diagnostic.location()}
|
, sourceLocation{diagnostic.location()}
|
||||||
{
|
{
|
||||||
@@ -117,12 +117,12 @@ TEST_F(SourceLocation, Offset)
|
|||||||
|
|
||||||
TEST_F(SourceLocation, Create)
|
TEST_F(SourceLocation, Create)
|
||||||
{
|
{
|
||||||
ASSERT_THAT(document.translationUnitCore().sourceLocationAt(4, 1), sourceLocation);
|
ASSERT_THAT(document.translationUnit().sourceLocationAt(4, 1), sourceLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SourceLocation, NotEqual)
|
TEST_F(SourceLocation, NotEqual)
|
||||||
{
|
{
|
||||||
ASSERT_THAT(document.translationUnitCore().sourceLocationAt(3, 1), Not(sourceLocation));
|
ASSERT_THAT(document.translationUnit().sourceLocationAt(3, 1), Not(sourceLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
Data *SourceLocation::d;
|
Data *SourceLocation::d;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <clangtranslationunitcore.h>
|
#include <clangtranslationunit.h>
|
||||||
#include <diagnostic.h>
|
#include <diagnostic.h>
|
||||||
#include <diagnosticset.h>
|
#include <diagnosticset.h>
|
||||||
#include <projectpart.h>
|
#include <projectpart.h>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
using ClangBackEnd::DiagnosticSet;
|
using ClangBackEnd::DiagnosticSet;
|
||||||
using ClangBackEnd::Document;
|
using ClangBackEnd::Document;
|
||||||
using ClangBackEnd::Documents;
|
using ClangBackEnd::Documents;
|
||||||
using ClangBackEnd::TranslationUnitCore;
|
using ClangBackEnd::TranslationUnit;
|
||||||
using ClangBackEnd::ProjectPart;
|
using ClangBackEnd::ProjectPart;
|
||||||
using ClangBackEnd::UnsavedFiles;
|
using ClangBackEnd::UnsavedFiles;
|
||||||
using ClangBackEnd::Diagnostic;
|
using ClangBackEnd::Diagnostic;
|
||||||
@@ -76,7 +76,7 @@ MATCHER_P4(IsSourceLocation, filePath, line, column, offset,
|
|||||||
|
|
||||||
struct SourceRangeData {
|
struct SourceRangeData {
|
||||||
SourceRangeData(Document &document)
|
SourceRangeData(Document &document)
|
||||||
: diagnosticSet{document.translationUnitCore().diagnostics()}
|
: diagnosticSet{document.translationUnit().diagnostics()}
|
||||||
, diagnostic{diagnosticSet.front()}
|
, diagnostic{diagnosticSet.front()}
|
||||||
, diagnosticWithFilteredOutInvalidRange{diagnosticSet.at(1)}
|
, diagnosticWithFilteredOutInvalidRange{diagnosticSet.at(1)}
|
||||||
, sourceRange{diagnostic.ranges().front()}
|
, sourceRange{diagnostic.ranges().front()}
|
||||||
@@ -105,9 +105,9 @@ struct Data {
|
|||||||
projectPart,
|
projectPart,
|
||||||
Utf8StringVector(),
|
Utf8StringVector(),
|
||||||
documents};
|
documents};
|
||||||
TranslationUnitCore translationUnitCore{filePath,
|
TranslationUnit translationUnit{filePath,
|
||||||
document.translationUnitCore().cxIndex(),
|
document.translationUnit().cxIndex(),
|
||||||
document.translationUnitCore().cxTranslationUnit()};
|
document.translationUnit().cxTranslationUnit()};
|
||||||
|
|
||||||
std::unique_ptr<SourceRangeData> d;
|
std::unique_ptr<SourceRangeData> d;
|
||||||
};
|
};
|
||||||
@@ -123,7 +123,7 @@ protected:
|
|||||||
const ::SourceRange &sourceRange = d->d->sourceRange;
|
const ::SourceRange &sourceRange = d->d->sourceRange;
|
||||||
const Diagnostic &diagnostic = d->d->diagnostic;
|
const Diagnostic &diagnostic = d->d->diagnostic;
|
||||||
const Diagnostic &diagnosticWithFilteredOutInvalidRange = d->d->diagnosticWithFilteredOutInvalidRange;
|
const Diagnostic &diagnosticWithFilteredOutInvalidRange = d->d->diagnosticWithFilteredOutInvalidRange;
|
||||||
const TranslationUnitCore &translationUnitCore = d->translationUnitCore;
|
const TranslationUnit &translationUnit = d->translationUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(SourceRange, IsNull)
|
TEST_F(SourceRange, IsNull)
|
||||||
@@ -168,7 +168,7 @@ TEST_F(SourceRange, Create)
|
|||||||
|
|
||||||
TEST_F(SourceRange, SourceRangeFromTranslationUnit)
|
TEST_F(SourceRange, SourceRangeFromTranslationUnit)
|
||||||
{
|
{
|
||||||
auto sourceRangeFromTranslationUnit = translationUnitCore.sourceRange(8u, 5u, 8u, 6u);
|
auto sourceRangeFromTranslationUnit = translationUnit.sourceRange(8u, 5u, 8u, 6u);
|
||||||
|
|
||||||
ASSERT_THAT(sourceRangeFromTranslationUnit, sourceRange);
|
ASSERT_THAT(sourceRangeFromTranslationUnit, sourceRange);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user