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:
@@ -146,7 +146,7 @@ unsigned TranslationUnit::matchingBrace(unsigned index) const
|
|||||||
MemoryPool *TranslationUnit::memoryPool() const
|
MemoryPool *TranslationUnit::memoryPool() const
|
||||||
{ return _pool; }
|
{ return _pool; }
|
||||||
|
|
||||||
TranslationUnitAST *TranslationUnit::ast() const
|
AST *TranslationUnit::ast() const
|
||||||
{ return _ast; }
|
{ return _ast; }
|
||||||
|
|
||||||
bool TranslationUnit::isTokenized() const
|
bool TranslationUnit::isTokenized() const
|
||||||
@@ -218,17 +218,49 @@ bool TranslationUnit::skipFunctionBody() const
|
|||||||
void TranslationUnit::setSkipFunctionBody(bool skipFunctionBody)
|
void TranslationUnit::setSkipFunctionBody(bool skipFunctionBody)
|
||||||
{ _skipFunctionBody = skipFunctionBody; }
|
{ _skipFunctionBody = skipFunctionBody; }
|
||||||
|
|
||||||
void TranslationUnit::parse()
|
bool TranslationUnit::parse(ParseMode mode)
|
||||||
{
|
{
|
||||||
if (isParsed())
|
if (isParsed())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (! isTokenized())
|
if (! isTokenized())
|
||||||
tokenize();
|
tokenize();
|
||||||
|
|
||||||
Parser parser(this);
|
Parser parser(this);
|
||||||
parser.setQtMocRunEnabled(_qtMocRunEnabled);
|
parser.setQtMocRunEnabled(_qtMocRunEnabled);
|
||||||
parser.parseTranslationUnit(_ast);
|
|
||||||
|
bool parsed = false;
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case ParseTranlationUnit: {
|
||||||
|
TranslationUnitAST *node = 0;
|
||||||
|
parsed = parser.parseTranslationUnit(node);
|
||||||
|
_ast = node;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case ParseDeclaration: {
|
||||||
|
DeclarationAST *node = 0;
|
||||||
|
parsed = parser.parseDeclaration(node);
|
||||||
|
_ast = node;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case ParseExpression: {
|
||||||
|
ExpressionAST *node = 0;
|
||||||
|
parsed = parser.parseExpression(node);
|
||||||
|
_ast = node;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case ParseStatement: {
|
||||||
|
StatementAST *node = 0;
|
||||||
|
parsed = parser.parseStatement(node);
|
||||||
|
_ast = node;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
} // switch
|
||||||
|
|
||||||
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::pushLineOffset(unsigned offset)
|
void TranslationUnit::pushLineOffset(unsigned offset)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
NumericLiteral *numericLiteral(unsigned index) const;
|
NumericLiteral *numericLiteral(unsigned index) const;
|
||||||
|
|
||||||
MemoryPool *memoryPool() const;
|
MemoryPool *memoryPool() const;
|
||||||
TranslationUnitAST *ast() const;
|
AST *ast() const;
|
||||||
|
|
||||||
bool blockErrors(bool block);
|
bool blockErrors(bool block);
|
||||||
|
|
||||||
@@ -113,7 +113,15 @@ public:
|
|||||||
void setSkipFunctionBody(bool skipFunctionBody);
|
void setSkipFunctionBody(bool skipFunctionBody);
|
||||||
|
|
||||||
bool isParsed() const;
|
bool isParsed() const;
|
||||||
void parse();
|
|
||||||
|
enum ParseMode {
|
||||||
|
ParseTranlationUnit,
|
||||||
|
ParseDeclaration,
|
||||||
|
ParseExpression,
|
||||||
|
ParseStatement
|
||||||
|
};
|
||||||
|
|
||||||
|
bool parse(ParseMode mode = ParseTranlationUnit);
|
||||||
|
|
||||||
void resetAST();
|
void resetAST();
|
||||||
void release();
|
void release();
|
||||||
@@ -169,7 +177,7 @@ private:
|
|||||||
std::vector<unsigned> _lineOffsets;
|
std::vector<unsigned> _lineOffsets;
|
||||||
std::vector<PPLine> _ppLines;
|
std::vector<PPLine> _ppLines;
|
||||||
MemoryPool *_pool;
|
MemoryPool *_pool;
|
||||||
TranslationUnitAST *_ast;
|
AST *_ast;
|
||||||
TranslationUnit *_previousTranslationUnit;
|
TranslationUnit *_previousTranslationUnit;
|
||||||
union {
|
union {
|
||||||
unsigned _flags;
|
unsigned _flags;
|
||||||
|
|||||||
@@ -251,9 +251,31 @@ QSet<QByteArray> Document::macroNames() const
|
|||||||
return _macroNames;
|
return _macroNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::parse()
|
bool Document::parse(ParseMode mode)
|
||||||
{
|
{
|
||||||
_translationUnit->parse();
|
TranslationUnit::ParseMode m = TranslationUnit::ParseTranlationUnit;
|
||||||
|
switch (mode) {
|
||||||
|
case ParseTranlationUnit:
|
||||||
|
m = TranslationUnit::ParseTranlationUnit;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ParseDeclaration:
|
||||||
|
m = TranslationUnit::ParseDeclaration;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ParseExpression:
|
||||||
|
m = TranslationUnit::ParseExpression;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ParseStatement:
|
||||||
|
m = TranslationUnit::ParseStatement;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _translationUnit->parse(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::check()
|
void Document::check()
|
||||||
@@ -264,7 +286,10 @@ void Document::check()
|
|||||||
|
|
||||||
_globalNamespace = _control->newNamespace(0);
|
_globalNamespace = _control->newNamespace(0);
|
||||||
Scope *globals = _globalNamespace->members();
|
Scope *globals = _globalNamespace->members();
|
||||||
if (TranslationUnitAST *ast = _translationUnit->ast()) {
|
if (! _translationUnit->ast())
|
||||||
|
return; // nothing to do.
|
||||||
|
|
||||||
|
if (TranslationUnitAST *ast = _translationUnit->ast()->asTranslationUnit()) {
|
||||||
for (DeclarationAST *decl = ast->declarations; decl; decl = decl->next) {
|
for (DeclarationAST *decl = ast->declarations; decl; decl = decl->next) {
|
||||||
semantic.check(decl, globals);
|
semantic.check(decl, globals);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,14 @@ public:
|
|||||||
void startSkippingBlocks(unsigned offset);
|
void startSkippingBlocks(unsigned offset);
|
||||||
void stopSkippingBlocks(unsigned offset);
|
void stopSkippingBlocks(unsigned offset);
|
||||||
|
|
||||||
void parse(); // ### remove
|
enum ParseMode { // ### keep in sync with CPlusPlus::TranslationUnit
|
||||||
|
ParseTranlationUnit,
|
||||||
|
ParseDeclaration,
|
||||||
|
ParseExpression,
|
||||||
|
ParseStatement
|
||||||
|
};
|
||||||
|
|
||||||
|
bool parse(ParseMode mode = ParseTranlationUnit);
|
||||||
void check();
|
void check();
|
||||||
void releaseTranslationUnit();
|
void releaseTranslationUnit();
|
||||||
|
|
||||||
|
|||||||
@@ -81,34 +81,17 @@ ExpressionAST *TypeOfExpression::expressionAST() const
|
|||||||
|
|
||||||
ExpressionAST *TypeOfExpression::extractExpressionAST(Document::Ptr doc) const
|
ExpressionAST *TypeOfExpression::extractExpressionAST(Document::Ptr doc) const
|
||||||
{
|
{
|
||||||
TranslationUnitAST *translationUnitAST = doc->translationUnit()->ast();
|
if (! doc->translationUnit()->ast())
|
||||||
|
return 0;
|
||||||
|
|
||||||
// ### evaluate the expression
|
return doc->translationUnit()->ast()->asExpression();
|
||||||
ExpressionAST *expressionAST = 0;
|
|
||||||
if (translationUnitAST) {
|
|
||||||
DeclarationAST *declaration = translationUnitAST->declarations;
|
|
||||||
SimpleDeclarationAST *simpleDecl = 0;
|
|
||||||
if (declaration)
|
|
||||||
simpleDecl = declaration->asSimpleDeclaration();
|
|
||||||
if (simpleDecl && simpleDecl->decl_specifier_seq) {
|
|
||||||
if (TypeofSpecifierAST *typeOfSpec = simpleDecl->decl_specifier_seq->asTypeofSpecifier())
|
|
||||||
expressionAST = typeOfSpec->expression;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return expressionAST;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Document::Ptr TypeOfExpression::documentForExpression(const QString &expression) const
|
Document::Ptr TypeOfExpression::documentForExpression(const QString &expression) const
|
||||||
{
|
{
|
||||||
// create a __typeof__ specifier
|
|
||||||
QByteArray declaration;
|
|
||||||
declaration += "__typeof__ ";
|
|
||||||
declaration += expression.toLatin1(); // C++ code needs to be in latin1
|
|
||||||
declaration += ";";
|
|
||||||
|
|
||||||
// create the expression's AST.
|
// create the expression's AST.
|
||||||
Document::Ptr doc = Document::create(QLatin1String("<completion>"));
|
Document::Ptr doc = Document::create(QLatin1String("<completion>"));
|
||||||
doc->setSource(declaration);
|
doc->setSource(expression.toUtf8());
|
||||||
doc->parse();
|
doc->parse(Document::ParseExpression);
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ CMakeStep::~CMakeStep()
|
|||||||
bool CMakeStep::init(const QString &buildConfiguration)
|
bool CMakeStep::init(const QString &buildConfiguration)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeStep::run(QFutureInterface<bool> &fi)
|
void CMakeStep::run(QFutureInterface<bool> &fi)
|
||||||
|
|||||||
@@ -640,9 +640,9 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
|||||||
const char *beginOfText = startOfToken(*identifierToken);
|
const char *beginOfText = startOfToken(*identifierToken);
|
||||||
const char *endOfText = endOfToken(*_dot);
|
const char *endOfText = endOfToken(*_dot);
|
||||||
++_dot; // skip T_RPAREN
|
++_dot; // skip T_RPAREN
|
||||||
m->hidden = true;
|
//m->hidden = true;
|
||||||
expand(beginOfText, endOfText, result);
|
expand(beginOfText, endOfText, result);
|
||||||
m->hidden = false;
|
//m->hidden = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &fileNam
|
|||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "diff" << workingDirectory << fileNames;
|
qDebug() << "diff" << workingDirectory << fileNames;
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("diff") << fileNames;
|
arguments << QLatin1String("diff") << QLatin1String("--") << fileNames;
|
||||||
|
|
||||||
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
|
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
|
||||||
const QString title = tr("Git Diff");
|
const QString title = tr("Git Diff");
|
||||||
@@ -187,7 +187,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("diff");
|
arguments << QLatin1String("diff");
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
arguments << fileName;
|
arguments << QLatin1String("--") << fileName;
|
||||||
|
|
||||||
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
|
const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
|
||||||
const QString title = tr("Git Diff %1").arg(fileName);
|
const QString title = tr("Git Diff %1").arg(fileName);
|
||||||
@@ -246,7 +246,7 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName)
|
|||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "blame" << workingDirectory << fileName;
|
qDebug() << "blame" << workingDirectory << fileName;
|
||||||
QStringList arguments(QLatin1String("blame"));
|
QStringList arguments(QLatin1String("blame"));
|
||||||
arguments << fileName;
|
arguments << QLatin1String("--") << fileName;
|
||||||
|
|
||||||
const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
|
const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
|
||||||
const QString title = tr("Git Blame %1").arg(fileName);
|
const QString title = tr("Git Blame %1").arg(fileName);
|
||||||
@@ -314,7 +314,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
|||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
QByteArray errorText;
|
QByteArray errorText;
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("reset") << QLatin1String("HEAD") << files;
|
arguments << QLatin1String("reset") << QLatin1String("HEAD") << QLatin1String("--") << files;
|
||||||
const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||||
const QString output = QString::fromLocal8Bit(outputText);
|
const QString output = QString::fromLocal8Bit(outputText);
|
||||||
m_plugin->m_outputWindow->popup(false);
|
m_plugin->m_outputWindow->popup(false);
|
||||||
@@ -643,9 +643,9 @@ GitCommand::~GitCommand()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitCommand::execute(const QStringList &arguments
|
void GitCommand::execute(const QStringList &arguments,
|
||||||
, const QString &workingDirectory
|
const QString &workingDirectory,
|
||||||
, const ProjectExplorer::Environment &environment)
|
const ProjectExplorer::Environment &environment)
|
||||||
{
|
{
|
||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "GitCommand::execute" << workingDirectory << arguments;
|
qDebug() << "GitCommand::execute" << workingDirectory << arguments;
|
||||||
@@ -663,9 +663,9 @@ void GitCommand::execute(const QStringList &arguments
|
|||||||
, Core::ProgressManagerInterface::CloseOnSuccess);
|
, Core::ProgressManagerInterface::CloseOnSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitCommand::run(const QStringList &arguments
|
void GitCommand::run(const QStringList &arguments,
|
||||||
, const QString &workingDirectory
|
const QString &workingDirectory,
|
||||||
, const ProjectExplorer::Environment &environment)
|
const ProjectExplorer::Environment &environment)
|
||||||
{
|
{
|
||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << "GitCommand::run" << workingDirectory << arguments;
|
qDebug() << "GitCommand::run" << workingDirectory << arguments;
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ GitSubmitEditorPanelData GitSubmitEditorWidget::panelData() const
|
|||||||
rc.author = m_gitSubmitPanelUi.authorLineEdit->text();
|
rc.author = m_gitSubmitPanelUi.authorLineEdit->text();
|
||||||
rc.email = m_gitSubmitPanelUi.emailLineEdit->text();
|
rc.email = m_gitSubmitPanelUi.emailLineEdit->text();
|
||||||
return rc;
|
return rc;
|
||||||
};
|
}
|
||||||
|
|
||||||
void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data)
|
void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data)
|
||||||
{
|
{
|
||||||
m_gitSubmitPanelUi.authorLineEdit->setText(data.author);
|
m_gitSubmitPanelUi.authorLineEdit->setText(data.author);
|
||||||
m_gitSubmitPanelUi.emailLineEdit->setText(data.email);
|
m_gitSubmitPanelUi.emailLineEdit->setText(data.email);
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="infoGroup">
|
<widget class="QGroupBox" name="infoGroup">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ bool ProFileReader::readProFile(const QString &fileName)
|
|||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
QString fn = QFileInfo(fileName).filePath();
|
QString fn = QFileInfo(fileName).filePath();
|
||||||
ProFile *pro = new ProFile(fn);
|
ProFile *pro = new ProFile(fn);
|
||||||
if (!queryProFile(pro)) {
|
if (!queryProFile(pro)) {
|
||||||
delete pro;
|
delete pro;
|
||||||
|
|||||||
@@ -883,12 +883,12 @@ QStringList Qt4ProFileNode::subDirsPaths(ProFileReader *reader) const
|
|||||||
QString realFile;
|
QString realFile;
|
||||||
const QString subDirKey = subDirVar + QLatin1String(".subdir");
|
const QString subDirKey = subDirVar + QLatin1String(".subdir");
|
||||||
if (reader->contains(subDirKey))
|
if (reader->contains(subDirKey))
|
||||||
realDir = reader->value(subDirKey);
|
realDir = QFileInfo(reader->value(subDirKey)).filePath();
|
||||||
else
|
else
|
||||||
realDir = subDirVar;
|
realDir = subDirVar;
|
||||||
QFileInfo info(realDir);
|
QFileInfo info(realDir);
|
||||||
if (!info.isAbsolute())
|
if (!info.isAbsolute())
|
||||||
realDir = QString("%1/%2").arg(m_projectDir, realDir);
|
realDir = m_projectDir + "/" + realDir;
|
||||||
|
|
||||||
#ifdef QTEXTENDED_QBUILD_SUPPORT
|
#ifdef QTEXTENDED_QBUILD_SUPPORT
|
||||||
// QBuild only uses project files named qbuild.pro, and subdirs are implied
|
// QBuild only uses project files named qbuild.pro, and subdirs are implied
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ bool VCSBaseSubmitEditor::restoreState(const QByteArray &/*state*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList VCSBaseSubmitEditor::checkedFiles() const
|
QStringList VCSBaseSubmitEditor::checkedFiles() const
|
||||||
{
|
{
|
||||||
return vcsFileListToFileList(m_d->m_widget->checkedFiles());
|
return vcsFileListToFileList(m_d->m_widget->checkedFiles());
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ void VCSBaseSubmitEditor::addFiles(const QStringList& list, bool checked, bool u
|
|||||||
m_d->m_widget->addFiles(list, checked, userCheckable);
|
m_d->m_widget->addFiles(list, checked, userCheckable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList)
|
void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList)
|
||||||
{
|
{
|
||||||
emit diffSelectedFiles(vcsFileListToFileList(rawList));
|
emit diffSelectedFiles(vcsFileListToFileList(rawList));
|
||||||
}
|
}
|
||||||
@@ -299,4 +299,4 @@ QIcon VCSBaseSubmitEditor::submitIcon()
|
|||||||
return QIcon(QLatin1String(":/vcsbase/images/submit.png"));
|
return QIcon(QLatin1String(":/vcsbase/images/submit.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace VCSBase
|
||||||
|
|||||||
@@ -56,8 +56,10 @@ int main(int, char *[])
|
|||||||
TranslationUnit unit(&control, fileId);
|
TranslationUnit unit(&control, fileId);
|
||||||
unit.setSource(source.constData(), source.size());
|
unit.setSource(source.constData(), source.size());
|
||||||
unit.parse();
|
unit.parse();
|
||||||
|
if (unit.ast()) {
|
||||||
|
TranslationUnitAST *ast = unit.ast()->asTranslationUnit();
|
||||||
|
Q_ASSERT(ast != 0);
|
||||||
|
|
||||||
if (TranslationUnitAST *ast = unit.ast()) {
|
|
||||||
Scope globalScope;
|
Scope globalScope;
|
||||||
Semantic sem(&control);
|
Semantic sem(&control);
|
||||||
for (DeclarationAST *decl = ast->declarations; decl; decl = decl->next) {
|
for (DeclarationAST *decl = ast->declarations; decl; decl = decl->next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user