Commit e134e249 authored by Wolfgang Beck's avatar Wolfgang Beck

Source update.

parent cc278a59
......@@ -33,30 +33,32 @@
#include <cplusplus/CheckUndefinedSymbols.h>
#include "cppmodelmanager.h"
#include "cpptoolsconstants.h"
#include "cpptoolseditorsupport.h"
#include "cppfindreferences.h"
#ifndef ICHECK_BUILD
# include "cpptoolsconstants.h"
# include "cpptoolseditorsupport.h"
# include "cppfindreferences.h"
#endif
#include <functional>
#include <QtConcurrentRun>
#include <QFutureSynchronizer>
#include <qtconcurrent/runextensions.h>
#include <texteditor/itexteditor.h>
#include <texteditor/basetexteditor.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <extensionsystem/pluginmanager.h>
#ifndef ICHECK_BUILD
# include <QFutureSynchronizer>
# include <qtconcurrent/runextensions.h>
# include <texteditor/itexteditor.h>
# include <texteditor/basetexteditor.h>
# include <projectexplorer/project.h>
# include <projectexplorer/projectexplorer.h>
# include <projectexplorer/projectexplorerconstants.h>
# include <projectexplorer/session.h>
# include <coreplugin/icore.h>
# include <coreplugin/uniqueidmanager.h>
# include <coreplugin/mimedatabase.h>
# include <coreplugin/editormanager/editormanager.h>
# include <coreplugin/progressmanager/progressmanager.h>
# include <extensionsystem/pluginmanager.h>
#else
# include <QDir>
#endif
#include <utils/qtcassert.h>
......@@ -199,9 +201,8 @@ void CppPreprocessor::setProjectFiles(const QStringList &files)
void CppPreprocessor::setTodo(const QStringList &files)
{ m_todo = QSet<QString>::fromList(files); }
namespace {
#ifndef ICHECK_BUILD
namespace {
class Process: public std::unary_function<Document::Ptr, void>
{
QPointer<CppModelManager> _modelManager;
......@@ -256,8 +257,8 @@ public:
_modelManager->emitDocumentUpdated(doc); // ### TODO: compress
}
};
#endif
} // end of anonymous namespace
#endif
void CppPreprocessor::run(const QString &fileName)
{
......
......@@ -31,21 +31,26 @@
#define CPPMODELMANAGER_H
#include <cpptools/cppmodelmanagerinterface.h>
#include <projectexplorer/project.h>
#ifndef ICHECK_BUILD
# include <projectexplorer/project.h>
#endif
#include <cplusplus/CppDocument.h>
#include <cplusplus/PreprocessorClient.h>
#include <texteditor/basetexteditor.h>
#ifndef ICHECK_BUILD
# include <texteditor/basetexteditor.h>
#endif
#include <cplusplus/PreprocessorEnvironment.h>
#include <cplusplus/pp-engine.h>
#ifdef ICHECK_BUILD
# include "ParseManager.h"
# include "parsemanager.h"
#else
# include <QtCore/QHash>
# include <QtCore/QFutureInterface>
# include <QtCore/QFutureSynchronizer>
# include <QtCore/QMutex>
# include <QtCore/QTimer>
# include <QtGui/QTextEdit> // for QTextEdit::ExtraSelection
#endif
#include <QtCore/QHash>
#include <QtCore/QFutureInterface>
#include <QtCore/QFutureSynchronizer>
#include <QtCore/QMutex>
#include <QtCore/QTimer>
#include <QtGui/QTextEdit> // for QTextEdit::ExtraSelection
namespace Core {
class ICore;
......
......@@ -586,6 +586,8 @@ public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
virtual QPropertyDeclarationAST *clone(MemoryPool *pool) const;
protected:
virtual void accept0(ASTVisitor *visitor);
virtual bool match0(AST *, ASTMatcher *);
......@@ -606,6 +608,8 @@ public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
virtual QEnumDeclarationAST *clone(MemoryPool *pool) const;
protected:
virtual void accept0(ASTVisitor *visitor);
virtual bool match0(AST *, ASTMatcher *);
......@@ -626,6 +630,8 @@ public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
virtual QFlagsDeclarationAST *clone(MemoryPool *pool) const;
protected:
virtual void accept0(ASTVisitor *visitor);
virtual bool match0(AST *, ASTMatcher *);
......@@ -647,6 +653,8 @@ public:
virtual unsigned firstToken() const;
virtual unsigned lastToken() const;
virtual QDeclareFlagsDeclarationAST *clone(MemoryPool *pool) const;
protected:
virtual void accept0(ASTVisitor *visitor);
virtual bool match0(AST *, ASTMatcher *);
......
......@@ -138,6 +138,67 @@ AccessDeclarationAST *AccessDeclarationAST::clone(MemoryPool *pool) const
return ast;
}
#ifdef ICHECK_BUILD
QPropertyDeclarationAST *QPropertyDeclarationAST::clone(MemoryPool *pool) const
{
QPropertyDeclarationAST *ast = new (pool) QPropertyDeclarationAST;
ast->property_specifier_token = property_specifier_token;
ast->lparen_token = lparen_token;
ast->type_token = type_token;
ast->type_name_token = type_name_token;
ast->read_token = read_token;
ast->read_function_token = read_function_token;
ast->write_token = write_token;
ast->write_function_token = write_function_token;
ast->reset_token = reset_token;
ast->reset_function_token = reset_function_token;
ast->notify_token = notify_token;
ast->notify_function_token = notify_function_token;
ast->rparen_token = rparen_token;
return ast;
}
QEnumDeclarationAST *QEnumDeclarationAST::clone(MemoryPool *pool) const
{
QEnumDeclarationAST *ast = new (pool)QEnumDeclarationAST;
ast->enum_specifier_token = enum_specifier_token;
ast->lparen_token = lparen_token;
ast->rparen_token = rparen_token;
EnumeratorListAST *enumerator_list;
for (EnumeratorListAST *iter = enumerator_list, **ast_iter = &ast->enumerator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) EnumeratorListAST((iter->value) ? iter->value->clone(pool) : 0);
return ast;
}
QFlagsDeclarationAST *QFlagsDeclarationAST::clone(MemoryPool *pool) const
{
QFlagsDeclarationAST *ast = new (pool) QFlagsDeclarationAST;
ast->flags_specifier_token = flags_specifier_token;
ast->lparen_token = lparen_token;
ast->rparen_token = rparen_token;
EnumeratorListAST *enumerator_list;
for (EnumeratorListAST *iter = enumerator_list, **ast_iter = &ast->enumerator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) EnumeratorListAST((iter->value) ? iter->value->clone(pool) : 0);
return ast;
}
QDeclareFlagsDeclarationAST *QDeclareFlagsDeclarationAST::clone(MemoryPool *pool) const
{
QDeclareFlagsDeclarationAST *ast = new (pool) QDeclareFlagsDeclarationAST;
ast->declareflags_specifier_token = declareflags_specifier_token;
ast->lparen_token = lparen_token;
ast->flag_token = flag_token;
ast->enum_token = enum_token;
ast->rparen_token = rparen_token;
return ast;
}
#endif
AsmDefinitionAST *AsmDefinitionAST::clone(MemoryPool *pool) const
{
AsmDefinitionAST *ast = new (pool) AsmDefinitionAST;
......
......@@ -272,7 +272,7 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
if (semantic()->isObjCClassMethod(tokenKind(ast->method_type_token)))
method->setStorage(Symbol::Static);
if (ast->selector->asObjCSelectorWithArguments()) {
if (ast->selector && ast->selector->asObjCSelectorWithArguments()) {
for (ObjCMessageArgumentDeclarationListAST *it = ast->argument_list; it; it = it->next) {
ObjCMessageArgumentDeclarationAST *argDecl = it->value;
......
......@@ -210,6 +210,16 @@ public:
} // end of anonymous namespace
#ifdef ICHECK_BUILD
//Symbian compiler has some difficulties to understand the templates.
static void delete_array_entries(std::vector<Symbol *> vt)
{
std::vector<Symbol *>::iterator it;
for (it = vt.begin(); it != vt.end(); ++it) {
delete *it;
}
}
#else
template <typename _Iterator>
static void delete_array_entries(_Iterator first, _Iterator last)
{
......@@ -220,6 +230,7 @@ static void delete_array_entries(_Iterator first, _Iterator last)
template <typename _Array>
static void delete_array_entries(const _Array &a)
{ delete_array_entries(a.begin(), a.end()); }
#endif
class Control::Data
{
......
......@@ -1748,11 +1748,12 @@ bool Parser::parseAccessSpecifier(SpecifierAST *&node)
bool Parser::parseAccessDeclaration(DeclarationAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_PUBLIC || LA() == T_PROTECTED || LA() == T_PRIVATE || LA() == T_Q_SIGNALS) {
if (LA() == T_PUBLIC || LA() == T_PROTECTED || LA() == T_PRIVATE || LA() == T_Q_SIGNALS || LA() == T_Q_SLOTS) {
bool isSignals = LA() == T_Q_SIGNALS;
bool isSlots = LA() == T_Q_SLOTS;
AccessDeclarationAST *ast = new (_pool) AccessDeclarationAST;
ast->access_specifier_token = consumeToken();
if (! isSignals && LA() == T_Q_SLOTS)
if (! isSignals && (LA() == T_Q_SLOTS || isSlots))
ast->slots_token = consumeToken();
match(T_COLON, &ast->colon_token);
node = ast;
......@@ -1930,6 +1931,7 @@ bool Parser::parseMemberSpecification(DeclarationAST *&node)
case T_PUBLIC:
case T_PROTECTED:
case T_PRIVATE:
case T_Q_SLOTS:
return parseAccessDeclaration(node);
#ifdef ICHECK_BUILD
......@@ -2426,6 +2428,7 @@ bool Parser::parseStatement(StatementAST *&node)
return parseExpressionOrDeclarationStatement(node);
} // switch
return false; //Avoid compiler warning
}
bool Parser::parseBreakStatement(StatementAST *&node)
......
......@@ -222,7 +222,9 @@ bool Function::isEqualTo(const Type *other) const
else if (isVolatile() != o->isVolatile())
return false;
#ifdef ICHECK_BUILD
else if (isInvokable() != o->isInvokable())
else if (isInvokable() != o->isInvokable())
return false;
else if (isSignal() != o->isSignal())
return false;
#endif
......@@ -258,6 +260,8 @@ bool Function::isEqualTo(const Function* fct, bool ignoreName/* = false*/) const
return false;
else if (isInvokable() != fct->isInvokable())
return false;
else if (isSignal() != fct->isSignal())
return false;
if (_arguments->symbolCount() != fct->_arguments->symbolCount())
return false;
......
......@@ -20,6 +20,6 @@ TARGET=tst_$$TARGET
include(./ichecklib.pri)
HEADERS += ./ichecklib.h \
./ichecklib_global.h \
./ParseManager.h
./parsemanager.h
SOURCES += ./ichecklib.cpp \
./ParseManager.cpp
./parsemanager.cpp
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "ichecklib.h"
#include "ParseManager.h"
#include "parsemanager.h"
#include <QtCore/QCoreApplication>
#include <QString>
#include <QStringList>
......@@ -17,7 +58,32 @@ QStringList getQTIncludePath()
foreach(QString item, processevironment){
if(item.indexOf("QTDIR=") == 0){
QString qtpath = item.remove("QTDIR=");
ret << qtpath + "/include";
ret << qtpath + "/include/ActiveQt";
ret << qtpath + "/include/phonon";
ret << qtpath + "/include/phonon_compat";
ret << qtpath + "/include/Qt";
ret << qtpath + "/include/Qt3Support";
ret << qtpath + "/include/QtAssistant";
ret << qtpath + "/include/QtCore";
ret << qtpath + "/include/QtDBus";
ret << qtpath + "/include/QtDeclarative";
ret << qtpath + "/include/QtDesigner";
ret << qtpath + "/include/QtGui";
ret << qtpath + "/include/QtHelp";
ret << qtpath + "/include/QtMultimedia";
ret << qtpath + "/include/QtNetwork";
ret << qtpath + "/include/QtOpenGL";
ret << qtpath + "/include/QtOpenVG";
ret << qtpath + "/include/QtScript";
ret << qtpath + "/include/QtScriptTools";
ret << qtpath + "/include/QtSql";
ret << qtpath + "/include/QtSvg";
ret << qtpath + "/include/QtTest";
ret << qtpath + "/include/QtUiTools";
ret << qtpath + "/include/QtWebKit";
ret << qtpath + "/include/QtXml";
ret << qtpath + "/include/QtXmlPatterns";
break;
}
}
......@@ -39,11 +105,11 @@ void ICheckLib::ParseHeader(const QStringList& includePath, const QStringList& f
pParseManager->parse(filelist);
}
bool ICheckLib::check(const ICheckLib& ichecklib /*ICheckLib from interface header*/)
bool ICheckLib::check(const ICheckLib& ichecklib /*ICheckLib from interface header*/, QString outputfile)
{
if(pParseManager){
CPlusPlus::ParseManager* cpparsemanager = ichecklib.pParseManager;
return pParseManager->checkAllMetadatas(cpparsemanager);
return pParseManager->checkAllMetadatas(cpparsemanager, outputfile);
}
return false;
}
......
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ICHECKLIB_H
#define ICHECKLIB_H
......@@ -11,7 +52,7 @@ class ICHECKLIBSHARED_EXPORT ICheckLib {
public:
ICheckLib();
void ParseHeader(const QStringList& includePath, const QStringList& filelist);
bool check(const ICheckLib& ichecklib /*ICheckLib from interface header*/);
bool check(const ICheckLib& ichecklib /*ICheckLib from interface header*/, QString outputfile);
QStringList getErrorMsg();
private:
CPlusPlus::ParseManager* pParseManager;
......
......@@ -56,11 +56,13 @@ HEADERS += $$REL_PATH_TO_SRC/shared/cplusplus/Array.h \
$$REL_PATH_TO_SRC/shared/cplusplus/Type.h \
$$REL_PATH_TO_SRC/shared/cplusplus/TypeMatcher.h \
$$REL_PATH_TO_SRC/libs/cplusplus/TypePrettyPrinter.h \
$$REL_PATH_TO_SRC/shared/cplusplus/TypeVisitor.h
$$REL_PATH_TO_SRC/shared/cplusplus/TypeVisitor.h \
$$REL_PATH_TO_SRC/plugins/cpptools/cpptools_global.h
SOURCES += $$REL_PATH_TO_SRC/shared/cplusplus/Array.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/AST.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/ASTMatch0.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/ASTMatcher.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/ASTClone.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/ASTVisit.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/ASTVisitor.cpp \
$$REL_PATH_TO_SRC/shared/cplusplus/CheckDeclaration.cpp \
......
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ICHECKLIB_GLOBAL_H
#define ICHECKLIB_GLOBAL_H
......
......@@ -66,6 +66,7 @@
#include <QFuture>
#include <QStringList>
#include "cplusplus/CppDocument.h"
#include <QFile>
namespace CppTools{
namespace Internal{
......@@ -78,11 +79,10 @@ namespace CPlusPlus {
class AST;
class ClassSpecifierAST;
class QPropertyDeclarationAST;
class QEnumDeclarationAST;
class QFlagsDeclarationAST;
class QDeclareFlagsDeclarationAST;
class EnumSpecifierAST;
class Function;
class EnumeratorAST;
class CLASSLISTITEM
{
......@@ -155,7 +155,7 @@ namespace CPlusPlus {
const CLASSLISTITEM* highestlevelclass;
CPlusPlus::TranslationUnit* trlUnit;
QStringList classWichIsNotFound;
QEnumDeclarationAST* ast;
EnumeratorAST* ast;
//an item in this list will be shown like:
//EnumName.EnumItemName.Value
//ConnectionState.disconnected.0
......@@ -195,7 +195,7 @@ namespace CPlusPlus {
const CLASSLISTITEM* highestlevelclass;
CPlusPlus::TranslationUnit* trlUnit;
QStringList classWichIsNotFound;
QFlagsDeclarationAST* ast;
EnumeratorAST* ast;
QStringList enumvalues;
bool foundallenums;
......@@ -226,6 +226,7 @@ namespace CPlusPlus {
}
};
static QFile* m_resultFile = 0;
class ParseManager : public QObject
{
Q_OBJECT
......@@ -234,14 +235,20 @@ namespace CPlusPlus {
virtual ~ParseManager();
void setIncludePath(const QStringList &includePath);
void parse(const QStringList &sourceFiles);
bool checkAllMetadatas(ParseManager* pInterfaceParserManager);
bool checkAllMetadatas(ParseManager* pInterfaceParserManager, QString resultfile);
CppTools::Internal::CppPreprocessor *getPreProcessor() { return pCppPreprocessor; }
QList<CLASSTREE*> CreateClassLists();
QList<CLASSTREE*> CreateClassLists(bool isInterfaceHeader);
QStringList getErrorMsg() { return m_errormsgs; }
private:
void parse(CppTools::Internal::CppPreprocessor *preproc, const QStringList &files);
void getBaseClasses(const CLASSLISTITEM* pclass, QList<CLASSLISTITEM*> &baseclasslist, const QList<CLASSLISTITEM*> &allclasslist);
void Trace(QString value);
inline QString getTraceFuntionString(const FUNCTIONITEM* fctitem, const QString& classname);
void getBaseClasses(const CLASSLISTITEM* pclass
, QList<CLASSLISTITEM*> &baseclasslist
, const QList<CLASSLISTITEM*> &allclasslist
, int level
, bool isInterfaceHeader);
void getElements(QList<FUNCTIONITEM*> &functionlist
, QList<PROPERTYITEM*> &propertylist
, QList<QENUMITEM*> &qenumlist
......@@ -255,7 +262,7 @@ namespace CPlusPlus {
QList<FUNCTIONITEM*> checkMetadataFunctions(const QList<QList<FUNCTIONITEM*> > &classfctlist, const QList<QList<FUNCTIONITEM*> > &iclassfctlist);
bool isMetaObjFunction(FUNCTIONITEM* fct);
QList<FUNCTIONITEM*> containsAllMetadataFunction(const QList<FUNCTIONITEM*> &classfctlist, const QList<FUNCTIONITEM*> &iclassfctlist);
QString getErrorMessage(FUNCTIONITEM* fct);
QStringList getErrorMessage(FUNCTIONITEM* fct);
//--->
//<--- for Q_PROPERTY functions checks
......@@ -265,7 +272,7 @@ namespace CPlusPlus {
, const QList<QList<FUNCTIONITEM*> > &iclassfctlist);
void assignPropertyFunctions(PROPERTYITEM* prop, const QList<QList<FUNCTIONITEM*> > &fctlookuplist);
QList<PROPERTYITEM*> containsAllPropertyFunction(const QList<PROPERTYITEM*> &classproplist, const QList<PROPERTYITEM*> &iclassproplist);
QString getErrorMessage(PROPERTYITEM* ppt);
QStringList getErrorMessage(PROPERTYITEM* ppt);
//--->
//<--- for Q_ENUMS checks
......@@ -276,7 +283,7 @@ namespace CPlusPlus {
QStringList getEnumValueStringList(ENUMITEM *penum, QString mappedenumname = "");
void assignEnumValues(QENUMITEM* qenum, const QList<QList<ENUMITEM*> > &enumlookuplist);
QList<QENUMITEM*> containsAllEnums(const QList<QENUMITEM*> &classqenumlist, const QList<QENUMITEM*> &iclassqenumlist);