Commit 37f6b439 authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/3.5'

Change-Id: I1ce0fa92e5c469d591d3030d1a4f168dcee232ba
parents d567dfff 053b2b64
doc/images/qtcreator-add-online-doc.png

8.51 KB | W: | H:

doc/images/qtcreator-add-online-doc.png

11.2 KB | W: | H:

doc/images/qtcreator-add-online-doc.png
doc/images/qtcreator-add-online-doc.png
doc/images/qtcreator-add-online-doc.png
doc/images/qtcreator-add-online-doc.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -55,19 +55,20 @@ ...@@ -55,19 +55,20 @@
\endlist \endlist
An IDE needs a parser for the language and the semantic analyzes. The only An IDE needs a parser for the language and the semantic analyzes.
difference between a code model and a compiler is that a code model does not
generate an executable.
As \l{http://clang.llvm.org/}{Clang} is a compiler, as well as a code model, \section1 Using Clang Code Model
it provides accurate information. The feedback you get through warning and
error markers is the same as the compiler will give you, not an incomplete The \l{http://clang.llvm.org/}{Clang} project provides libraries for parsing
C and C++ source files. The feedback you get through warning and
error markers is the same as a compiler will give you, not an incomplete
set or a close approximation, as when using the built-in \QC code model. set or a close approximation, as when using the built-in \QC code model.
Clang focuses on detailed information for diagnostics, which is really Clang focuses on detailed information for diagnostics, which is really
useful if the code contains typos, for example. useful if the code contains typos, for example.
Also, Clang already supports C++98/03, C89 and C99, Objective-C (and Clang keeps up with the development of the C++ language. At the time of this
Objective-C++), and C++11 support is in active development. writing, it supports C++98/03, C++11, C++14, C89, C99, Objective-C, and
Objective-C++.
On the downside, for large projects using Clang as code model is slower than On the downside, for large projects using Clang as code model is slower than
using the built-in code model. Clang does not need to generate object files, using the built-in code model. Clang does not need to generate object files,
...@@ -84,14 +85,14 @@ ...@@ -84,14 +85,14 @@
\list \list
\li Highlighting
\li Code completion \li Code completion
\li Syntactic and semantic highlighting
\endlist \endlist
To use the plugin, you must build it and configure it in \QC. To use the plugin, you must build it and configure it in \QC.
\section1 Building Clang Code Model Plugin \section2 Building Clang Code Model Plugin
\list 1 \list 1
...@@ -138,7 +139,7 @@ ...@@ -138,7 +139,7 @@
\li Installed via package manager on Linux: \li Installed via package manager on Linux:
\c {LLVM_INSTALL_DIR=/usr/lib/llvm-3.4} \c {LLVM_INSTALL_DIR=/usr/lib/llvm-3.6}
\li Manually built on Unix in release mode: \li Manually built on Unix in release mode:
...@@ -154,7 +155,7 @@ ...@@ -154,7 +155,7 @@
\endlist \endlist
\section1 Configuring Clang Code Model Plugin \section2 Configuring Clang Code Model Plugin
\list 1 \list 1
......
...@@ -168,8 +168,8 @@ ...@@ -168,8 +168,8 @@
\key {Ctrl+E,F2} to follow the symbol in the next split. If necessary, the \key {Ctrl+E,F2} to follow the symbol in the next split. If necessary, the
view is automatically split. To change the default behavior, select view is automatically split. To change the default behavior, select
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} > \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Display, and then select \uicontrol Display > \uicontrol {Always open links in another split}.
\uicontrol {Always Open Links in Next Split}. Additional symbols are Additional symbols are
displayed and switching between definition and declaration is done in displayed and switching between definition and declaration is done in
another split. If you change the default behavior, the shortcuts for opening another split. If you change the default behavior, the shortcuts for opening
link targets in the next split are used to open them in the current split. link targets in the next split are used to open them in the current split.
...@@ -197,5 +197,5 @@ ...@@ -197,5 +197,5 @@
\QC underlines semantic errors in olive in the C++ code editor. To check the \QC underlines semantic errors in olive in the C++ code editor. To check the
correct paths for includes that are not resolved or that are resolved to the correct paths for includes that are not resolved or that are resolved to the
wrong file, select \uicontrol {Project Parts} > \uicontrol {Include Paths}. wrong file, select \uicontrol {Project Parts} > \uicontrol {Header Paths}.
*/ */
...@@ -787,9 +787,9 @@ ...@@ -787,9 +787,9 @@
Select \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} Select \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor}
> \uicontrol Completion. > \uicontrol Completion.
By default, code completion considers only the first letter case-sensitive. By default, code completion does not consider case. To apply full or
To apply full or no case-sensitivity, select the option in the first-letter case-sensitivity, select \uicontrol Full or
\uicontrol {Case-sensitivity} field. \uicontrol {First Letter} in the \uicontrol {Case-sensitivity} field.
\section2 Summary of Available Types \section2 Summary of Available Types
...@@ -1291,7 +1291,8 @@ ...@@ -1291,7 +1291,8 @@
\section2 Specifying Tabs and Indentation \section2 Specifying Tabs and Indentation
You can specify tab policy and tab size in the \uicontrol Typing group. In You can specify tab policy and tab size in the
\uicontrol {Tabs and Indentation} group. In
the \uicontrol {Tab policy} field, select whether to use only spaces or the \uicontrol {Tab policy} field, select whether to use only spaces or
only tabs for indentation, or to use a mixture of them. only tabs for indentation, or to use a mixture of them.
...@@ -1416,7 +1417,7 @@ ...@@ -1416,7 +1417,7 @@
\li To search only whole words, select \uicontrol {Whole Words Only}. \li To search only whole words, select \uicontrol {Whole Words Only}.
\li To search using regular expressions, select \li To search using regular expressions, select
\uicontrol {Regular Expressions}. Regular expressions used in \QC \uicontrol {Use Regular Expressions}. Regular expressions used in \QC
are modeled on Perl regular expressions. For more information on are modeled on Perl regular expressions. For more information on
using regular expressions, see the documentation for the using regular expressions, see the documentation for the
QRegularExpression Class. QRegularExpression Class.
...@@ -1444,7 +1445,7 @@ ...@@ -1444,7 +1445,7 @@
The \uicontrol {Preserve Case when Replacing} option can be selected to The \uicontrol {Preserve Case when Replacing} option can be selected to
preserve the case of the original text when replacing. This option is not preserve the case of the original text when replacing. This option is not
compatible with the \uicontrol {Regular Expressions} search option, and will compatible with the \uicontrol {Use Regular Expressions} search option, and will
thus be disabled when regular expressions are used. When the option is used, thus be disabled when regular expressions are used. When the option is used,
the case of the occurrence will be conserved, according to the following the case of the occurrence will be conserved, according to the following
rules: rules:
...@@ -1469,7 +1470,7 @@ ...@@ -1469,7 +1470,7 @@
The locations of search hits, breakpoints, and bookmarks in your document The locations of search hits, breakpoints, and bookmarks in your document
are highlighted on the editor scroll bar. To turn highlighting off, select are highlighted on the editor scroll bar. To turn highlighting off, select
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} > \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol {Highlight search results on the scrollbar}. \uicontrol Display > \uicontrol {Highlight search results on the scrollbar}.
\section1 Advanced Search \section1 Advanced Search
...@@ -2532,8 +2533,8 @@ ...@@ -2532,8 +2533,8 @@
\li Specify the prefix string. \li Specify the prefix string.
\li To show only results matching this filter, select \li To implicitly include the filter even when not typing a prefix as a
\uicontrol {Limit to prefix}. part of the search string, select \uicontrol {Include by default}.
\li Specify other available options. For more information, see \li Specify other available options. For more information, see
\l{Adding Web Search Engines}. \l{Adding Web Search Engines}.
...@@ -2601,8 +2602,9 @@ ...@@ -2601,8 +2602,9 @@
\li Specify the prefix string. \li Specify the prefix string.
To show only results matching this filter, select To implicitly include the filter even when not typing a prefix
\uicontrol {Limit to prefix}. as a part of the search string, select
\uicontrol {Include by default}.
\image qtcreator-navigate-customfilter.png \image qtcreator-navigate-customfilter.png
......
...@@ -50,19 +50,20 @@ ...@@ -50,19 +50,20 @@
and integrated into \QC. The correct folder to place the plugins depends on and integrated into \QC. The correct folder to place the plugins depends on
whether you use the standalone \QD or the integrated \QD. whether you use the standalone \QD or the integrated \QD.
The integrated \QD fetches plugins from the \c {%SDK%\bin\designer} folder The integrated \QD fetches plugins from the \c {\bin\plugins\designer}
on Windows and Linux. For information about how to configure plugins on directory in the \QC installation directory on Windows and Linux. For
OS X, see \l{Configuring Qt Designer Plugins on OS X}. information about how to configure plugins on OS X, see
\l{Configuring Qt Designer Plugins on OS X}.
To check which plugins To check which plugins were loaded successfully and which failed, choose
were loaded successfully and which failed, choose \uicontrol{Tools > Form Editor > \uicontrol Tools > \uicontrol {Form Editor} >
About Qt Designer Plugins}. \uicontrol {About Qt Designer Plugins}.
The standalone \QD is part of the Qt library used for building projects, The standalone \QD is part of the Qt library used for building projects,
located under \c {%SDK%\qt}. Therefore, it fetches plugins from the located in \c {<Qt_version>\<compiler>\bin} in the Qt installation
following folder: \c {%SDK%\qt\plugins\designer}. To check which plugins directory. It fetches plugins from the \c {\plugins\designer} subdirectory
were loaded successfully and which failed, choose \uicontrol{Help > of \c bin. To check which plugins were loaded successfully and which failed,
About Plugins}. choose \uicontrol Help > \uicontrol {About Plugins}.
\section2 Configuring Qt Designer Plugins on OS X \section2 Configuring Qt Designer Plugins on OS X
......
#!/bin/sh
################################################################################
# Copyright (C) 2015 The Qt Company Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of The Qt Company Ltd, nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
################################################################################
# --- helpers -----------------------------------------------------------------
printUsage()
{
echo "Usage: $0 [-v] [-c clang-executable] file line column"
echo
echo "Options:"
echo " -v Run c-index-test instead of clang to get more details."
echo " -c clang-executable Use the provided clang-executable."
echo
echo "The clang executable is determined by this order:"
echo " 1. Use clang from the -c option."
echo " 2. Use clang from environment variable CLANG_FOR_COMPLETION."
echo " 3. Use clang from \$PATH."
echo
echo "Path to c-index-test will be determined with the help of the clang executable."
}
# There is no readlink on cygwin.
hasReadLink()
{
return $(command -v readlink >/dev/null 2>&1)
}
checkIfFileExistsOrDie()
{
[ ! -f "$1" ] && echo "'$1' is not a file or does not exist." && exit 1
}
checkIfFileExistsAndIsExecutableOrDie()
{
checkIfFileExistsOrDie "$1"
[ ! -x "$1" ] && echo "'$1' is not executable." && exit 2
}
findClangOrDie()
{
if [ -z "$CLANG_EXEC" ]; then
if [ -n "${CLANG_FOR_COMPLETION}" ]; then
CLANG_EXEC=${CLANG_FOR_COMPLETION}
else
CLANG_EXEC=$(which clang)
fi
fi
hasReadLink && CLANG_EXEC=$(readlink -e "$CLANG_EXEC")
checkIfFileExistsAndIsExecutableOrDie "$CLANG_EXEC"
}
findCIndexTestOrDie()
{
if [ -n "$RUN_WITH_CINDEXTEST" ]; then
CINDEXTEST_EXEC=$(echo $CLANG_EXEC | sed -e 's/clang/c-index-test/g')
hasReadLink && CINDEXTEST_EXEC=$(readlink -e "$CINDEXTEST_EXEC")
checkIfFileExistsAndIsExecutableOrDie "$CINDEXTEST_EXEC"
fi
}
printClangVersion()
{
command="${CLANG_EXEC} --version"
echo "Command: $command"
eval $command
}
runCodeCompletion()
{
if [ -n "${CINDEXTEST_EXEC}" ]; then
command="${CINDEXTEST_EXEC} -code-completion-at=${FILE}:${LINE}:${COLUMN} ${FILE}"
else
command="${CLANG_EXEC} -cc1 -code-completion-at ${FILE}:${LINE}:${COLUMN} ${FILE}"
fi
echo "Command: $command"
eval $command
}
# --- Process arguments -------------------------------------------------------
CLANG_EXEC=
RUN_WITH_CINDEXTEST=
FILE=
LINE=
COLUMN=
while [ -n "$1" ]; do
param=$1
shift
case $param in
-h | -help | --help)
printUsage
exit 0
;;
-v | -verbose | --verbose)
RUN_WITH_CINDEXTEST=1
;;
-c | -clang | --clang)
CLANG_EXEC=$1
shift
;;
*)
break;
;;
esac
done
[ "$#" -ne 2 ] && printUsage && exit 1
checkIfFileExistsOrDie "$param"
FILE=$param
LINE=$1
COLUMN=$2
# --- main --------------------------------------------------------------------
findClangOrDie
findCIndexTestOrDie
printClangVersion
echo
runCodeCompletion
...@@ -56,6 +56,6 @@ QtcProduct { ...@@ -56,6 +56,6 @@ QtcProduct {
Group { Group {
fileTagsFilter: product.type fileTagsFilter: product.type
qbs.install: true qbs.install: true
qbs.installDir: project.ide_app_path qbs.installDir: project.ide_bin_path
} }
} }
...@@ -847,7 +847,6 @@ void PluginManagerPrivate::nextDelayedInitialize() ...@@ -847,7 +847,6 @@ void PluginManagerPrivate::nextDelayedInitialize()
\internal \internal
*/ */
PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) : PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) :
m_failedTests(0),
delayedInitializeTimer(0), delayedInitializeTimer(0),
shutdownEventLoop(0), shutdownEventLoop(0),
m_profileElapsedMS(0), m_profileElapsedMS(0),
...@@ -1127,6 +1126,7 @@ void PluginManagerPrivate::startTests() ...@@ -1127,6 +1126,7 @@ void PluginManagerPrivate::startTests()
return; return;
} }
int failedTests = 0;
foreach (const PluginManagerPrivate::TestSpec &testSpec, testSpecs) { foreach (const PluginManagerPrivate::TestSpec &testSpec, testSpecs) {
IPlugin *plugin = testSpec.pluginSpec->plugin(); IPlugin *plugin = testSpec.pluginSpec->plugin();
if (!plugin) if (!plugin)
...@@ -1144,10 +1144,10 @@ void PluginManagerPrivate::startTests() ...@@ -1144,10 +1144,10 @@ void PluginManagerPrivate::startTests()
? generateCompleteTestPlan(plugin, testObjects) ? generateCompleteTestPlan(plugin, testObjects)
: generateCustomTestPlan(plugin, testObjects, testSpec.testFunctionsOrObjects); : generateCustomTestPlan(plugin, testObjects, testSpec.testFunctionsOrObjects);
m_failedTests += executeTestPlan(testPlan); failedTests += executeTestPlan(testPlan);
} }
if (!testSpecs.isEmpty())
QTimer::singleShot(1, this, SLOT(exitWithNumberOfFailedTests())); QTimer::singleShot(0, this, [failedTests]() { emit m_instance->testsFinished(failedTests); });
} }
#endif #endif
...@@ -1270,14 +1270,6 @@ void PluginManagerPrivate::asyncShutdownFinished() ...@@ -1270,14 +1270,6 @@ void PluginManagerPrivate::asyncShutdownFinished()
shutdownEventLoop->exit(); shutdownEventLoop->exit();
} }
/*!
\internal
*/
void PluginManagerPrivate::exitWithNumberOfFailedTests()
{
QCoreApplication::exit(m_failedTests);
}
/*! /*!
\internal \internal
*/ */
......
...@@ -158,6 +158,7 @@ signals: ...@@ -158,6 +158,7 @@ signals:
void pluginsChanged(); void pluginsChanged();
void initializationDone(); void initializationDone();
void testsFinished(int failedTests);
public slots: public slots:
void remoteArguments(const QString &serializedArguments, QObject *socket); void remoteArguments(const QString &serializedArguments, QObject *socket);
......
...@@ -102,7 +102,6 @@ public: ...@@ -102,7 +102,6 @@ public:
QHash<QString, PluginCollection *> pluginCategories; QHash<QString, PluginCollection *> pluginCategories;
QList<PluginSpec *> pluginSpecs; QList<PluginSpec *> pluginSpecs;
QList<TestSpec> testSpecs; QList<TestSpec> testSpecs;
int m_failedTests;
QStringList pluginPaths; QStringList pluginPaths;
QString pluginIID; QString pluginIID;
QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ? QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ?
...@@ -138,7 +137,6 @@ public: ...@@ -138,7 +137,6 @@ public:
private slots: private slots:
void nextDelayedInitialize(); void nextDelayedInitialize();
void asyncShutdownFinished(); void asyncShutdownFinished();
void exitWithNumberOfFailedTests();
private: private:
PluginCollection *defaultCollection; PluginCollection *defaultCollection;
......
...@@ -440,6 +440,8 @@ Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInf ...@@ -440,6 +440,8 @@ Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInf
"Import paths:\n" "Import paths:\n"
"%1\n\n" "%1\n\n"
"For qmake projects, use the QML_IMPORT_PATH variable to add import paths.\n" "For qmake projects, use the QML_IMPORT_PATH variable to add import paths.\n"
"For qbs projects, declare and set a qmlImportPaths property in your product "
"to add import paths.\n"
"For qmlproject projects, use the importPaths property to add import paths.").arg( "For qmlproject projects, use the importPaths property to add import paths.").arg(
importPaths.join(QLatin1Char('\n')))); importPaths.join(QLatin1Char('\n'))));
} }
......
The ClangCodeModel plugin See ../../../doc/src/editors/creator-clang-codemodel.qdoc
=========================
The ClangCodeModel plugin integrates the clang frontend into Qt Creator. Clang
is "a C language family frontend for LLVM". You can find more information at
http://clang.llvm.org/.
At the time of writing the plugin can replace the following functionality of
the built-in code model:
* Highlighting
* Completion
All other functionality relies on the built-in code model (indexing, quick
fixes, follow symbol, find usages, ...).
Setup
=====
Compile the plugin
------------------
1. Get libclang
You need to have libclang (and thus llvm) installed on your system. Either
build llvm/clang yourself [1], install some ready-to-use package [2] or use the
package manager of your system.
[1] http://clang.llvm.org/get_started.html
See http://llvm.org/docs/GettingStarted.html#git-mirror for git mirrors.
[2] http://llvm.org/releases/ or http://llvm.org/builds/
If you are building llvm/clang yourself, make sure to build it in release mode.
2. Set LLVM_INSTALL_DIR and (re)build Qt Creator
Point the LLVM_INSTALL_DIR variable to the build/installation directory of
llvm, e.g.:
Installed via package manager on GNU/Linux:
LLVM_INSTALL_DIR=/usr/lib/llvm-3.4
Manually build on Unix in release mode:
LLVM_INSTALL_DIR=$HOME/llvm-build/Release+Asserts
Installed a snapshot on Windows:
LLVM_INSTALL_DIR=C:\llvm
Set the variable either as part of the build environment or pass it directly to
qmake and rebuild Qt Creator.
Enable the plugin
-----------------
Enable the "ClangCodeModel" plugin in the dialog "Menu: Help -> About Plugins"
and restart Qt Creator.
Select the file types you want to use the ClangCodeModel for in "Menu: Tools ->
Options -> C++ -> Tab: Code Model". For the next opened file matching the
selected file types the ClangCodeModel will be used (see limitations at the
start of this README).
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QRegExp>
#include <QSet> #include <QSet>
#include <QString> #include <QString>