Commit d455c4ba authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Big commit.

First checkout on the DataAccess information and start of the FlowGraph data structures.
parent 568dc8ee
......@@ -25,6 +25,7 @@ if("${_isSystemLibDir}" STREQUAL "-1")
endif("${_isSystemLibDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
message(STATUS "ssssssssssssssss ${KDEVPLATFORM_INCLUDE_DIR} ${CMAKE_MODULE_PATH}")
find_package(KDevPlatform 1.1.60 REQUIRED)
include_directories(${KDEVPLATFORM_INCLUDE_DIR})
......
......@@ -36,6 +36,8 @@
# Copyright 2007 Andreas Pakulat <apaku@gmx.de>
# Redistribution and use is allowed according to the terms of the BSD license.
message(STATUS "PEEEE ${CMAKE_MODULE_PATH}")
set(_KDevPlatform_FIND_QUIETLY ${KDevPlatform_FIND_QUIETLY})
find_package( KDevPlatform ${KDevPlatform_FIND_VERSION} NO_MODULE )
set(KDevPlatform_FIND_QUIETLY ${_KDevPlatform_FIND_QUIETLY})
......
......@@ -496,6 +496,7 @@ def build_dictionary ():
pretty_printers_dict[re.compile('^QString$')] = lambda val: QStringPrinter(val)
pretty_printers_dict[re.compile('^QByteArray$')] = lambda val: QByteArrayPrinter(val)
pretty_printers_dict[re.compile('^QList<.*>$')] = lambda val: QListPrinter(val, None)
pretty_printers_dict[re.compile('^QStack<.*>$')] = lambda val: QListPrinter(val, None)
pretty_printers_dict[re.compile('^QStringList$')] = lambda val: QListPrinter(val, 'QString')
pretty_printers_dict[re.compile('^QMap<.*>$')] = lambda val: QMapPrinter(val)
pretty_printers_dict[re.compile('^QHash<.*>$')] = lambda val: QHashPrinter(val)
......
[Project]
Name=KDevelop
Manager=KDevCMakeManager
Name=kdevelop
......@@ -46,10 +46,15 @@ set(kdevcppduchain_LIB_SRCS
type_visitor.cpp
builtinoperators.cpp
expressionevaluationresult.cpp
usedecoratorvisitor.cpp
navigation/navigationwidget.cpp
navigation/declarationnavigationcontext.cpp
navigation/includenavigationcontext.cpp
navigation/macronavigationcontext.cpp
dataaccessrepository.cpp
flownode.cpp
flowgraph.cpp
)
# Note: This library doesn't follow API/ABI/BC rules and shouldn't have a SOVERSION
......
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "dataaccessrepository.h"
namespace KDevelop {
void DataAccessRepository::addModification(const KDevelop::SimpleCursor& cursor, uint flags)
{
m_modifications.append(DataAccess(cursor, flags));
}
DataAccess::DataAccess(const KDevelop::SimpleCursor& cur, uint flags)
: m_flags(flags), m_pos(cur)
{}
}
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef MODIFICATIONSREPOSITORY_H
#define MODIFICATIONSREPOSITORY_H
#include <language/editor/simplecursor.h>
#include <cppduchainexport.h>
#include <language/duchain/identifier.h>
#include <language/duchain/types/abstracttype.h>
namespace KDevelop
{
class Declaration;
//DataAccess
class DataAccess
{
public:
enum Flags { None=0, Read=1, Write=2 };
DataAccess(const SimpleCursor& cur, uint flags);
uint m_flags;
KDevelop::SimpleCursor m_pos;
//SimpleRange value() const; //nomes per write?
Declaration* declarationForDataAccess() const;
};
class KDEVCPPDUCHAIN_EXPORT DataAccessRepository
{
public:
//Again, cursor/range?
void addModification(const KDevelop::SimpleCursor& cursor, uint flags);
void clear() { m_modifications.clear(); }
int count() const { return m_modifications.size(); }
const DataAccess& at(int i) const { return m_modifications.at(i); }
private:
QList<DataAccess> m_modifications;
};
}
#endif
......@@ -380,6 +380,7 @@ void ExpressionVisitor::findMember( AST* node, AbstractType::Ptr base, const Ide
clearLast();
return;
}
session()->mapCallAstToType(node, m_lastType.cast<FunctionType>());
if( !m_lastDeclarations.isEmpty() ) {
DeclarationPointer decl(m_lastDeclarations.first());
......@@ -723,6 +724,7 @@ void ExpressionVisitor::findMember( AST* node, AbstractType::Ptr base, const Ide
m_lastType = thisPointer.cast<AbstractType>();
m_lastInstance = Instance(true);
session()->mapCallAstToType(node, cppFunction);
}else{
if( context->owner() && context->owner() && context->owner()->abstractType() )
problem(node, QString("\"this\" used in non-function context of type %1(%2)").arg( "unknown" ) .arg(m_currentContext->owner()->abstractType()->toString()));
......@@ -941,7 +943,6 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
}
}
}
visit(node->right_expression);
Instance rightInstance = m_lastInstance;
......@@ -1044,7 +1045,10 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
m_lastInstance = Instance(functions.first().function.declaration());
lock.unlock();
newUse( node, node->op, node->op+1, functions.first().function.declaration() );
//apol: we should check the arguments here and in case there's some ref value mark it as write
newUse( node, node->op, node->op+1, functions.first().function.declaration() );
session()->mapCallAstToType(node, function);
}else{
//Do not complain here, because we do not check for builtin operators
//problem(node, "No fitting operator. found" );
......@@ -1641,7 +1645,9 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
m_lastInstance = Instance(true);
lock.unlock();
//apol: should mark the used value as writed considering if the const-ness of the function and the argument passed
newUse( node, node->op, node->op+1, functions.first().function.declaration() );
session()->mapCallAstToType(node, function);
}else{
problem(node, QString("Found no viable function"));
}
......@@ -1790,6 +1796,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
return true;
visit(expression);
qDebug("b");
//binary expressions don't yield m_lastType, so when m_lastType is set we probably only have one single parameter
if( m_lastType ) {
......@@ -1967,6 +1974,8 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
} else {
problem( node, QString( "could not find a matching function for function-call" ) );
}
session()->mapCallAstToType(node, chosenFunction->abstractType().cast<KDevelop::FunctionType>());
static IndexedString functionCallOperatorIdentifier("operator()");
......@@ -2123,6 +2132,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
if( function ) {
m_lastType = function->returnType();
m_lastInstance = Instance(true);
session()->mapCallAstToType(node, function);
}else{
clearLast();
problem(node, QString("Found no subscript-function"));
......@@ -2220,6 +2230,7 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
if( functions.first().function.isViable() && function ) {
m_lastType = function->returnType();
m_lastInstance = Instance(true);
session()->mapCallAstToType(node, function);
}else{
problem(node, QString("Found no viable function"));
}
......@@ -2336,6 +2347,8 @@ void ExpressionVisitor::createDelayedType( AST* node , bool expression ) {
if (chosenFunction) {
uint token = node->initializer_id->end_token;
newUse( node , token, token+1, chosenFunction );
session()->mapCallAstToType(node, chosenFunction->type<FunctionType>());
}
}
......
......@@ -160,7 +160,7 @@ public:
* The whole sense of this thing is to allow updating an earlier created use in a later AST, like necessary because of overload-resolution.
* Must be called when the du-chain is not locked.
* */
void newUse( AST* node, size_t start_token, size_t end_token, const KDevelop::DeclarationPointer& decl ) {
void newUse( AST* node, size_t start_token, size_t end_token, const KDevelop::DeclarationPointer& decl) {
if( !m_ignore_uses ) {
flushUse();
m_currentUse.isValid = true;
......@@ -197,6 +197,8 @@ private:
AST* node;
size_t start_token, end_token;
KDevelop::DeclarationPointer declaration;
bool read;
bool write;
} m_currentUse; //This is used to temporarily delay the calling of usingDeclaration.
ParseSession* m_session;
......
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "flowgraph.h"
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef CONTROLFLOWGRAPH_H
#define CONTROLFLOWGRAPH_H
namespace KDevelop {
class FlowNode;
class FlowGraph
{
public:
void addEntry(FlowNode* n);
};
}
#endif // FLUXGRAPH_H
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "flownode.h"
using namespace KDevelop;
FlowNode::FlowNode(const KDevelop::RangeInRevision& range, FlowNode* next, FlowNode* alternative, const KDevelop::RangeInRevision& condition)
: m_nodeRange(range), m_conditionRange(condition), m_next(next), m_alternative(alternative)
{
Q_ASSERT(!m_alternative || m_next); //If we have alternative, we have next.
}
FlowNode FlowNode::createConditional(const RangeInRevision& r, FlowNode* n, FlowNode* a, const RangeInRevision& c) { return FlowNode(r, n, a, c); }
FlowNode FlowNode::createExit(const RangeInRevision& r) { return FlowNode(r); }
FlowNode FlowNode::createSequential(const RangeInRevision& r, FlowNode* next) { return FlowNode(r, next); }
FlowNode::Type FlowNode::type() const
{
if(m_next && m_alternative) return Conditional;
else if(m_next) return Sequential;
else return Exit;
}
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef FLOWNODE_H
#define FLOWNODE_H
#include <language/editor/rangeinrevision.h>
namespace KDevelop
{
class FlowNode
{
public:
enum Type { Conditional, Sequential, Exit };
static FlowNode createExit(const RangeInRevision& range);
static FlowNode createConditional(const RangeInRevision& range, FlowNode* next, FlowNode* alternative, const KDevelop::RangeInRevision& condition);
static FlowNode createSequential(const RangeInRevision& range, FlowNode* next);
Type type() const;
private:
FlowNode() {}
FlowNode(const KDevelop::RangeInRevision& range, FlowNode* next=0, FlowNode* alternative=0, const KDevelop::RangeInRevision& condition=KDevelop::RangeInRevision());
KDevelop::RangeInRevision m_nodeRange;
KDevelop::RangeInRevision m_conditionRange;
FlowNode* m_next;
FlowNode* m_alternative;
};
}
#endif // FLUXNODE_H
......@@ -139,13 +139,14 @@ void NameASTVisitor::visitUnqualifiedName(UnqualifiedNameAST *node)
createUse = !m_foundSomething || !Cpp::isTemplateDependent(m_foundSomething.data());
}
if(createUse)
m_visitor->newUse(node, node->id, node->id+1, DeclarationPointer());
m_visitor->newUse(node, node->id, node->id+1, DeclarationPointer() );
}
if( m_debug )
kDebug( 9007 ) << "failed to find " << m_currentIdentifier << " as part of " << decode( m_session, node ) << ", searched in " << m_find.describeLastContext();
}
}
qDebug() << "done with" << m_currentIdentifier.toString();
_M_name.push(m_currentIdentifier);
......
......@@ -45,3 +45,9 @@ set(itemrepositorytest_SRCS test_itemrepository.cpp)
kde4_add_unit_test(itemrepositorytest ${itemrepositorytest_SRCS})
target_link_libraries(itemrepositorytest ${KDE4_KDECORE_LIBS} ${KDE4_KTEXTEDITOR_LIBRARY} ${QT_QTTEST_LIBRARY} ${KDEVPLATFORM_LANGUAGE_LIBRARIES} ${KDEVPLATFORM_TESTS_LIBRARIES})
########## next target ################
kde4_add_unit_test(dataaccesstest dataaccesstest.cpp testhelper.cpp)
target_link_libraries(dataaccesstest ${KDE4_KDECORE_LIBS} ${KDE4_KTEXTEDITOR_LIBRARY} ${QT_QTTEST_LIBRARY}
kdev4cppparser kdev4cpprpp kdev4cppduchain ${KDEVPLATFORM_LANGUAGE_LIBRARIES} ${KDEVPLATFORM_TESTS_LIBRARIES})
\ No newline at end of file
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "dataaccesstest.h"
#include <QTest>
#include <language/duchain/duchain.h>
QTEST_MAIN(DataAccessRepositoryTest)
using namespace KDevelop;
using namespace Cpp;
DataAccessRepositoryTest::DataAccessRepositoryTest(QObject* parent): QObject(parent)
{
initShell();
}
void DataAccessRepositoryTest::initTestCase()
{}
void DataAccessRepositoryTest::cleanupTestCase()
{}
void DataAccessRepositoryTest::testUseReadWrite()
{
QFETCH(QString, code);
QFETCH(QVariantList, modFlags);
m_modifications.clear();
LockedTopDUContext top = parse(code.toUtf8(), DumpNone);
DataAccessRepository* repo = &m_modifications;
QCOMPARE(repo->count(), modFlags.size());
int i=0;
foreach(const QVariant& f, modFlags) {
qDebug() << "flags" << repo->at(i).m_flags << f;
QCOMPARE(repo->at(i).m_flags, f.toUInt());
i++;
}
}
void DataAccessRepositoryTest::testUseReadWrite_data()
{
QTest::addColumn<QString>("code");
QTest::addColumn<QVariantList>("modFlags");
QTest::newRow("def") << "int a; void main() { a=3; }" << (QVariantList() << uint(DataAccess::Write));
QTest::newRow("int==") << "int a; int main() { a==3; }" << (QVariantList() << uint(DataAccess::Read));
QTest::newRow("callr") << "int f(int e, int a) { f(a,e); }" << (QVariantList() << uint(DataAccess::Read) << uint(DataAccess::Read) << uint(DataAccess::Read));
QTest::newRow("callrw") << "int p,w; int f(int&, int) { f(p,w); }" << (QVariantList() << uint(DataAccess::Write|DataAccess::Read) << uint(DataAccess::Read) << uint(DataAccess::Read));
QTest::newRow("oper==") << "class C { bool operator==(const C&) const; }; bool f(const C& e) { return e==e; }"
<< (QVariantList() << uint(DataAccess::Read) << uint(DataAccess::Read));
QTest::newRow("++oper") << "struct C { bool operator++(); }; C e; bool f() { ++e; }"
<< (QVariantList() << uint(DataAccess::Write|DataAccess::Read));
QTest::newRow("oper++") << "struct C { bool operator++(int); }; C e; bool f() { e++; }"
<< (QVariantList() << uint(DataAccess::Write|DataAccess::Read));
QTest::newRow("member-dot") << "struct C { C boh(); }; C e; bool f() { e.boh().boh().boh(); }"
<< (QVariantList() << uint(DataAccess::Write|DataAccess::Read));
QTest::newRow("member-arrow") << "struct C { C boh(); }; C* e; bool f() { e->boh(); }"
<< (QVariantList() << uint(DataAccess::Read));
QTest::newRow("forloop") << "int i; bool f() { for(i=0; i<33; ++i) {} }"
<< (QVariantList() << uint(DataAccess::Write) << uint(DataAccess::Read) << uint(DataAccess::Read|DataAccess::Write));
QTest::newRow("if-nocond") << "int i; bool f() { if(i) {} }"
<< (QVariantList() << uint(DataAccess::Read));
QTest::newRow("if-unary") << "int i; bool f() { if(!i) {} }"
<< (QVariantList() << uint(DataAccess::Read));
QTest::newRow("ternary-op") << "int i; bool f() { i ? i : i; }"
<< (QVariantList() << uint(DataAccess::Read) << uint(DataAccess::Read) << uint(DataAccess::Read));
QTest::newRow("initializer") << "struct C {int i,j; C() : i(0),j(i) {} };" //todo: the use on j(>i<) is repeated
<< (QVariantList() << uint(DataAccess::Write) << uint(DataAccess::Write) << uint(DataAccess::Read));
QTest::newRow("new-delete") << "int *a,b; void f() { a = new int(b); delete a; }"
<< (QVariantList() << uint(DataAccess::Write) << uint(DataAccess::Read) << uint(DataAccess::Read));
QTest::newRow("return") << "int a; int f() { return a; }"
<< (QVariantList() << uint(DataAccess::Read));
QTest::newRow("init") << "int f() { int a=3; }"
<< (QVariantList() << uint(DataAccess::Write));
}
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DATAACCESSTEST_H
#define DATAACCESSTEST_H
#include <QObject>
#include "testhelper.h"
class DataAccessRepositoryTest : public QObject, public Cpp::TestHelper
{
Q_OBJECT
public:
explicit DataAccessRepositoryTest(QObject* parent = 0);
private slots:
void initTestCase();
void cleanupTestCase();
void testUseReadWrite();
void testUseReadWrite_data();
};
#endif // DATAACCESSTEST_H
......@@ -5815,4 +5815,17 @@ void TestDUChain::testCommentAfterFunctionCall()
QCOMPARE(m_view->uses().size(), 1);
}
QVector<const Use*> usesForContext(DUContext* c)
{
QVector<const Use*> ret;
for(int i=0; i<c->usesCount(); i++) {
ret += &c->uses()[i];
}
foreach(DUContext* cc, c->childContexts()) {
ret += usesForContext(cc);
}
return ret;
}
#include "test_duchain.moc"
......@@ -51,6 +51,7 @@ public:
//Move to slots again once it should be tested
void testFileParse();
void testLocalNamespaceAlias();
private slots:
void initTestCase();
......@@ -72,7 +73,7 @@ private slots:
void testDeclareNamespace2();
void testGlobalNamespaceAlias();
void testGlobalNamespaceAliasCycle();
void testLocalNamespaceAlias();
void testDeclareUsingNamespace();
void testUsingDeclaration();
void testUsingDeclarationInTemplate();
......@@ -190,6 +191,7 @@ private slots:
void testAutoTypes();
void testCommentAfterFunctionCall();
private:
void assertNoMemberFunctionModifiers(KDevelop::ClassFunctionDeclaration* memberFun);
......
......@@ -31,6 +31,7 @@
#include <language/codegen/coderepresentation.h>
#include <tests/autotestshell.h>
#include <tests/testcore.h>
#include <usedecoratorvisitor.h>
using namespace KDevelop;
......@@ -129,6 +130,9 @@ TopDUContext* TestHelper::parse(const QByteArray& unit, DumpAreas dump, TopDUCon
UseBuilder useBuilder(session.data());
useBuilder.buildUses(ast);
UseDecoratorVisitor visit(session.data(), &m_modifications);
visit.run(ast);
if (dump & DumpDUChain) {
kDebug(9007) << "===== DUChain:";
......
......@@ -25,6 +25,7 @@
#include "dumpchain.h"
#include "control.h"
#include <language/duchain/duchainlock.h>
#include "dataaccessrepository.h"
namespace KDevelop {
class TopDUContext;
......@@ -65,12 +66,13 @@ public:
KDevelop::TopDUContext* parse(const QByteArray& unit,
DumpAreas dump = static_cast<DumpAreas>(DumpAST | DumpDUChain | DumpType),
KDevelop::TopDUContext* update = 0, bool keepAst = false);
protected:
KDevelop::DataAccessRepository m_modifications;
private:
// Parser
Control control;
DumpChain cppDumper;
};
}
......
......@@ -124,7 +124,8 @@ class UseExpressionVisitor : public Cpp::ExpressionVisitor {
virtual void usingDeclaration(AST* node,
size_t start_token, size_t end_token,
const KDevelop::DeclarationPointer& decl ) {
const KDevelop::DeclarationPointer& decl)
{
RangeInRevision range = m_builder->editor()->findRange(start_token, end_token);
m_builder->newUse(node, range, decl);
}
......@@ -135,7 +136,7 @@ class UseExpressionVisitor : public Cpp::ExpressionVisitor {
/* else
kDebug(9007) << "problem";*/
}
UseBuilder* m_builder;
std::size_t m_lastEndToken; //Assume everything is processed from left to right
bool m_dumpProblems;
......
This diff is collapsed.
/* This file is part of KDevelop
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef USEDECORATORVISITOR_H
#define USEDECORATORVISITOR_H
#include <cppduchainexport.h>
#include <default_visitor.h>
#include <language/duchain/types/abstracttype.h>
#include <QStack>
namespace KDevelop {
class DataAccessRepository;
}
class KDEVCPPDUCHAIN_EXPORT UseDecoratorVisitor : protected DefaultVisitor
{
public:
UseDecoratorVisitor(ParseSession* session, KDevelop::DataAccessRepository* repo);