diff --git a/shared/cplusplus/CheckDeclaration.cpp b/shared/cplusplus/CheckDeclaration.cpp index b4c381d6175b061fdc7670b9b091346485a5ffa1..6915faf82ceb6b8cd67f3540a9347894eb95c42e 100644 --- a/shared/cplusplus/CheckDeclaration.cpp +++ b/shared/cplusplus/CheckDeclaration.cpp @@ -236,13 +236,21 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast) _scope->enterSymbol(fun); - if (ast->ctor_initializer && (ty.isValid() || (fun->identity() && ! fun->identity()->isNameId()))) { - translationUnit()->error(ast->ctor_initializer->firstToken(), - "only constructors take base initializers"); + if (ast->ctor_initializer) { + bool looksLikeCtor = false; + if (ty.isValid() || ! fun->identity()) + looksLikeCtor = false; + else if (fun->identity()->isNameId() || fun->identity()->isTemplateNameId()) + looksLikeCtor = true; + + if (! looksLikeCtor) { + translationUnit()->error(ast->ctor_initializer->firstToken(), + "only constructors take base initializers"); + } } - int previousVisibility = semantic()->switchVisibility(Symbol::Public); - int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod); + const int previousVisibility = semantic()->switchVisibility(Symbol::Public); + const int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod); semantic()->check(ast->function_body, fun->members()); diff --git a/shared/cplusplus/Lexer.cpp b/shared/cplusplus/Lexer.cpp index 6b08e2ad082c0cc62017f8853c9749579ec4533e..af6f09f74d211d285249c8601829bd2af4cee89f 100644 --- a/shared/cplusplus/Lexer.cpp +++ b/shared/cplusplus/Lexer.cpp @@ -221,7 +221,7 @@ void Lexer::scan_helper(Token *tok) return; } - char ch = _yychar; + unsigned char ch = _yychar; yyinp(); switch (ch) { diff --git a/shared/cplusplus/Lexer.h b/shared/cplusplus/Lexer.h index f2eebf2bacf543cc970876be9840726fef307012..1d85a58eb9fb41664b4b21de4f2c66e32b1e4f6b 100644 --- a/shared/cplusplus/Lexer.h +++ b/shared/cplusplus/Lexer.h @@ -132,7 +132,7 @@ private: const char *_currentChar; const char *_lastChar; const char *_tokenStart; - char _yychar; + unsigned char _yychar; int _state; union { unsigned _flags; diff --git a/shared/cplusplus/TranslationUnit.cpp b/shared/cplusplus/TranslationUnit.cpp index 896ab7d1a55fa475646c69c76c1a0c138ebbd161..bc4d219e0f333c10d7ff9c11c2d71b4cbb74784c 100644 --- a/shared/cplusplus/TranslationUnit.cpp +++ b/shared/cplusplus/TranslationUnit.cpp @@ -146,7 +146,7 @@ unsigned TranslationUnit::matchingBrace(unsigned index) const MemoryPool *TranslationUnit::memoryPool() const { return _pool; } -TranslationUnitAST *TranslationUnit::ast() const +AST *TranslationUnit::ast() const { return _ast; } bool TranslationUnit::isTokenized() const @@ -218,17 +218,49 @@ bool TranslationUnit::skipFunctionBody() const void TranslationUnit::setSkipFunctionBody(bool skipFunctionBody) { _skipFunctionBody = skipFunctionBody; } -void TranslationUnit::parse() +bool TranslationUnit::parse(ParseMode mode) { if (isParsed()) - return; + return false; if (! isTokenized()) tokenize(); Parser parser(this); 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) diff --git a/shared/cplusplus/TranslationUnit.h b/shared/cplusplus/TranslationUnit.h index 41f5a1d6e86e07f89847a3aed7f8928b452b8586..ae6b911aeeeb6584a5137572ea3ad7884c317f4e 100644 --- a/shared/cplusplus/TranslationUnit.h +++ b/shared/cplusplus/TranslationUnit.h @@ -95,7 +95,7 @@ public: NumericLiteral *numericLiteral(unsigned index) const; MemoryPool *memoryPool() const; - TranslationUnitAST *ast() const; + AST *ast() const; bool blockErrors(bool block); @@ -113,7 +113,15 @@ public: void setSkipFunctionBody(bool skipFunctionBody); bool isParsed() const; - void parse(); + + enum ParseMode { + ParseTranlationUnit, + ParseDeclaration, + ParseExpression, + ParseStatement + }; + + bool parse(ParseMode mode = ParseTranlationUnit); void resetAST(); void release(); @@ -169,7 +177,7 @@ private: std::vector<unsigned> _lineOffsets; std::vector<PPLine> _ppLines; MemoryPool *_pool; - TranslationUnitAST *_ast; + AST *_ast; TranslationUnit *_previousTranslationUnit; union { unsigned _flags; diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 3fe4ea86b63982e13e91f367637ec40730bc2457..782c14ff6d556ecac284d71a567d619d1e52d145 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -251,9 +251,31 @@ QSet<QByteArray> Document::macroNames() const 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() @@ -264,7 +286,10 @@ void Document::check() _globalNamespace = _control->newNamespace(0); 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) { semantic.check(decl, globals); } diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index d4de240d3a45a99f710d0ea25d0b9572f4f8ded3..17762200fa03c99fdde3871c5c9398c07720f411 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -85,7 +85,14 @@ public: void startSkippingBlocks(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 releaseTranslationUnit(); diff --git a/src/libs/cplusplus/TypeOfExpression.cpp b/src/libs/cplusplus/TypeOfExpression.cpp index 7e3ed35af8b25c9084e91bb0477b7238524c6def..7dd669365fc3ec8bf3be89b6cf5e7c8ca8210759 100644 --- a/src/libs/cplusplus/TypeOfExpression.cpp +++ b/src/libs/cplusplus/TypeOfExpression.cpp @@ -81,34 +81,18 @@ ExpressionAST *TypeOfExpression::expressionAST() const ExpressionAST *TypeOfExpression::extractExpressionAST(Document::Ptr doc) const { - TranslationUnitAST *translationUnitAST = doc->translationUnit()->ast(); + if (! doc->translationUnit()->ast()) + return 0; - // ### evaluate the expression - 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; + return doc->translationUnit()->ast()->asExpression(); } 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. Document::Ptr doc = Document::create(QLatin1String("<completion>")); - doc->setSource(declaration); - doc->parse(); + const QByteArray bytes = expression.toUtf8(); + doc->setSource(bytes); + doc->parse(Document::ParseExpression); return doc; } diff --git a/src/plugins/cmakeprojectmanager/cmakestep.cpp b/src/plugins/cmakeprojectmanager/cmakestep.cpp new file mode 100644 index 0000000000000000000000000000000000000000..821bf6b1beca5b1b356adfa8d12430eaa7626325 --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakestep.cpp @@ -0,0 +1,91 @@ +#include "cmakestep.h" +#include "cmakeprojectconstants.h" +#include "cmakeproject.h" + +using namespace CMakeProjectManager; +using namespace CMakeProjectManager::Internal; + +CMakeStep::CMakeStep(CMakeProject *pro) + : BuildStep(pro), m_pro(pro) +{ + +} + +CMakeStep::~CMakeStep() +{ + +} + +bool CMakeStep::init(const QString &buildConfiguration) +{ + // TODO + return true; +} + +void CMakeStep::run(QFutureInterface<bool> &fi) +{ + // TODO + fi.reportResult(true); +} + +QString CMakeStep::name() +{ + return "CMake"; +} + +QString CMakeStep::displayName() +{ + return Constants::CMAKESTEP; +} + +ProjectExplorer::BuildStepConfigWidget *CMakeStep::createConfigWidget() +{ + return new CMakeBuildStepConfigWidget(); +} + +bool CMakeStep::immutable() const +{ + return true; +} + +// +// CMakeBuildStepConfigWidget +// + +QString CMakeBuildStepConfigWidget::displayName() const +{ + return "CMake"; +} + +void CMakeBuildStepConfigWidget::init(const QString &buildConfiguration) +{ + // TODO +} + +// +// CMakeBuildStepFactory +// + +bool CMakeBuildStepFactory::canCreate(const QString &name) const +{ + return (Constants::CMAKESTEP == name); +} + +ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const +{ + Q_ASSERT(name == Constants::CMAKESTEP); + CMakeProject *pro = qobject_cast<CMakeProject *>(project); + Q_ASSERT(pro); + return new CMakeStep(pro); +} + +QStringList CMakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const +{ + return QStringList(); +} + +QString CMakeBuildStepFactory::displayNameForName(const QString &name) const +{ + return "CMake"; +} + diff --git a/src/plugins/cmakeprojectmanager/cmakestep.h b/src/plugins/cmakeprojectmanager/cmakestep.h new file mode 100644 index 0000000000000000000000000000000000000000..dea4499efc4fc3c6b05abc9d6772f6d5554528b4 --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakestep.h @@ -0,0 +1,48 @@ +#ifndef CMAKESTEP_H +#define CMAKESTEP_H + +#include <projectexplorer/buildstep.h> + +namespace CMakeProjectManager { +namespace Internal { + +class CMakeProject; + +class CMakeBuildStepConfigWidget; + +class CMakeStep : public ProjectExplorer::BuildStep +{ +public: + CMakeStep(CMakeProject *pro); + ~CMakeStep(); + virtual bool init(const QString &buildConfiguration); + + virtual void run(QFutureInterface<bool> &fi); + + virtual QString name(); + virtual QString displayName(); + virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); + virtual bool immutable() const; +private: + CMakeProject *m_pro; +}; + +class CMakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget +{ +public: + virtual QString displayName() const; + virtual void init(const QString &buildConfiguration); +}; + +class CMakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory +{ + virtual bool canCreate(const QString &name) const; + virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const; + virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const; + virtual QString displayNameForName(const QString &name) const; +}; + + +} +} +#endif // CMAKESTEP_H diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index aa15e462f86c9c00a14619e11a23a8855ef0030e..1593847ef858a8d992ce95d4d83868a677d7a3c0 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -342,13 +342,6 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) : updateActions(); m_d->m_windowPopup = new OpenEditorsWindow(this); - -#ifdef Q_OS_MAC - m_d->m_externalEditor = m_d->m_core->resourcePath() - +QLatin1String("/runInTerminal.command vi %f %l %c %W %H %x %y"); -#elif defined(Q_OS_UNIX) - m_d->m_externalEditor = QLatin1String("xterm -geom %Wx%H+%x+%y -e vi %f +%l +\"normal %c|\""); -#endif } EditorManager::~EditorManager() @@ -381,6 +374,20 @@ QSize EditorManager::minimumSizeHint() const return QSize(400, 300); } +QString EditorManager::defaultExternalEditor() const +{ +#ifdef Q_OS_MAC + return m_d->m_core->resourcePath() + +QLatin1String("/runInTerminal.command vi %f %l %c %W %H %x %y"); +#elif defined(Q_OS_UNIX) + return QLatin1String("xterm -geom %Wx%H+%x+%y -e vi %f +%l +\"normal %c|\""); +#elif defined (Q_OS_WIN) + return QLatin1String("notepad %f"); +#else + return QString(); +#endif +} + EditorSplitter *EditorManager::editorSplitter() const { return m_d->m_splitter; @@ -1153,7 +1160,7 @@ void EditorManager::updateActions() m_d->m_duplicateAction->setEnabled(curEditor != 0 && curEditor->duplicateSupported()); - m_d->m_openInExternalEditorAction->setEnabled(curEditor != 0 && !m_d->m_externalEditor.isEmpty()); + m_d->m_openInExternalEditorAction->setEnabled(curEditor != 0); } QList<IEditor*> EditorManager::openedEditors() const @@ -1364,7 +1371,7 @@ void EditorManager::saveSettings(QSettings *settings) m_d->m_splitter->saveSettings(settings); settings->setValue(QLatin1String("EditorManager/DocumentStates"), m_d->m_editorStates); - settings->setValue(QLatin1String("EditorManager/ExternalEditor"), + settings->setValue(QLatin1String("EditorManager/ExternalEditorCommand"), m_d->m_externalEditor); } @@ -1375,7 +1382,7 @@ void EditorManager::readSettings(QSettings *settings) m_d->m_editorStates = settings->value(QLatin1String("EditorManager/DocumentStates")) .value<QMap<QString, QVariant> >(); if (settings->contains(QLatin1String("EditorManager/ExternalEditor"))) - m_d->m_externalEditor = settings->value(QLatin1String("EditorManager/ExternalEditor")).toString(); + m_d->m_externalEditor = settings->value(QLatin1String("EditorManager/ExternalEditorCommand")).toString(); } QByteArray EditorManager::saveOpenEditorList() const @@ -1489,7 +1496,11 @@ QString EditorManager::externalEditorHelpText() const void EditorManager::openInExternalEditor() { - if (m_d->m_externalEditor.isEmpty()) + QString command = m_d->m_externalEditor; + if (command.isEmpty()) + command = defaultExternalEditor(); + + if (command.isEmpty()) return; IEditor *editor = currentEditor(); @@ -1508,7 +1519,7 @@ void EditorManager::openInExternalEditor() QFontMetrics fm(font); rect.moveTo(editor->widget()->mapToGlobal(QPoint(0,0))); - QString pre = m_d->m_externalEditor; + QString pre = command; QString cmd; for (int i = 0; i < pre.size(); ++i) { QChar c = pre.at(i); @@ -1551,11 +1562,16 @@ void EditorManager::openInExternalEditor() void EditorManager::setExternalEditor(const QString &editor) { - m_d->m_externalEditor = editor; + if (editor.isEmpty() || editor == defaultExternalEditor()) + m_d->m_externalEditor = defaultExternalEditor(); + else + m_d->m_externalEditor = editor; } QString EditorManager::externalEditor() const { + if (m_d->m_externalEditor.isEmpty()) + return defaultExternalEditor(); return m_d->m_externalEditor; } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 0a35ffcfaa926275aac9a8419472702bc40430ad..b71791f36bfaae03145b5eda8dd2804f48cfa1b2 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -156,6 +156,7 @@ public: void setExternalEditor(const QString &); QString externalEditor() const; + QString defaultExternalEditor() const; QString externalEditorHelpText() const; signals: diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 7b0aadc1b3ad41fac3c877b82269cf4caaeb008c..5edfda207e87ae8b856609a067ebfd917893c3b8 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -72,6 +72,8 @@ QWidget* GeneralSettings::createPage(QWidget *parent) connect(m_page->resetButton, SIGNAL(clicked()), this, SLOT(resetInterfaceColor())); + connect(m_page->resetEditorButton, SIGNAL(clicked()), + this, SLOT(resetExternalEditor())); connect(m_page->helpExternalEditorButton, SIGNAL(clicked()), this, SLOT(showHelpForExternalEditor())); @@ -95,6 +97,10 @@ void GeneralSettings::resetInterfaceColor() m_page->colorButton->setColor(0x666666); } +void GeneralSettings::resetExternalEditor() +{ + m_page->externalEditorEdit->setText(EditorManager::instance()->defaultExternalEditor()); +} void GeneralSettings::showHelpForExternalEditor() { diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h index 5d69e7cd64198e2272d9cb697a7e0d2ceb075913..3b6bbad33c3210254282fd6f90047da08152f155 100644 --- a/src/plugins/coreplugin/generalsettings.h +++ b/src/plugins/coreplugin/generalsettings.h @@ -59,6 +59,7 @@ public: private slots: void resetInterfaceColor(); + void resetExternalEditor(); void showHelpForExternalEditor(); private: diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index 1e5357d15475acef8ae3cfb68de0c7fab5d16ac3..316637e6a06da090124032ebbf02905c0a8800d8 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -108,6 +108,20 @@ <item> <widget class="QLineEdit" name="externalEditorEdit"/> </item> + <item> + <widget class="QToolButton" name="resetEditorButton"> + <property name="toolTip"> + <string>Reset to default</string> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="core.qrc"> + <normaloff>:/qworkbench/images/reset.png</normaloff>:/qworkbench/images/reset.png</iconset> + </property> + </widget> + </item> <item> <widget class="QToolButton" name="helpExternalEditorButton"> <property name="text"> diff --git a/src/plugins/cpptools/rpp/pp-engine.cpp b/src/plugins/cpptools/rpp/pp-engine.cpp index a061b2942a97141a11de81678ef00ab26f83a980..3a3e9245b30229a330fe9f3ea894eb5ec9a66b29 100644 --- a/src/plugins/cpptools/rpp/pp-engine.cpp +++ b/src/plugins/cpptools/rpp/pp-engine.cpp @@ -585,15 +585,19 @@ void pp::operator()(const QByteArray &source, QByteArray *result) } else { if (! m->function_like) { if (_dot->isNot(T_LPAREN)) { + m->hidden = true; expand(m->definition.constBegin(), m->definition.constEnd(), result); + m->hidden = false; continue; } else { QByteArray tmp; + m->hidden = true; expand(m->definition.constBegin(), m->definition.constEnd(), &tmp); + m->hidden = false; m = 0; // reset the active the macro @@ -636,7 +640,9 @@ void pp::operator()(const QByteArray &source, QByteArray *result) const char *beginOfText = startOfToken(*identifierToken); const char *endOfText = endOfToken(*_dot); ++_dot; // skip T_RPAREN + //m->hidden = true; expand(beginOfText, endOfText, result); + //m->hidden = false; } } } diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 04875e12fd5d20c13047afac43d8753bd64ceec6..f696d728467654a5df68124e060c28f030c97fcc 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -791,6 +791,11 @@ bool DebuggerManager::startNewDebugger(StartMode mode) m_processArgs = QStringList(); m_workingDir = QString(); m_attachedPID = dlg.attachPID(); + if (m_attachedPID == 0) { + QMessageBox::warning(mainWindow(), tr("Warning"), + tr("Cannot attach to PID 0")); + return false; + } } else if (startMode() == startInternal) { if (m_executable.isEmpty()) { QString startDirectory = m_executable; diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index bd1d564a60936ae1ecf5d4429587d93065a7d196..df0eaa9f0b293d0379236ebc67172daf095aba40 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1650,16 +1650,15 @@ bool GdbEngine::startDebugger() #ifdef Q_OS_MAC sendCommand("-gdb-set inferior-auto-start-cfm off"); sendCommand("-gdb-set sharedLibrary load-rules " - "dyld \".*libSystem.*\" " - "all dyld \".*libauto.*\" " - "all dyld \".*AppKit.*\" " - "all dyld \".*PBGDBIntrospectionSupport.*\" " - "all dyld \".*Foundation.*\" " - "all dyld \".*CFDataFormatters.*\" " - "all dyld \".*libobjc.*\" " - "all dyld \".*CarbonDataFormatters"); + "dyld \".*libSystem.*\" all " + "dyld \".*libauto.*\" all " + "dyld \".*AppKit.*\" all " + "dyld \".*PBGDBIntrospectionSupport.*\" all " + "dyld \".*Foundation.*\" all " + "dyld \".*CFDataFormatters.*\" all " + "dyld \".*libobjc.*\" all " + "dyld \".*CarbonDataFormatters.*\" all"); #endif - if (q->startMode() == q->attachExternal) { sendCommand("attach " + QString::number(q->m_attachedPID)); } diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 6b3eb20ad7f62e8b0e80a63cb62af625674da9bb..fb73d4fe5e2b41a2a750f4ab656d3966baab951c 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -170,7 +170,7 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &fileNam if (Git::Constants::debug) qDebug() << "diff" << workingDirectory << fileNames; QStringList arguments; - arguments << QLatin1String("diff") << fileNames; + arguments << QLatin1String("diff") << QLatin1String("--") << fileNames; const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND); const QString title = tr("Git Diff"); @@ -187,7 +187,7 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName) QStringList arguments; arguments << QLatin1String("diff"); if (!fileName.isEmpty()) - arguments << fileName; + arguments << QLatin1String("--") << fileName; const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND); 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) qDebug() << "blame" << workingDirectory << fileName; QStringList arguments(QLatin1String("blame")); - arguments << fileName; + arguments << QLatin1String("--") << fileName; const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND); const QString title = tr("Git Blame %1").arg(fileName); @@ -314,7 +314,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory, QByteArray outputText; QByteArray errorText; QStringList arguments; - arguments << QLatin1String("reset") << QLatin1String("HEAD") << files; + arguments << QLatin1String("reset") << QLatin1String("HEAD") << QLatin1String("--") << files; const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText); const QString output = QString::fromLocal8Bit(outputText); m_plugin->m_outputWindow->popup(false); @@ -643,9 +643,9 @@ GitCommand::~GitCommand() { } -void GitCommand::execute(const QStringList &arguments - , const QString &workingDirectory - , const ProjectExplorer::Environment &environment) +void GitCommand::execute(const QStringList &arguments, + const QString &workingDirectory, + const ProjectExplorer::Environment &environment) { if (Git::Constants::debug) qDebug() << "GitCommand::execute" << workingDirectory << arguments; @@ -663,9 +663,9 @@ void GitCommand::execute(const QStringList &arguments , Core::ProgressManagerInterface::CloseOnSuccess); } -void GitCommand::run(const QStringList &arguments - , const QString &workingDirectory - , const ProjectExplorer::Environment &environment) +void GitCommand::run(const QStringList &arguments, + const QString &workingDirectory, + const ProjectExplorer::Environment &environment) { if (Git::Constants::debug) qDebug() << "GitCommand::run" << workingDirectory << arguments; diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index 5d5cb0a2ef3e2134c16a88ce941ce62b7a1f9130..e9110f8fbeb01bb004e511f5b3d9ef5543371e33 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -57,9 +57,9 @@ GitSubmitEditorPanelData GitSubmitEditorWidget::panelData() const rc.author = m_gitSubmitPanelUi.authorLineEdit->text(); rc.email = m_gitSubmitPanelUi.emailLineEdit->text(); return rc; -}; +} -void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data) +void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data) { m_gitSubmitPanelUi.authorLineEdit->setText(data.author); m_gitSubmitPanelUi.emailLineEdit->setText(data.email); diff --git a/src/plugins/git/gitsubmitpanel.ui b/src/plugins/git/gitsubmitpanel.ui index d408eeab11d23e9a708817fb00f415faa74ca186..aba46b7c52542d09f7ba027fc21571f5bfa5c9a0 100644 --- a/src/plugins/git/gitsubmitpanel.ui +++ b/src/plugins/git/gitsubmitpanel.ui @@ -11,6 +11,9 @@ </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="margin"> + <number>0</number> + </property> <item> <widget class="QGroupBox" name="infoGroup"> <property name="title"> diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f403ef2b57d22fdb4cbcae06ad4845bfe3b12e4 --- /dev/null +++ b/src/plugins/git/gitversioncontrol.cpp @@ -0,0 +1,104 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.2, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "gitversioncontrol.h" +#include "gitclient.h" + +namespace Git { +namespace Internal { + +GitVersionControl::GitVersionControl(GitClient *client) : + m_enabled(true), + m_client(client) +{ +} + +QString GitVersionControl::name() const +{ + return QLatin1String("git"); +} + +bool GitVersionControl::isEnabled() const +{ + return m_enabled; +} + +void GitVersionControl::setEnabled(bool enabled) +{ + if (m_enabled != enabled) { + m_enabled = enabled; + emit enabledChanged(m_enabled); + } +} + +bool GitVersionControl::supportsOperation(Operation operation) const +{ + bool rc = false; + switch (operation) { + case AddOperation: + case DeleteOperation: + case OpenOperation: + break; + } + return rc; +} + +bool GitVersionControl::vcsOpen(const QString & /*fileName*/) +{ + return false; +} + +bool GitVersionControl::vcsAdd(const QString & /*fileName*/) +{ + return false; +} + +bool GitVersionControl::vcsDelete(const QString & /*fileName*/) +{ + // TODO: implement using 'git rm'. + return false; +} + +bool GitVersionControl::managesDirectory(const QString &directory) const +{ + return !GitClient::findRepositoryForDirectory(directory).isEmpty(); + +} + +QString GitVersionControl::findTopLevelForDirectory(const QString &directory) const +{ + return GitClient::findRepositoryForDirectory(directory); +} + +} // Internal +} // Git diff --git a/src/plugins/git/gitversioncontrol.h b/src/plugins/git/gitversioncontrol.h new file mode 100644 index 0000000000000000000000000000000000000000..e12e7736713c9a6b5ed100cef2b1fd705680d3c8 --- /dev/null +++ b/src/plugins/git/gitversioncontrol.h @@ -0,0 +1,75 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.2, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#ifndef GITVERSIONCONTROL_H +#define GITVERSIONCONTROL_H + +#include <coreplugin/iversioncontrol.h> + +namespace Git { +namespace Internal { + +class GitClient; + +// Just a proxy for GitPlugin +class GitVersionControl : public Core::IVersionControl +{ + Q_OBJECT +public: + explicit GitVersionControl(GitClient *plugin); + + virtual QString name() const; + + virtual bool isEnabled() const; + virtual void setEnabled(bool enabled); + + bool managesDirectory(const QString &directory) const; + virtual QString findTopLevelForDirectory(const QString &directory) const; + + virtual bool supportsOperation(Operation operation) const; + virtual bool vcsOpen(const QString &fileName); + virtual bool vcsAdd(const QString &fileName); + virtual bool vcsDelete(const QString &filename); + +signals: + void enabledChanged(bool); + +private: + bool m_enabled; + GitClient *m_client; +}; + +} // Internal +} // Git + +#endif // GITVERSIONCONTROL_H diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e04553763a36e1194fc9a2cffd5dc707afa6486e..1a9c24b994d3e11fa49d01769068d000309d8e81 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -685,28 +685,19 @@ void ProjectExplorerPlugin::loadAction() updateActions(); } -bool ProjectExplorerPlugin::saveAction(Project *pro) +void ProjectExplorerPlugin::unloadProject() { if (debug) - qDebug() << "ProjectExplorerPlugin::saveAction"; - - if (!pro) - pro = m_currentProject; - Q_ASSERT(pro); - - Core::IFile *fi = pro->file(); + qDebug() << "ProjectExplorerPlugin::unloadProject"; - if (!fi) // TODO Why saving the session here???? - fi = m_session->file(); + Core::IFile *fi = m_currentProject->file(); if (!fi || fi->fileName().isEmpty()) //nothing to save? - return false; + return; QList<Core::IFile*> filesToSave; - filesToSave << fi; - if (pro) - filesToSave << pro->dependencies(); + filesToSave << m_currentProject->dependencies(); // check the number of modified files int readonlycount = 0; @@ -721,20 +712,10 @@ bool ProjectExplorerPlugin::saveAction(Project *pro) else success = m_core->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty(); - if (success) - addToRecentProjects(fi->fileName()); - updateActions(); - return success; -} - -void ProjectExplorerPlugin::unloadProject() -{ - if (debug) - qDebug() << "ProjectExplorerPlugin::unloadProject"; - - if (!saveAction(m_currentProject)) + if (!success) return; + addToRecentProjects(fi->fileName()); m_session->removeProject(m_currentProject); updateActions(); } diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 039def13052347ccb61ab58c3f14cca361224902..6a7f4beb83119b92c5756cd744430a9c720b2b9c 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -139,7 +139,6 @@ private slots: void cancelBuild(); void debugProject(); void editDependencies(); - bool saveAction(ProjectExplorer::Project *pro = 0); void loadAction(); void unloadProject(); void clearSession(); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 61ca7df05a9a705c0cb84867e9810a44ba2d6ecf..876b8294a377c0ca72f49d88e2823ca8309acd2c 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -939,6 +939,7 @@ void SessionManager::removeProjects(QList<Project *> remove) // Delete projects foreach (Project *pro, remove) { + pro->saveSettings(); m_file->m_projects.removeOne(pro); if (pro == m_file->m_startupProject) diff --git a/src/plugins/qt4projectmanager/profilereader.cpp b/src/plugins/qt4projectmanager/profilereader.cpp index 0618fe6c730b2afc802ae1222026c9b79c9fe0e0..0e7dd7ece2ad88e1a746a037e4475c9c0bae0e66 100644 --- a/src/plugins/qt4projectmanager/profilereader.cpp +++ b/src/plugins/qt4projectmanager/profilereader.cpp @@ -69,7 +69,7 @@ bool ProFileReader::readProFile(const QString &fileName) // return false; // } // } - QString fn = QFileInfo(fileName).filePath(); + QString fn = QFileInfo(fileName).filePath(); ProFile *pro = new ProFile(fn); if (!queryProFile(pro)) { delete pro; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 34abb9316986a26a1a236878feabc3175048ae12..672ce8b835b9077fd5ae28c743231979b39b1304 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -33,7 +33,6 @@ #include "proeditormodel.h" -#include "profilecache.h" #include "profilereader.h" #include "prowriter.h" #include "qt4nodes.h" @@ -884,12 +883,12 @@ QStringList Qt4ProFileNode::subDirsPaths(ProFileReader *reader) const QString realFile; const QString subDirKey = subDirVar + QLatin1String(".subdir"); if (reader->contains(subDirKey)) - realDir = reader->value(subDirKey); + realDir = QFileInfo(reader->value(subDirKey)).filePath(); else realDir = subDirVar; QFileInfo info(realDir); if (!info.isAbsolute()) - realDir = QString("%1/%2").arg(m_projectDir, realDir); + realDir = m_projectDir + "/" + realDir; #ifdef QTEXTENDED_QBUILD_SUPPORT // QBuild only uses project files named qbuild.pro, and subdirs are implied diff --git a/src/plugins/vcsbase/baseannotationhighlighter.cpp b/src/plugins/vcsbase/baseannotationhighlighter.cpp index 5b02bc9ea1ab8765c5b5e06faa577c934dbc700f..167c1d7d31b2d2d5d1c1b431a9042e3aa2429da2 100644 --- a/src/plugins/vcsbase/baseannotationhighlighter.cpp +++ b/src/plugins/vcsbase/baseannotationhighlighter.cpp @@ -69,7 +69,7 @@ void BaseAnnotationHighlighter::setChangeNumbers(const ChangeNumbers &changeNumb // Assign a color gradient to annotation change numbers. Give // each change number a unique color. const double oneThird = 1.0 / 3.0; - const int step = qRound(ceil(pow(changeNumbers.count(), oneThird))); + const int step = qRound(ceil(pow(double(changeNumbers.count()), oneThird))); QList<QColor> colors; const int factor = 255 / step; for (int i=0; i<step; ++i) diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 3ac864f9ab4a690147e052f5fdcced70362b21a1..6152a93b795c0925cb64ee60609de3a1d0f61213 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -240,7 +240,7 @@ bool VCSBaseSubmitEditor::restoreState(const QByteArray &/*state*/) return true; } -QStringList VCSBaseSubmitEditor::checkedFiles() const +QStringList VCSBaseSubmitEditor::checkedFiles() const { 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); } -void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList) +void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList) { emit diffSelectedFiles(vcsFileListToFileList(rawList)); } @@ -299,4 +299,4 @@ QIcon VCSBaseSubmitEditor::submitIcon() return QIcon(QLatin1String(":/vcsbase/images/submit.png")); } -} +} // namespace VCSBase diff --git a/src/qworkbench.pri b/src/qworkbench.pri index d7ac4f34c5a1c366ec055213f6b3a0afbd49c81e..e869ce452a8aba19d28d009046cb44a32833adf4 100644 --- a/src/qworkbench.pri +++ b/src/qworkbench.pri @@ -39,3 +39,14 @@ DEPENDPATH += \ $$IDE_SOURCE_TREE/tools \ LIBS += -L$$IDE_LIBRARY_PATH + +unix { + debug:OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared + release:OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared + + debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared + release:MOC_DIR = $${OUT_PWD}/.moc/release-shared + + RCC_DIR = $${OUT_PWD}/.rcc/ + UI_DIR = $${OUT_PWD}/.uic/ +} diff --git a/src/qworkbenchplugin.pri b/src/qworkbenchplugin.pri index 50b667fc716693f2cab12627096107adde35f60d..e598570259aa4612c73f69e4a48ad7a14495139d 100644 --- a/src/qworkbenchplugin.pri +++ b/src/qworkbenchplugin.pri @@ -47,11 +47,4 @@ macx { } -unix { - OBJECTS_DIR = $${OUT_PWD}/.obj/ - MOC_DIR = $${OUT_PWD}/.moc/ - RCC_DIR = $${OUT_PWD}/.rcc/ - UI_DIR = $${OUT_PWD}/.uic/ -} - contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols diff --git a/tests/manual/cplusplus/c++ b/tests/manual/cplusplus/c++ new file mode 100755 index 0000000000000000000000000000000000000000..f4cbb4fe5ca94388a0321b00ea72c0c19be583bf --- /dev/null +++ b/tests/manual/cplusplus/c++ @@ -0,0 +1,3 @@ +#!/bin/sh +me=$(dirname $0) +${CPP-gcc} -xc++ -E -include $me/conf.c++ $* | $me/cplusplus0 diff --git a/tests/manual/cplusplus/conf.c++ b/tests/manual/cplusplus/conf.c++ new file mode 100644 index 0000000000000000000000000000000000000000..fbfad57a4bc2157303aac6103ef7e15ca056e1d5 --- /dev/null +++ b/tests/manual/cplusplus/conf.c++ @@ -0,0 +1,7 @@ +#define __extension__ +#define __context__ +#define __range__ +#define __asm(a...) +#define __asm__(a...) +#define restrict +#define __restrict diff --git a/tests/manual/cplusplus/cplusplus.pro b/tests/manual/cplusplus/cplusplus.pro new file mode 100644 index 0000000000000000000000000000000000000000..0d965b8ed0aea1f4eaf8a05cefda58e9ae033dad --- /dev/null +++ b/tests/manual/cplusplus/cplusplus.pro @@ -0,0 +1,19 @@ +QT = core +macx:CONFIG -= app_bundle +TARGET = cplusplus0 + +include(../../../shared/cplusplus/cplusplus.pri) + +# Input +SOURCES += main.cpp + +unix { + debug:OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared + release:OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared + + debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared + release:MOC_DIR = $${OUT_PWD}/.moc/release-shared + + RCC_DIR = $${OUT_PWD}/.rcc/ + UI_DIR = $${OUT_PWD}/.uic/ +} diff --git a/tests/manual/cplusplus/main.cpp b/tests/manual/cplusplus/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..234c9684a394c06e6f4b2f852af9ff1ae6de5851 --- /dev/null +++ b/tests/manual/cplusplus/main.cpp @@ -0,0 +1,71 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.2, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include <QFile> + +#include <cstdio> +#include <cstdlib> + +#include <TranslationUnit.h> +#include <Control.h> +#include <AST.h> +#include <Semantic.h> +#include <Scope.h> + +int main(int, char *[]) +{ + Control control; + StringLiteral *fileId = control.findOrInsertFileName("<stdin>"); + + QFile in; + if (! in.open(stdin, QFile::ReadOnly)) + return EXIT_FAILURE; + + const QByteArray source = in.readAll(); + + TranslationUnit unit(&control, fileId); + unit.setSource(source.constData(), source.size()); + unit.parse(); + if (unit.ast()) { + TranslationUnitAST *ast = unit.ast()->asTranslationUnit(); + Q_ASSERT(ast != 0); + + Scope globalScope; + Semantic sem(&control); + for (DeclarationAST *decl = ast->declarations; decl; decl = decl->next) { + sem.check(decl, &globalScope); + } + } + + return EXIT_SUCCESS; +}