On 2012-05-28 (Monday) 20:45:03 Raphael Kubo da Costa wrote: > SVN commit 8248 by rakuco: > > Add my upstream commits to fix the build with clang. > > > > A kdevelop-kde4/files/patch-git_e37294e > A kdevplatform/files/patch-git_4eed758 > > > _______________________________________________ > kde-freebsd mailing list > kde-freebsd@kde.org > https://mail.kde.org/mailman/listinfo/kde-freebsd > See also http://freebsd.kde.org/ for latest information
Hello, I also was working on compiling devel/kdevelop-kde4 (ports one, not area51) with clang earlier today, though I more and more get the feeling the problems originated in clang's libc++ rather then a kdevelop. Workaround patches are attached, both to solve issues probably only libc++ users affected from where both std::list(QList::Iterator, QList::Iterator) and also QList::toStdList(), which I tried first as workaround seem not to work. For the workaround, I rewrote the two affected functions to use array index style access instead of iterator style one, as array indices aren't invalidated by append calls, QList is supposed to provide O(1) access with them and it also saves having to clone the list. Alonso
--- ./languages/cpp/codecompletion/context.cpp.orig 2012-05-28 20:11:44.000000000 +0200 +++ ./languages/cpp/codecompletion/context.cpp 2012-05-28 20:25:15.000000000 +0200 @@ -1100,25 +1100,35 @@ } QSet<DUContext*> CodeCompletionContext::memberAccessContainers() const { - QSet<DUContext*> ret; + QSet<DUContext*> ret; + QList<Declaration*> decls; + Declaration *decl; + NamespaceAliasDeclaration *alias_decl; + int i; - if( m_accessType == StaticMemberChoose && m_duContext ) { + if ((m_accessType == StaticMemberChoose) && (m_duContext != 0)) + { //Locate all namespace-instances we will be completing from - QList< Declaration* > decls = m_duContext->findDeclarations(QualifiedIdentifier(m_expression)); ///@todo respect position + decls = m_duContext->findDeclarations(QualifiedIdentifier(m_expression)); ///@todo respect position - // qlist does not provide convenient stable iterators - std::list<Declaration*> worklist(decls.begin(), decls.end()); - for (std::list<Declaration*>::iterator it = worklist.begin(); it != worklist.end(); ++it) { - Declaration * decl = *it; - if((decl->kind() == Declaration::Namespace || dynamic_cast<ClassDeclaration*>(decl)) && decl->internalContext()) - ret.insert(decl->internalContext()); - else if (decl->kind() == Declaration::NamespaceAlias) { - NamespaceAliasDeclaration * aliasDecl = dynamic_cast<NamespaceAliasDeclaration*>(decl); - if (aliasDecl) { - QList<Declaration*> importedDecls = m_duContext->findDeclarations(aliasDecl->importIdentifier()); ///@todo respect position - std::copy(importedDecls.begin(), importedDecls.end(), - std::back_inserter(worklist)); - } + /* + * Use array-style iteration, for QList is effectively a vector and also + * to avoid iterator invalidation on uppon element insertion. + */ + for (i=0; i!=decls.size(); ++i) + { + decl = decls[i]; + + if (((decl->kind() == Declaration::Namespace) || (dynamic_cast<ClassDeclaration*>(decl) != __null)) + && (decl->internalContext() != __null)) + { + ret.insert (decl->internalContext()); + } + else if (decl->kind() == Declaration::NamespaceAlias) + { + alias_decl = dynamic_cast<NamespaceAliasDeclaration*>(decl); + if (alias_decl != __null) + decls.append (m_duContext->findDeclarations(alias_decl->importIdentifier())); } } }
--- ./languages/cpp/cppduchain/declarationbuilder.cpp.orig 2012-05-28 19:29:04.000000000 +0200 +++ ./languages/cpp/cppduchain/declarationbuilder.cpp 2012-05-28 20:03:15.000000000 +0200 @@ -1226,26 +1226,39 @@ QualifiedIdentifier DeclarationBuilder::resolveNamespaceIdentifier(const QualifiedIdentifier& identifier, const CursorInRevision& position) { - QList< Declaration* > decls = currentContext()->findDeclarations(identifier, position); - - QList<DUContext*> contexts; - - // qlist does not provide convenient stable iterators - std::list<Declaration*> worklist(decls.begin(), decls.end()); - for (std::list<Declaration*>::iterator it = worklist.begin(); it != worklist.end(); ++it) { - Declaration * decl = *it; - if(decl->kind() == Declaration::Namespace && decl->internalContext()) { + QList<Declaration*> decls; + QList<DUContext*> contexts; + QList<Declaration *> imported_decls; + + Declaration *decl; + NamespaceAliasDeclaration *alias_decl; + int i; + + decls = currentContext()->findDeclarations(identifier, position); + + /* + * Use array-style iteration, for QList is effectively a vector and also + * to avoid iterator invalidation on uppon element insertion. + */ + for (int i=0; i!=decls.size(); ++i) + { + decl = decls[i]; + if ((decl->kind() == Declaration::Namespace) && (decl->internalContext())) + { contexts << decl->internalContext(); - } else if (decl->kind() == Declaration::NamespaceAlias) { - NamespaceAliasDeclaration *aliasDecl = dynamic_cast<NamespaceAliasDeclaration*>(decl); - if (aliasDecl) { - QList<Declaration*> importedDecls = currentContext()->findDeclarations(aliasDecl->importIdentifier(), position); - std::copy(importedDecls.begin(), importedDecls.end(), - std::back_inserter(worklist)); + } + else if (decl->kind() == Declaration::NamespaceAlias) + { + alias_decl = dynamic_cast<NamespaceAliasDeclaration*>(decl); + if (alias_decl != __null) + { + imported_decls = currentContext()->findDeclarations( + alias_decl->importIdentifier(), position); + decls.append (imported_decls); } } } - + if( contexts.isEmpty() ) { //Failed to resolve namespace kDebug(9007) << "Failed to resolve namespace \"" << identifier << "\"";
_______________________________________________ kde-freebsd mailing list kde-freebsd@kde.org https://mail.kde.org/mailman/listinfo/kde-freebsd See also http://freebsd.kde.org/ for latest information