Merge remote-tracking branch 'origin/4.0'

Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/projectwizardpage.cpp
	src/plugins/projectexplorer/xcodebuildparser.h
	src/plugins/qmldesigner/qmldesignerplugin.cpp
	src/tools/clangbackend/ipcsource/translationunits.cpp

Change-Id: Ibf0857cf8dbf95fc9ac13d5c2112b3f4a2ca7de6
This commit is contained in:
Eike Ziller
2016-05-03 11:49:01 +02:00
169 changed files with 4156 additions and 1867 deletions

View File

@@ -39,6 +39,7 @@
#include "translationunitfilenotexitexception.h"
#include "translationunitisnullexception.h"
#include "translationunitparseerrorexception.h"
#include "translationunitreparseerrorexception.h"
#include "translationunits.h"
#include "unsavedfiles.h"
@@ -76,6 +77,8 @@ public:
Utf8StringVector fileArguments;
Utf8String filePath;
CXTranslationUnit translationUnit = nullptr;
CXErrorCode parseErrorCode = CXError_Success;
int reparseErrorCode = 0;
CXIndex index = nullptr;
uint documentRevision = 0;
bool needsToBeReparsed = false;
@@ -155,6 +158,16 @@ void TranslationUnit::reparse() const
reparseTranslationUnit();
}
bool TranslationUnit::parseWasSuccessful() const
{
return d->parseErrorCode == CXError_Success;
}
bool TranslationUnit::reparseWasSuccessful() const
{
return d->reparseErrorCode == 0;
}
CXIndex TranslationUnit::index() const
{
checkIfNull();
@@ -350,7 +363,7 @@ void TranslationUnit::checkIfNull() const
void TranslationUnit::checkIfFileExists() const
{
if (!QFileInfo::exists(d->filePath.toString()))
if (!fileExists())
throw TranslationUnitFileNotExitsException(d->filePath);
}
@@ -396,16 +409,16 @@ void TranslationUnit::createTranslationUnitIfNeeded() const
if (isVerboseModeEnabled())
args.print();
CXErrorCode errorCode = clang_parseTranslationUnit2(index(),
NULL,
args.data(),
args.count(),
unsavedFiles().cxUnsavedFiles(),
unsavedFiles().count(),
defaultOptions(),
&d->translationUnit);
d->parseErrorCode = clang_parseTranslationUnit2(index(),
NULL,
args.data(),
args.count(),
unsavedFiles().cxUnsavedFiles(),
unsavedFiles().count(),
defaultOptions(),
&d->translationUnit);
checkTranslationUnitErrorCode(errorCode);
checkParseErrorCode();
updateIncludeFilePaths();
@@ -413,22 +426,33 @@ void TranslationUnit::createTranslationUnitIfNeeded() const
}
}
void TranslationUnit::checkTranslationUnitErrorCode(CXErrorCode errorCode) const
void TranslationUnit::checkParseErrorCode() const
{
switch (errorCode) {
case CXError_Success: break;
default: throw TranslationUnitParseErrorException(d->filePath,
d->projectPart.projectPartId(),
errorCode);
if (!parseWasSuccessful()) {
throw TranslationUnitParseErrorException(d->filePath,
d->projectPart.projectPartId(),
d->parseErrorCode);
}
}
void TranslationUnit::checkReparseErrorCode() const
{
if (!reparseWasSuccessful()) {
throw TranslationUnitReparseErrorException(d->filePath,
d->projectPart.projectPartId(),
d->reparseErrorCode);
}
}
void TranslationUnit::reparseTranslationUnit() const
{
clang_reparseTranslationUnit(d->translationUnit,
unsavedFiles().count(),
unsavedFiles().cxUnsavedFiles(),
clang_defaultReparseOptions(d->translationUnit));
d->reparseErrorCode = clang_reparseTranslationUnit(
d->translationUnit,
unsavedFiles().count(),
unsavedFiles().cxUnsavedFiles(),
clang_defaultReparseOptions(d->translationUnit));
checkReparseErrorCode();
updateIncludeFilePaths();
@@ -474,6 +498,19 @@ void TranslationUnit::updateIncludeFilePaths() const
d->translationUnits.addWatchedFiles(d->dependedFilePaths);
}
bool TranslationUnit::fileExists() const
{
return QFileInfo::exists(d->filePath.toString());
}
bool TranslationUnit::isIntact() const
{
return !isNull()
&& fileExists()
&& parseWasSuccessful()
&& reparseWasSuccessful();
}
CommandLineArguments TranslationUnit::commandLineArguments() const
{
return CommandLineArguments(d->filePath.constData(),