forked from qt-creator/qt-creator
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
This commit is contained in:
@@ -138,19 +138,9 @@ void Document::addIncludeFile(const QString &fileName)
|
|||||||
_includedFiles.append(fileName);
|
_includedFiles.append(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Document::definedMacros() const
|
void Document::appendMacro(const Macro ¯o)
|
||||||
{
|
{
|
||||||
return _definedMacros;
|
_definedMacros.append(macro);
|
||||||
}
|
|
||||||
|
|
||||||
void Document::appendMacro(const QByteArray ¯oName, const QByteArray &text)
|
|
||||||
{
|
|
||||||
int index = macroName.indexOf('(');
|
|
||||||
if (index == -1)
|
|
||||||
_macroNames.insert(macroName);
|
|
||||||
else
|
|
||||||
_macroNames.insert(macroName.left(index));
|
|
||||||
_definedMacros += text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::addMacroUse(unsigned offset, unsigned length)
|
void Document::addMacroUse(unsigned offset, unsigned length)
|
||||||
@@ -251,11 +241,6 @@ void Document::stopSkippingBlocks(unsigned stop)
|
|||||||
_skippedBlocks.back() = Block(start, stop);
|
_skippedBlocks.back() = Block(start, stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QByteArray> Document::macroNames() const
|
|
||||||
{
|
|
||||||
return _macroNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Document::parse(ParseMode mode)
|
bool Document::parse(ParseMode mode)
|
||||||
{
|
{
|
||||||
TranslationUnit::ParseMode m = TranslationUnit::ParseTranlationUnit;
|
TranslationUnit::ParseMode m = TranslationUnit::ParseTranlationUnit;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <CPlusPlusForwardDeclarations.h>
|
#include <CPlusPlusForwardDeclarations.h>
|
||||||
|
|
||||||
|
#include "pp-macro.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
@@ -45,6 +47,8 @@
|
|||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
|
class Macro;
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT Document
|
class CPLUSPLUS_EXPORT Document
|
||||||
{
|
{
|
||||||
Document(const Document &other);
|
Document(const Document &other);
|
||||||
@@ -63,10 +67,7 @@ public:
|
|||||||
QStringList includedFiles() const;
|
QStringList includedFiles() const;
|
||||||
void addIncludeFile(const QString &fileName);
|
void addIncludeFile(const QString &fileName);
|
||||||
|
|
||||||
QByteArray definedMacros() const;
|
void appendMacro(const Macro ¯o);
|
||||||
QSet<QByteArray> macroNames() const;
|
|
||||||
|
|
||||||
void appendMacro(const QByteArray ¯oName, const QByteArray &text);
|
|
||||||
|
|
||||||
void addMacroUse(unsigned offset, unsigned length);
|
void addMacroUse(unsigned offset, unsigned length);
|
||||||
|
|
||||||
@@ -81,6 +82,9 @@ public:
|
|||||||
Scope *globalSymbols() const; // ### deprecate?
|
Scope *globalSymbols() const; // ### deprecate?
|
||||||
Namespace *globalNamespace() const;
|
Namespace *globalNamespace() const;
|
||||||
|
|
||||||
|
QList<Macro> definedMacros() const
|
||||||
|
{ return _definedMacros; }
|
||||||
|
|
||||||
Symbol *findSymbolAt(unsigned line, unsigned column) const;
|
Symbol *findSymbolAt(unsigned line, unsigned column) const;
|
||||||
|
|
||||||
void setSource(const QByteArray &source);
|
void setSource(const QByteArray &source);
|
||||||
@@ -191,8 +195,7 @@ private:
|
|||||||
TranslationUnit *_translationUnit;
|
TranslationUnit *_translationUnit;
|
||||||
Namespace *_globalNamespace;
|
Namespace *_globalNamespace;
|
||||||
QList<DiagnosticMessage> _diagnosticMessages;
|
QList<DiagnosticMessage> _diagnosticMessages;
|
||||||
QByteArray _definedMacros;
|
QList<Macro> _definedMacros;
|
||||||
QSet<QByteArray> _macroNames;
|
|
||||||
QList<Block> _skippedBlocks;
|
QList<Block> _skippedBlocks;
|
||||||
QList<Block> _macroUses;
|
QList<Block> _macroUses;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ TypeOfExpression::TypeOfExpression():
|
|||||||
void TypeOfExpression::setDocuments(const QMap<QString, Document::Ptr> &documents)
|
void TypeOfExpression::setDocuments(const QMap<QString, Document::Ptr> &documents)
|
||||||
{
|
{
|
||||||
m_documents = documents;
|
m_documents = documents;
|
||||||
|
m_lookupContext = LookupContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expression,
|
QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expression,
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Sets the documents used to evaluate expressions. Should be set before
|
* Sets the documents used to evaluate expressions. Should be set before
|
||||||
* calling this functor.
|
* calling this functor.
|
||||||
|
*
|
||||||
|
* Also clears the lookup context, so can be used to make sure references
|
||||||
|
* to the documents previously used are removed.
|
||||||
*/
|
*/
|
||||||
void setDocuments(const QMap<QString, Document::Ptr> &documents);
|
void setDocuments(const QMap<QString, Document::Ptr> &documents);
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,16 @@ HEADERS += \
|
|||||||
TypeOfExpression.h \
|
TypeOfExpression.h \
|
||||||
TypePrettyPrinter.h \
|
TypePrettyPrinter.h \
|
||||||
ResolveExpression.h \
|
ResolveExpression.h \
|
||||||
LookupContext.h
|
LookupContext.h \
|
||||||
|
pp-cctype.h \
|
||||||
|
pp-engine.h \
|
||||||
|
pp-fwd.h \
|
||||||
|
pp-macro-expander.h \
|
||||||
|
pp-scanner.h \
|
||||||
|
pp-client.h \
|
||||||
|
pp-environment.h \
|
||||||
|
pp-internal.h \
|
||||||
|
pp-macro.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
SimpleLexer.cpp \
|
SimpleLexer.cpp \
|
||||||
@@ -35,6 +44,9 @@ SOURCES += \
|
|||||||
TypeOfExpression.cpp \
|
TypeOfExpression.cpp \
|
||||||
TypePrettyPrinter.cpp \
|
TypePrettyPrinter.cpp \
|
||||||
ResolveExpression.cpp \
|
ResolveExpression.cpp \
|
||||||
LookupContext.cpp
|
LookupContext.cpp \
|
||||||
|
pp-engine.cpp \
|
||||||
|
pp-environment.cpp \
|
||||||
|
pp-macro-expander.cpp
|
||||||
|
|
||||||
RESOURCES += cplusplus.qrc
|
RESOURCES += cplusplus.qrc
|
||||||
|
|||||||
@@ -53,22 +53,24 @@
|
|||||||
#ifndef PP_CCTYPE_H
|
#ifndef PP_CCTYPE_H
|
||||||
#define PP_CCTYPE_H
|
#define PP_CCTYPE_H
|
||||||
|
|
||||||
|
#include <CPlusPlusForwardDeclarations.h>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
inline bool pp_isalpha (int __ch)
|
inline bool CPLUSPLUS_EXPORT pp_isalpha (int __ch)
|
||||||
{ return std::isalpha ((unsigned char) __ch) != 0; }
|
{ return std::isalpha ((unsigned char) __ch) != 0; }
|
||||||
|
|
||||||
inline bool pp_isalnum (int __ch)
|
inline bool CPLUSPLUS_EXPORT pp_isalnum (int __ch)
|
||||||
{ return std::isalnum ((unsigned char) __ch) != 0; }
|
{ return std::isalnum ((unsigned char) __ch) != 0; }
|
||||||
|
|
||||||
inline bool pp_isdigit (int __ch)
|
inline bool CPLUSPLUS_EXPORT pp_isdigit (int __ch)
|
||||||
{ return std::isdigit ((unsigned char) __ch) != 0; }
|
{ return std::isdigit ((unsigned char) __ch) != 0; }
|
||||||
|
|
||||||
inline bool pp_isspace (int __ch)
|
inline bool CPLUSPLUS_EXPORT pp_isspace (int __ch)
|
||||||
{ return std::isspace ((unsigned char) __ch) != 0; }
|
{ return std::isspace ((unsigned char) __ch) != 0; }
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_CCTYPE_H
|
#endif // PP_CCTYPE_H
|
||||||
@@ -34,15 +34,17 @@
|
|||||||
#ifndef PP_CLIENT_H
|
#ifndef PP_CLIENT_H
|
||||||
#define PP_CLIENT_H
|
#define PP_CLIENT_H
|
||||||
|
|
||||||
|
#include <CPlusPlusForwardDeclarations.h>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
class Macro;
|
class Macro;
|
||||||
|
|
||||||
class Client
|
class CPLUSPLUS_EXPORT Client
|
||||||
{
|
{
|
||||||
Client(const Client &other);
|
Client(const Client &other);
|
||||||
void operator=(const Client &other);
|
void operator=(const Client &other);
|
||||||
@@ -60,7 +62,7 @@ public:
|
|||||||
virtual ~Client()
|
virtual ~Client()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void macroAdded(const QByteArray ¯oId, const QByteArray &text) = 0;
|
virtual void macroAdded(const Macro ¯o) = 0;
|
||||||
virtual void sourceNeeded(QString &fileName, IncludeType mode) = 0; // ### FIX the signature.
|
virtual void sourceNeeded(QString &fileName, IncludeType mode) = 0; // ### FIX the signature.
|
||||||
|
|
||||||
virtual void startExpandingMacro(unsigned offset,
|
virtual void startExpandingMacro(unsigned offset,
|
||||||
@@ -74,6 +76,6 @@ public:
|
|||||||
virtual void stopSkippingBlocks(unsigned offset) = 0;
|
virtual void stopSkippingBlocks(unsigned offset) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_CLIENT_H
|
#endif // PP_CLIENT_H
|
||||||
@@ -57,7 +57,6 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace rpp;
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -907,16 +906,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
|||||||
|
|
||||||
env.bind(macro);
|
env.bind(macro);
|
||||||
|
|
||||||
QByteArray macroText;
|
if (client)
|
||||||
macroText.reserve(64);
|
client->macroAdded(macro);
|
||||||
macroText += "#define ";
|
|
||||||
|
|
||||||
macroText += macroId;
|
|
||||||
macroText += ' ';
|
|
||||||
macroText += macro.definition;
|
|
||||||
macroText += '\n';
|
|
||||||
|
|
||||||
client->macroAdded(macroId, macroText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pp::processIf(TokenIterator firstToken, TokenIterator lastToken)
|
void pp::processIf(TokenIterator firstToken, TokenIterator lastToken)
|
||||||
@@ -1020,13 +1011,10 @@ void pp::processUndef(TokenIterator firstToken, TokenIterator lastToken)
|
|||||||
|
|
||||||
if (tk->is(T_IDENTIFIER)) {
|
if (tk->is(T_IDENTIFIER)) {
|
||||||
const QByteArray macroName = tokenText(*tk);
|
const QByteArray macroName = tokenText(*tk);
|
||||||
env.remove(macroName);
|
const Macro *macro = env.remove(macroName);
|
||||||
|
|
||||||
QByteArray macroText;
|
if (client && macro)
|
||||||
macroText += "#undef ";
|
client->macroAdded(*macro);
|
||||||
macroText += macroName;
|
|
||||||
macroText += '\n';
|
|
||||||
client->macroAdded(macroName, macroText);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ namespace CPlusPlus {
|
|||||||
class Token;
|
class Token;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct Value
|
struct Value
|
||||||
{
|
{
|
||||||
@@ -134,7 +134,7 @@ namespace rpp {
|
|||||||
#undef PP_DEFINE_BIN_OP
|
#undef PP_DEFINE_BIN_OP
|
||||||
};
|
};
|
||||||
|
|
||||||
class pp
|
class CPLUSPLUS_EXPORT pp
|
||||||
{
|
{
|
||||||
Client *client;
|
Client *client;
|
||||||
Environment &env;
|
Environment &env;
|
||||||
@@ -200,7 +200,7 @@ namespace rpp {
|
|||||||
|
|
||||||
Value evalExpression(TokenIterator firstToken,
|
Value evalExpression(TokenIterator firstToken,
|
||||||
TokenIterator lastToken,
|
TokenIterator lastToken,
|
||||||
const QByteArray &source) const;
|
const QByteArray &source) const;
|
||||||
|
|
||||||
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
|
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
|
||||||
|
|
||||||
@@ -226,6 +226,6 @@ namespace rpp {
|
|||||||
bool isQtReservedWord(const QByteArray &name) const;
|
bool isQtReservedWord(const QByteArray &name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_ENGINE_H
|
#endif // PP_ENGINE_H
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
#include "pp.h"
|
#include "pp.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace rpp;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
Environment::Environment ()
|
Environment::Environment ()
|
||||||
: currentLine(0),
|
: currentLine(0),
|
||||||
@@ -115,12 +115,12 @@ Macro *Environment::bind(const Macro &__macro)
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Environment::remove (const QByteArray &name)
|
Macro *Environment::remove (const QByteArray &name)
|
||||||
{
|
{
|
||||||
Macro macro;
|
Macro macro;
|
||||||
macro.name = name;
|
macro.name = name;
|
||||||
macro.hidden = true;
|
macro.hidden = true;
|
||||||
bind(macro);
|
return bind(macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Environment::isBuiltinMacro(const QByteArray &s) const
|
bool Environment::isBuiltinMacro(const QByteArray &s) const
|
||||||
@@ -53,14 +53,16 @@
|
|||||||
#ifndef PP_ENVIRONMENT_H
|
#ifndef PP_ENVIRONMENT_H
|
||||||
#define PP_ENVIRONMENT_H
|
#define PP_ENVIRONMENT_H
|
||||||
|
|
||||||
|
#include "CPlusPlusForwardDeclarations.h"
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct Macro;
|
class Macro;
|
||||||
|
|
||||||
class Environment
|
class CPLUSPLUS_EXPORT Environment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Environment();
|
Environment();
|
||||||
@@ -70,7 +72,7 @@ public:
|
|||||||
Macro *macroAt(unsigned index) const;
|
Macro *macroAt(unsigned index) const;
|
||||||
|
|
||||||
Macro *bind(const Macro ¯o);
|
Macro *bind(const Macro ¯o);
|
||||||
void remove(const QByteArray &name);
|
Macro *remove(const QByteArray &name);
|
||||||
|
|
||||||
Macro *resolve(const QByteArray &name) const;
|
Macro *resolve(const QByteArray &name) const;
|
||||||
bool isBuiltinMacro(const QByteArray &name) const;
|
bool isBuiltinMacro(const QByteArray &name) const;
|
||||||
@@ -104,6 +106,6 @@ private:
|
|||||||
int _hash_count;
|
int _hash_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_ENVIRONMENT_H
|
#endif // PP_ENVIRONMENT_H
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
namespace _PP_internal {
|
namespace _PP_internal {
|
||||||
|
|
||||||
inline bool comment_p (const char *__first, const char *__last)
|
inline bool comment_p (const char *__first, const char *__last)
|
||||||
@@ -73,6 +73,6 @@ inline bool comment_p (const char *__first, const char *__last)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // _PP_internal
|
} // _PP_internal
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_INTERNAL_H
|
#endif // PP_INTERNAL_H
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "pp-macro-expander.h"
|
#include "pp-macro-expander.h"
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
using namespace rpp;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
|
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
|
||||||
: env(env), frame(frame),
|
: env(env), frame(frame),
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
#ifndef PP_MACRO_EXPANDER_H
|
#ifndef PP_MACRO_EXPANDER_H
|
||||||
#define PP_MACRO_EXPANDER_H
|
#define PP_MACRO_EXPANDER_H
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct pp_frame
|
struct pp_frame
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ namespace rpp {
|
|||||||
int generated_lines;
|
int generated_lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_MACRO_EXPANDER_H
|
#endif // PP_MACRO_EXPANDER_H
|
||||||
|
|
||||||
@@ -53,43 +53,44 @@
|
|||||||
#ifndef PP_MACRO_H
|
#ifndef PP_MACRO_H
|
||||||
#define PP_MACRO_H
|
#define PP_MACRO_H
|
||||||
|
|
||||||
|
#include <CPlusPlusForwardDeclarations.h>
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct Macro
|
class CPLUSPLUS_EXPORT Macro
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QByteArray name;
|
||||||
|
QByteArray definition;
|
||||||
|
QVector<QByteArray> formals;
|
||||||
|
QByteArray fileName;
|
||||||
|
int line;
|
||||||
|
Macro *next;
|
||||||
|
unsigned hashcode;
|
||||||
|
|
||||||
|
union
|
||||||
{
|
{
|
||||||
QByteArray name;
|
unsigned state;
|
||||||
QByteArray definition;
|
|
||||||
QVector<QByteArray> formals;
|
|
||||||
QByteArray fileName;
|
|
||||||
int line;
|
|
||||||
int lines;
|
|
||||||
Macro *next;
|
|
||||||
unsigned hashcode;
|
|
||||||
|
|
||||||
union
|
struct
|
||||||
{
|
{
|
||||||
unsigned state;
|
unsigned hidden: 1;
|
||||||
|
unsigned function_like: 1;
|
||||||
struct
|
unsigned variadics: 1;
|
||||||
{
|
|
||||||
unsigned hidden: 1;
|
|
||||||
unsigned function_like: 1;
|
|
||||||
unsigned variadics: 1;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
inline Macro():
|
inline Macro():
|
||||||
line(0),
|
line(0),
|
||||||
lines(0),
|
|
||||||
next(0),
|
next(0),
|
||||||
hashcode(0),
|
hashcode(0),
|
||||||
state(0)
|
state(0)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_MACRO_H
|
#endif // PP_MACRO_H
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
#ifndef PP_SCANNER_H
|
#ifndef PP_SCANNER_H
|
||||||
#define PP_SCANNER_H
|
#define PP_SCANNER_H
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct pp_skip_blanks
|
struct pp_skip_blanks
|
||||||
{
|
{
|
||||||
@@ -373,7 +373,7 @@ struct pp_skip_argument
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_SCANNER_H
|
#endif // PP_SCANNER_H
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@
|
|||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
#include "cmakeprojectnodes.h"
|
#include "cmakeprojectnodes.h"
|
||||||
|
#include "cmakestep.h"
|
||||||
|
#include "makestep.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <cpptools/cppmodelmanagerinterface.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
@@ -188,7 +190,7 @@ QString CMakeProject::buildDirectory(const QString &buildConfiguration) const
|
|||||||
{
|
{
|
||||||
Q_UNUSED(buildConfiguration)
|
Q_UNUSED(buildConfiguration)
|
||||||
//TODO
|
//TODO
|
||||||
return "";
|
return QFileInfo(m_fileName).absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStepConfigWidget *CMakeProject::createConfigWidget()
|
ProjectExplorer::BuildStepConfigWidget *CMakeProject::createConfigWidget()
|
||||||
@@ -225,13 +227,29 @@ QStringList CMakeProject::files(FilesMode fileMode) const
|
|||||||
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
|
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
Q_UNUSED(writer)
|
Q_UNUSED(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
Q_UNUSED(reader)
|
Q_UNUSED(reader);
|
||||||
|
if (buildConfigurations().isEmpty()) {
|
||||||
|
// No build configuration, adding those
|
||||||
|
|
||||||
|
// TODO do we want to create one build configuration per target?
|
||||||
|
// or how do we want to handle that?
|
||||||
|
|
||||||
|
CMakeStep *cmakeStep = new CMakeStep(this);
|
||||||
|
MakeStep *makeStep = new MakeStep(this);
|
||||||
|
|
||||||
|
insertBuildStep(0, cmakeStep);
|
||||||
|
insertBuildStep(1, makeStep);
|
||||||
|
|
||||||
|
addBuildConfiguration("all");
|
||||||
|
setActiveBuildConfiguration("all");
|
||||||
|
}
|
||||||
|
// Restoring is fine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -376,12 +394,36 @@ void CMakeCbpParser::parseBuild()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseTarget()
|
void CMakeCbpParser::parseTarget()
|
||||||
{
|
{
|
||||||
|
m_targetOutput.clear();
|
||||||
|
m_targetType = false;
|
||||||
|
while(!atEnd()) {
|
||||||
|
readNext();
|
||||||
|
if (isEndElement()) {
|
||||||
|
if (m_targetType && !m_targetOutput.isEmpty()) {
|
||||||
|
qDebug()<<"found target "<<m_targetOutput;
|
||||||
|
m_targets.insert(m_targetOutput);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (name() == "Compiler") {
|
||||||
|
parseCompiler();
|
||||||
|
} else if (name() == "Option") {
|
||||||
|
parseTargetOption();
|
||||||
|
} else if (isStartElement()) {
|
||||||
|
parseUnknownElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeCbpParser::parseTargetOption()
|
||||||
|
{
|
||||||
|
if (attributes().hasAttribute("output"))
|
||||||
|
m_targetOutput = attributes().value("output").toString();
|
||||||
|
else if (attributes().hasAttribute("type") && attributes().value("type") == "1")
|
||||||
|
m_targetType = true;
|
||||||
while(!atEnd()) {
|
while(!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
} else if (name() == "Compiler") {
|
|
||||||
parseCompiler();
|
|
||||||
} else if (isStartElement()) {
|
} else if (isStartElement()) {
|
||||||
parseUnknownElement();
|
parseUnknownElement();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,13 +123,18 @@ private:
|
|||||||
void parseProject();
|
void parseProject();
|
||||||
void parseBuild();
|
void parseBuild();
|
||||||
void parseTarget();
|
void parseTarget();
|
||||||
|
void parseTargetOption();
|
||||||
void parseCompiler();
|
void parseCompiler();
|
||||||
void parseAdd();
|
void parseAdd();
|
||||||
void parseUnit();
|
void parseUnit();
|
||||||
void parseUnknownElement();
|
void parseUnknownElement();
|
||||||
|
|
||||||
|
QSet<QString> m_targets;
|
||||||
QList<ProjectExplorer::FileNode *> m_fileList;
|
QList<ProjectExplorer::FileNode *> m_fileList;
|
||||||
QStringList m_includeFiles;
|
QStringList m_includeFiles;
|
||||||
|
|
||||||
|
QString m_targetOutput;
|
||||||
|
bool m_targetType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeFile : public Core::IFile
|
class CMakeFile : public Core::IFile
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ bool CMakeStep::init(const QString &buildConfiguration)
|
|||||||
setEnabled(buildConfiguration, true);
|
setEnabled(buildConfiguration, true);
|
||||||
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
|
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
|
||||||
setCommand(buildConfiguration, "cmake"); // TODO give full path here?
|
setCommand(buildConfiguration, "cmake"); // TODO give full path here?
|
||||||
setArguments(buildConfiguration, QStringList()); // TODO
|
setArguments(buildConfiguration, QStringList() << "-GUnix Makefiles"); // TODO
|
||||||
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
|
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
|
||||||
return AbstractProcessStep::init(buildConfiguration);
|
return AbstractProcessStep::init(buildConfiguration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -699,7 +699,9 @@ void CppCodeCompletion::addMacros(const LookupContext &context)
|
|||||||
continue;
|
continue;
|
||||||
processed.insert(fn);
|
processed.insert(fn);
|
||||||
if (Document::Ptr doc = context.document(fn)) {
|
if (Document::Ptr doc = context.document(fn)) {
|
||||||
macroNames += doc->macroNames();
|
foreach (const Macro macro, doc->definedMacros()) {
|
||||||
|
macroNames.insert(macro.name);
|
||||||
|
}
|
||||||
todo += doc->includedFiles();
|
todo += doc->includedFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1025,6 +1027,10 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem
|
|||||||
void CppCodeCompletion::cleanup()
|
void CppCodeCompletion::cleanup()
|
||||||
{
|
{
|
||||||
m_completions.clear();
|
m_completions.clear();
|
||||||
|
|
||||||
|
// Set empty map in order to avoid referencing old versions of the documents
|
||||||
|
// until the next completion
|
||||||
|
typeOfExpression.setDocuments(QMap<QString, Document::Ptr>());
|
||||||
}
|
}
|
||||||
|
|
||||||
int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor)
|
int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "pp.h"
|
#include <cplusplus/pp.h>
|
||||||
|
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "cpphoverhandler.h"
|
#include "cpphoverhandler.h"
|
||||||
@@ -107,7 +107,7 @@ static const char pp_configuration[] =
|
|||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppPreprocessor: public rpp::Client
|
class CppPreprocessor: public CPlusPlus::Client
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CppPreprocessor(QPointer<CppModelManager> modelManager);
|
CppPreprocessor(QPointer<CppModelManager> modelManager);
|
||||||
@@ -129,12 +129,11 @@ protected:
|
|||||||
void mergeEnvironment(CPlusPlus::Document::Ptr doc);
|
void mergeEnvironment(CPlusPlus::Document::Ptr doc);
|
||||||
void mergeEnvironment(CPlusPlus::Document::Ptr doc, QSet<QString> *processed);
|
void mergeEnvironment(CPlusPlus::Document::Ptr doc, QSet<QString> *processed);
|
||||||
|
|
||||||
virtual void macroAdded(const QByteArray ¯oName,
|
virtual void macroAdded(const Macro ¯o);
|
||||||
const QByteArray ¯oText);
|
|
||||||
virtual void startExpandingMacro(unsigned offset,
|
virtual void startExpandingMacro(unsigned offset,
|
||||||
const rpp::Macro ¯o,
|
const Macro ¯o,
|
||||||
const QByteArray &originalText);
|
const QByteArray &originalText);
|
||||||
virtual void stopExpandingMacro(unsigned offset, const rpp::Macro ¯o);
|
virtual void stopExpandingMacro(unsigned offset, const Macro ¯o);
|
||||||
virtual void startSkippingBlocks(unsigned offset);
|
virtual void startSkippingBlocks(unsigned offset);
|
||||||
virtual void stopSkippingBlocks(unsigned offset);
|
virtual void stopSkippingBlocks(unsigned offset);
|
||||||
virtual void sourceNeeded(QString &fileName, IncludeType type);
|
virtual void sourceNeeded(QString &fileName, IncludeType type);
|
||||||
@@ -142,8 +141,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
QPointer<CppModelManager> m_modelManager;
|
QPointer<CppModelManager> m_modelManager;
|
||||||
CppModelManager::DocumentTable m_documents;
|
CppModelManager::DocumentTable m_documents;
|
||||||
rpp::Environment env;
|
Environment env;
|
||||||
rpp::pp m_proc;
|
pp m_proc;
|
||||||
QStringList m_includePaths;
|
QStringList m_includePaths;
|
||||||
QStringList m_systemIncludePaths;
|
QStringList m_systemIncludePaths;
|
||||||
QMap<QString, QByteArray> m_workingCopy;
|
QMap<QString, QByteArray> m_workingCopy;
|
||||||
@@ -295,16 +294,16 @@ QByteArray CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type)
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::macroAdded(const QByteArray ¯oName, const QByteArray ¯oText)
|
void CppPreprocessor::macroAdded(const Macro ¯o)
|
||||||
{
|
{
|
||||||
if (! m_currentDoc)
|
if (! m_currentDoc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_currentDoc->appendMacro(macroName, macroText);
|
m_currentDoc->appendMacro(macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::startExpandingMacro(unsigned offset,
|
void CppPreprocessor::startExpandingMacro(unsigned offset,
|
||||||
const rpp::Macro &,
|
const Macro &,
|
||||||
const QByteArray &originalText)
|
const QByteArray &originalText)
|
||||||
{
|
{
|
||||||
if (! m_currentDoc)
|
if (! m_currentDoc)
|
||||||
@@ -314,7 +313,7 @@ void CppPreprocessor::startExpandingMacro(unsigned offset,
|
|||||||
m_currentDoc->addMacroUse(offset, originalText.length());
|
m_currentDoc->addMacroUse(offset, originalText.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::stopExpandingMacro(unsigned, const rpp::Macro &)
|
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
||||||
{
|
{
|
||||||
if (! m_currentDoc)
|
if (! m_currentDoc)
|
||||||
return;
|
return;
|
||||||
@@ -340,14 +339,13 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *process
|
|||||||
|
|
||||||
processed->insert(fn);
|
processed->insert(fn);
|
||||||
|
|
||||||
foreach (QString includedFile, doc->includedFiles())
|
foreach (QString includedFile, doc->includedFiles()) {
|
||||||
mergeEnvironment(m_documents.value(includedFile), processed);
|
mergeEnvironment(m_documents.value(includedFile), processed);
|
||||||
|
}
|
||||||
|
|
||||||
const QByteArray macros = doc->definedMacros();
|
foreach (const Macro macro, doc->definedMacros()) {
|
||||||
QByteArray localFileName = doc->fileName().toUtf8();
|
env.bind(macro);
|
||||||
|
}
|
||||||
QByteArray dummy;
|
|
||||||
m_proc(localFileName, macros, &dummy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::startSkippingBlocks(unsigned offset)
|
void CppPreprocessor::startSkippingBlocks(unsigned offset)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
|||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
DEFINES += CPPTOOLS_LIBRARY
|
DEFINES += CPPTOOLS_LIBRARY
|
||||||
CONFIG += help
|
CONFIG += help
|
||||||
include(rpp/rpp.pri)|error("Can't find RPP")
|
|
||||||
HEADERS += cpptools_global.h \
|
HEADERS += cpptools_global.h \
|
||||||
cppquickopenfilter.h \
|
cppquickopenfilter.h \
|
||||||
cppclassesfilter.h \
|
cppclassesfilter.h \
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
DEPENDPATH += $$PWD
|
|
||||||
INCLUDEPATH += $$PWD
|
|
||||||
|
|
||||||
HEADERS += $$PWD/pp-cctype.h \
|
|
||||||
$$PWD/pp-engine.h \
|
|
||||||
$$PWD/pp-environment.h \
|
|
||||||
$$PWD/pp-internal.h \
|
|
||||||
$$PWD/pp-macro-expander.h \
|
|
||||||
$$PWD/pp-macro.h \
|
|
||||||
$$PWD/pp-scanner.h \
|
|
||||||
$$PWD/pp.h \
|
|
||||||
$$PWD/pp-client.h
|
|
||||||
|
|
||||||
SOURCES += $$PWD/pp-engine.cpp \
|
|
||||||
$$PWD/pp-environment.cpp \
|
|
||||||
$$PWD/pp-macro-expander.cpp
|
|
||||||
|
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ QString SearchSymbols::symbolName(const Symbol *symbol) const
|
|||||||
void SearchSymbols::appendItem(const QString &name,
|
void SearchSymbols::appendItem(const QString &name,
|
||||||
const QString &info,
|
const QString &info,
|
||||||
ModelItemInfo::ItemType type,
|
ModelItemInfo::ItemType type,
|
||||||
const CPlusPlus::Symbol *symbol)
|
const Symbol *symbol)
|
||||||
{
|
{
|
||||||
const QIcon icon = icons.iconForSymbol(symbol);
|
const QIcon icon = icons.iconForSymbol(symbol);
|
||||||
items.append(ModelItemInfo(name, info, type,
|
items.append(ModelItemInfo(name, info, type,
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(sessionManager()));
|
connect(m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(showSessionManager()));
|
||||||
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newProject()));
|
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newProject()));
|
||||||
#if 0
|
#if 0
|
||||||
connect(m_loadAction, SIGNAL(triggered()), this, SLOT(loadAction()));
|
connect(m_loadAction, SIGNAL(triggered()), this, SLOT(loadAction()));
|
||||||
@@ -765,10 +765,10 @@ void ProjectExplorerPlugin::newProject()
|
|||||||
updateActions();
|
updateActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::sessionManager()
|
void ProjectExplorerPlugin::showSessionManager()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectExplorerPlugin::newSession";
|
qDebug() << "ProjectExplorerPlugin::showSessionManager";
|
||||||
|
|
||||||
if (m_session->isDefaultVirgin()) {
|
if (m_session->isDefaultVirgin()) {
|
||||||
// do not save new virgin default sessions
|
// do not save new virgin default sessions
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ private slots:
|
|||||||
void unloadProject();
|
void unloadProject();
|
||||||
void clearSession();
|
void clearSession();
|
||||||
void newProject();
|
void newProject();
|
||||||
void sessionManager();
|
void showSessionManager();
|
||||||
void populateBuildConfigurationMenu();
|
void populateBuildConfigurationMenu();
|
||||||
void buildConfigurationMenuTriggered(QAction *);
|
void buildConfigurationMenuTriggered(QAction *);
|
||||||
void populateRunConfigurationMenu();
|
void populateRunConfigurationMenu();
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ void SessionManager::editDependencies()
|
|||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Project *> SessionManager::projects() const
|
const QList<Project *> &SessionManager::projects() const
|
||||||
{
|
{
|
||||||
return m_file->m_projects;
|
return m_file->m_projects;
|
||||||
}
|
}
|
||||||
@@ -839,26 +839,26 @@ Project *SessionManager::projectForFile(const QString &fileName) const
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionManager::projectForFile(" << fileName << ")";
|
qDebug() << "SessionManager::projectForFile(" << fileName << ")";
|
||||||
|
|
||||||
Project *project = 0;
|
const QList<Project *> &projectList = projects();
|
||||||
|
|
||||||
QList<Project *> projectList = projects();
|
// Check current project first
|
||||||
|
Project *currentProject = ProjectExplorerPlugin::instance()->currentProject();
|
||||||
|
if (currentProject && projectContainsFile(currentProject, fileName))
|
||||||
|
return currentProject;
|
||||||
|
|
||||||
// Always check current project first
|
foreach (Project *p, projectList)
|
||||||
if (Project *currentProject = ProjectExplorerPlugin::instance()->currentProject()) {
|
if (p != currentProject && projectContainsFile(p, fileName))
|
||||||
projectList.removeOne(currentProject);
|
return p;
|
||||||
projectList.insert(0, currentProject);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (Project *p, projectList) {
|
return 0;
|
||||||
if (!m_projectFileCache.contains(p)) {
|
}
|
||||||
m_projectFileCache.insert(p, p->files(Project::AllFiles));
|
|
||||||
}
|
bool SessionManager::projectContainsFile(Project *p, const QString &fileName) const
|
||||||
if (m_projectFileCache.value(p).contains(fileName)) {
|
{
|
||||||
project = p;
|
if (!m_projectFileCache.contains(p))
|
||||||
break;
|
m_projectFileCache.insert(p, p->files(Project::AllFiles));
|
||||||
}
|
|
||||||
}
|
return m_projectFileCache.value(p).contains(fileName);
|
||||||
return project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::setEditorCodec(Core::IEditor *editor, const QString &fileName)
|
void SessionManager::setEditorCodec(Core::IEditor *editor, const QString &fileName)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
Core::IFile *file() const;
|
Core::IFile *file() const;
|
||||||
Project *startupProject() const;
|
Project *startupProject() const;
|
||||||
|
|
||||||
QList<Project *> projects() const;
|
const QList<Project *> &projects() const;
|
||||||
|
|
||||||
bool isDefaultVirgin() const;
|
bool isDefaultVirgin() const;
|
||||||
bool isDefaultSession(const QString &session) const;
|
bool isDefaultSession(const QString &session) const;
|
||||||
@@ -182,6 +182,7 @@ private:
|
|||||||
bool loadImpl(const QString &fileName);
|
bool loadImpl(const QString &fileName);
|
||||||
bool createImpl(const QString &fileName);
|
bool createImpl(const QString &fileName);
|
||||||
QString sessionNameToFileName(const QString &session);
|
QString sessionNameToFileName(const QString &session);
|
||||||
|
bool projectContainsFile(Project *p, const QString &fileName) const;
|
||||||
|
|
||||||
bool recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const;
|
bool recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const;
|
||||||
QStringList dependencies(const QString &proName) const;
|
QStringList dependencies(const QString &proName) const;
|
||||||
|
|||||||
@@ -474,6 +474,9 @@ void Qt4Project::updateCodeModel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add mkspec directory
|
||||||
|
allIncludePaths.append(qtVersion(activeBuildConfiguration())->mkspecPath());
|
||||||
|
|
||||||
QStringList files;
|
QStringList files;
|
||||||
files += m_projectFiles->files[HeaderType];
|
files += m_projectFiles->files[HeaderType];
|
||||||
files += m_projectFiles->generatedFiles[HeaderType];
|
files += m_projectFiles->generatedFiles[HeaderType];
|
||||||
|
|||||||
@@ -728,6 +728,12 @@ QString QtVersion::mkspec() const
|
|||||||
return m_mkspec;
|
return m_mkspec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QtVersion::mkspecPath() const
|
||||||
|
{
|
||||||
|
updateMkSpec();
|
||||||
|
return m_mkspecFullPath;
|
||||||
|
}
|
||||||
|
|
||||||
QHash<QString,QString> QtVersion::versionInfo() const
|
QHash<QString,QString> QtVersion::versionInfo() const
|
||||||
{
|
{
|
||||||
updateVersionInfo();
|
updateVersionInfo();
|
||||||
@@ -1023,25 +1029,25 @@ void QtVersion::updateMkSpec() const
|
|||||||
//qDebug()<<"Finding mkspec for"<<path();
|
//qDebug()<<"Finding mkspec for"<<path();
|
||||||
|
|
||||||
QString mkspec;
|
QString mkspec;
|
||||||
QFile f(path() + "/.qmake.cache");
|
// QFile f(path() + "/.qmake.cache");
|
||||||
if (f.exists() && f.open(QIODevice::ReadOnly)) {
|
// if (f.exists() && f.open(QIODevice::ReadOnly)) {
|
||||||
while(!f.atEnd()) {
|
// while(!f.atEnd()) {
|
||||||
QByteArray line = f.readLine();
|
// QByteArray line = f.readLine();
|
||||||
if(line.startsWith("QMAKESPEC")) {
|
// if(line.startsWith("QMAKESPEC")) {
|
||||||
const QList<QByteArray> &temp = line.split('=');
|
// const QList<QByteArray> &temp = line.split('=');
|
||||||
if(temp.size() == 2) {
|
// if(temp.size() == 2) {
|
||||||
mkspec = temp.at(1).trimmed();
|
// mkspec = temp.at(1).trimmed();
|
||||||
if (mkspec.startsWith("$$QT_BUILD_TREE/mkspecs/"))
|
// if (mkspec.startsWith("$$QT_BUILD_TREE/mkspecs/"))
|
||||||
mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
|
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
|
||||||
else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
|
// else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
|
||||||
mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
|
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
|
||||||
mkspec = QDir::fromNativeSeparators(mkspec);
|
// mkspec = QDir::fromNativeSeparators(mkspec);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
f.close();
|
// f.close();
|
||||||
} else {
|
// } else {
|
||||||
// no .qmake.cache so look at the default mkspec
|
// no .qmake.cache so look at the default mkspec
|
||||||
QString mkspecPath = versionInfo().value("QMAKE_MKSPECS");
|
QString mkspecPath = versionInfo().value("QMAKE_MKSPECS");
|
||||||
if (mkspecPath.isEmpty())
|
if (mkspecPath.isEmpty())
|
||||||
@@ -1096,8 +1102,9 @@ void QtVersion::updateMkSpec() const
|
|||||||
mkspec = f2.symLinkTarget();
|
mkspec = f2.symLinkTarget();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
m_mkspecFullPath = mkspec;
|
||||||
int index = mkspec.lastIndexOf('/');
|
int index = mkspec.lastIndexOf('/');
|
||||||
if(index == -1)
|
if(index == -1)
|
||||||
index = mkspec.lastIndexOf('\\');
|
index = mkspec.lastIndexOf('\\');
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public:
|
|||||||
QString path() const;
|
QString path() const;
|
||||||
QString sourcePath() const;
|
QString sourcePath() const;
|
||||||
QString mkspec() const;
|
QString mkspec() const;
|
||||||
|
QString mkspecPath() const;
|
||||||
QString makeCommand() const;
|
QString makeCommand() const;
|
||||||
QString qmakeCommand() const;
|
QString qmakeCommand() const;
|
||||||
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
|
// Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
|
||||||
@@ -107,6 +108,7 @@ private:
|
|||||||
QString m_path;
|
QString m_path;
|
||||||
QString m_sourcePath;
|
QString m_sourcePath;
|
||||||
mutable QString m_mkspec; // updated lazily
|
mutable QString m_mkspec; // updated lazily
|
||||||
|
mutable QString m_mkspecFullPath;
|
||||||
QString m_mingwDirectory;
|
QString m_mingwDirectory;
|
||||||
QString m_prependPath;
|
QString m_prependPath;
|
||||||
QString m_msvcVersion;
|
QString m_msvcVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user