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
2890e323
Commit
2890e323
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
8580234e
4556e602
Changes
33
Hide whitespace changes
Inline
Side-by-side
bin/gdbmacros/gdbmacros.cpp
View file @
2890e323
...
...
@@ -122,6 +122,7 @@ int qtGhVersion = QT_VERSION;
# include <QImage>
#endif
#include
<list>
#include
<string>
#include
<vector>
...
...
@@ -406,12 +407,13 @@ struct QDumper
QDumper
&
operator
<<
(
unsigned
int
i
);
QDumper
&
operator
<<
(
const
void
*
p
);
QDumper
&
operator
<<
(
qulonglong
c
);
void
put
(
char
c
);
void
addCommaIfNeeded
();
void
putBase64Encoded
(
const
char
*
buf
,
int
n
);
QDumper
&
operator
<<
(
const
char
*
str
);
QDumper
&
operator
<<
(
const
QByteArray
&
ba
);
QDumper
&
operator
<<
(
const
QString
&
str
);
void
put
(
char
c
);
void
addCommaIfNeeded
();
void
putBase64Encoded
(
const
char
*
buf
,
int
n
);
void
putEllipsis
();
void
disarm
();
void
beginHash
();
// start of data hash output
...
...
@@ -657,6 +659,11 @@ void QDumper::endHash()
put
(
'}'
);
}
void
QDumper
::
putEllipsis
()
{
addCommaIfNeeded
();
*
this
<<
"{name=
\"
<incomplete>
\"
,value=
\"\"
,type=
\"
"
<<
innertype
<<
"
\"
}"
;
}
//
// Some helpers to keep the dumper code short
...
...
@@ -815,6 +822,27 @@ static void qDumpInnerValue(QDumper &d, const char *type, const void *addr)
}
static
void
qDumpInnerValueOrPointer
(
QDumper
&
d
,
const
char
*
type
,
const
char
*
strippedtype
,
const
void
*
addr
)
{
if
(
strippedtype
)
{
if
(
deref
(
addr
))
{
P
(
d
,
"addr"
,
deref
(
addr
));
P
(
d
,
"type"
,
strippedtype
);
qDumpInnerValueHelper
(
d
,
strippedtype
,
deref
(
addr
));
}
else
{
P
(
d
,
"addr"
,
addr
);
P
(
d
,
"type"
,
strippedtype
);
P
(
d
,
"value"
,
"<null>"
);
P
(
d
,
"numchild"
,
"0"
);
}
}
else
{
P
(
d
,
"addr"
,
addr
);
P
(
d
,
"type"
,
type
);
qDumpInnerValueHelper
(
d
,
type
,
addr
);
}
}
//////////////////////////////////////////////////////////////////////////////
static
void
qDumpQByteArray
(
QDumper
&
d
)
...
...
@@ -1212,9 +1240,8 @@ static void qDumpQList(QDumper &d)
bool
isInternal
=
innerSize
<=
int
(
sizeof
(
void
*
))
&&
isMovableType
(
d
.
innertype
);
P
(
d
,
"internal"
,
(
int
)
isInternal
);
P
(
d
,
"childtype"
,
d
.
innertype
);
P
(
d
,
"internal"
,
(
int
)
isInternal
);
P
(
d
,
"childtype"
,
d
.
innertype
);
if
(
n
>
1000
)
n
=
1000
;
d
<<
",children=["
;
...
...
@@ -1244,11 +1271,8 @@ static void qDumpQList(QDumper &d)
}
d
.
endHash
();
}
if
(
n
<
nn
)
{
d
.
beginHash
();
P
(
d
,
"value"
,
"<incomplete>"
);
d
.
endHash
();
}
if
(
n
<
nn
)
d
.
putEllipsis
();
d
<<
"]"
;
}
d
.
disarm
();
...
...
@@ -1490,7 +1514,6 @@ static void qDumpQObject(QDumper &d)
d.beginHash();
P(d, "name", "methods");
P(d, "exp", "*(class '"NS"QObject'*)" << d.data);
P(d, "type", NS"QObjectMethodList");
P(d, "value", "<" << mo->methodCount() << " items>");
P(d, "numchild", mo->methodCount());
d.endHash();
...
...
@@ -1876,11 +1899,7 @@ static void qDumpQSet(QDumper &d)
d
.
endHash
();
++
i
;
if
(
i
>
10000
)
{
d
.
beginHash
();
P
(
d
,
"name"
,
"Warning:"
);
P
(
d
,
"value"
,
"<incomplete>"
);
P
(
d
,
"type"
,
""
);
d
.
endHash
();
d
.
putEllipsis
();
break
;
}
}
...
...
@@ -1935,13 +1954,8 @@ static void qDumpQStringList(QDumper &d)
P
(
d
,
"valueencoded"
,
"1"
);
d
.
endHash
();
}
if
(
n
<
list
.
size
())
{
d
.
beginHash
();
P
(
d
,
"name"
,
"Warning:"
);
P
(
d
,
"value"
,
"<incomplete>"
);
P
(
d
,
"type"
,
""
);
d
.
endHash
();
}
if
(
n
<
list
.
size
())
d
.
putEllipsis
();
d
<<
"]"
;
}
d
.
disarm
();
...
...
@@ -2065,37 +2079,68 @@ static void qDumpQVector(QDumper &d)
P
(
d
,
"valuedisabled"
,
"true"
);
P
(
d
,
"numchild"
,
n
);
if
(
d
.
dumpChildren
)
{
bool
innerTypeIsPointer
=
isPointerType
(
d
.
innertype
);
QByteArray
strippedInnerType
=
stripPointerType
(
d
.
innertype
);
const
char
*
stripped
=
isPointerType
(
d
.
innertype
)
?
strippedInnerType
.
data
()
:
0
;
if
(
n
>
1000
)
n
=
1000
;
d
<<
",children=["
;
for
(
int
i
=
0
;
i
!=
n
;
++
i
)
{
d
.
beginHash
();
P
(
d
,
"name"
,
"["
<<
i
<<
"]"
);
const
void
*
p
=
addOffset
(
v
,
i
*
innersize
+
typeddatasize
);
if
(
innerTypeIsPointer
)
{
if
(
deref
(
p
))
{
//P(d, "value","@" << p);
qDumpInnerValue
(
d
,
strippedInnerType
.
data
(),
deref
(
p
));
}
else
{
P
(
d
,
"type"
,
d
.
innertype
);
P
(
d
,
"value"
,
"<null>"
);
P
(
d
,
"numchild"
,
"0"
);
}
}
else
{
qDumpInnerValue
(
d
,
d
.
innertype
,
p
);
}
qDumpInnerValueOrPointer
(
d
,
d
.
innertype
,
stripped
,
addOffset
(
v
,
i
*
innersize
+
typeddatasize
));
d
.
endHash
();
}
if
(
n
<
nn
)
{
if
(
n
<
nn
)
d
.
putEllipsis
();
d
<<
"]"
;
}
d
.
disarm
();
}
static
void
qDumpStdList
(
QDumper
&
d
)
{
const
std
::
list
<
int
>
&
list
=
*
reinterpret_cast
<
const
std
::
list
<
int
>
*>
(
d
.
data
);
const
void
*
p
=
d
.
data
;
qCheckAccess
(
p
);
p
=
deref
(
p
);
qCheckAccess
(
p
);
p
=
deref
(
p
);
qCheckAccess
(
p
);
p
=
deref
(
addOffset
(
d
.
data
,
sizeof
(
void
*
)));
qCheckAccess
(
p
);
p
=
deref
(
addOffset
(
p
,
sizeof
(
void
*
)));
qCheckAccess
(
p
);
p
=
deref
(
addOffset
(
p
,
sizeof
(
void
*
)));
qCheckAccess
(
p
);
int
nn
=
0
;
std
::
list
<
int
>::
const_iterator
it
=
list
.
begin
();
for
(;
nn
<
101
&&
it
!=
list
.
end
();
++
nn
,
++
it
)
qCheckAccess
(
it
.
operator
->
());
if
(
nn
>
100
)
P
(
d
,
"value"
,
"<more than 100 items>"
);
else
P
(
d
,
"value"
,
"<"
<<
nn
<<
" items>"
);
P
(
d
,
"numchild"
,
nn
);
P
(
d
,
"valuedisabled"
,
"true"
);
if
(
d
.
dumpChildren
)
{
QByteArray
strippedInnerType
=
stripPointerType
(
d
.
innertype
);
const
char
*
stripped
=
isPointerType
(
d
.
innertype
)
?
strippedInnerType
.
data
()
:
0
;
d
<<
",children=["
;
it
=
list
.
begin
();
for
(
int
i
=
0
;
i
<
1000
&&
it
!=
list
.
end
();
++
i
,
++
it
)
{
d
.
beginHash
();
P
(
d
,
"name"
,
"[...]"
);
P
(
d
,
"value"
,
"<incomplete>"
);
P
(
d
,
"type"
,
d
.
innertype
);
P
(
d
,
"name"
,
"["
<<
i
<<
"]"
);
qDumpInnerValueOrPointer
(
d
,
d
.
innertype
,
stripped
,
it
.
operator
->
());
d
.
endHash
();
}
if
(
it
!=
list
.
end
())
d
.
putEllipsis
();
d
<<
"]"
;
}
d
.
disarm
();
...
...
@@ -2167,37 +2212,21 @@ static void qDumpStdVector(QDumper &d)
P
(
d
,
"numchild"
,
n
);
if
(
d
.
dumpChildren
)
{
unsigned
innersize
=
d
.
extraInt
[
0
];
bool
innerTypeIsPointer
=
isPointerType
(
d
.
innertype
);
QByteArray
strippedInnerType
=
stripPointerType
(
d
.
innertype
);
const
char
*
stripped
=
isPointerType
(
d
.
innertype
)
?
strippedInnerType
.
data
()
:
0
;
if
(
n
>
1000
)
n
=
1000
;
d
<<
",children=["
;
for
(
int
i
=
0
;
i
!=
n
;
++
i
)
{
d
.
beginHash
();
P
(
d
,
"name"
,
"["
<<
i
<<
"]"
);
const
void
*
p
=
addOffset
(
v
->
start
,
i
*
innersize
);
if
(
innerTypeIsPointer
)
{
if
(
deref
(
p
))
{
//P(d, "value","@" << p);
qDumpInnerValue
(
d
,
strippedInnerType
.
data
(),
deref
(
p
));
}
else
{
P
(
d
,
"type"
,
d
.
innertype
);
P
(
d
,
"value"
,
"<null>"
);
P
(
d
,
"numchild"
,
"0"
);
}
}
else
{
qDumpInnerValue
(
d
,
d
.
innertype
,
p
);
}
d
.
endHash
();
}
if
(
n
<
nn
)
{
d
.
beginHash
();
P
(
d
,
"name"
,
"[...]"
);
P
(
d
,
"value"
,
"<incomplete>"
);
P
(
d
,
"type"
,
d
.
innertype
);
qDumpInnerValueOrPointer
(
d
,
d
.
innertype
,
stripped
,
addOffset
(
v
->
start
,
i
*
innersize
));
d
.
endHash
();
}
if
(
n
<
nn
)
d
.
putEllipsis
();
d
<<
"]"
;
}
d
.
disarm
();
...
...
@@ -2325,6 +2354,8 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpStdVector
(
d
);
else
if
(
isEqual
(
type
,
"std::vector::bool"
))
qDumpStdVectorBool
(
d
);
else
if
(
isEqual
(
type
,
"std::list"
))
qDumpStdList
(
d
);
else
if
(
isEqual
(
type
,
"string"
))
qDumpStdString
(
d
);
else
if
(
isEqual
(
type
,
"std::string"
))
...
...
shared/cplusplus/Keywords.cpp
View file @
2890e323
...
...
@@ -1208,4 +1208,141 @@ int Lexer::classify(const char *s, int n, bool q) {
}
// switch
}
static
inline
int
classifyOperator2
(
const
char
*
s
)
{
if
(
s
[
0
]
==
'o'
)
{
if
(
s
[
1
]
==
'r'
)
{
return
T_OR
;
}
}
return
T_IDENTIFIER
;
}
static
inline
int
classifyOperator3
(
const
char
*
s
)
{
if
(
s
[
0
]
==
'a'
)
{
if
(
s
[
1
]
==
'n'
)
{
if
(
s
[
2
]
==
'd'
)
{
return
T_AND
;
}
}
}
else
if
(
s
[
0
]
==
'n'
)
{
if
(
s
[
1
]
==
'o'
)
{
if
(
s
[
2
]
==
't'
)
{
return
T_NOT
;
}
}
}
else
if
(
s
[
0
]
==
'x'
)
{
if
(
s
[
1
]
==
'o'
)
{
if
(
s
[
2
]
==
'r'
)
{
return
T_XOR
;
}
}
}
return
T_IDENTIFIER
;
}
static
inline
int
classifyOperator5
(
const
char
*
s
)
{
if
(
s
[
0
]
==
'b'
)
{
if
(
s
[
1
]
==
'i'
)
{
if
(
s
[
2
]
==
't'
)
{
if
(
s
[
3
]
==
'o'
)
{
if
(
s
[
4
]
==
'r'
)
{
return
T_BITOR
;
}
}
}
}
}
else
if
(
s
[
0
]
==
'c'
)
{
if
(
s
[
1
]
==
'o'
)
{
if
(
s
[
2
]
==
'm'
)
{
if
(
s
[
3
]
==
'p'
)
{
if
(
s
[
4
]
==
'l'
)
{
return
T_COMPL
;
}
}
}
}
}
else
if
(
s
[
0
]
==
'o'
)
{
if
(
s
[
1
]
==
'r'
)
{
if
(
s
[
2
]
==
'_'
)
{
if
(
s
[
3
]
==
'e'
)
{
if
(
s
[
4
]
==
'q'
)
{
return
T_OR_EQ
;
}
}
}
}
}
return
T_IDENTIFIER
;
}
static
inline
int
classifyOperator6
(
const
char
*
s
)
{
if
(
s
[
0
]
==
'a'
)
{
if
(
s
[
1
]
==
'n'
)
{
if
(
s
[
2
]
==
'd'
)
{
if
(
s
[
3
]
==
'_'
)
{
if
(
s
[
4
]
==
'e'
)
{
if
(
s
[
5
]
==
'q'
)
{
return
T_AND_EQ
;
}
}
}
}
}
}
else
if
(
s
[
0
]
==
'b'
)
{
if
(
s
[
1
]
==
'i'
)
{
if
(
s
[
2
]
==
't'
)
{
if
(
s
[
3
]
==
'a'
)
{
if
(
s
[
4
]
==
'n'
)
{
if
(
s
[
5
]
==
'd'
)
{
return
T_BITAND
;
}
}
}
}
}
}
else
if
(
s
[
0
]
==
'n'
)
{
if
(
s
[
1
]
==
'o'
)
{
if
(
s
[
2
]
==
't'
)
{
if
(
s
[
3
]
==
'_'
)
{
if
(
s
[
4
]
==
'e'
)
{
if
(
s
[
5
]
==
'q'
)
{
return
T_NOT_EQ
;
}
}
}
}
}
}
else
if
(
s
[
0
]
==
'x'
)
{
if
(
s
[
1
]
==
'o'
)
{
if
(
s
[
2
]
==
'r'
)
{
if
(
s
[
3
]
==
'_'
)
{
if
(
s
[
4
]
==
'e'
)
{
if
(
s
[
5
]
==
'q'
)
{
return
T_XOR_EQ
;
}
}
}
}
}
}
return
T_IDENTIFIER
;
}
int
Lexer
::
classifyOperator
(
const
char
*
s
,
int
n
)
{
switch
(
n
)
{
case
2
:
return
classifyOperator2
(
s
);
case
3
:
return
classifyOperator3
(
s
);
case
5
:
return
classifyOperator5
(
s
);
case
6
:
return
classifyOperator6
(
s
);
default:
return
T_IDENTIFIER
;
}
// switch
}
CPLUSPLUS_END_NAMESPACE
shared/cplusplus/Lexer.cpp
View file @
2890e323
...
...
@@ -589,8 +589,13 @@ void Lexer::scan_helper(Token *tok)
tok
->
kind
=
classify
(
yytext
,
yylen
,
_qtMocRunEnabled
);
else
tok
->
kind
=
T_IDENTIFIER
;
if
(
tok
->
kind
==
T_IDENTIFIER
&&
control
())
tok
->
identifier
=
control
()
->
findOrInsertIdentifier
(
yytext
,
yylen
);
if
(
tok
->
kind
==
T_IDENTIFIER
)
{
tok
->
kind
=
classifyOperator
(
yytext
,
yylen
);
if
(
control
())
tok
->
identifier
=
control
()
->
findOrInsertIdentifier
(
yytext
,
yylen
);
}
break
;
}
else
if
(
std
::
isdigit
(
ch
))
{
const
char
*
yytext
=
_currentChar
-
1
;
...
...
shared/cplusplus/Lexer.h
View file @
2890e323
...
...
@@ -112,6 +112,7 @@ private:
void
scan_helper
(
Token
*
tok
);
void
setSource
(
const
char
*
firstChar
,
const
char
*
lastChar
);
static
int
classify
(
const
char
*
string
,
int
length
,
bool
q
);
static
int
classifyOperator
(
const
char
*
string
,
int
length
);
inline
void
yyinp
()
{
...
...
shared/cplusplus/Token.h
View file @
2890e323
...
...
@@ -209,7 +209,19 @@ enum Kind {
T_LAST_KEYWORD
=
T_SLOTS
,
// ### aliases
// aliases
T_OR
=
T_PIPE_PIPE
,
T_AND
=
T_AMPER_AMPER
,
T_NOT
=
T_EXCLAIM
,
T_XOR
=
T_CARET
,
T_BITOR
=
T_PIPE
,
T_COMPL
=
T_TILDE
,
T_OR_EQ
=
T_PIPE_EQUAL
,
T_AND_EQ
=
T_AMPER_EQUAL
,
T_BITAND
=
T_AMPER
,
T_NOT_EQ
=
T_EXCLAIM_EQUAL
,
T_XOR_EQ
=
T_CARET_EQUAL
,
T___ASM
=
T_ASM
,
T___ASM__
=
T_ASM
,
...
...
src/libs/cplusplus/CppDocument.cpp
View file @
2890e323
...
...
@@ -33,8 +33,6 @@
#include
"CppDocument.h"
#include
<utils/qtcassert.h>
#include
<Control.h>
#include
<TranslationUnit.h>
#include
<DiagnosticClient.h>
...
...
@@ -133,12 +131,16 @@ QString Document::fileName() const
QStringList
Document
::
includedFiles
()
const
{
return
_includedFiles
;
QStringList
files
;
foreach
(
const
Include
&
i
,
_includes
)
files
.
append
(
i
.
fileName
());
files
.
removeDuplicates
();
return
files
;
}
void
Document
::
addIncludeFile
(
const
QString
&
fileName
)
void
Document
::
addIncludeFile
(
const
QString
&
fileName
,
unsigned
line
)
{
_include
dFile
s
.
append
(
fileName
);
_includes
.
append
(
Include
(
fileName
,
line
)
);
}
void
Document
::
appendMacro
(
const
Macro
&
macro
)
...
...
@@ -273,7 +275,7 @@ bool Document::parse(ParseMode mode)
void
Document
::
check
()
{
Q
TC
_ASSERT
(
!
_globalNamespace
,
return
);
Q_ASSERT
(
!
_globalNamespace
);
Semantic
semantic
(
_control
);
...
...
src/libs/cplusplus/CppDocument.h
View file @
2890e323
...
...
@@ -65,7 +65,7 @@ public:
QString
fileName
()
const
;
QStringList
includedFiles
()
const
;
void
addIncludeFile
(
const
QString
&
fileName
);
void
addIncludeFile
(
const
QString
&
fileName
,
unsigned
line
);
void
appendMacro
(
const
Macro
&
macro
);
void
addMacroUse
(
const
Macro
&
macro
,
unsigned
offset
,
unsigned
length
);
...
...
@@ -181,6 +181,22 @@ public:
{
return
pos
>=
_begin
&&
pos
<
_end
;
}
};
class
Include
{
QString
_fileName
;
unsigned
_line
;
public:
Include
(
const
QString
&
fileName
,
unsigned
line
)
:
_fileName
(
fileName
),
_line
(
line
)
{
}
QString
fileName
()
const
{
return
_fileName
;
}
unsigned
line
()
const
{
return
_line
;
}
};
class
MacroUse
:
public
Block
{
Macro
_macro
;
...
...
@@ -196,6 +212,9 @@ public:
{
return
_macro
;
}
};
QList
<
Include
>
includes
()
const
{
return
_includes
;
}
QList
<
Block
>
skippedBlocks
()
const
{
return
_skippedBlocks
;
}
...
...
@@ -207,11 +226,11 @@ private:
private:
QString
_fileName
;
QStringList
_includedFiles
;
Control
*
_control
;
TranslationUnit
*
_translationUnit
;
Namespace
*
_globalNamespace
;
QList
<
DiagnosticMessage
>
_diagnosticMessages
;
QList
<
Include
>
_includes
;
QList
<
Macro
>
_definedMacros
;
QList
<
Block
>
_skippedBlocks
;
QList
<
MacroUse
>
_macroUses
;
...
...
src/libs/cplusplus/OverviewModel.cpp
View file @
2890e323
...
...
@@ -34,8 +34,6 @@
#include
"OverviewModel.h"
#include
"Overview.h"
#include
<utils/qtcassert.h>
#include
<Scope.h>
#include
<Semantic.h>
#include
<Literals.h>
...
...
@@ -83,13 +81,13 @@ QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent)
return
createIndex
(
row
,
column
,
symbol
);
}
else
{
Symbol
*
parentSymbol
=
static_cast
<
Symbol
*>
(
parent
.
internalPointer
());
Q
TC
_ASSERT
(
parentSymbol
,
return
QModelIndex
()
);
Q_ASSERT
(
parentSymbol
);
ScopedSymbol
*
scopedSymbol
=
parentSymbol
->
asScopedSymbol
();
Q
TC
_ASSERT
(
scopedSymbol
,
return
QModelIndex
()
);
Q_ASSERT
(
scopedSymbol
);
Scope
*
scope
=
scopedSymbol
->
members
();
Q
TC
_ASSERT
(
scope
,
return
QModelIndex
()
);
Q_ASSERT
(
scope
);
return
createIndex
(
row
,
0
,
scope
->
symbolAt
(
row
));
}
...
...
@@ -126,12 +124,12 @@ int OverviewModel::rowCount(const QModelIndex &parent) const
if
(
!
parent
.
parent
().
isValid
()
&&
parent
.
row
()
==
0
)
// account for no symbol item
return
0
;
Symbol
*
parentSymbol
=
static_cast
<
Symbol
*>
(
parent
.
internalPointer
());
Q
TC
_ASSERT
(
parentSymbol
,
return
0
);
Q_ASSERT
(
parentSymbol
);
if
(
ScopedSymbol
*
scopedSymbol
=
parentSymbol
->
asScopedSymbol
())
{
if
(
!
scopedSymbol
->
isFunction
())
{
Scope
*
parentScope
=
scopedSymbol
->
members
();
Q
TC
_ASSERT
(
parentScope
,
return
0
);
Q_ASSERT
(
parentScope
);
return
parentScope
->
symbolCount
();
}
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
2890e323
...
...
@@ -45,8 +45,6 @@
#include
<TypeVisitor.h>
#include
<NameVisitor.h>
#include
<utils/qtcassert.h>
#include
<QtCore/QList>
#include
<QtCore/QtDebug>
...
...
@@ -100,7 +98,7 @@ protected:
// types
virtual
void
visit
(
PointerToMemberType
*
/*ty*/
)
{
Q
TC
_ASSERT
(
false
,
/**/
);
Q_ASSERT
(
false
);
}