Commit 78fde8db authored by dt's avatar dt

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 6daea3a7 9548b91b
<ui version="4.0">
<class>%CLASS%Class</class>
<class>%CLASS%</class>
<widget class="%BASECLASS%" name="%CLASS%" >
<property name="geometry" >
<rect>
......
......@@ -1128,7 +1128,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
if (function->argumentCount() == 0) {
extraChars += QLatin1Char('<');
}
} else {
} else if (! function->isAmbiguous()) {
extraChars += QLatin1Char('(');
// If the function takes no arguments, automatically place the closing parenthesis
......
......@@ -214,7 +214,6 @@ private:
Document::Ptr m_currentDoc;
QSet<QString> m_todo;
QSet<QString> m_processed;
QFutureSynchronizer<void> m_synchronizer;
};
} // namespace Internal
......@@ -224,9 +223,7 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
: snapshot(modelManager->snapshot()),
m_modelManager(modelManager),
preprocess(this, &env)
{
m_synchronizer.setCancelOnWait(true);
}
{ }
CppPreprocessor::~CppPreprocessor()
{ }
......@@ -510,7 +507,9 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
snapshot.insert(doc->fileName(), doc);
m_todo.remove(fileName);
m_synchronizer.addFuture(QtConcurrent::run(Process(m_modelManager), doc));
Process process(m_modelManager);
process(doc);
(void) switchDocument(previousDoc);
}
......
......@@ -1195,10 +1195,11 @@ static bool isAllowedTransition(int from, int to)
{
return (from == -1)
|| (from == DebuggerProcessNotReady && to == DebuggerProcessStartingUp)
|| (from == DebuggerProcessStartingUp && to == DebuggerInferiorStopped)
//|| (from == DebuggerProcessStartingUp && to == DebuggerInferiorStopped)
|| (from == DebuggerInferiorStopped && to == DebuggerInferiorRunningRequested)
|| (from == DebuggerInferiorRunningRequested && to == DebuggerInferiorRunning)
|| (from == DebuggerInferiorRunning && to == DebuggerInferiorStopRequested)
|| (from == DebuggerInferiorRunning && to == DebuggerInferiorStopped)
|| (from == DebuggerInferiorStopRequested && to == DebuggerInferiorStopped)
|| (to == DebuggerProcessNotReady);
}
......@@ -1214,7 +1215,6 @@ void DebuggerManager::setStatus(int status)
if (!isAllowedTransition(m_status, status))
qDebug() << "UNEXPECTED TRANSITION: " << m_status << status;
m_status = status;
const bool started = status == DebuggerInferiorRunning
......
......@@ -162,6 +162,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
if (languageChange) {
sourceStr << '\n' << namespaceIndent << "void " << unqualifiedClassName << "::" << "changeEvent(QEvent *e)\n"
<< namespaceIndent << "{\n"
<< namespaceIndent << indent << formBaseClass << "::changeEvent(e);\n"
<< namespaceIndent << indent << "switch (e->type()) {\n" << namespaceIndent << indent << "case QEvent::LanguageChange:\n"
<< namespaceIndent << indent << indent;
if (embedding != InheritedUiClass)
......
......@@ -235,9 +235,9 @@ void GitClient::diff(const QString &workingDirectory,
if (Git::Constants::debug)
qDebug() << "diff" << workingDirectory << fileName;
QStringList arguments;
arguments << QLatin1String("diff");
arguments << QLatin1String("diff") << QLatin1String(noColorOption);
if (!fileName.isEmpty())
arguments << diffArgs << QLatin1String(noColorOption) << QLatin1String("--") << fileName;
arguments << diffArgs << QLatin1String("--") << fileName;
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
const QString title = tr("Git Diff %1").arg(fileName);
......
......@@ -1682,6 +1682,10 @@ FunctionDeclaratorAST *FunctionDeclaratorAST::clone(MemoryPool *pool) const
void FunctionDeclaratorAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
accept(parameters, visitor);
for (SpecifierAST *it = cv_qualifier_seq; it; it = it->next)
accept(it, visitor);
accept(exception_specification, visitor);
}
visitor->endVisit(this);
}
......
......@@ -805,6 +805,7 @@ public:
unsigned rparen_token;
SpecifierAST *cv_qualifier_seq;
ExceptionSpecificationAST *exception_specification;
ExpressionAST *as_cpp_initializer;
public: // annotations
Function *symbol;
......
......@@ -157,6 +157,7 @@ bool CheckDeclarator::visit(NestedDeclaratorAST *ast)
bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
{
Function *fun = control()->newFunction(ast->firstToken());
fun->setAmbiguous(ast->as_cpp_initializer != 0);
ast->symbol = fun;
fun->setReturnType(_fullySpecifiedType);
......
......@@ -977,7 +977,7 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node)
return false;
}
bool Parser::parseDeclarator(DeclaratorAST *&node)
bool Parser::parseDeclarator(DeclaratorAST *&node, bool stopAtCppInitializer)
{
if (! parseCoreDeclarator(node))
return false;
......@@ -988,6 +988,47 @@ bool Parser::parseDeclarator(DeclaratorAST *&node)
unsigned startOfPostDeclarator = cursor();
if (LA() == T_LPAREN) {
if (stopAtCppInitializer) {
unsigned lparen_token = cursor();
ExpressionAST *initializer = 0;
bool blocked = blockErrors(true);
if (parseInitializer(initializer)) {
if (NestedExpressionAST *expr = initializer->asNestedExpression()) {
if (expr->expression && expr->rparen_token && (LA() == T_COMMA || LA() == T_SEMICOLON)) {
rewind(lparen_token);
// check for ambiguous declarators.
consumeToken();
ParameterDeclarationClauseAST *parameter_declaration_clause = 0;
if (parseParameterDeclarationClause(parameter_declaration_clause) && LA() == T_RPAREN) {
unsigned rparen_token = consumeToken();
FunctionDeclaratorAST *ast = new (_pool) FunctionDeclaratorAST;
ast->lparen_token = lparen_token;
ast->parameters = parameter_declaration_clause;
ast->as_cpp_initializer = initializer;
ast->rparen_token = rparen_token;
*postfix_ptr = ast;
postfix_ptr = &(*postfix_ptr)->next;
blockErrors(blocked);
return true;
}
blockErrors(blocked);
rewind(lparen_token);
return true;
}
}
}
blockErrors(blocked);
rewind(lparen_token);
}
FunctionDeclaratorAST *ast = new (_pool) FunctionDeclaratorAST;
ast->lparen_token = consumeToken();
parseParameterDeclarationClause(ast->parameters);
......@@ -1494,7 +1535,7 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node,
if (acceptStructDeclarator && LA() == T_COLON) {
// anonymous bit-field declaration.
// ### TODO create the AST
} else if (! parseDeclarator(node)) {
} else if (! parseDeclarator(node, /*stopAtCppInitializer = */ ! acceptStructDeclarator)) {
return false;
}
......
......@@ -107,7 +107,7 @@ public:
bool parseSimpleDeclaration(DeclarationAST *&node, bool acceptStructDeclarator = false);
bool parseDeclarationStatement(StatementAST *&node);
bool parseCoreDeclarator(DeclaratorAST *&node);
bool parseDeclarator(DeclaratorAST *&node);
bool parseDeclarator(DeclaratorAST *&node, bool stopAtCppInitializer = false);
bool parseDeleteExpression(ExpressionAST *&node);
bool parseDoStatement(StatementAST *&node);
bool parseElaboratedTypeSpecifier(SpecifierAST *&node);
......
......@@ -255,6 +255,12 @@ bool Function::isPureVirtual() const
void Function::setPureVirtual(bool isPureVirtual)
{ _isPureVirtual = isPureVirtual; }
bool Function::isAmbiguous() const
{ return _isAmbiguous; }
void Function::setAmbiguous(bool isAmbiguous)
{ _isAmbiguous = isAmbiguous; }
void Function::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
......
......@@ -322,6 +322,9 @@ public:
virtual Function *asFunctionType()
{ return this; }
bool isAmbiguous() const; // internal
void setAmbiguous(bool isAmbiguous); // internal
protected:
virtual void visitSymbol0(SymbolVisitor *visitor);
virtual void accept0(TypeVisitor *visitor);
......@@ -337,6 +340,7 @@ private:
unsigned _isPureVirtual: 1;
unsigned _isConst: 1;
unsigned _isVolatile: 1;
unsigned _isAmbiguous: 1;
unsigned _methodKey: 3;
};
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment