Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
39ad48c3
Commit
39ad48c3
authored
Dec 10, 2008
by
mae
Browse files
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
parents
1931304d
9c9308b9
Changes
31
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/pp-engine.cpp
View file @
39ad48c3
...
...
@@ -164,7 +164,15 @@ protected:
bool
process_primary
()
{
if
((
*
_lex
)
->
is
(
T_INT_LITERAL
))
{
_value
.
set_long
(
tokenSpell
().
toLong
());
int
base
=
10
;
const
QByteArray
spell
=
tokenSpell
();
if
(
spell
.
at
(
0
)
==
'0'
)
{
if
(
spell
.
size
()
>
1
&&
(
spell
.
at
(
1
)
==
'x'
||
spell
.
at
(
1
)
==
'X'
))
base
=
16
;
else
base
=
8
;
}
_value
.
set_long
(
tokenSpell
().
toLong
(
0
,
base
));
++
(
*
_lex
);
return
true
;
}
else
if
(
isTokenDefined
())
{
...
...
@@ -367,7 +375,7 @@ protected:
{
process_xor
();
while
((
*
_lex
)
->
is
(
T_
CARET
))
{
while
((
*
_lex
)
->
is
(
T_
PIPE
))
{
const
Token
op
=
*
(
*
_lex
);
++
(
*
_lex
);
...
...
@@ -481,12 +489,12 @@ void pp::operator () (const QByteArray &filename,
const
QByteArray
&
source
,
QByteArray
*
result
)
{
const
QByteArray
previousFile
=
env
.
current
_f
ile
;
env
.
current
_f
ile
=
filename
;
const
QByteArray
previousFile
=
env
.
current
F
ile
;
env
.
current
F
ile
=
filename
;
operator
()
(
source
,
result
);
env
.
current
_f
ile
=
previousFile
;
env
.
current
F
ile
=
previousFile
;
}
pp
::
State
pp
::
createStateFromSource
(
const
QByteArray
&
source
)
const
...
...
@@ -518,7 +526,7 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
result
->
append
(
QByteArray
::
number
(
_dot
->
lineno
));
result
->
append
(
' '
);
result
->
append
(
'"'
);
result
->
append
(
env
.
current
_f
ile
);
result
->
append
(
env
.
current
F
ile
);
result
->
append
(
'"'
);
result
->
append
(
'\n'
);
}
else
{
...
...
@@ -844,6 +852,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
}
Macro
macro
;
macro
.
fileName
=
env
.
currentFile
;
macro
.
line
=
env
.
currentLine
;
macro
.
name
=
tokenText
(
*
tk
);
++
tk
;
// skip T_IDENTIFIER
...
...
src/libs/cplusplus/pp-environment.cpp
View file @
39ad48c3
...
...
@@ -97,8 +97,6 @@ Macro *Environment::bind(const Macro &__macro)
Macro
*
m
=
new
Macro
(
__macro
);
m
->
hashcode
=
hash_code
(
m
->
name
);
m
->
fileName
=
current_file
;
m
->
line
=
currentLine
;
if
(
++
_macro_count
==
_allocated_macros
)
{
if
(
!
_allocated_macros
)
...
...
@@ -122,11 +120,13 @@ Macro *Environment::bind(const Macro &__macro)
return
m
;
}
Macro
*
Environment
::
remove
(
const
QByteArray
&
name
)
Macro
*
Environment
::
remove
(
const
QByteArray
&
name
)
{
Macro
macro
;
macro
.
name
=
name
;
macro
.
hidden
=
true
;
macro
.
fileName
=
currentFile
;
macro
.
line
=
currentLine
;
return
bind
(
macro
);
}
...
...
src/libs/cplusplus/pp-environment.h
View file @
39ad48c3
...
...
@@ -94,7 +94,7 @@ private:
void
rehash
();
public:
QByteArray
current
_f
ile
;
QByteArray
current
F
ile
;
unsigned
currentLine
;
bool
hide_next
;
...
...
src/libs/cplusplus/pp-macro-expander.cpp
View file @
39ad48c3
...
...
@@ -73,7 +73,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
__result
->
append
(
QByteArray
::
number
(
env
.
currentLine
));
__result
->
append
(
' '
);
__result
->
append
(
'"'
);
__result
->
append
(
env
.
current
_f
ile
);
__result
->
append
(
env
.
current
F
ile
);
__result
->
append
(
'"'
);
__result
->
append
(
'\n'
);
++
lines
;
...
...
@@ -218,7 +218,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
else
if
(
fast_name
==
"__FILE__"
)
{
__result
->
append
(
'"'
);
__result
->
append
(
env
.
current
_f
ile
);
__result
->
append
(
env
.
current
F
ile
);
__result
->
append
(
'"'
);
continue
;
}
...
...
src/libs/cplusplus/pp-macro.h
View file @
39ad48c3
...
...
@@ -111,7 +111,7 @@ public:
}
if
(
variadics
)
text
+=
QLatin1String
(
"..."
);
text
+=
QLatin1Char
(
'
'
);
text
+=
QLatin1Char
(
'
)
'
);
}
text
+=
QLatin1Char
(
' '
);
text
+=
QString
::
fromUtf8
(
definition
.
constData
(),
definition
.
size
());
...
...
src/libs/utils/qtcassert.h
View file @
39ad48c3
...
...
@@ -36,13 +36,11 @@
#include
<QtCore/QDebug>
#ifdef Q_OS_UNIX
// we do not use the 'do {...} while (0)' idiom here to be able to use
// 'break' and 'continue' as 'actions'.
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
#else
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
#endif
#endif // QTC_ASSERT_H
src/plugins/cppeditor/cppeditor.cpp
View file @
39ad48c3
...
...
@@ -520,6 +520,15 @@ void CPPEditor::jumpToDefinition()
#endif
}
}
else
{
foreach
(
const
Document
::
MacroUse
use
,
doc
->
macroUses
())
{
if
(
use
.
contains
(
endOfName
-
1
))
{
const
Macro
&
macro
=
use
.
macro
();
const
QString
fileName
=
QString
::
fromUtf8
(
macro
.
fileName
);
if
(
TextEditor
::
BaseTextEditor
::
openEditorAt
(
fileName
,
macro
.
line
,
0
))
return
;
// done
}
}
qDebug
()
<<
"No results for expression:"
<<
expression
;
}
}
...
...
src/plugins/cpptools/cppfunctionsfilter.cpp
0 → 100644
View file @
39ad48c3
/***************************************************************************
**
** 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
"cppfunctionsfilter.h"
using
namespace
CppTools
::
Internal
;
CppFunctionsFilter
::
CppFunctionsFilter
(
CppModelManager
*
manager
,
Core
::
EditorManager
*
editorManager
)
:
CppQuickOpenFilter
(
manager
,
editorManager
)
{
setShortcutString
(
"m"
);
setIncludedByDefault
(
false
);
search
.
setSymbolsToSearchFor
(
SearchSymbols
::
Functions
);
search
.
setSeparateScope
(
true
);
}
CppFunctionsFilter
::~
CppFunctionsFilter
()
{
}
src/plugins/cpptools/cppfunctionsfilter.h
0 → 100644
View file @
39ad48c3
/***************************************************************************
**
** 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 CPPFUNCTIONSFILTER_H
#define CPPFUNCTIONSFILTER_H
#include
<cppquickopenfilter.h>
namespace
CppTools
{
namespace
Internal
{
class
CppFunctionsFilter
:
public
CppQuickOpenFilter
{
Q_OBJECT
public:
CppFunctionsFilter
(
CppModelManager
*
manager
,
Core
::
EditorManager
*
editorManager
);
~
CppFunctionsFilter
();
QString
trName
()
const
{
return
tr
(
"Methods"
);
}
QString
name
()
const
{
return
QLatin1String
(
"Methods"
);
}
Priority
priority
()
const
{
return
Medium
;
}
};
}
// namespace Internal
}
// namespace CppTools
#endif // CPPFUNCTIONSFILTER_H
src/plugins/cpptools/cppmodelmanager.cpp
View file @
39ad48c3
...
...
@@ -390,17 +390,17 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
}
else
{
Document
::
Ptr
previousDoc
=
switchDocument
(
Document
::
create
(
fileName
));
const
QByteArray
previousFile
=
env
.
current
_f
ile
;
const
QByteArray
previousFile
=
env
.
current
F
ile
;
const
unsigned
previousLine
=
env
.
currentLine
;
env
.
current
_f
ile
=
QByteArray
(
m_currentDoc
->
translationUnit
()
->
fileName
(),
m_currentDoc
->
translationUnit
()
->
fileNameLength
());
env
.
current
F
ile
=
QByteArray
(
m_currentDoc
->
translationUnit
()
->
fileName
(),
m_currentDoc
->
translationUnit
()
->
fileNameLength
());
QByteArray
preprocessedCode
;
m_proc
(
contents
,
&
preprocessedCode
);
//qDebug() << preprocessedCode;
env
.
current
_f
ile
=
previousFile
;
env
.
current
F
ile
=
previousFile
;
env
.
currentLine
=
previousLine
;
m_currentDoc
->
setSource
(
preprocessedCode
);
...
...
src/plugins/cpptools/cppquickopenfilter.cpp
View file @
39ad48c3
...
...
@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future)
Q_UNUSED
(
future
);
}
static
bool
compareLexigraphically
(
const
QuickOpen
::
FilterEntry
&
a
,
const
QuickOpen
::
FilterEntry
&
b
)
{
return
a
.
displayName
<
b
.
displayName
;
}
QList
<
QuickOpen
::
FilterEntry
>
CppQuickOpenFilter
::
matchesFor
(
const
QString
&
origEntry
)
{
QString
entry
=
trimWildcards
(
origEntry
);
...
...
@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
}
}
if
(
entries
.
size
()
<
1000
)
qSort
(
entries
.
begin
(),
entries
.
end
(),
compareLexigraphically
);
return
entries
;
}
...
...
src/plugins/cpptools/cpptools.cpp
View file @
39ad48c3
...
...
@@ -34,6 +34,7 @@
#include
"cpptools.h"
#include
"cppclassesfilter.h"
#include
"cppcodecompletion.h"
#include
"cppfunctionsfilter.h"
#include
"cpphoverhandler.h"
#include
"cppmodelmanager.h"
#include
"cpptoolsconstants.h"
...
...
@@ -89,6 +90,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
m_core
->
editorManager
());
addAutoReleasedObject
(
quickOpenFilter
);
addAutoReleasedObject
(
new
CppClassesFilter
(
m_modelManager
,
m_core
->
editorManager
()));
addAutoReleasedObject
(
new
CppFunctionsFilter
(
m_modelManager
,
m_core
->
editorManager
()));
// Menus
Core
::
IActionContainer
*
mtools
=
am
->
actionContainer
(
Core
::
Constants
::
M_TOOLS
);
...
...
src/plugins/cpptools/cpptools.pro
View file @
39ad48c3
...
...
@@ -10,15 +10,16 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
INCLUDEPATH
+=
.
DEFINES
+=
CPPTOOLS_LIBRARY
CONFIG
+=
help
HEADERS
+=
cpptools_global
.
h
\
cppquickopenfilter
.
h
\
cppclassesfilter
.
h
\
searchsymbols
.
h
searchsymbols
.
h
\
cppfunctionsfilter
.
h
SOURCES
+=
cppquickopenfilter
.
cpp
\
cpptoolseditorsupport
.
cpp
\
cppclassesfilter
.
cpp
\
searchsymbols
.
cpp
searchsymbols
.
cpp
\
cppfunctionsfilter
.
cpp
#
Input
SOURCES
+=
cpptools
.
cpp
\
...
...
src/plugins/cpptools/searchsymbols.cpp
View file @
39ad48c3
...
...
@@ -35,6 +35,7 @@
#include
<Literals.h>
#include
<Scope.h>
#include
<Names.h>
using
namespace
CPlusPlus
;
using
namespace
CppTools
::
Internal
;
...
...
@@ -97,12 +98,24 @@ bool SearchSymbols::visit(Function *symbol)
if
(
!
(
symbolsToSearchFor
&
Functions
))
return
false
;
QString
extraScope
;
if
(
Name
*
name
=
symbol
->
name
())
{
if
(
QualifiedNameId
*
nameId
=
name
->
asQualifiedNameId
())
{
if
(
nameId
->
nameCount
()
>
1
)
{
extraScope
=
overview
.
prettyName
(
nameId
->
nameAt
(
nameId
->
nameCount
()
-
2
));
}
}
}
QString
fullScope
=
_scope
;
if
(
!
_scope
.
isEmpty
()
&&
!
extraScope
.
isEmpty
())
fullScope
+=
QLatin1String
(
"::"
);
fullScope
+=
extraScope
;
QString
name
=
symbolName
(
symbol
);
QString
scopedName
=
scopedSymbolName
(
name
);
QString
type
=
overview
.
prettyType
(
symbol
->
type
(),
separateScope
?
symbol
->
name
()
:
0
);
separateScope
?
symbol
->
identity
()
:
0
);
appendItem
(
separateScope
?
type
:
scopedName
,
separateScope
?
_s
cope
:
type
,
separateScope
?
fullS
cope
:
type
,
ModelItemInfo
::
Method
,
symbol
);
return
false
;
}
...
...
@@ -153,7 +166,7 @@ bool SearchSymbols::visit(Class *symbol)
QString
SearchSymbols
::
scopedSymbolName
(
const
QString
&
symbolName
)
const
{
QString
name
=
_scope
;
if
(
!
name
.
isEmpty
())
if
(
!
name
.
isEmpty
())
name
+=
QLatin1String
(
"::"
);
name
+=
symbolName
;
return
name
;
...
...
@@ -196,6 +209,9 @@ void SearchSymbols::appendItem(const QString &name,
ModelItemInfo
::
ItemType
type
,
const
Symbol
*
symbol
)
{
if
(
!
symbol
->
name
())
return
;
const
QIcon
icon
=
icons
.
iconForSymbol
(
symbol
);
items
.
append
(
ModelItemInfo
(
name
,
info
,
type
,
QString
::
fromUtf8
(
symbol
->
fileName
(),
symbol
->
fileNameLength
()),
...
...
src/plugins/debugger/breakhandler.cpp
View file @
39ad48c3
...
...
@@ -34,7 +34,8 @@
#include
"breakhandler.h"
#include
"imports.h"
// TextEditor::BaseTextMark
#include
"qtcassert.h"
#include
<utils/qtcassert.h>
#include
<QtCore/QDebug>
#include
<QtCore/QFileInfo>
...
...
src/plugins/debugger/debugger.pro
View file @
39ad48c3
...
...
@@ -10,8 +10,6 @@ include(../../plugins/texteditor/texteditor.pri)
include
(..
/../
plugins
/
cpptools
/
cpptools
.
pri
)
include
(..
/../
libs
/
cplusplus
/
cplusplus
.
pri
)
INCLUDEPATH
+=
..
/../
libs
/
utils
#
DEFINES
+=
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_TO_ASCII
QT
+=
gui
network
script
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
39ad48c3
...
...
@@ -39,7 +39,6 @@
#include
"gdboptionpage.h"
#include
"gdbengine.h"
#include
"mode.h"
#include
"qtcassert.h"
#include
<coreplugin/actionmanager/actionmanagerinterface.h>
#include
<coreplugin/coreconstants.h>
...
...
@@ -48,20 +47,27 @@
#include
<coreplugin/messagemanager.h>
#include
<coreplugin/modemanager.h>
#include
<coreplugin/uniqueidmanager.h>
#include
<cplusplus/ExpressionUnderCursor.h>
#include
<cppeditor/cppeditorconstants.h>
#include
<projectexplorer/projectexplorerconstants.h>
#include
<projectexplorer/session.h>
#include
<texteditor/basetexteditor.h>
#include
<texteditor/basetextmark.h>
#include
<texteditor/itexteditor.h>
#include
<texteditor/texteditorconstants.h>
#include
<texteditor/basetexteditor.h>
#include
<utils/qtcassert.h>
#include
<QtCore/QDebug>
#include
<QtCore/qplugin.h>
#include
<QtCore/QObject>
#include
<QtCore/QPoint>
#include
<QtCore/QSettings>
#include
<QtGui/QPlainTextEdit>
#include
<QtGui/QTextBlock>
#include
<QtGui/QTextCursor>
...
...
src/plugins/debugger/gdbengine.cpp
View file @
39ad48c3
...
...
@@ -37,7 +37,6 @@
#include
"debuggermanager.h"
#include
"gdbmi.h"
#include
"procinterrupt.h"
#include
"qtcassert.h"
#include
"disassemblerhandler.h"
#include
"breakhandler.h"
...
...
@@ -49,6 +48,8 @@
#include
"startexternaldialog.h"
#include
"attachexternaldialog.h"
#include
<utils/qtcassert.h>
#include
<QtCore/QDebug>
#include
<QtCore/QDir>
#include
<QtCore/QFileInfo>
...
...
src/plugins/debugger/gdbmi.cpp
View file @
39ad48c3
...
...
@@ -32,10 +32,10 @@
***************************************************************************/
#include
"gdbmi.h"
#include
"qtcassert.h"
#include
<utils/qtcassert.h>
#include
<QtCore/QByteArray>
#include
<QtCore/QDebug>
#include
<QtCore/QTextStream>
namespace
Debugger
{
...
...
src/plugins/debugger/mode.cpp
View file @
39ad48c3
...
...
@@ -35,7 +35,6 @@
#include
"debuggerconstants.h"
#include
"debuggermanager.h"
#include
"qtcassert.h"
#include
<coreplugin/coreconstants.h>
#include
<coreplugin/icore.h>
...
...
@@ -48,10 +47,14 @@
#include
<coreplugin/outputpane.h>
#include
<coreplugin/navigationwidget.h>
#include
<coreplugin/rightpane.h>
#include
<projectexplorer/projectexplorerconstants.h>
#include
<utils/qtcassert.h>
#include
<QtCore/QDebug>
#include
<QtCore/QSettings>
#include
<QtGui/QDockWidget>
#include
<QtGui/QLabel>
#include
<QtGui/QMainWindow>
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment