Merge remote-tracking branch 'origin/2.6'

Conflicts:
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/madde/maemoglobal.cpp
	src/plugins/madde/maemoinstalltosysrootstep.cpp
	src/plugins/madde/maemopublisherfremantlefree.cpp
	src/plugins/madde/qt4maemodeployconfiguration.cpp
	src/plugins/qt4projectmanager/librarydetailscontroller.cpp
	src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
	src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
	src/plugins/qt4projectmanager/qt4project.cpp
	src/plugins/qtsupport/baseqtversion.cpp
	src/plugins/remotelinux/abstractremotelinuxdeployservice.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/remotelinuxdeployconfigurationfactory.cpp
	src/plugins/remotelinux/remotelinuxrunconfiguration.cpp
	src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp

Change-Id: I2560b528596f284e7b45a2260d8d3037891c5d17
This commit is contained in:
Eike Ziller
2012-09-04 18:04:16 +02:00
300 changed files with 4257 additions and 3427 deletions

View File

@@ -212,35 +212,6 @@ void FindUsages::reportResult(unsigned tokenIndex)
_references.append(tokenIndex);
}
bool FindUsages::compareFullyQualifiedName(const QList<const Name *> &path, const QList<const Name *> &other)
{
if (path.length() != other.length())
return false;
for (int i = 0; i < path.length(); ++i) {
if (! compareName(path.at(i), other.at(i)))
return false;
}
return true;
}
bool FindUsages::compareName(const Name *name, const Name *other)
{
if (name == other)
return true;
else if (name && other) {
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
if (id == otherId || (id && id->isEqualTo(otherId)))
return true;
}
return false;
}
bool FindUsages::isLocalScope(Scope *scope)
{
if (scope) {

View File

@@ -82,8 +82,6 @@ protected:
bool checkCandidates(const QList<LookupItem> &candidates) const;
void checkExpression(unsigned startToken, unsigned endToken, Scope *scope = 0);
static bool compareFullyQualifiedName(const QList<const Name *> &path, const QList<const Name *> &other);
static bool compareName(const Name *name, const Name *other);
static bool isLocalScope(Scope *scope);
void statement(StatementAST *ast);

View File

@@ -88,6 +88,39 @@ static void path_helper(Symbol *symbol, QList<const Name *> *names)
}
}
namespace CPlusPlus {
bool compareName(const Name *name, const Name *other)
{
if (name == other)
return true;
else if (name && other) {
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
if (id == otherId || (id && id->isEqualTo(otherId)))
return true;
}
return false;
}
bool compareFullyQualifiedName(const QList<const Name *> &path, const QList<const Name *> &other)
{
if (path.length() != other.length())
return false;
for (int i = 0; i < path.length(); ++i) {
if (! compareName(path.at(i), other.at(i)))
return false;
}
return true;
}
}
bool ClassOrNamespace::CompareName::operator()(const Name *name, const Name *other) const
{
Q_ASSERT(name != 0);
@@ -416,20 +449,51 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
QList<LookupItem> result;
if (name) {
QSet<ClassOrNamespace *> processed;
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
if (! q->base())
result = globalNamespace()->find(q->name());
else if (ClassOrNamespace *binding = lookupType(q->base()))
else if (ClassOrNamespace *binding = lookupType(q->base())) {
result = binding->find(q->name());
lookup_helper(name, this, &result, &processed, /*templateId = */ 0);
QList<const Name *> fullName;
addNames(name, &fullName);
// It's also possible that there are matches in the parent binding through
// a qualified name. For instance, a nested class which is forward declared
// in the class but defined outside it - we should capture both.
Symbol *match = 0;
ClassOrNamespace *parentBinding = binding->parent();
while (parentBinding && !match) {
for (int j = 0; j < parentBinding->symbols().size() && !match; ++j) {
if (Scope *scope = parentBinding->symbols().at(j)->asScope()) {
for (unsigned i = 0; i < scope->memberCount(); ++i) {
Symbol *candidate = scope->memberAt(i);
if (compareFullyQualifiedName(
fullName,
LookupContext::fullyQualifiedName(candidate))) {
match = candidate;
break;
}
}
}
}
parentBinding = parentBinding->parent();
}
if (match) {
LookupItem item;
item.setDeclaration(match);
item.setBinding(binding);
result.append(item);
}
}
return result;
}
QSet<ClassOrNamespace *> processed;
ClassOrNamespace *binding = this;
do {
lookup_helper(name, binding, &result, &processed, /*templateId = */ 0);
@@ -456,6 +520,7 @@ void ClassOrNamespace::lookup_helper(const Name *name, ClassOrNamespace *binding
else if (s->isUsingNamespaceDirective())
continue;
if (Scope *scope = s->asScope()) {
if (Class *klass = scope->asClass()) {
if (const Identifier *id = klass->identifier()) {

View File

@@ -252,6 +252,11 @@ private:
QSharedPointer<Control> _control;
};
bool CPLUSPLUS_EXPORT compareName(const Name *name, const Name *other);
bool CPLUSPLUS_EXPORT compareFullyQualifiedName(const QList<const Name *> &path,
const QList<const Name *> &other);
} // namespace CPlusPlus
#endif // CPLUSPLUS_LOOKUPCONTEXT_H

View File

@@ -473,27 +473,38 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
if (item.declaration() == 0)
continue;
if (item.type().isAuto()) {
if (item.type().isAuto()
&& _blockedIds.find(ast->name->identifier()) == _blockedIds.end()) {
const Declaration *decl = item.declaration()->asDeclaration();
if (!decl)
continue;
Document::Ptr doc = _context.snapshot().document(decl->fileName());
const StringLiteral *initializationString = decl->getInitializer();
if (initializationString == 0)
continue;
QByteArray initializer = QByteArray::fromRawData(initializationString->chars(), initializationString->size()).trimmed();
const QByteArray &initializer =
QByteArray::fromRawData(initializationString->chars(),
initializationString->size()).trimmed();
// Skip lambda-function initializers
if (initializer.length() > 0 && initializer[0] == '[')
continue;
TypeOfExpression exprTyper;
Document::Ptr doc = _context.snapshot().document(decl->fileName());
exprTyper.init(doc, _context.snapshot(), _context.bindings());
QList<LookupItem> typeItems = exprTyper(initializer, decl->enclosingScope(), TypeOfExpression::Preprocess);
Document::Ptr exprDoc =
documentForExpression(exprTyper.preprocessedExpression(initializer));
exprDoc->check();
ExpressionAST *exprAST = extractExpressionAST(exprDoc);
if (!exprAST)
continue;
_blockedIds.insert(ast->name->identifier());
const QList<LookupItem> &typeItems = resolve(exprAST, decl->enclosingScope());
_blockedIds.erase(ast->name->identifier());
if (typeItems.empty())
continue;

View File

@@ -36,6 +36,7 @@
#include <ASTVisitor.h>
#include <FullySpecifiedType.h>
#include <Bind.h>
#include <set>
namespace CPlusPlus {
@@ -118,12 +119,20 @@ protected:
// Objective-C expressions
virtual bool visit(ObjCMessageExpressionAST *ast);
private:
struct IdentifierComp
{
bool operator()(const Identifier *a, const Identifier *b) const
{ return strcmp(a->chars(), b->chars()) < 0; }
};
Scope *_scope;
LookupContext _context;
Bind bind;
QList<LookupItem> _results;
bool _reference;
std::set<const Identifier *, IdentifierComp> _blockedIds; // Replace by a hash impl.
};
} // namespace CPlusPlus

View File

@@ -163,23 +163,6 @@ ExpressionAST *TypeOfExpression::expressionAST() const
return extractExpressionAST(m_lookupContext.expressionDocument());
}
ExpressionAST *TypeOfExpression::extractExpressionAST(Document::Ptr doc) const
{
if (! doc->translationUnit()->ast())
return 0;
return doc->translationUnit()->ast()->asExpression();
}
Document::Ptr TypeOfExpression::documentForExpression(const QByteArray &utf8code) const
{
// create the expression's AST.
Document::Ptr doc = Document::create(QLatin1String("<completion>"));
doc->setUtf8Source(utf8code);
doc->parse(Document::ParseExpression);
return doc;
}
void TypeOfExpression::processEnvironment(Document::Ptr doc, Environment *env,
QSet<QString> *processed) const
{
@@ -210,3 +193,24 @@ QByteArray TypeOfExpression::preprocessedExpression(const QByteArray &utf8code)
Preprocessor preproc(0, m_environment.data());
return preproc.run("<expression>", utf8code);
}
namespace CPlusPlus {
ExpressionAST *extractExpressionAST(Document::Ptr doc)
{
if (! doc->translationUnit()->ast())
return 0;
return doc->translationUnit()->ast()->asExpression();
}
Document::Ptr documentForExpression(const QByteArray &utf8code)
{
// create the expression's AST.
Document::Ptr doc = Document::create(QLatin1String("<completion>"));
doc->setUtf8Source(utf8code);
doc->parse(Document::ParseExpression);
return doc;
}
} // namespace CPlusPlus

View File

@@ -122,15 +122,13 @@ public:
Scope *scope() const;
ExpressionAST *expressionAST() const;
QByteArray preprocessedExpression(const QByteArray &utf8code) const;
private:
ExpressionAST *extractExpressionAST(Document::Ptr doc) const;
Document::Ptr documentForExpression(const QByteArray &utf8code) const;
void processEnvironment(Document::Ptr doc, Environment *env,
QSet<QString> *processed) const;
QByteArray preprocessedExpression(const QByteArray &utf8code) const;
private:
Document::Ptr m_thisDocument;
@@ -142,6 +140,9 @@ private:
mutable QSharedPointer<Environment> m_environment;
};
ExpressionAST CPLUSPLUS_EXPORT *extractExpressionAST(Document::Ptr doc);
Document::Ptr CPLUSPLUS_EXPORT documentForExpression(const QByteArray &utf8code);
} // namespace CPlusPlus
#endif // CPLUSPLUS_TYPEOFEXPRESSION_H