Commit e866d089 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Merge branch 'master' into cmakePossibleTargetsFile

parents 0be02a31 a3e05c37
......@@ -58,10 +58,6 @@ add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -DQT_NO_
remove_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) # comes from KDELibs4Support
add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
# Turn off missing-field-initializers warning to avoid noise from false positives with empty {}
# See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html
if (CMAKE_COMPILER_IS_GNUCXX)
......
......@@ -6,6 +6,7 @@ Icon=kdevelop
X-DocPath=kdevelop/index.html
Terminal=false
Name=KDevelop 4
Name[ar]=مطوّرك 4
Name[bs]=KDevelop 4
Name[ca]=KDevelop 4
Name[ca@valencia]=KDevelop 4
......@@ -49,6 +50,7 @@ Name[x-test]=xxKDevelop 4xx
Name[zh_CN]=KDevelop 4
Name[zh_TW]=KDevelop 4
GenericName=Integrated Development Environment
GenericName[ar]=بيئة تطوير متكاملة
GenericName[bs]=Integrisano razvojno okruženje
GenericName[ca]=Entorn integrat de desenvolupament
GenericName[ca@valencia]=Entorn integrat de desenvolupament
......
[Global]
IconName=kdevelop
Comment=KDevelop
Comment[ar]=مطوّرك
Comment[br]=KDevelop
Comment[bs]=KDevelop
Comment[ca]=KDevelop
......@@ -51,6 +52,7 @@ Comment[zh_TW]=KDevelop
[Event/ProcessSuccess]
Name=Process successful
Name[ar]=نجحت العمليّة
Name[bs]=Proces uspješan
Name[ca]=Procés correcte
Name[ca@valencia]=Procés correcte
......@@ -97,6 +99,7 @@ Name[x-test]=xxProcess successfulxx
Name[zh_CN]=处理成功
Name[zh_TW]=行程成功
Comment=Process finished successfully
Comment[ar]=انتهت العمليّة بنجاح
Comment[bs]=Proces je uspješno završio
Comment[ca]=El procés ha finalitzat amb èxit
Comment[ca@valencia]=El procés ha finalitzat amb èxit
......@@ -145,6 +148,7 @@ Action=None
[Event/ProcessError]
Name=Process error
Name[ar]=خطأ في العمليّة
Name[bs]=Greška u procesu
Name[ca]=Error de procés
Name[ca@valencia]=Error de procés
......@@ -192,6 +196,7 @@ Name[x-test]=xxProcess errorxx
Name[zh_CN]=处理出错
Name[zh_TW]=行程錯誤
Comment=Process finished with errors
Comment[ar]=انتهت العمليّة بأخطاء
Comment[bs]=Proces je zavrsio sa greškama
Comment[ca]=El procés ha finalitzat amb errors
Comment[ca@valencia]=El procés ha finalitzat amb errors
......@@ -242,6 +247,7 @@ Action=None
[Event/LoadingProject]
Name=Loading Project
Name[ar]=يحمّل مشروعًا
Name[bs]=Učitavam projekat
Name[ca]=S'està carregant el projecte
Name[ca@valencia]=S'està carregant el projecte
......@@ -278,6 +284,7 @@ Name[x-test]=xxLoading Projectxx
Name[zh_CN]=正在装入工程
Name[zh_TW]=載入專案中
Comment=A project loading process has just started
Comment[ar]=بدأت عمليّة تحميل مشروع
Comment[bs]=Proces učitavanja projekta je upravo počeo
Comment[ca]=Tot just s'acaba de començar a carregar el projecte
Comment[ca@valencia]=Tot just s'acaba de començar a carregar el projecte
......@@ -316,6 +323,7 @@ Action=Popup
[Event/ProjectLoadedSuccessfully]
Name=Project Loaded Successfully
Name[ar]=حُمّل المشروع بنجاح
Name[bs]=Projekat uspješno učitan
Name[ca]=El projecte s'ha carregat amb èxit
Name[ca@valencia]=El projecte s'ha carregat amb èxit
......@@ -353,6 +361,7 @@ Name[x-test]=xxProject Loaded Successfullyxx
Name[zh_CN]=工程成功装入
Name[zh_TW]=專案已成功載入
Comment=A project has been loaded successfully
Comment[ar]=حُمّل مشروع ما بنجاح
Comment[bs]=Projekat je uspješno učitan
Comment[ca]=S'ha carregat amb èxit un projecte
Comment[ca@valencia]=S'ha carregat amb èxit un projecte
......@@ -392,6 +401,7 @@ Action=Popup
[Context/debugger]
Name=Debugger
Name[ar]=المنقّح
Name[bs]=Ispravljač grešaka
Name[ca]=Depurador
Name[ca@valencia]=Depurador
......@@ -432,6 +442,7 @@ Contexts=debugger
Action=Taskbar
IconName=script-error
Name=Breakpoint Hit
Name[ar]=تصادم بنقطة توقّف
Name[bs]=Dolazak do prijelomne tačke
Name[ca]=Punt d'interrupció
Name[ca@valencia]=Punt d'interrupció
......@@ -450,6 +461,7 @@ Name[it]=Breakpoint raggiunto
Name[ja]=ブレイクポイントをヒット
Name[kk]=Аялдау нүктеге келу
Name[km]=ចំណុច​បញ្ឈប់
Name[ko]=중단점 도달
Name[nb]=Bruddpunkt nådd
Name[nds]=Hollpunkt drapen
Name[nl]=Breekpunt bereikt
......@@ -467,6 +479,7 @@ Name[x-test]=xxBreakpoint Hitxx
Name[zh_CN]=断点命中
Name[zh_TW]=遇到中斷點
Comment=A Breakpoint has been hit by the debugger
Comment[ar]=تصادم المنقّح بنقطة توقّف
Comment[bs]=Ispravljač grešaka je dosao do prijelomne tačke
Comment[ca]=El depurador ha assolit un punt d'interrupció
Comment[ca@valencia]=El depurador ha assolit un punt d'interrupció
......@@ -505,6 +518,7 @@ Comment[zh_TW]=除錯器進行遇到中斷點
Contexts=debugger
Action=Popup
Name=Watchpoint Hit
Name[ar]=تصادم بنقطة مشاهدة
Name[bs]=Dolazak do pregledne tačke
Name[ca]=Punt d'observació
Name[ca@valencia]=Punt d'observació
......@@ -540,6 +554,7 @@ Name[x-test]=xxWatchpoint Hitxx
Name[zh_CN]=观察点命中
Name[zh_TW]=遇到監看點
Comment=A Watchpoint has been hit by the debugger
Comment[ar]=تصادم المنقّح بنقطة مشاهدة
Comment[bs]=Ispravljač grešaka je došao do pregledne tačke
Comment[ca]=El depurador ha assolit un punt d'observació
Comment[ca@valencia]=El depurador ha assolit un punt d'observació
......
......@@ -5,6 +5,7 @@ MimeType=application/x-kdevelop;
Icon=kdevelop
Terminal=false
Name=KDevelop 4 (Pick Session)
Name[ar]=مطوّرك 4 (انتقِ جلسةً)
Name[bs]=KDevelop 4 (Dobavljanje sesije)
Name[ca]=KDevelop 4 (Selecció de sessió)
Name[ca@valencia]=KDevelop 4 (Selecció de sessió)
......@@ -40,6 +41,7 @@ Name[x-test]=xxKDevelop 4 (Pick Session)xx
Name[zh_CN]=KDevelop 4 (选择会话)
Name[zh_TW]=KDevelop 4(選擇工作階段)
GenericName=Integrated Development Environment (Pick Session to start with)
GenericName[ar]=بيئة تطوير متكاملة (انتقِ جلسةً للبدء بها)
GenericName[bs]=Integrisano razvojno okruženje (odaberite sesiju za započeti)
GenericName[ca]=Entorn integrat de desenvolupament (Seleccioneu una sessió)
GenericName[ca@valencia]=Entorn integrat de desenvolupament (Seleccioneu una sessió)
......
[Desktop Entry]
Name=KDevelop Sessions
Name[ar]=جلسات مطوّرك
Name[bs]=KDevelop sesije
Name[ca]=Sessions del KDevelop
Name[ca@valencia]=Sessions del KDevelop
......@@ -35,6 +36,7 @@ Name[x-test]=xxKDevelop Sessionsxx
Name[zh_CN]=KDevelop 会话
Name[zh_TW]=KDevelop 工作階段
Comment=List and launch KDevelop sessions
Comment[ar]=اعرض جلسات مطوّرك وأطلقها
Comment[bs]=Listanje i pokretanje KDevelop sesija
Comment[ca]=Llista i inicia sessions del KDevelop
Comment[ca@valencia]=Llista i inicia sessions del KDevelop
......
[Desktop Entry]
Name=KDevelop Sessions
Name[ar]=جلسات مطوّرك
Name[bs]=KDevelop sesije
Name[ca]=Sessions del KDevelop
Name[ca@valencia]=Sessions del KDevelop
......@@ -35,6 +36,7 @@ Name[x-test]=xxKDevelop Sessionsxx
Name[zh_CN]=KDevelop 会话
Name[zh_TW]=KDevelop 工作階段
Comment=List and launch KDevelop sessions
Comment[ar]=اعرض جلسات مطوّرك وأطلقها
Comment[bs]=Listanje i pokretanje KDevelop sesija
Comment[ca]=Llista i inicia sessions del KDevelop
Comment[ca@valencia]=Llista i inicia sessions del KDevelop
......
[Desktop Entry]
Name=KDevelop Sessions
Name[ar]=جلسات مطوّرك
Name[bs]=KDevelop sesije
Name[ca]=Sessions del KDevelop
Name[ca@valencia]=Sessions del KDevelop
......@@ -35,6 +36,7 @@ Name[x-test]=xxKDevelop Sessionsxx
Name[zh_CN]=KDevelop 会话
Name[zh_TW]=KDevelop 工作階段
Comment=Matches KDevelop Sessions
Comment[ar]=يطابق جلسات مطوّرك
Comment[bs]=Usaglašuje KDevelop Sesije
Comment[ca]=Concorda amb sessions del KDevelop
Comment[ca@valencia]=Concorda amb sessions del KDevelop
......
......@@ -37,6 +37,7 @@ Comment[x-test]=xxThis plugin provides a frontend for GDB, a source-level debugg
Comment[zh_CN]=此插件提供了 GDB 前端,GDB 是一个源码级的 C、C++ 等多语言的调试器。
Comment[zh_TW]=這個外掛程式提供 GDB 的前端介面。
Name=GDB Support
Name[ar]=دعم GDB
Name[bs]=GDB podrška
Name[ca]=Implementació de GDB
Name[ca@valencia]=Implementació de GDB
......@@ -74,6 +75,7 @@ Name[x-test]=xxGDB Supportxx
Name[zh_CN]=GDB 支持
Name[zh_TW]=GDB 支援
GenericName=Debugger Frontend
GenericName[ar]=صدر منقّح
GenericName[bs]=Korisničko okruženje za ispravljač grešaka
GenericName[ca]=Frontal del depurador
GenericName[ca@valencia]=Frontal del depurador
......
......@@ -528,4 +528,3 @@ namespace GDBDebugger
}
#include "memviewdlg.moc"
......@@ -76,4 +76,3 @@ void ProcessSelectionDialog::selectionChanged()
}
}
#include "processselection.moc"
......@@ -2,6 +2,7 @@
Type=Service
Icon=x-office-address-book
Comment=This plugin provides Manual Pages integration
Comment[ar]=توفّر هذه الملحقة تكامل صفحات الكتيّب
Comment[bs]=Ovaj dodatak omogućava integraciju sa stranicama uputstava
Comment[ca]=Aquest connector proporciona la integració de les pàgines del manual
Comment[ca@valencia]=Este connector proporciona la integració de les pàgines del manual
......@@ -34,6 +35,7 @@ Comment[x-test]=xxThis plugin provides Manual Pages integrationxx
Comment[zh_CN]=此插件提供了帮助手册整合
Comment[zh_TW]=此外掛程式提供 Man Page 整合
Name=Man Pages
Name[ar]=صفحات Man
Name[bs]=Man stgranice
Name[ca]=Pàgines man
Name[ca@valencia]=Pàgines man
......@@ -68,6 +70,7 @@ Name[x-test]=xxMan Pagesxx
Name[zh_CN]=Man 手册
Name[zh_TW]=Man Pages
GenericName=Documentation Support
GenericName[ar]=دعم التّوثيق
GenericName[bs]=Podrška za dokumentaciju
GenericName[ca]=Implementació de la documentació
GenericName[ca@valencia]=Implementació de la documentació
......
......@@ -3,6 +3,7 @@ Type=Service
Exec=blubb
Icon=qtlogo
Comment=This plugin provides QtHelp integration
Comment[ar]=توفّر هذه الملحقة توثيق كيوت
Comment[bs]=Ovaj dodatak pruža QtHelp integraciju
Comment[ca]=Aquest connector proveeix d'integració amb QtHelp
Comment[ca@valencia]=Este connector proveeix d'integració amb QtHelp
......@@ -37,6 +38,7 @@ Comment[x-test]=xxThis plugin provides QtHelp integrationxx
Comment[zh_CN]=此插件提供了 QtHelp 整合
Comment[zh_TW]=此外掛程式提供 QtHelp 整合
Name=Qt Documentation
Name[ar]=توثيق كيوت
Name[bs]=Qt Dokumentacija
Name[ca]=Documentació de Qt
Name[ca@valencia]=Documentació de Qt
......@@ -73,6 +75,7 @@ Name[x-test]=xxQt Documentationxx
Name[zh_CN]=Qt 文档
Name[zh_TW]=Qt 文件
GenericName=Documentation Support
GenericName[ar]=دعم التّوثيق
GenericName[bs]=Podrška za dokumentaciju
GenericName[ca]=Implementació de la documentació
GenericName[ca@valencia]=Implementació de la documentació
......
......@@ -44,7 +44,6 @@ Q_LOGGING_CATEGORY(CUSTOMSCRIPT, "kdevelop.formatters.customscript")
#include <KParts/MainWindow>
#include <KLocalizedString>
#include <interfaces/ilanguagecontroller.h>
#include <interfaces/ilanguage.h>
#include <language/interfaces/ilanguagesupport.h>
using namespace KDevelop;
......@@ -221,8 +220,8 @@ QString CustomScriptPlugin::formatSource(const QString& text, const QUrl &url, c
static QList<SourceFormatterStyle> stylesFromLanguagePlugins() {
QList<KDevelop::SourceFormatterStyle> styles;
for ( ILanguage* lang: ICore::self()->languageController()->loadedLanguages() ) {
const SourceFormatterItemList& languageStyles = lang->languageSupport()->sourceFormatterItems();
foreach (auto lang, ICore::self()->languageController()->loadedLanguages()) {
const SourceFormatterItemList& languageStyles = lang->sourceFormatterItems();
for ( const SourceFormatterStyleItem& item: languageStyles ) {
if ( item.engine == "customscript" ) {
styles << item.style;
......@@ -399,11 +398,11 @@ QStringList CustomScriptPlugin::computeIndentationFromSample( const QUrl &url )
{
QStringList ret;
QList<ILanguage*> lang = ICore::self()->languageController()->languagesForUrl( url );
if( lang.isEmpty() )
auto languages = ICore::self()->languageController()->languagesForUrl( url );
if (languages.isEmpty())
return ret;
QString sample = lang[0]->languageSupport()->indentationSample();
QString sample = languages[0]->indentationSample();
QString formattedSample = formatSource(sample, url, QMimeDatabase().mimeTypeForUrl(url), QString(), QString());
QStringList lines = formattedSample.split( "\n" );
......
......@@ -64,6 +64,7 @@ Name[x-test]=xxPlasmoid Launcherxx
Name[zh_CN]=Plasmoid 启动器
Name[zh_TW]=Plasmoid 啟動器
GenericName=Plasmoid Launcher Support
GenericName[ar]=دعم بلازمويد مُطلِق
GenericName[bs]=Podrška za pokretač plazmoida
GenericName[ca]=Implementació de llançadors de plasmoides
GenericName[ca@valencia]=Implementació de llançadors de plasmoides
......
......@@ -66,7 +66,6 @@
#define LOCKDUCHAIN DUChainReadLocker lock(DUChain::lock())
#include <cpputils.h>
#include <interfaces/ilanguage.h>
#include <util/foregroundlock.h>
#include <util/path.h>
#include <interfaces/icore.h>
......@@ -1248,11 +1247,9 @@ bool CodeCompletionContext::isImplementationHelperValid() const
static TopDUContext* proxyContextForUrl(QUrl url)
{
QList< ILanguage* > languages = ICore::self()->languageController()->languagesForUrl(url);
foreach(ILanguage* language, languages)
{
if(language->languageSupport())
return language->languageSupport()->standardContext(url, true);
auto languages = ICore::self()->languageController()->languagesForUrl(url);
foreach (auto language, languages) {
return language->standardContext(url, true);
}
return 0;
......@@ -2106,7 +2103,7 @@ QList<CompletionTreeItemPointer> CodeCompletionContext::getImplementationHelpers
if(!CppUtils::isHeader( searchInContext->url().toUrl() )) {
QUrl headerUrl = QUrl::fromLocalFile(CppUtils::sourceOrHeaderCandidate( searchInContext->url().str(), false ));
searchInContext = ICore::self()->languageController()->language("C++")->languageSupport()->standardContext(headerUrl);
searchInContext = ICore::self()->languageController()->language("C++")->standardContext(headerUrl);
if(searchInContext)
ret += getImplementationHelpersInternal(m_duContext->scopeIdentifier(true), searchInContext);
}
......
......@@ -155,16 +155,16 @@ QString SimpleRefactoring::moveIntoSource(const IndexedDeclaration& iDecl)
const QString prefixText = code->rangeText(prefixRange);
for (int i = prefixText.length() - 1; i >= 0 && prefixText.at(i).isSpace(); --i) {
if (headerRange.start().column() == 0) {
headerRange.start().setLine(headerRange.start().line() - 1);
headerRange.start() = headerRange.start() - KTextEditor::Cursor(1, 0);
if (headerRange.start().line() == prefixRange.start().line()) {
headerRange.start().setColumn(prefixRange.start().column() + i);
headerRange.start() = KTextEditor::Cursor(headerRange.start().line(), prefixRange.start().column() + i);
} else {
int lastNewline = prefixText.lastIndexOf('\n', i - 1);
headerRange.start().setColumn(i - lastNewline - 1);
headerRange.start() = KTextEditor::Cursor(headerRange.start().line(), i - lastNewline - 1);
qCWarning(CPP) << "UNSUPPORTED" << headerRange.start().column() << lastNewline << i << prefixText;
}
} else {
headerRange.start().setColumn(headerRange.start().column() - 1);
headerRange.start() = headerRange.start() - KTextEditor::Cursor(0, 1);
}
}
const QString body = code->rangeText(headerRange);
......
......@@ -642,13 +642,13 @@ void ExpressionVisitor::findMember( AST* node, AbstractType::Ptr base, const Ide
QByteArray symbol = m_session->token_stream->symbolByteArray(token);
if (symbol.startsWith('L')) {
charType->setDataType(IntegralType::TypeWchar_t);
symbol.right(symbol.size() - 1);
symbol.remove(0, 1);
} else if (symbol.startsWith('u')) {
charType->setDataType(IntegralType::TypeChar16_t);
symbol.right(symbol.size() - 1);
symbol.remove(0, 1);
} else if (symbol.startsWith('U')) {
charType->setDataType(IntegralType::TypeChar32_t);
symbol.right(symbol.size() - 1);
symbol.remove(0, 1);
}
if (symbol.size() == 4) {
if (symbol == "'\\t'") {
......
......@@ -273,7 +273,7 @@ KTextEditor::Range SourceCodeInsertion::insertionRange(int line)
{
range.start() = m_context->rangeInCurrentRevision().end();
if(range.start().column() > 0)
range.start().setColumn(range.start().column() - 1);
range.start() = range.start() - KTextEditor::Cursor(0, 1);
range.end() = range.start();
}
return range;
......
......@@ -43,7 +43,6 @@
#include <interfaces/iproject.h>
#include <interfaces/idocument.h>
#include <interfaces/idocumentcontroller.h>
#include <interfaces/ilanguage.h>
#include <interfaces/ilanguagecontroller.h>
#include <interfaces/iprojectcontroller.h>
#include <interfaces/isourceformattercontroller.h>
......@@ -125,7 +124,7 @@ KDevelop::ContextMenuExtension CppLanguageSupport::contextMenuExtension(KDevelop
ContextMenuExtension cm;
EditorContext *ec = dynamic_cast<KDevelop::EditorContext *>(context);
if (ec && ICore::self()->languageController()->languagesForUrl(ec->url()).contains(language())) {
if (ec && ICore::self()->languageController()->languagesForUrl(ec->url()).contains(this)) {
// It's a C++ file, let's add our context menu.
m_refactoring->fillContextMenu(cm, context);
fillEditIncludeDirectoriesContextMenu(cm, context);
......@@ -230,12 +229,11 @@ void CppLanguageSupport::createActionsForMainWindow (Sublime::MainWindow* /*wind
CppLanguageSupport::~CppLanguageSupport()
{
ILanguage* lang = language();
if (lang) {
{
TemporarilyReleaseForegroundLock release;
lang->parseLock()->lockForWrite();
parseLock()->lockForWrite();
m_self = 0; //By locking the parse-mutexes, we make sure that parse- and preprocess-jobs get a chance to finish in a good state
lang->parseLock()->unlock();
parseLock()->unlock();
}
delete m_quickOpenDataProvider;
......@@ -475,14 +473,14 @@ QPair<TopDUContextPointer, KTextEditor::Range> CppLanguageSupport::importedConte
int pos = 0;
for(; pos < word.size(); ++pos) {
if(word[pos] == '"' || word[pos] == '<') {
wordRange.start().setColumn(++pos);
wordRange.start() = wordRange.start() + KTextEditor::Cursor(0, ++pos);
break;
}
}
for(; pos < word.size(); ++pos) {
if(word[pos] == '"' || word[pos] == '>') {
wordRange.end().setColumn(pos);
wordRange.end() = KTextEditor::Cursor(wordRange.end().line(), pos);
break;
}
}
......
......@@ -62,7 +62,6 @@
#include <language/backgroundparser/urlparselock.h>
#include <language/backgroundparser/backgroundparser.h>
#include <interfaces/ilanguage.h>
#include <interfaces/iuicontroller.h>
#include <interfaces/icore.h>
#include <interfaces/ilanguagecontroller.h>
......@@ -423,12 +422,12 @@ void CPPInternalParseJob::highlightIfNeeded()
void CPPInternalParseJob::run(ThreadWeaver::JobPointer pointer, ThreadWeaver::Thread* thread)
{
//Happens during shutdown
if(ICore::self()->shuttingDown() || !ICore::self()->languageController()->language("C++")->languageSupport() || !parentJob()->cpp())
if(ICore::self()->shuttingDown() || !ICore::self()->languageController()->language("C++") || !parentJob()->cpp())
return;
//If we have a parent, the parse-mutex is already locked
QReadLocker lock(parentJob()->parentPreprocessor() ? 0 : parentJob()->cpp()->language()->parseLock());
if(!ICore::self()->languageController()->language("C++")->languageSupport() || !parentJob()->cpp())
QReadLocker lock(parentJob()->parentPreprocessor() ? 0 : parentJob()->cpp()->parseLock());
if(!ICore::self()->languageController()->language("C++") || !parentJob()->cpp())
return;
initialize();
......
......@@ -40,7 +40,6 @@
#include <threadweaver/thread.h>
#include <interfaces/ilanguage.h>
#include <interfaces/icore.h>
#include <interfaces/ilanguagecontroller.h>
......@@ -114,11 +113,11 @@ void PreprocessJob::foundHeaderGuard(rpp::Stream& stream, KDevelop::IndexedStrin
void PreprocessJob::run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread* thread)
{
if(!ICore::self()->languageController()->language("C++")->languageSupport())
if(!ICore::self()->languageController()->language("C++"))
return;
//If we have a parent, that parent already has locked the parse-lock
QReadLocker lock(parentJob()->parentPreprocessor() ? 0 : parentJob()->cpp()->language()->parseLock());
QReadLocker lock(parentJob()->parentPreprocessor() ? 0 : parentJob()->cpp()->parseLock());
//It seems like we cannot influence the actual thread priority in thread-weaver, so for now set it here.
//It must be low so the GUI stays fluid.
......@@ -624,7 +623,7 @@ bool PreprocessJob::checkAbort()
return true;
}
if(!ICore::self()->languageController()->language("C++") || !ICore::self()->languageController()->language("C++")->languageSupport()) {
if (!ICore::self()->languageController()->language("C++")) {
qCDebug(CPP) << "Environment-manager disappeared" ;
return true;
}
......
......@@ -41,7 +41,6 @@
#include "cpplanguagesupport.h"
#include <interfaces/icore.h>
#include <interfaces/ilanguagecontroller.h>
#include <interfaces/ilanguage.h>
#include "cpputils.h"
#include "debug.h"
......@@ -53,7 +52,7 @@ TopDUContextPointer getCurrentTopDUContext() {
if( doc )
{
return TopDUContextPointer( ICore::self()->languageController()->language("C++")->languageSupport()->standardContext( doc->url() ) );
return TopDUContextPointer( ICore::self()->languageController()->language("C++")->standardContext( doc->url() ) );
}
return TopDUContextPointer();
}
......@@ -312,7 +311,7 @@ void IncludeFileDataProvider::reset()
{
DUChainReadLocker lock( DUChain::lock() );
m_duContext = TopDUContextPointer( ICore::self()->languageController()->language("C++")->languageSupport()->standardContext( doc->url() ) );
m_duContext = TopDUContextPointer( ICore::self()->languageController()->language("C++")->standardContext( doc->url() ) );
if( m_allowImporters && m_duContext ) {
QSet<IndexedString> importers;
......
......@@ -37,7 +37,6 @@
#include <language/duchain/duchainutils.h>
#include <language/codegen/coderepresentation.h>
#include <shell/documentcontroller.h>
#include <interfaces/ilanguage.h>
#include <navigation/macronavigationcontext.h>
#include <navigation/navigationwidget.h>
......@@ -411,10 +410,10 @@ void TestCppAssistants::testMacroExpansion()
Core::self()->documentController()->openDocument(url);
DUChain::self()->waitForUpdate(IndexedString(url), KDevelop::TopDUContext::AllDeclarationsAndContexts);
ILanguage* language = ICore::self()->languageController()->languagesForUrl(url).at(0);
auto language = ICore::self()->languageController()->languagesForUrl(url).at(0);
QVERIFY(language);
QWidget *macroWidget = language->languageSupport()->specialLanguageObjectNavigationWidget(url, KTextEditor::Cursor(macroLine,0));
QWidget *macroWidget = language->specialLanguageObjectNavigationWidget(url, KTextEditor::Cursor(macroLine,0));
QVERIFY(macroWidget);
Cpp::NavigationWidget *macroNavigationWidget = dynamic_cast<Cpp::NavigationWidget*>(macroWidget);
QVERIFY(macroNavigationWidget);
......
......@@ -86,22 +86,11 @@ CompilerProvider::CompilerProvider( SettingsManager* settings, QObject* parent )
registerCompiler(CompilerPointer(new NoCompiler()));
retrieveUserDefinedCompilers();
// NOTE: we connect to both, projectAboutToBeOpened as well as projectOpened.
// The former to be sure we get called as soon as possible, the latter to prevent
// a race condition, where this plugin gets initialized but a project just emitted that
// it is about to be opened, but did not open yet.
connect( ICore::self()->projectController(), &IProjectController::projectAboutToBeOpened,
this, &CompilerProvider::projectOpened );
connect( ICore::self()->projectController(), &IProjectController::projectOpened,
this, &CompilerProvider::projectOpened );
connect( ICore::self()->projectController(), &IProjectController::projectClosed,
this, &CompilerProvider::projectClosed);
//Add a provider for files without project
addPoject( nullptr, checkCompilerExists({}));
for (auto project : ICore::self()->projectController()->projects()) {
projectOpened( project );
}
}
CompilerProvider::~CompilerProvider() = default;
......@@ -109,6 +98,9 @@ CompilerProvider::~CompilerProvider() = default;
CompilerPointer CompilerProvider::compilerForItem(ProjectBaseItem* item) const
{
auto project = item ? item->project() : nullptr;
if(!m_projects.contains(project)){
const_cast<CompilerProvider*>(this)->addProject(item->project());
}
Q_ASSERT(m_projects.contains(project));
auto compiler = m_projects[project];
Q_ASSERT(compiler);
......@@ -172,7 +164,7 @@ void CompilerProvider::setCompiler( IProject* project, const CompilerPointer& co
addPoject( project, c );
}
void CompilerProvider::projectOpened( KDevelop::IProject* project )
void CompilerProvider::addProject( KDevelop::IProject* project )
{
definesAndIncludesDebug() << "Adding project: " << project->name();
auto projectConfig = project->projectConfiguration().data();
......@@ -201,6 +193,9 @@ QVector< CompilerPointer > CompilerProvider::compilers() const
CompilerPointer CompilerProvider::currentCompiler(IProject* project) const
{
if(!m_projects.contains(project)){
const_cast<CompilerProvider*>(this)->addProject(project);
}
Q_ASSERT(m_projects.contains(project));
return m_projects[project];
}
......
......@@ -68,7 +68,7 @@ private:
void removePoject( KDevelop::IProject* project );
private Q_SLOTS:
void projectOpened( KDevelop::IProject* );
void addProject( KDevelop::IProject* );
void projectClosed( KDevelop::IProject* );
void retrieveUserDefinedCompilers();
......
......@@ -139,9 +139,4 @@ Path::List GccLikeCompiler::includes() const
GccLikeCompiler::GccLikeCompiler(const QString& name, const QString& path, bool editable, const QString& factoryName):
ICompiler(name, path, factoryName, editable)
{
if (!path.isEmpty()) {
//cache includes/defines
includes();
defines();
}
}
......@@ -70,6 +70,18 @@ static ConfigEntry findConfigForItem(const QList<ConfigEntry>& paths, const KDev
return ret;
}
void merge(Defines* target, const Defines& source)
{
if (target->isEmpty()) {
*target = source;
return;
}
for (auto it = source.constBegin(); it != source.constEnd(); ++it) {
target->insert(it.key(), it.value());
}
}
}
K_PLUGIN_FACTORY(DefinesAndIncludesManagerFactory, registerPlugin<DefinesAndIncludesManager>(); )
......@@ -97,20 +109,14 @@ Defines DefinesAndIncludesManager::defines( ProjectBaseItem* item, Type type )
for (auto provider : m_providers) {
if (provider->type() & type) {
auto result = provider->defines(item);
for (auto it = result.constBegin(); it != result.constEnd(); it++) {
defines[it.key()] = it.value();
}
merge(&defines, provider->defines(item));
}
}
if ( type & ProjectSpecific ) {
auto buildManager = item->project()->buildSystemManager();
if ( buildManager ) {