forked from qt-creator/qt-creator
ClangCodeModel: Replace nested ClangCodeModel::Utils namespace
... by the customary ::Internal. It adds only noise on the user side and conflicts regularly with the top-level ::Utils namespace. Remove a (now) duplicated definition of setLastSentDocumentRevision(). Plus minor namespace related fixes. There are still minor conflicts between Utils::Text and ClangCodeModel::Text Change-Id: I2e8df6b3c6c3599192774032822ee7e778355bba Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
using namespace CPlusPlus;
|
||||
using namespace ClangBackEnd;
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
@@ -110,9 +111,7 @@ static bool isAtUsingDeclaration(TextDocumentManipulatorInterface &manipulator,
|
||||
if (lastToken.kind() != T_COLON_COLON)
|
||||
return false;
|
||||
|
||||
return ::Utils::contains(tokens, [](const Token &token) {
|
||||
return token.kind() == T_USING;
|
||||
});
|
||||
return contains(tokens, [](const Token &token) { return token.kind() == T_USING; });
|
||||
}
|
||||
|
||||
static QString methodDefinitionParameters(const CodeCompletionChunks &chunks)
|
||||
@@ -238,9 +237,9 @@ void ClangAssistProposalItem::apply(TextDocumentManipulatorInterface &manipulato
|
||||
QTextCursor cursor = manipulator.textCursorAt(basePosition);
|
||||
|
||||
bool abandonParen = false;
|
||||
if (Utils::Text::matchPreviousWord(manipulator, cursor, "&")) {
|
||||
Utils::Text::moveToPreviousWord(manipulator, cursor);
|
||||
Utils::Text::moveToPreviousChar(manipulator, cursor);
|
||||
if (matchPreviousWord(manipulator, cursor, "&")) {
|
||||
moveToPreviousWord(manipulator, cursor);
|
||||
moveToPreviousChar(manipulator, cursor);
|
||||
const QChar prevChar = manipulator.characterAt(cursor.position());
|
||||
cursor.setPosition(basePosition);
|
||||
abandonParen = QString("(;,{}").contains(prevChar);
|
||||
@@ -255,7 +254,7 @@ void ClangAssistProposalItem::apply(TextDocumentManipulatorInterface &manipulato
|
||||
if (!abandonParen && ccr.completionKind == CodeCompletion::FunctionDefinitionCompletionKind) {
|
||||
const CodeCompletionChunk resultType = ccr.chunks.first();
|
||||
if (resultType.kind == CodeCompletionChunk::ResultType) {
|
||||
if (Utils::Text::matchPreviousWord(manipulator, cursor, resultType.text.toString())) {
|
||||
if (matchPreviousWord(manipulator, cursor, resultType.text.toString())) {
|
||||
extraCharacters += methodDefinitionParameters(ccr.chunks);
|
||||
// To skip the next block.
|
||||
abandonParen = true;
|
||||
@@ -376,14 +375,14 @@ std::pair<int, int> fixItPositionsRange(const FixItContainer &fixIt, const QText
|
||||
const QTextBlock startLine = cursor.document()->findBlockByNumber(fixIt.range.start.line - 1);
|
||||
const QTextBlock endLine = cursor.document()->findBlockByNumber(fixIt.range.end.line - 1);
|
||||
|
||||
const int fixItStartPos = ::Utils::Text::positionInText(
|
||||
const int fixItStartPos = Text::positionInText(
|
||||
cursor.document(),
|
||||
static_cast<int>(fixIt.range.start.line),
|
||||
Utils::cppEditorColumn(startLine, static_cast<int>(fixIt.range.start.column)));
|
||||
const int fixItEndPos = ::Utils::Text::positionInText(
|
||||
cppEditorColumn(startLine, static_cast<int>(fixIt.range.start.column)));
|
||||
const int fixItEndPos = Text::positionInText(
|
||||
cursor.document(),
|
||||
static_cast<int>(fixIt.range.end.line),
|
||||
Utils::cppEditorColumn(endLine, static_cast<int>(fixIt.range.end.column)));
|
||||
cppEditorColumn(endLine, static_cast<int>(fixIt.range.end.column)));
|
||||
return std::make_pair(fixItStartPos, fixItEndPos);
|
||||
}
|
||||
|
||||
@@ -432,11 +431,11 @@ QIcon ClangAssistProposalItem::icon() const
|
||||
case CodeCompletion::ClassCompletionKind:
|
||||
case CodeCompletion::TemplateClassCompletionKind:
|
||||
case CodeCompletion::TypeAliasCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Class);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Class);
|
||||
case CodeCompletion::EnumerationCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Enum);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Enum);
|
||||
case CodeCompletion::EnumeratorCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Enumerator);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Enumerator);
|
||||
case CodeCompletion::ConstructorCompletionKind:
|
||||
case CodeCompletion::DestructorCompletionKind:
|
||||
case CodeCompletion::FunctionCompletionKind:
|
||||
@@ -446,40 +445,40 @@ QIcon ClangAssistProposalItem::icon() const
|
||||
switch (completion.availability) {
|
||||
case CodeCompletion::Available:
|
||||
case CodeCompletion::Deprecated:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::FuncPublic);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::FuncPublic);
|
||||
default:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::FuncPrivate);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::FuncPrivate);
|
||||
}
|
||||
case CodeCompletion::SignalCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Signal);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Signal);
|
||||
case CodeCompletion::SlotCompletionKind:
|
||||
switch (completion.availability) {
|
||||
case CodeCompletion::Available:
|
||||
case CodeCompletion::Deprecated:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::SlotPublic);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::SlotPublic);
|
||||
case CodeCompletion::NotAccessible:
|
||||
case CodeCompletion::NotAvailable:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::SlotPrivate);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::SlotPrivate);
|
||||
}
|
||||
break;
|
||||
case CodeCompletion::NamespaceCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Namespace);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Namespace);
|
||||
case CodeCompletion::PreProcessorCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Macro);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Macro);
|
||||
case CodeCompletion::VariableCompletionKind:
|
||||
switch (completion.availability) {
|
||||
case CodeCompletion::Available:
|
||||
case CodeCompletion::Deprecated:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::VarPublic);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::VarPublic);
|
||||
default:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::VarPrivate);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::VarPrivate);
|
||||
}
|
||||
case CodeCompletion::KeywordCompletionKind:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Keyword);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Keyword);
|
||||
case CodeCompletion::ClangSnippetKind:
|
||||
return snippetIcon;
|
||||
case CodeCompletion::Other:
|
||||
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Unknown);
|
||||
return CodeModelIcon::iconForType(CodeModelIcon::Unknown);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
using namespace CPlusPlus;
|
||||
using namespace ClangBackEnd;
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
enum { backEndStartTimeOutInMs = 10000 };
|
||||
|
||||
@@ -103,9 +104,9 @@ BackendCommunicator::BackendCommunicator()
|
||||
this, &BackendCommunicator::onEditorAboutToClose);
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose,
|
||||
this, &BackendCommunicator::setupDummySender);
|
||||
auto globalFCB = ::Utils::GlobalFileChangeBlocker::instance();
|
||||
auto globalFCB = GlobalFileChangeBlocker::instance();
|
||||
m_postponeBackendJobs = globalFCB->isBlocked();
|
||||
connect(globalFCB, &::Utils::GlobalFileChangeBlocker::stateChanged,
|
||||
connect(globalFCB, &GlobalFileChangeBlocker::stateChanged,
|
||||
this, &BackendCommunicator::setBackendJobsPostponed);
|
||||
|
||||
initializeBackend();
|
||||
@@ -188,7 +189,7 @@ Utf8StringVector visibleCppEditorDocumentsFilePaths()
|
||||
|
||||
void BackendCommunicator::documentVisibilityChanged()
|
||||
{
|
||||
documentVisibilityChanged(Utils::currentCppEditorDocumentFilePath(),
|
||||
documentVisibilityChanged(currentCppEditorDocumentFilePath(),
|
||||
visibleCppEditorDocumentsFilePaths());
|
||||
}
|
||||
|
||||
@@ -247,14 +248,14 @@ void BackendCommunicator::unsavedFilesUpdatedForUiHeaders()
|
||||
|
||||
void BackendCommunicator::documentsChangedFromCppEditorDocument(const QString &filePath)
|
||||
{
|
||||
const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
const CppTools::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
QTC_ASSERT(document, return);
|
||||
documentsChanged(filePath, document->contents(), document->revision());
|
||||
}
|
||||
|
||||
void BackendCommunicator::unsavedFilesUpdatedFromCppEditorDocument(const QString &filePath)
|
||||
{
|
||||
const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
const CppTools::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
QTC_ASSERT(document, return);
|
||||
unsavedFilesUpdated(filePath, document->contents(), document->revision());
|
||||
}
|
||||
@@ -286,18 +287,12 @@ void BackendCommunicator::unsavedFilesUpdated(const QString &filePath,
|
||||
|
||||
static bool documentHasChanged(const QString &filePath, uint revision)
|
||||
{
|
||||
if (CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath))
|
||||
if (CppTools::CppEditorDocumentHandle *document = cppDocument(filePath))
|
||||
return document->sendTracker().shouldSendRevision(revision);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void setLastSentDocumentRevision(const QString &filePath, uint revision)
|
||||
{
|
||||
if (CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath))
|
||||
document->sendTracker().setLastSentRevision(int(revision));
|
||||
}
|
||||
|
||||
void BackendCommunicator::documentsChangedWithRevisionCheck(const FileContainer &fileContainer)
|
||||
{
|
||||
if (documentHasChanged(fileContainer.filePath, fileContainer.documentRevision)) {
|
||||
@@ -367,7 +362,7 @@ void BackendCommunicator::documentsChangedWithRevisionCheck(Core::IDocument *doc
|
||||
|
||||
void BackendCommunicator::updateChangeContentStartPosition(const QString &filePath, int position)
|
||||
{
|
||||
if (CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath))
|
||||
if (CppTools::CppEditorDocumentHandle *document = cppDocument(filePath))
|
||||
document->sendTracker().applyContentChange(position);
|
||||
}
|
||||
|
||||
@@ -465,7 +460,7 @@ void BackendCommunicator::documentsOpened(const FileContainers &fileContainers)
|
||||
Utf8String currentDocument;
|
||||
Utf8StringVector visibleDocuments;
|
||||
if (!m_postponeBackendJobs) {
|
||||
currentDocument = Utils::currentCppEditorDocumentFilePath();
|
||||
currentDocument = currentCppEditorDocumentFilePath();
|
||||
visibleDocuments = visibleCppEditorDocumentsFilePaths();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
@@ -73,8 +75,8 @@ void ClangCodeModelPlugin::generateCompilationDB()
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
QFuture<Utils::GenerateCompilationDbResult> task
|
||||
= QtConcurrent::run(&Utils::generateCompilationDB,
|
||||
QFuture<GenerateCompilationDbResult> task
|
||||
= QtConcurrent::run(&Internal::generateCompilationDB,
|
||||
CppModelManager::instance()->projectInfo(target->project()));
|
||||
Core::ProgressManager::addTask(task, tr("Generating Compilation DB"), "generate compilation db");
|
||||
m_generatorWatcher.setFuture(task);
|
||||
@@ -121,10 +123,10 @@ void ClangCodeModelPlugin::createCompilationDBButton()
|
||||
Core::ActionContainer *mbuild =
|
||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
|
||||
// generate compile_commands.json
|
||||
m_generateCompilationDBAction = new ::Utils::ParameterAction(
|
||||
m_generateCompilationDBAction = new ParameterAction(
|
||||
tr("Generate Compilation Database"),
|
||||
tr("Generate Compilation Database for \"%1\""),
|
||||
::Utils::ParameterAction::AlwaysEnabled, this);
|
||||
ParameterAction::AlwaysEnabled, this);
|
||||
|
||||
ProjectExplorer::Project *startupProject = ProjectExplorer::SessionManager::startupProject();
|
||||
m_generateCompilationDBAction->setEnabled(isDBGenerationEnabled(startupProject));
|
||||
@@ -137,9 +139,9 @@ void ClangCodeModelPlugin::createCompilationDBButton()
|
||||
command->setDescription(m_generateCompilationDBAction->text());
|
||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
||||
|
||||
connect(&m_generatorWatcher, &QFutureWatcher<Utils::GenerateCompilationDbResult>::finished,
|
||||
connect(&m_generatorWatcher, &QFutureWatcher<GenerateCompilationDbResult>::finished,
|
||||
this, [this] () {
|
||||
const Utils::GenerateCompilationDbResult result = m_generatorWatcher.result();
|
||||
const GenerateCompilationDbResult result = m_generatorWatcher.result();
|
||||
QString message;
|
||||
if (result.error.isEmpty()) {
|
||||
message = tr("Clang compilation database generated at \"%1\".")
|
||||
|
||||
@@ -54,8 +54,8 @@ private:
|
||||
void createCompilationDBButton();
|
||||
|
||||
ClangModelManagerSupportProvider m_modelManagerSupportProvider;
|
||||
::Utils::ParameterAction *m_generateCompilationDBAction = nullptr;
|
||||
QFutureWatcher<Utils::GenerateCompilationDbResult> m_generatorWatcher;
|
||||
Utils::ParameterAction *m_generateCompilationDBAction = nullptr;
|
||||
QFutureWatcher<GenerateCompilationDbResult> m_generatorWatcher;
|
||||
#ifdef WITH_TESTS
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
#endif
|
||||
|
||||
@@ -99,9 +99,7 @@ static void addFunctionOverloadAssistProposalItem(QList<AssistProposalItemInterf
|
||||
cursor.movePosition(QTextCursor::StartOfWord);
|
||||
|
||||
const ClangBackEnd::CodeCompletionChunk resultType = codeCompletion.chunks.first();
|
||||
if (Utils::Text::matchPreviousWord(*interface->textEditorWidget(),
|
||||
cursor,
|
||||
resultType.text.toString())) {
|
||||
if (matchPreviousWord(*interface->textEditorWidget(), cursor, resultType.text.toString())) {
|
||||
// Function definition completion - do not merge completions together.
|
||||
addAssistProposalItem(items, codeCompletion, name);
|
||||
} else {
|
||||
@@ -535,7 +533,7 @@ void ClangCompletionAssistProcessor::completeIncludePath(const QString &realPath
|
||||
auto *item = new ClangPreprocessorAssistProposalItem;
|
||||
item->setText(text);
|
||||
item->setDetail(hint);
|
||||
item->setIcon(Icons::keywordIcon());
|
||||
item->setIcon(CPlusPlus::Icons::keywordIcon());
|
||||
item->setCompletionOperator(m_completionOperator);
|
||||
m_completions.append(item);
|
||||
}
|
||||
@@ -546,11 +544,11 @@ bool ClangCompletionAssistProcessor::completePreprocessorDirectives()
|
||||
{
|
||||
foreach (const QString &preprocessorCompletion, m_preprocessorCompletions)
|
||||
addCompletionItem(preprocessorCompletion,
|
||||
::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Macro));
|
||||
Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Macro));
|
||||
|
||||
if (m_interface->objcEnabled())
|
||||
addCompletionItem(QLatin1String("import"),
|
||||
::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Macro));
|
||||
Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Macro));
|
||||
|
||||
return !m_completions.isEmpty();
|
||||
}
|
||||
@@ -558,7 +556,7 @@ bool ClangCompletionAssistProcessor::completePreprocessorDirectives()
|
||||
bool ClangCompletionAssistProcessor::completeDoxygenKeywords()
|
||||
{
|
||||
for (int i = 1; i < CppTools::T_DOXY_LAST_TAG; ++i)
|
||||
addCompletionItem(QString::fromLatin1(CppTools::doxygenTagSpell(i)), Icons::keywordIcon());
|
||||
addCompletionItem(QString::fromLatin1(CppTools::doxygenTagSpell(i)), CPlusPlus::Icons::keywordIcon());
|
||||
return !m_completions.isEmpty();
|
||||
}
|
||||
|
||||
@@ -602,7 +600,7 @@ namespace {
|
||||
bool shouldSendDocumentForCompletion(const QString &filePath,
|
||||
int completionPosition)
|
||||
{
|
||||
CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
CppTools::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
|
||||
if (document) {
|
||||
auto &sendTracker = document->sendTracker();
|
||||
@@ -616,7 +614,7 @@ bool shouldSendDocumentForCompletion(const QString &filePath,
|
||||
bool shouldSendCodeCompletion(const QString &filePath,
|
||||
int completionPosition)
|
||||
{
|
||||
CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
CppTools::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
|
||||
if (document) {
|
||||
auto &sendTracker = document->sendTracker();
|
||||
@@ -628,7 +626,7 @@ bool shouldSendCodeCompletion(const QString &filePath,
|
||||
|
||||
void setLastDocumentRevision(const QString &filePath)
|
||||
{
|
||||
CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
CppTools::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
|
||||
if (document)
|
||||
document->sendTracker().setLastSentRevision(int(document->revision()));
|
||||
@@ -637,7 +635,7 @@ void setLastDocumentRevision(const QString &filePath)
|
||||
void setLastCompletionPosition(const QString &filePath,
|
||||
int completionPosition)
|
||||
{
|
||||
CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
|
||||
CppTools::CppEditorDocumentHandle *document = cppDocument(filePath);
|
||||
|
||||
if (document)
|
||||
document->sendTracker().setLastCompletionPosition(completionPosition);
|
||||
@@ -652,9 +650,9 @@ ClangCompletionAssistProcessor::extractLineColumn(int position)
|
||||
return {-1, -1};
|
||||
|
||||
int line = -1, column = -1;
|
||||
::Utils::Text::convertPosition(m_interface->textDocument(), position, &line, &column);
|
||||
Utils::Text::convertPosition(m_interface->textDocument(), position, &line, &column);
|
||||
|
||||
column = Utils::clangColumn(m_interface->textDocument()->findBlock(position), column);
|
||||
column = clangColumn(m_interface->textDocument()->findBlock(position), column);
|
||||
return {line, column};
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ TextEditor::AssistInterface *ClangCompletionAssistProvider::createAssistInterfac
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const
|
||||
{
|
||||
const CppTools::ProjectPart::Ptr projectPart = Utils::projectPartForFileBasedOnProcessor(filePath);
|
||||
const CppTools::ProjectPart::Ptr projectPart = projectPartForFileBasedOnProcessor(filePath);
|
||||
if (projectPart) {
|
||||
return new ClangCompletionAssistInterface(m_communicator,
|
||||
textEditorWidget,
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
@@ -75,7 +77,7 @@ static Core::LocatorFilterEntry makeEntry(Core::ILocatorFilter *filter,
|
||||
{
|
||||
const ClangBackEnd::ExtraInfo &extraInfo = info.extraInfo;
|
||||
QString displayName = extraInfo.token;
|
||||
::Utils::LineColumn lineColumn(info.line, info.column);
|
||||
LineColumn lineColumn(info.line, info.column);
|
||||
Core::LocatorFilterEntry entry(filter, displayName, QVariant::fromValue(lineColumn));
|
||||
QString extra;
|
||||
ClangBackEnd::HighlightingType mainType = info.types.mainHighlightingType;
|
||||
@@ -91,7 +93,7 @@ static Core::LocatorFilterEntry makeEntry(Core::ILocatorFilter *filter,
|
||||
}
|
||||
entry.displayName = displayName;
|
||||
entry.extraInfo = extra;
|
||||
entry.displayIcon = ::Utils::CodeModelIcon::iconForType(Utils::iconTypeForToken(info));
|
||||
entry.displayIcon = CodeModelIcon::iconForType(iconTypeForToken(info));
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -132,7 +134,7 @@ void ClangCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection,
|
||||
{
|
||||
if (!m_currentEditor)
|
||||
return;
|
||||
auto lineColumn = qvariant_cast<::Utils::LineColumn>(selection.internalData);
|
||||
auto lineColumn = qvariant_cast<LineColumn>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(m_currentPath, lineColumn.line,
|
||||
lineColumn.column - 1);
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ static void addTask(const ClangBackEnd::DiagnosticContainer &diagnostic, bool is
|
||||
}
|
||||
|
||||
TaskHub::addTask(Task(taskType,
|
||||
Utils::diagnosticCategoryPrefixRemoved(diagnostic.text.toString()),
|
||||
diagnosticCategoryPrefixRemoved(diagnostic.text.toString()),
|
||||
FilePath::fromString(diagnostic.location.filePath.toString()),
|
||||
diagnostic.location.line,
|
||||
Constants::TASK_CATEGORY_DIAGNOSTICS,
|
||||
|
||||
@@ -43,9 +43,8 @@
|
||||
#include <QTextDocument>
|
||||
#include <QUrl>
|
||||
|
||||
using namespace ClangCodeModel;
|
||||
using Internal::ClangDiagnosticWidget;
|
||||
using Internal::ClangFixItOperation;
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -184,7 +183,6 @@ private:
|
||||
|
||||
ClangBackEnd::DiagnosticContainer supplementedDiagnostic = diagnostic;
|
||||
|
||||
using namespace ClangCodeModel::Utils;
|
||||
DiagnosticTextInfo info(diagnostic.text);
|
||||
supplementedDiagnostic.enableOption = info.option();
|
||||
supplementedDiagnostic.category = info.category();
|
||||
@@ -221,7 +219,7 @@ private:
|
||||
QString option = optionAsUtf8String.toString();
|
||||
|
||||
// Clazy
|
||||
if (ClangCodeModel::Utils::DiagnosticTextInfo::isClazyOption(option)) {
|
||||
if (DiagnosticTextInfo::isClazyOption(option)) {
|
||||
option = optionAsUtf8String.mid(8); // Remove "-Wclazy-" prefix.
|
||||
return QString::fromUtf8(CppTools::Constants::CLAZY_DOCUMENTATION_URL_TEMPLATE)
|
||||
.arg(option);
|
||||
@@ -422,9 +420,6 @@ WidgetFromDiagnostics::DisplayHints toHints(const ClangDiagnosticWidget::Destina
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
QString ClangDiagnosticWidget::createText(
|
||||
const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics,
|
||||
const ClangDiagnosticWidget::Destination &destination)
|
||||
|
||||
@@ -347,7 +347,7 @@ ClangEditorDocumentProcessor::cursorInfo(const CppTools::CursorInfoParams ¶m
|
||||
if (!isCursorOnIdentifier(params.textCursor))
|
||||
return defaultCursorInfoFuture();
|
||||
|
||||
column = Utils::clangColumn(params.textCursor.document()->findBlockByNumber(line - 1), column);
|
||||
column = clangColumn(params.textCursor.document()->findBlockByNumber(line - 1), column);
|
||||
const CppTools::SemanticInfo::LocalUseMap localUses
|
||||
= CppTools::BuiltinCursorInfo::findLocalUses(params.semanticInfo.doc, line, column);
|
||||
|
||||
@@ -405,7 +405,7 @@ ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &f
|
||||
static bool isProjectPartLoadedOrIsFallback(CppTools::ProjectPart::Ptr projectPart)
|
||||
{
|
||||
return projectPart
|
||||
&& (projectPart->id().isEmpty() || ClangCodeModel::Utils::isProjectPartLoaded(projectPart));
|
||||
&& (projectPart->id().isEmpty() || isProjectPartLoaded(projectPart));
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::updateBackendProjectPartAndDocument()
|
||||
@@ -565,7 +565,7 @@ void ClangEditorDocumentProcessor::updateBackendDocument(CppTools::ProjectPart &
|
||||
const FileOptionsBuilder fileOptions(filePath(), projectPart);
|
||||
m_diagnosticConfigId = fileOptions.diagnosticConfigId();
|
||||
|
||||
const QStringList projectPartOptions = ClangCodeModel::Utils::createClangOptions(
|
||||
const QStringList projectPartOptions = createClangOptions(
|
||||
projectPart, fileOptions.useBuildSystemWarnings(),
|
||||
CppTools::ProjectFile::Unsupported); // No language option as FileOptionsBuilder adds it.
|
||||
|
||||
@@ -573,7 +573,7 @@ void ClangEditorDocumentProcessor::updateBackendDocument(CppTools::ProjectPart &
|
||||
|
||||
m_communicator.documentsOpened(
|
||||
{fileContainerWithOptionsAndDocumentContent(compilationArguments, projectPart.headerPaths)});
|
||||
ClangCodeModel::Utils::setLastSentDocumentRevision(filePath(), revision());
|
||||
setLastSentDocumentRevision(filePath(), revision());
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::closeBackendDocument()
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
|
||||
using ClangBackEnd::DiagnosticContainer;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
|
||||
void capitalizeText(QString &text)
|
||||
@@ -50,7 +53,7 @@ QString tweakedDiagnosticText(const QString &diagnosticText)
|
||||
QString tweakedText = diagnosticText;
|
||||
|
||||
if (!tweakedText.isEmpty()) {
|
||||
tweakedText = ClangCodeModel::Utils::diagnosticCategoryPrefixRemoved(tweakedText);
|
||||
tweakedText = diagnosticCategoryPrefixRemoved(tweakedText);
|
||||
capitalizeText(tweakedText);
|
||||
}
|
||||
|
||||
@@ -71,9 +74,6 @@ bool hasFixItAt(const QVector<ClangBackEnd::FixItContainer> &fixits,
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
ClangFixItOperationsExtractor::ClangFixItOperationsExtractor(
|
||||
const QVector<DiagnosticContainer> &diagnosticContainers)
|
||||
: diagnosticContainers(diagnosticContainers)
|
||||
|
||||
@@ -311,7 +311,7 @@ void ClangModelManagerSupport::onAbstractEditorSupportRemoved(const QString &fil
|
||||
|
||||
if (!cppModelManager()->cppEditorDocument(filePath)) {
|
||||
const QString mappedPath = m_uiHeaderOnDiskManager.remove(filePath);
|
||||
const QString projectPartId = Utils::projectPartIdForFile(filePath);
|
||||
const QString projectPartId = projectPartIdForFile(filePath);
|
||||
m_communicator.unsavedFilesRemoved({{mappedPath, projectPartId}});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
using TokenContainer = ClangBackEnd::TokenInfoContainer;
|
||||
using TokenContainers = QVector<TokenContainer>;
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
@@ -171,7 +173,7 @@ QVariant TokenTreeItem::data(int column, int role) const
|
||||
}
|
||||
|
||||
case Qt::DecorationRole: {
|
||||
return ::Utils::CodeModelIcon::iconForType(ClangCodeModel::Utils::iconTypeForToken(token));
|
||||
return CodeModelIcon::iconForType(iconTypeForToken(token));
|
||||
}
|
||||
|
||||
case CppTools::AbstractOverviewModel::FileNameRole: {
|
||||
@@ -219,16 +221,16 @@ bool OverviewModel::isGenerated(const QModelIndex &) const
|
||||
return false;
|
||||
}
|
||||
|
||||
::Utils::Link OverviewModel::linkFromIndex(const QModelIndex &sourceIndex) const
|
||||
Link OverviewModel::linkFromIndex(const QModelIndex &sourceIndex) const
|
||||
{
|
||||
auto item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
|
||||
if (!item)
|
||||
return {};
|
||||
return ::Utils::Link(m_filePath, static_cast<int>(item->token.line),
|
||||
return Link(m_filePath, static_cast<int>(item->token.line),
|
||||
static_cast<int>(item->token.column) - 1);
|
||||
}
|
||||
|
||||
::Utils::LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIndex) const
|
||||
LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIndex) const
|
||||
{
|
||||
auto item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
|
||||
if (!item)
|
||||
@@ -243,9 +245,9 @@ OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceInde
|
||||
if (!item)
|
||||
return {};
|
||||
const ClangBackEnd::SourceRangeContainer &range = item->token.extraInfo.cursorRange;
|
||||
return std::make_pair(::Utils::LineColumn(static_cast<int>(range.start.line),
|
||||
return std::make_pair(LineColumn(static_cast<int>(range.start.line),
|
||||
static_cast<int>(range.start.column)),
|
||||
::Utils::LineColumn(static_cast<int>(range.end.line),
|
||||
LineColumn(static_cast<int>(range.end.line),
|
||||
static_cast<int>(range.end.column)));
|
||||
}
|
||||
|
||||
|
||||
@@ -71,14 +71,14 @@ bool isWarningOrNote(ClangBackEnd::DiagnosticSeverity severity)
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
static ::Utils::Id categoryForSeverity(ClangBackEnd::DiagnosticSeverity severity)
|
||||
static Id categoryForSeverity(ClangBackEnd::DiagnosticSeverity severity)
|
||||
{
|
||||
return isWarningOrNote(severity) ? Constants::CLANG_WARNING : Constants::CLANG_ERROR;
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *projectForCurrentEditor()
|
||||
{
|
||||
const QString filePath = Utils::currentCppEditorDocumentFilePath();
|
||||
const QString filePath = currentCppEditorDocumentFilePath();
|
||||
if (filePath.isEmpty())
|
||||
return nullptr;
|
||||
|
||||
@@ -97,8 +97,8 @@ DiagnosticType diagnosticType(const ClangBackEnd::DiagnosticContainer &diagnosti
|
||||
if (!diagnostic.disableOption.isEmpty())
|
||||
return DiagnosticType::Clang;
|
||||
|
||||
const Utils::DiagnosticTextInfo textInfo(diagnostic.text);
|
||||
if (Utils::DiagnosticTextInfo::isClazyOption(textInfo.option()))
|
||||
const DiagnosticTextInfo textInfo(diagnostic.text);
|
||||
if (DiagnosticTextInfo::isClazyOption(textInfo.option()))
|
||||
return DiagnosticType::Clazy;
|
||||
return DiagnosticType::Tidy;
|
||||
}
|
||||
@@ -106,8 +106,6 @@ DiagnosticType diagnosticType(const ClangBackEnd::DiagnosticContainer &diagnosti
|
||||
void disableDiagnosticInConfig(ClangDiagnosticConfig &config,
|
||||
const ClangBackEnd::DiagnosticContainer &diagnostic)
|
||||
{
|
||||
using namespace ClangCodeModel::Utils;
|
||||
|
||||
switch (diagnosticType(diagnostic)) {
|
||||
case DiagnosticType::Clang:
|
||||
config.setClangOptions(config.clangOptions() + QStringList(diagnostic.disableOption));
|
||||
@@ -134,7 +132,7 @@ ClangDiagnosticConfig diagnosticConfig(const ClangProjectSettings &projectSettin
|
||||
QTC_ASSERT(project, return {});
|
||||
|
||||
// Get config id
|
||||
::Utils::Id currentConfigId = projectSettings.warningConfigId();
|
||||
Id currentConfigId = projectSettings.warningConfigId();
|
||||
if (projectSettings.useGlobalConfig())
|
||||
currentConfigId = globalSettings.clangDiagnosticConfigId();
|
||||
|
||||
@@ -202,9 +200,9 @@ void disableDiagnosticInCurrentProjectConfig(const ClangBackEnd::DiagnosticConta
|
||||
const QString text
|
||||
= QCoreApplication::translate("ClangDiagnosticConfig",
|
||||
"Changes applied in Projects Mode > Clang Code Model");
|
||||
::Utils::FadingIndicator::showText(Core::ICore::mainWindow(),
|
||||
FadingIndicator::showText(Core::ICore::mainWindow(),
|
||||
text,
|
||||
::Utils::FadingIndicator::SmallText);
|
||||
FadingIndicator::SmallText);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -226,15 +224,15 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
|
||||
: TextEditor::TextMark::HighPriority);
|
||||
updateIcon();
|
||||
if (fullVisualization) {
|
||||
setLineAnnotation(Utils::diagnosticCategoryPrefixRemoved(diagnostic.text.toString()));
|
||||
setColor(warning ? ::Utils::Theme::CodeModel_Warning_TextMarkColor
|
||||
: ::Utils::Theme::CodeModel_Error_TextMarkColor);
|
||||
setLineAnnotation(diagnosticCategoryPrefixRemoved(diagnostic.text.toString()));
|
||||
setColor(warning ? Theme::CodeModel_Warning_TextMarkColor
|
||||
: Theme::CodeModel_Error_TextMarkColor);
|
||||
}
|
||||
|
||||
// Copy to clipboard action
|
||||
QVector<QAction *> actions;
|
||||
QAction *action = new QAction();
|
||||
action->setIcon(QIcon::fromTheme("edit-copy", ::Utils::Icons::COPY.icon()));
|
||||
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
|
||||
QObject::connect(action, &QAction::triggered, [diagnostic]() {
|
||||
const QString text = ClangDiagnosticWidget::createText({diagnostic},
|
||||
ClangDiagnosticWidget::InfoBar);
|
||||
@@ -246,7 +244,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
|
||||
ProjectExplorer::Project *project = projectForCurrentEditor();
|
||||
if (project && isDiagnosticConfigChangable(project, diagnostic)) {
|
||||
action = new QAction();
|
||||
action->setIcon(::Utils::Icons::BROKEN.icon());
|
||||
action->setIcon(Icons::BROKEN.icon());
|
||||
QObject::connect(action, &QAction::triggered, [diagnostic]() {
|
||||
disableDiagnosticInCurrentProjectConfig(diagnostic);
|
||||
});
|
||||
@@ -258,7 +256,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
|
||||
|
||||
void ClangTextMark::updateIcon(bool valid)
|
||||
{
|
||||
using namespace ::Utils::Icons;
|
||||
using namespace Icons;
|
||||
if (isWarningOrNote(m_diagnostic.severity))
|
||||
setIcon(valid ? CODEMODEL_WARNING.icon() : CODEMODEL_DISABLED_WARNING.icon());
|
||||
else
|
||||
|
||||
@@ -56,14 +56,13 @@
|
||||
#include <QStringList>
|
||||
#include <QTextBlock>
|
||||
|
||||
using namespace ClangCodeModel;
|
||||
using namespace ClangCodeModel::Internal;
|
||||
using namespace Core;
|
||||
using namespace CppTools;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Utils {
|
||||
namespace Internal {
|
||||
|
||||
class LibClangOptionsBuilder final : public CompilerOptionsBuilder
|
||||
{
|
||||
@@ -174,52 +173,52 @@ int cppEditorColumn(const QTextBlock &line, int clangColumn)
|
||||
return QString::fromUtf8(line.text().toUtf8().left(clangColumn - 1)).size() + 1;
|
||||
}
|
||||
|
||||
::Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token)
|
||||
CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token)
|
||||
{
|
||||
const ClangBackEnd::ExtraInfo &extraInfo = token.extraInfo;
|
||||
if (extraInfo.signal)
|
||||
return ::Utils::CodeModelIcon::Signal;
|
||||
return CodeModelIcon::Signal;
|
||||
|
||||
ClangBackEnd::AccessSpecifier access = extraInfo.accessSpecifier;
|
||||
if (extraInfo.slot) {
|
||||
switch (access) {
|
||||
case ClangBackEnd::AccessSpecifier::Public:
|
||||
case ClangBackEnd::AccessSpecifier::Invalid:
|
||||
return ::Utils::CodeModelIcon::SlotPublic;
|
||||
return CodeModelIcon::SlotPublic;
|
||||
case ClangBackEnd::AccessSpecifier::Protected:
|
||||
return ::Utils::CodeModelIcon::SlotProtected;
|
||||
return CodeModelIcon::SlotProtected;
|
||||
case ClangBackEnd::AccessSpecifier::Private:
|
||||
return ::Utils::CodeModelIcon::SlotPrivate;
|
||||
return CodeModelIcon::SlotPrivate;
|
||||
}
|
||||
}
|
||||
|
||||
ClangBackEnd::HighlightingType mainType = token.types.mainHighlightingType;
|
||||
|
||||
if (mainType == ClangBackEnd::HighlightingType::QtProperty)
|
||||
return ::Utils::CodeModelIcon::Property;
|
||||
return CodeModelIcon::Property;
|
||||
|
||||
if (mainType == ClangBackEnd::HighlightingType::PreprocessorExpansion
|
||||
|| mainType == ClangBackEnd::HighlightingType::PreprocessorDefinition) {
|
||||
return ::Utils::CodeModelIcon::Macro;
|
||||
return CodeModelIcon::Macro;
|
||||
}
|
||||
|
||||
if (mainType == ClangBackEnd::HighlightingType::Enumeration)
|
||||
return ::Utils::CodeModelIcon::Enumerator;
|
||||
return CodeModelIcon::Enumerator;
|
||||
|
||||
if (mainType == ClangBackEnd::HighlightingType::Type
|
||||
|| mainType == ClangBackEnd::HighlightingType::Keyword) {
|
||||
const ClangBackEnd::MixinHighlightingTypes &types = token.types.mixinHighlightingTypes;
|
||||
if (types.contains(ClangBackEnd::HighlightingType::Enum))
|
||||
return ::Utils::CodeModelIcon::Enum;
|
||||
return CodeModelIcon::Enum;
|
||||
if (types.contains(ClangBackEnd::HighlightingType::Struct))
|
||||
return ::Utils::CodeModelIcon::Struct;
|
||||
return CodeModelIcon::Struct;
|
||||
if (types.contains(ClangBackEnd::HighlightingType::Namespace))
|
||||
return ::Utils::CodeModelIcon::Namespace;
|
||||
return CodeModelIcon::Namespace;
|
||||
if (types.contains(ClangBackEnd::HighlightingType::Class))
|
||||
return ::Utils::CodeModelIcon::Class;
|
||||
return CodeModelIcon::Class;
|
||||
if (mainType == ClangBackEnd::HighlightingType::Keyword)
|
||||
return ::Utils::CodeModelIcon::Keyword;
|
||||
return ::Utils::CodeModelIcon::Class;
|
||||
return CodeModelIcon::Keyword;
|
||||
return CodeModelIcon::Class;
|
||||
}
|
||||
|
||||
ClangBackEnd::StorageClass storageClass = extraInfo.storageClass;
|
||||
@@ -231,21 +230,21 @@ int cppEditorColumn(const QTextBlock &line, int clangColumn)
|
||||
switch (access) {
|
||||
case ClangBackEnd::AccessSpecifier::Public:
|
||||
case ClangBackEnd::AccessSpecifier::Invalid:
|
||||
return ::Utils::CodeModelIcon::FuncPublic;
|
||||
return CodeModelIcon::FuncPublic;
|
||||
case ClangBackEnd::AccessSpecifier::Protected:
|
||||
return ::Utils::CodeModelIcon::FuncProtected;
|
||||
return CodeModelIcon::FuncProtected;
|
||||
case ClangBackEnd::AccessSpecifier::Private:
|
||||
return ::Utils::CodeModelIcon::FuncPrivate;
|
||||
return CodeModelIcon::FuncPrivate;
|
||||
}
|
||||
} else {
|
||||
switch (access) {
|
||||
case ClangBackEnd::AccessSpecifier::Public:
|
||||
case ClangBackEnd::AccessSpecifier::Invalid:
|
||||
return ::Utils::CodeModelIcon::FuncPublicStatic;
|
||||
return CodeModelIcon::FuncPublicStatic;
|
||||
case ClangBackEnd::AccessSpecifier::Protected:
|
||||
return ::Utils::CodeModelIcon::FuncProtectedStatic;
|
||||
return CodeModelIcon::FuncProtectedStatic;
|
||||
case ClangBackEnd::AccessSpecifier::Private:
|
||||
return ::Utils::CodeModelIcon::FuncPrivateStatic;
|
||||
return CodeModelIcon::FuncPrivateStatic;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,26 +254,26 @@ int cppEditorColumn(const QTextBlock &line, int clangColumn)
|
||||
switch (access) {
|
||||
case ClangBackEnd::AccessSpecifier::Public:
|
||||
case ClangBackEnd::AccessSpecifier::Invalid:
|
||||
return ::Utils::CodeModelIcon::VarPublic;
|
||||
return CodeModelIcon::VarPublic;
|
||||
case ClangBackEnd::AccessSpecifier::Protected:
|
||||
return ::Utils::CodeModelIcon::VarProtected;
|
||||
return CodeModelIcon::VarProtected;
|
||||
case ClangBackEnd::AccessSpecifier::Private:
|
||||
return ::Utils::CodeModelIcon::VarPrivate;
|
||||
return CodeModelIcon::VarPrivate;
|
||||
}
|
||||
} else {
|
||||
switch (access) {
|
||||
case ClangBackEnd::AccessSpecifier::Public:
|
||||
case ClangBackEnd::AccessSpecifier::Invalid:
|
||||
return ::Utils::CodeModelIcon::VarPublicStatic;
|
||||
return CodeModelIcon::VarPublicStatic;
|
||||
case ClangBackEnd::AccessSpecifier::Protected:
|
||||
return ::Utils::CodeModelIcon::VarProtectedStatic;
|
||||
return CodeModelIcon::VarProtectedStatic;
|
||||
case ClangBackEnd::AccessSpecifier::Private:
|
||||
return ::Utils::CodeModelIcon::VarPrivateStatic;
|
||||
return CodeModelIcon::VarPrivateStatic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ::Utils::CodeModelIcon::Unknown;
|
||||
return CodeModelIcon::Unknown;
|
||||
}
|
||||
|
||||
QString diagnosticCategoryPrefixRemoved(const QString &text)
|
||||
@@ -302,18 +301,18 @@ QString diagnosticCategoryPrefixRemoved(const QString &text)
|
||||
return text;
|
||||
}
|
||||
|
||||
static ::Utils::FilePath compilerPath(const CppTools::ProjectPart &projectPart)
|
||||
static FilePath compilerPath(const CppTools::ProjectPart &projectPart)
|
||||
{
|
||||
Target *target = projectPart.project->activeTarget();
|
||||
if (!target)
|
||||
return ::Utils::FilePath();
|
||||
return FilePath();
|
||||
|
||||
ToolChain *toolchain = ToolChainKitAspect::cxxToolChain(target->kit());
|
||||
|
||||
return toolchain->compilerCommand();
|
||||
}
|
||||
|
||||
static ::Utils::FilePath buildDirectory(const ProjectExplorer::Project &project)
|
||||
static FilePath buildDirectory(const ProjectExplorer::Project &project)
|
||||
{
|
||||
if (auto *target = project.activeTarget()) {
|
||||
if (auto *bc = target->activeBuildConfiguration())
|
||||
@@ -352,7 +351,7 @@ static QStringList projectPartArguments(const ProjectPart &projectPart)
|
||||
return args;
|
||||
}
|
||||
|
||||
static QJsonObject createFileObject(const ::Utils::FilePath &buildDir,
|
||||
static QJsonObject createFileObject(const FilePath &buildDir,
|
||||
const QStringList &arguments,
|
||||
const ProjectPart &projectPart,
|
||||
const ProjectFile &projFile)
|
||||
@@ -372,7 +371,7 @@ static QJsonObject createFileObject(const ::Utils::FilePath &buildDir,
|
||||
QStringList langOption
|
||||
= createLanguageOptionGcc(kind,
|
||||
projectPart.languageExtensions
|
||||
& ::Utils::LanguageExtension::ObjectiveC);
|
||||
& LanguageExtension::ObjectiveC);
|
||||
for (const QString &langOptionPart : langOption)
|
||||
args.append(langOptionPart);
|
||||
}
|
||||
@@ -384,7 +383,7 @@ static QJsonObject createFileObject(const ::Utils::FilePath &buildDir,
|
||||
|
||||
GenerateCompilationDbResult generateCompilationDB(CppTools::ProjectInfo projectInfo)
|
||||
{
|
||||
const ::Utils::FilePath buildDir = buildDirectory(*projectInfo.project());
|
||||
const FilePath buildDir = buildDirectory(*projectInfo.project());
|
||||
QTC_ASSERT(!buildDir.isEmpty(), return GenerateCompilationDbResult(QString(),
|
||||
QCoreApplication::translate("ClangUtils", "Could not retrieve build directory.")));
|
||||
|
||||
@@ -475,5 +474,5 @@ QString DiagnosticTextInfo::clazyCheckName(const QString &option)
|
||||
return option;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Internal
|
||||
} // namespace Clang
|
||||
|
||||
@@ -41,14 +41,10 @@ class CppEditorDocumentHandle;
|
||||
class ProjectInfo;
|
||||
}
|
||||
|
||||
namespace Utils {
|
||||
class FilePath;
|
||||
}
|
||||
|
||||
namespace ClangBackEnd { class TokenInfoContainer; }
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Utils {
|
||||
namespace Internal {
|
||||
|
||||
CppTools::CppEditorDocumentHandle *cppDocument(const QString &filePath);
|
||||
void setLastSentDocumentRevision(const QString &filePath, uint revision);
|
||||
@@ -68,7 +64,7 @@ QString currentCppEditorDocumentFilePath();
|
||||
|
||||
QString diagnosticCategoryPrefixRemoved(const QString &text);
|
||||
|
||||
::Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token);
|
||||
Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token);
|
||||
|
||||
class GenerateCompilationDbResult
|
||||
{
|
||||
@@ -101,8 +97,6 @@ private:
|
||||
const int m_squareBracketStartIndex;
|
||||
};
|
||||
|
||||
namespace Text {
|
||||
|
||||
template <class CharacterProvider>
|
||||
void moveToPreviousChar(CharacterProvider &provider, QTextCursor &cursor)
|
||||
{
|
||||
@@ -148,6 +142,5 @@ bool matchPreviousWord(CharacterProvider &provider, QTextCursor cursor, QString
|
||||
return pattern.isEmpty();
|
||||
}
|
||||
|
||||
} // namespace Text
|
||||
} // namespace Utils
|
||||
} // namespace Internal
|
||||
} // namespace Clang
|
||||
|
||||
Reference in New Issue
Block a user