From ef39553502d9380eebf494a1de48b9bfa32c5df4 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 7 Oct 2009 12:12:59 +0200 Subject: [PATCH 1/8] Regenerated the JS parser to incorporate a bug fix. Reviewed-by: Roberto Raggi --- src/plugins/qtscripteditor/parser/cmd.sed | 16 ------ src/plugins/qtscripteditor/parser/gen.sh | 49 ------------------- .../parser/javascriptgrammar.cpp | 41 ++++++++++++++++ .../parser/javascriptgrammar_p.h | 36 ++++++++++++-- .../parser/javascriptparser.cpp | 2 +- 5 files changed, 74 insertions(+), 70 deletions(-) delete mode 100644 src/plugins/qtscripteditor/parser/cmd.sed delete mode 100644 src/plugins/qtscripteditor/parser/gen.sh diff --git a/src/plugins/qtscripteditor/parser/cmd.sed b/src/plugins/qtscripteditor/parser/cmd.sed deleted file mode 100644 index d9ffe43a9fd..00000000000 --- a/src/plugins/qtscripteditor/parser/cmd.sed +++ /dev/null @@ -1,16 +0,0 @@ -s/#include "qscriptcontext_p.h"//g -s/#include "qscriptcontext.h"//g -s/#include "qscriptengine.h"//g -s/#include "qscriptmember_p.h"//g -s/#include "qscriptobject_p.h"//g -s/#include "qscriptvalueimpl_p.h"//g - -s/#ifndef QT_NO_SCRIPT//g -s,#endif // QT_NO_SCRIPT,,g - -s/QScript/JavaScript/g -s/QSCRIPT/JAVASCRIPT/g -s/qscript/javascript/g -s/Q_SCRIPT/J_SCRIPT/g - -s/qsreal/qjsreal/g \ No newline at end of file diff --git a/src/plugins/qtscripteditor/parser/gen.sh b/src/plugins/qtscripteditor/parser/gen.sh deleted file mode 100644 index cc4054e06ad..00000000000 --- a/src/plugins/qtscripteditor/parser/gen.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -me=$(dirname $0) - -rm -f javascript.g -rm -f javascriptast.cpp -rm -f javascriptast_p.h -rm -f javascriptastfwd_p.h -rm -f javascriptastvisitor.cpp -rm -f javascriptastvisitor_p.h -rm -f javascriptlexer.cpp -rm -f javascriptlexer_p.h -rm -f javascriptmemorypool_p.h -rm -f javascriptnodepool_p.h - -rm -f javascriptgrammar_p.h -rm -f javascriptgrammar.cpp -rm -f javascriptparser_p.h -rm -f javascriptparser.cpp - -sed -f $me/cmd.sed $QTDIR/src/script/qscript.g > javascript.g - -sed -f $me/cmd.sed $QTDIR/src/script/qscriptast.cpp > javascriptast.cpp -sed -f $me/cmd.sed $QTDIR/src/script/qscriptast_p.h > javascriptast_p.h -sed -f $me/cmd.sed $QTDIR/src/script/qscriptastfwd_p.h > javascriptastfwd_p.h -sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor.cpp > javascriptastvisitor.cpp -sed -f $me/cmd.sed $QTDIR/src/script/qscriptastvisitor_p.h > javascriptastvisitor_p.h -sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer_p.h > javascriptlexer_p.h -sed -f $me/cmd.sed $QTDIR/src/script/qscriptlexer.cpp > javascriptlexer.cpp -sed -f $me/cmd.sed $QTDIR/src/script/qscriptmemorypool_p.h > javascriptmemorypool_p.h -sed -f $me/cmd.sed $QTDIR/src/script/qscriptnodepool_p.h > javascriptnodepool_p.h - -qlalr --troll --no-lines --no-debug $me/javascript.g - -chmod ugo-w javascript.g -chmod ugo-w javascriptast.cpp -chmod ugo-w javascriptast_p.h -chmod ugo-w javascriptastfwd_p.h -chmod ugo-w javascriptastvisitor.cpp -chmod ugo-w javascriptastvisitor_p.h -chmod ugo-w javascriptlexer_p.h -chmod ugo-w javascriptlexer.cpp -chmod ugo-w javascriptmemorypool_p.h -chmod ugo-w javascriptnodepool_p.h - -chmod ugo-w javascriptgrammar_p.h -chmod ugo-w javascriptgrammar.cpp -chmod ugo-w javascriptparser_p.h -chmod ugo-w javascriptparser.cpp diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp index 1c46c75562f..aaa8cd092b5 100644 --- a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp +++ b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp @@ -1,4 +1,45 @@ // This file was generated by qlalr - DO NOT EDIT! +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "javascriptgrammar_p.h" const char *const JavaScriptGrammar::spell [] = { diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h index 8e62d4abd06..3126ed08cf1 100644 --- a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h +++ b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h @@ -2,13 +2,41 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/qtscripteditor/parser/javascriptparser.cpp b/src/plugins/qtscripteditor/parser/javascriptparser.cpp index 66acc68e6b1..b63a9fbe93a 100644 --- a/src/plugins/qtscripteditor/parser/javascriptparser.cpp +++ b/src/plugins/qtscripteditor/parser/javascriptparser.cpp @@ -1122,7 +1122,7 @@ case 266: { token_buffer[1].dval = yylval = lexer->dval(); token_buffer[1].loc = yylloc = location(lexer); - if (t_action(errorState, yytoken)) { + if (token_buffer[0].token != -1 && t_action(errorState, yytoken)) { QString msg = QString::fromUtf8("Removed token"); if (const char *tokenSpell = spell[token_buffer[0].token]) { msg += QLatin1String(": `"); From e2e9c773231ced6419dacc5edce273bf55912932 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 7 Oct 2009 12:17:59 +0200 Subject: [PATCH 2/8] Fix tip to be true on Mac OS X. Reviewed-By: con --- .../gettingstartedwelcomepagewidget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp index d0417fe0d51..dca4ab11936 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp @@ -215,6 +215,15 @@ QStringList GettingStartedWelcomePageWidget::tipsOfTheDay() #else tr("Alt", "Shortcut key"); #endif + + QString ctrlShortcut = +#ifdef Q_WS_MAC + tr("Cmd", "Shortcut key"); +#else + tr("Ctrl", "Shortcut key"); +#endif + + tips.append(tr("You can switch between Qt Creator's modes using Ctrl+number:")); @@ -236,7 +245,7 @@ QStringList GettingStartedWelcomePageWidget::tipsOfTheDay() "").arg(altShortcut)); tips.append(tr("You can quickly search methods, classes, help and more using the " - "Locator bar (Ctrl+K).")); + "Locator bar (%1+K).").arg(ctrlShortcut)); tips.append(tr("You can add custom build steps in the " "build settings.")); tips.append(tr("Within a session, you can add " From 1fb8f60e03a267941822eb96ab8e6faedc6036f1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 7 Oct 2009 13:36:48 +0200 Subject: [PATCH 3/8] Debugger: Fix crash toggling Stack/"Derefence Pointers" without project Enable debugger actions correctly. Reviewed-by: hjk --- src/plugins/debugger/breakwindow.cpp | 2 ++ src/plugins/debugger/debuggermanager.cpp | 40 ++++++++++++++++++++++ src/plugins/debugger/debuggermanager.h | 2 ++ src/plugins/debugger/moduleswindow.cpp | 8 +++-- src/plugins/debugger/registerwindow.cpp | 1 + src/plugins/debugger/sourcefileswindow.cpp | 2 ++ src/plugins/debugger/stackhandler.cpp | 1 + src/plugins/debugger/stackwindow.cpp | 5 +-- src/plugins/debugger/watchwindow.cpp | 11 +++--- 9 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 46dc6faac71..b0edd855459 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -30,6 +30,7 @@ #include "breakwindow.h" #include "debuggeractions.h" +#include "debuggermanager.h" #include "ui_breakcondition.h" #include "ui_breakbyfunction.h" @@ -179,6 +180,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) editConditionAction->setEnabled(si.size() > 0); QAction *synchronizeAction = new QAction(tr("Synchronize breakpoints"), &menu); + synchronizeAction->setEnabled(Debugger::DebuggerManager::instance()->debuggerActionsEnabled()); QModelIndex idx0 = (si.size() ? si.front() : QModelIndex()); QModelIndex idx2 = idx0.sibling(idx0.row(), 2); diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index a90d143f9dd..7d96912c8a8 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1684,11 +1684,51 @@ void DebuggerManager::setState(DebuggerState state) d->m_actions.runToFunctionAction->setEnabled(stopped); d->m_actions.jumpToLineAction->setEnabled(stopped); d->m_actions.nextAction->setEnabled(stopped); + + const bool actionsEnabled = debuggerActionsEnabled(); + theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled); + theDebuggerAction(AutoDerefPointers)->setEnabled(actionsEnabled && d->m_engine->isGdbEngine()); + theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled); + theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady); + emit stateChanged(d->m_state); const bool notbusy = state == InferiorStopped || state == DebuggerNotReady || state == InferiorUnrunnable; setBusyCursor(!notbusy); + +} + +bool DebuggerManager::debuggerActionsEnabled() const +{ + if (!d->m_engine) + return false; + switch (state()) { + case InferiorPrepared: + case InferiorStarting: + case InferiorRunningRequested: + case InferiorRunning: + case InferiorUnrunnable: + case InferiorStopping: + case InferiorStopped: + return true; + case DebuggerNotReady: + case EngineStarting: + case AdapterStarting: + case AdapterStarted: + case AdapterStartFailed: + case InferiorPreparing: + case InferiorPreparationFailed: + case InferiorStartFailed: + case InferiorStopFailed: + case InferiorShuttingDown: + case InferiorShutDown: + case InferiorShutdownFailed: + case AdapterShuttingDown: + case AdapterShutdownFailed: + break; + } + return false; } QDebug operator<<(QDebug d, DebuggerState state) diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 7579ebd7227..ee7f439ba98 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -175,6 +175,8 @@ public: void showMessageBox(int icon, const QString &title, const QString &text); + bool debuggerActionsEnabled() const; + static DebuggerManager *instance(); public slots: diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp index f5d48db0882..6d46dda03c5 100644 --- a/src/plugins/debugger/moduleswindow.cpp +++ b/src/plugins/debugger/moduleswindow.cpp @@ -105,11 +105,15 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) if (index.isValid()) name = model()->data(index).toString(); + QMenu menu; + const bool enabled = Debugger::DebuggerManager::instance()->debuggerActionsEnabled(); QAction *act0 = new QAction(tr("Update module list"), &menu); - QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name), - &menu); + act0->setEnabled(enabled); + QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name), &menu); + act3->setEnabled(enabled); QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu); + act4->setEnabled(enabled); QAction *act5 = 0; QAction *act6 = 0; QAction *act7 = 0; diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp index 3bc52f29456..ddaedbd808c 100644 --- a/src/plugins/debugger/registerwindow.cpp +++ b/src/plugins/debugger/registerwindow.cpp @@ -177,6 +177,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev) } else { actShowMemory->setText(tr("Open memory editor at %1").arg(address)); } + actShowMemory->setEnabled(m_manager->debuggerActionsEnabled()); menu.addSeparator(); int base = model()->data(QModelIndex(), RegisterNumberBaseRole).toInt(); diff --git a/src/plugins/debugger/sourcefileswindow.cpp b/src/plugins/debugger/sourcefileswindow.cpp index 5a9f5b5151d..52341c62852 100644 --- a/src/plugins/debugger/sourcefileswindow.cpp +++ b/src/plugins/debugger/sourcefileswindow.cpp @@ -29,6 +29,7 @@ #include "sourcefileswindow.h" #include "debuggeractions.h" +#include "debuggermanager.h" #include #include @@ -199,6 +200,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev) QMenu menu; QAction *act1 = new QAction(tr("Reload data"), &menu); + act1->setEnabled(Debugger::DebuggerManager::instance()->debuggerActionsEnabled()); //act1->setCheckable(true); QAction *act2 = 0; if (name.isEmpty()) { diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index a12367df9a4..2d9cbea92d7 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -240,6 +240,7 @@ bool StackHandler::isDebuggingDebuggingHelpers() const ThreadData::ThreadData(int threadId) : id(threadId), + address(0), line(-1) { } diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp index d854a5edaf6..910f69ea35c 100644 --- a/src/plugins/debugger/stackwindow.cpp +++ b/src/plugins/debugger/stackwindow.cpp @@ -102,7 +102,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev) actShowMemory->setEnabled(false); } else { actShowMemory->setText(tr("Open memory editor at %1").arg(address)); - } + } QAction *actShowDisassembler = menu.addAction(QString()); if (address.isEmpty()) { @@ -113,8 +113,9 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev) } menu.addSeparator(); - +#if 0 // @TODO: not implemented menu.addAction(theDebuggerAction(UseToolTipsInStackView)); +#endif menu.addAction(theDebuggerAction(UseAddressInStackView)); QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index f40bb93085d..db3f33057b7 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -245,16 +245,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) } QMenu menu; - //QAction *actWatchExpressionInWindow - // = theDebuggerAction(WatchExpressionInWindow); - //menu.addAction(actWatchExpressionInWindow); QAction *actInsertNewWatchItem = menu.addAction(tr("Insert new watch item")); QAction *actSelectWidgetToWatch = menu.addAction(tr("Select widget to watch")); const QString address = model()->data(mi0, AddressRole).toString(); QAction *actWatchKnownMemory = 0; - QAction *actWatchUnknownMemory = new QAction(tr("Open memory editor..."), &menu);; + QAction *actWatchUnknownMemory = new QAction(tr("Open memory editor..."), &menu); + actWatchUnknownMemory->setEnabled(m_manager->debuggerActionsEnabled()); + if (!address.isEmpty()) actWatchKnownMemory = new QAction(tr("Open memory editor at %1").arg(address), &menu); menu.addSeparator(); @@ -270,6 +269,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(actWatchKnownMemory); menu.addAction(actWatchUnknownMemory); menu.addSeparator(); + menu.addAction(theDebuggerAction(RecheckDebuggingHelpers)); menu.addAction(theDebuggerAction(UseDebuggingHelpers)); @@ -277,8 +277,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(theDebuggerAction(UseToolTipsInLocalsView)); menu.addAction(theDebuggerAction(AutoDerefPointers)); - theDebuggerAction(AutoDerefPointers)-> - setEnabled(m_manager->currentEngine()->isGdbEngine()); + QAction *actAdjustColumnWidths = menu.addAction(tr("Adjust column widths to contents")); QAction *actAlwaysAdjustColumnWidth = From 07f05c8ef09af53e2fdbe4a46823396aecab5f39 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 7 Oct 2009 13:51:40 +0200 Subject: [PATCH 4/8] Changelog 1.3.0 --- dist/changes-1.3.0 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/changes-1.3.0 b/dist/changes-1.3.0 index 28dfc6927c9..578ce887b70 100644 --- a/dist/changes-1.3.0 +++ b/dist/changes-1.3.0 @@ -64,19 +64,25 @@ Debugging * CDB: Added more types to the dumpers (QSharedPointer, QVector, common QMap/QSet types), dereference reference and pointer parameters * CDB: Simplified display of STL types in the locals window - * CDB: Fixed thread handling + * CDB: Fixed thread handling, display thread position * CDB: Added internal dumpers for string types for debuggee crashes + * CDB: Set symbol paths correctly * Improved QObject dumping, print out QRect/QSize, enumerations and flags * Made it possible to use the BinEditor plugin for displaying raw memory * Replace disassembler window by a real text editor enabling "mixed" output + * Improved dumper building on options page, run in background Designer * Added support for rearranging and floating form editor tools Version control plugins * Added CVS support + * Display diff/annotation with correct encoding * Added "sync" menu item to the Perforce plugin - + * Fixed locking of temporary submit message files on Windows + * Use a single, colored output pane for all version control systems + * Position annotation view of file at current line of editor + Wizards * Fixed GUI project and form class wizards to use the same settings. * Added version control checkout wizards From 77aa3064783d64cc7d028772a59f13e5f0cd4780 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 7 Oct 2009 13:56:59 +0200 Subject: [PATCH 5/8] Removed the MacroResolver Unfortunately, the MacroResolver does not scale and we get pretty bad performances when parsing big projects. --- src/libs/cplusplus/FastPreprocessor.cpp | 49 ------------------- src/libs/cplusplus/FastPreprocessor.h | 16 ------ src/plugins/cppeditor/cppeditor.cpp | 4 -- src/plugins/cpptools/cppfindreferences.cpp | 8 +-- .../cplusplus/CPlusPlusForwardDeclarations.h | 1 - src/shared/cplusplus/Control.cpp | 15 +----- src/shared/cplusplus/Control.h | 15 ------ src/shared/cplusplus/Parser.cpp | 12 ----- src/shared/cplusplus/Parser.h | 2 - 9 files changed, 3 insertions(+), 119 deletions(-) diff --git a/src/libs/cplusplus/FastPreprocessor.cpp b/src/libs/cplusplus/FastPreprocessor.cpp index 4a4c10d732b..b61f61cee76 100644 --- a/src/libs/cplusplus/FastPreprocessor.cpp +++ b/src/libs/cplusplus/FastPreprocessor.cpp @@ -34,55 +34,6 @@ using namespace CPlusPlus; -FastMacroResolver::FastMacroResolver(TranslationUnit *unit, const Snapshot &snapshot) - : _unit(unit), _snapshot(snapshot) -{ - const QString fileName = QString::fromUtf8(unit->fileName(), unit->fileNameLength()); - - QSet processed; - updateCache(fileName, &processed); -} - -bool FastMacroResolver::isMacro(TranslationUnit *unit, unsigned tokenIndex) const -{ - if (unit != _unit){ - qWarning() << Q_FUNC_INFO << "unexpected translation unit:" << unit->fileName(); - return false; - } - - const Token &tk = unit->tokenAt(tokenIndex); - if (tk.isNot(T_IDENTIFIER)) - return false; - - Identifier *id = tk.identifier; - const QByteArray macroName = QByteArray::fromRawData(id->chars(), id->size()); - return _cachedMacros.contains(macroName); -} - -void FastMacroResolver::updateCache(const QString &fileName, QSet *processed) -{ - if (processed->contains(fileName)) - return; - - processed->insert(fileName); - - if (Document::Ptr doc = _snapshot.value(fileName)) { - const QList definedMacros = doc->definedMacros(); - - for (int i = definedMacros.size() - 1; i != -1; --i) { - const Macro ¯o = definedMacros.at(i); - - if (macro.isHidden()) - _cachedMacros.remove(macro.name()); - else - _cachedMacros.insert(macro.name()); - } - - foreach (const Document::Include &incl, doc->includes()) - updateCache(incl.fileName(), processed); - } -} - FastPreprocessor::FastPreprocessor(const Snapshot &snapshot) : _snapshot(snapshot), _preproc(this, &_env) diff --git a/src/libs/cplusplus/FastPreprocessor.h b/src/libs/cplusplus/FastPreprocessor.h index 83d1bb257fd..ebbc8d17525 100644 --- a/src/libs/cplusplus/FastPreprocessor.h +++ b/src/libs/cplusplus/FastPreprocessor.h @@ -41,22 +41,6 @@ namespace CPlusPlus { -class CPLUSPLUS_EXPORT FastMacroResolver: public MacroResolver -{ -public: - FastMacroResolver(TranslationUnit *unit, const Snapshot &snapshot); - - virtual bool isMacro(TranslationUnit *unit, unsigned tokenIndex) const; - -private: - void updateCache(const QString &fileName, QSet *processed); - -private: - TranslationUnit *_unit; - Snapshot _snapshot; - QSet _cachedMacros; -}; - class CPLUSPLUS_EXPORT FastPreprocessor: public Client { Environment _env; diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index d048f6dee95..13228855f90 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -2090,11 +2090,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) snapshot = source.snapshot; doc = source.snapshot.documentFromSource(preprocessedCode, source.fileName); - - FastMacroResolver fastMacroResolver(doc->translationUnit(), snapshot); - doc->control()->setMacroResolver(&fastMacroResolver); doc->check(); - doc->control()->setMacroResolver(0); } Control *control = doc->control(); diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 6d9b9f8d0e6..26f9a18696b 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -531,13 +531,7 @@ static void find_helper(QFutureInterface &future, if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) { QTime tm; tm.start(); - TranslationUnit *unit = doc->translationUnit(); - Control *control = doc->control(); - - FastMacroResolver fastMacroResolver(unit, snapshot); - control->setMacroResolver(&fastMacroResolver); doc->parse(); - control->setMacroResolver(0); //qDebug() << "***" << unit->fileName() << "parsed in:" << tm.elapsed(); @@ -548,6 +542,8 @@ static void find_helper(QFutureInterface &future, tm.start(); Process process(doc, snapshot, &future); + + TranslationUnit *unit = doc->translationUnit(); process(symbol, id, unit->ast()); //qDebug() << "***" << unit->fileName() << "processed in:" << tm.elapsed(); diff --git a/src/shared/cplusplus/CPlusPlusForwardDeclarations.h b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h index 2467d4c56b0..b060f11dfa5 100644 --- a/src/shared/cplusplus/CPlusPlusForwardDeclarations.h +++ b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h @@ -83,7 +83,6 @@ class Semantic; class Control; class MemoryPool; class DiagnosticClient; -class MacroResolver; class Identifier; class Literal; diff --git a/src/shared/cplusplus/Control.cpp b/src/shared/cplusplus/Control.cpp index 6338d99fd22..30c5552bbe8 100644 --- a/src/shared/cplusplus/Control.cpp +++ b/src/shared/cplusplus/Control.cpp @@ -59,11 +59,6 @@ CPLUSPLUS_BEGIN_NAMESPACE -MacroResolver::MacroResolver() -{ } - -MacroResolver::~MacroResolver() -{ } template static void delete_map_entries(_Iterator first, _Iterator last) @@ -93,8 +88,7 @@ public: Data(Control *control) : control(control), translationUnit(0), - diagnosticClient(0), - macroResolver(0) + diagnosticClient(0) { } ~Data() @@ -539,7 +533,6 @@ public: Control *control; TranslationUnit *translationUnit; DiagnosticClient *diagnosticClient; - MacroResolver *macroResolver; LiteralTable identifiers; LiteralTable stringLiterals; LiteralTable numericLiterals; @@ -602,12 +595,6 @@ TranslationUnit *Control::switchTranslationUnit(TranslationUnit *unit) return previousTranslationUnit; } -MacroResolver *Control::macroResolver() const -{ return d->macroResolver; } - -void Control::setMacroResolver(MacroResolver *macroResolver) -{ d->macroResolver = macroResolver; } - DiagnosticClient *Control::diagnosticClient() const { return d->diagnosticClient; } diff --git a/src/shared/cplusplus/Control.h b/src/shared/cplusplus/Control.h index 060be182b68..9a41629feaa 100644 --- a/src/shared/cplusplus/Control.h +++ b/src/shared/cplusplus/Control.h @@ -55,18 +55,6 @@ CPLUSPLUS_BEGIN_HEADER CPLUSPLUS_BEGIN_NAMESPACE -class CPLUSPLUS_EXPORT MacroResolver -{ - MacroResolver(const MacroResolver &other); - void operator = (const MacroResolver &other); - -public: - MacroResolver(); - virtual ~MacroResolver(); - - virtual bool isMacro(TranslationUnit *unit, unsigned tokenIndex) const = 0; -}; - class CPLUSPLUS_EXPORT Control { public: @@ -76,9 +64,6 @@ public: TranslationUnit *translationUnit() const; TranslationUnit *switchTranslationUnit(TranslationUnit *unit); - MacroResolver *macroResolver() const; - void setMacroResolver(MacroResolver *macroResolver); - DiagnosticClient *diagnosticClient() const; void setDiagnosticClient(DiagnosticClient *diagnosticClient); diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index d335b5ebfff..958d740a587 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -244,14 +244,6 @@ void Parser::match(int kind, unsigned *token) } } -bool Parser::isMacro(unsigned tokenIndex) const -{ - if (MacroResolver *r = _control->macroResolver()) - return r->isMacro(_translationUnit, tokenIndex); - - return false; -} - bool Parser::parseClassOrNamespaceName(NameAST *&node) { if (LA() == T_IDENTIFIER) { @@ -2561,10 +2553,6 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierAST *&node) bool Parser::parseSimpleDeclaration(DeclarationAST *&node, bool acceptStructDeclarator) { - if (LA() == T_IDENTIFIER && isMacro(cursor())) { - // printf("***** found macro reference `%s'\n", tok().identifier->chars()); - } - unsigned qt_invokable_token = 0; if (acceptStructDeclarator && (LA() == T_Q_SIGNAL || LA() == T_Q_SLOT)) qt_invokable_token = consumeToken(); diff --git a/src/shared/cplusplus/Parser.h b/src/shared/cplusplus/Parser.h index 1bd6700f537..2f274e93ab5 100644 --- a/src/shared/cplusplus/Parser.h +++ b/src/shared/cplusplus/Parser.h @@ -286,8 +286,6 @@ private: inline void rewind(unsigned cursor) { _tokenIndex = cursor; } - bool isMacro(unsigned tokenIndex) const; - private: TranslationUnit *_translationUnit; Control *_control; From 21cd54802ac80515253ed0a94780884f36133ebf Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 7 Oct 2009 13:29:22 +0200 Subject: [PATCH 6/8] debugger: make "Debugger View" un-tabbed at the top of the screen by default. --- src/plugins/debugger/debuggermanager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 7d96912c8a8..660340bb4c4 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -662,13 +662,15 @@ void DebuggerManager::setSimpleDockWidgetArrangement() } foreach (QDockWidget *dockWidget, dockWidgets) { - d->m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dockWidget); + if (dockWidget == d->m_outputDock) + d->m_mainWindow->addDockWidget(Qt::TopDockWidgetArea, dockWidget); + else + d->m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dockWidget); dockWidget->show(); } d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_breakDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_modulesDock); - d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_outputDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_registerDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_threadsDock); d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_sourceFilesDock); From a92d6fbcd8403bf9fa9c2e1cd8be9f6769ef6e13 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 7 Oct 2009 14:29:55 +0200 Subject: [PATCH 7/8] debugger: disable l&w 'alternative formats' submenu if there aren't any alternatives. --- src/plugins/debugger/watchwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index db3f33057b7..5cf8f4ff534 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -237,6 +237,10 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) individualFormatMenu.addAction(act); individualFormatActions.append(act); } + if (alternativeFormats.isEmpty()) { + typeFormatMenu.setEnabled(false); + individualFormatMenu.setEnabled(false); + } } else { typeFormatMenu.setTitle(tr("Change format for type")); typeFormatMenu.setEnabled(false); From 92c3939088f3002e4a92c0215bb5b0453256a9e4 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 7 Oct 2009 14:43:06 +0200 Subject: [PATCH 8/8] debugger: remove ambiguous shortcut --- src/plugins/debugger/debuggeroutputwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/debugger/debuggeroutputwindow.cpp b/src/plugins/debugger/debuggeroutputwindow.cpp index a3ca21f25c4..c75fbd5a328 100644 --- a/src/plugins/debugger/debuggeroutputwindow.cpp +++ b/src/plugins/debugger/debuggeroutputwindow.cpp @@ -155,7 +155,6 @@ public: m_clearContentsAction = new QAction(this); m_clearContentsAction->setText(tr("Clear contents")); m_clearContentsAction->setEnabled(true); - m_clearContentsAction->setShortcut(Qt::ControlModifier + Qt::Key_R); connect(m_clearContentsAction, SIGNAL(triggered(bool)), parent, SLOT(clearContents()));