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
14ddfc45
Commit
14ddfc45
authored
Dec 08, 2008
by
hjk
Browse files
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
parents
8d3a774f
bf7486c0
Changes
33
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CppDocument.cpp
View file @
14ddfc45
...
...
@@ -138,19 +138,9 @@ void Document::addIncludeFile(const QString &fileName)
_includedFiles
.
append
(
fileName
);
}
QByteArray
Document
::
define
dMacro
s
()
const
void
Document
::
appen
dMacro
(
const
Macro
&
macro
)
{
return
_definedMacros
;
}
void
Document
::
appendMacro
(
const
QByteArray
&
macroName
,
const
QByteArray
&
text
)
{
int
index
=
macroName
.
indexOf
(
'('
);
if
(
index
==
-
1
)
_macroNames
.
insert
(
macroName
);
else
_macroNames
.
insert
(
macroName
.
left
(
index
));
_definedMacros
+=
text
;
_definedMacros
.
append
(
macro
);
}
void
Document
::
addMacroUse
(
unsigned
offset
,
unsigned
length
)
...
...
@@ -251,11 +241,6 @@ void Document::stopSkippingBlocks(unsigned stop)
_skippedBlocks
.
back
()
=
Block
(
start
,
stop
);
}
QSet
<
QByteArray
>
Document
::
macroNames
()
const
{
return
_macroNames
;
}
bool
Document
::
parse
(
ParseMode
mode
)
{
TranslationUnit
::
ParseMode
m
=
TranslationUnit
::
ParseTranlationUnit
;
...
...
src/libs/cplusplus/CppDocument.h
View file @
14ddfc45
...
...
@@ -36,6 +36,8 @@
#include
<CPlusPlusForwardDeclarations.h>
#include
"pp-macro.h"
#include
<QByteArray>
#include
<QList>
#include
<QSet>
...
...
@@ -45,6 +47,8 @@
namespace
CPlusPlus
{
class
Macro
;
class
CPLUSPLUS_EXPORT
Document
{
Document
(
const
Document
&
other
);
...
...
@@ -63,10 +67,7 @@ public:
QStringList
includedFiles
()
const
;
void
addIncludeFile
(
const
QString
&
fileName
);
QByteArray
definedMacros
()
const
;
QSet
<
QByteArray
>
macroNames
()
const
;
void
appendMacro
(
const
QByteArray
&
macroName
,
const
QByteArray
&
text
);
void
appendMacro
(
const
Macro
&
macro
);
void
addMacroUse
(
unsigned
offset
,
unsigned
length
);
...
...
@@ -81,6 +82,9 @@ public:
Scope
*
globalSymbols
()
const
;
// ### deprecate?
Namespace
*
globalNamespace
()
const
;
QList
<
Macro
>
definedMacros
()
const
{
return
_definedMacros
;
}
Symbol
*
findSymbolAt
(
unsigned
line
,
unsigned
column
)
const
;
void
setSource
(
const
QByteArray
&
source
);
...
...
@@ -191,8 +195,7 @@ private:
TranslationUnit
*
_translationUnit
;
Namespace
*
_globalNamespace
;
QList
<
DiagnosticMessage
>
_diagnosticMessages
;
QByteArray
_definedMacros
;
QSet
<
QByteArray
>
_macroNames
;
QList
<
Macro
>
_definedMacros
;
QList
<
Block
>
_skippedBlocks
;
QList
<
Block
>
_macroUses
;
};
...
...
src/libs/cplusplus/TypeOfExpression.cpp
View file @
14ddfc45
...
...
@@ -48,6 +48,7 @@ TypeOfExpression::TypeOfExpression():
void
TypeOfExpression
::
setDocuments
(
const
QMap
<
QString
,
Document
::
Ptr
>
&
documents
)
{
m_documents
=
documents
;
m_lookupContext
=
LookupContext
();
}
QList
<
TypeOfExpression
::
Result
>
TypeOfExpression
::
operator
()(
const
QString
&
expression
,
...
...
src/libs/cplusplus/TypeOfExpression.h
View file @
14ddfc45
...
...
@@ -54,6 +54,9 @@ public:
/**
* Sets the documents used to evaluate expressions. Should be set before
* calling this functor.
*
* Also clears the lookup context, so can be used to make sure references
* to the documents previously used are removed.
*/
void
setDocuments
(
const
QMap
<
QString
,
Document
::
Ptr
>
&
documents
);
...
...
src/libs/cplusplus/cplusplus.pro
View file @
14ddfc45
...
...
@@ -21,7 +21,16 @@ HEADERS += \
TypeOfExpression
.
h
\
TypePrettyPrinter
.
h
\
ResolveExpression
.
h
\
LookupContext
.
h
LookupContext
.
h
\
pp
-
cctype
.
h
\
pp
-
engine
.
h
\
pp
-
fwd
.
h
\
pp
-
macro
-
expander
.
h
\
pp
-
scanner
.
h
\
pp
-
client
.
h
\
pp
-
environment
.
h
\
pp
-
internal
.
h
\
pp
-
macro
.
h
SOURCES
+=
\
SimpleLexer
.
cpp
\
...
...
@@ -35,6 +44,9 @@ SOURCES += \
TypeOfExpression
.
cpp
\
TypePrettyPrinter
.
cpp
\
ResolveExpression
.
cpp
\
LookupContext
.
cpp
LookupContext
.
cpp
\
pp
-
engine
.
cpp
\
pp
-
environment
.
cpp
\
pp
-
macro
-
expander
.
cpp
RESOURCES
+=
cplusplus
.
qrc
src/
plugins/cpptools/rpp
/pp-cctype.h
→
src/
libs/cplusplus
/pp-cctype.h
View file @
14ddfc45
...
...
@@ -53,22 +53,24 @@
#ifndef PP_CCTYPE_H
#define PP_CCTYPE_H
#include
<CPlusPlusForwardDeclarations.h>
#include
<cctype>
namespace
rpp
{
namespace
CPlusPlus
{
inline
bool
pp_isalpha
(
int
__ch
)
inline
bool
CPLUSPLUS_EXPORT
pp_isalpha
(
int
__ch
)
{
return
std
::
isalpha
((
unsigned
char
)
__ch
)
!=
0
;
}
inline
bool
pp_isalnum
(
int
__ch
)
inline
bool
CPLUSPLUS_EXPORT
pp_isalnum
(
int
__ch
)
{
return
std
::
isalnum
((
unsigned
char
)
__ch
)
!=
0
;
}
inline
bool
pp_isdigit
(
int
__ch
)
inline
bool
CPLUSPLUS_EXPORT
pp_isdigit
(
int
__ch
)
{
return
std
::
isdigit
((
unsigned
char
)
__ch
)
!=
0
;
}
inline
bool
pp_isspace
(
int
__ch
)
inline
bool
CPLUSPLUS_EXPORT
pp_isspace
(
int
__ch
)
{
return
std
::
isspace
((
unsigned
char
)
__ch
)
!=
0
;
}
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_CCTYPE_H
src/
plugins/cpptools/rpp
/pp-client.h
→
src/
libs/cplusplus
/pp-client.h
View file @
14ddfc45
...
...
@@ -34,15 +34,17 @@
#ifndef PP_CLIENT_H
#define PP_CLIENT_H
#include
<CPlusPlusForwardDeclarations.h>
#include
<QByteArray>
#include
<QString>
#include
<QFile>
namespace
rpp
{
namespace
CPlusPlus
{
class
Macro
;
class
Client
class
CPLUSPLUS_EXPORT
Client
{
Client
(
const
Client
&
other
);
void
operator
=
(
const
Client
&
other
);
...
...
@@ -60,7 +62,7 @@ public:
virtual
~
Client
()
{
}
virtual
void
macroAdded
(
const
QByteArray
&
macroId
,
const
QByteArray
&
text
)
=
0
;
virtual
void
macroAdded
(
const
Macro
&
macro
)
=
0
;
virtual
void
sourceNeeded
(
QString
&
fileName
,
IncludeType
mode
)
=
0
;
// ### FIX the signature.
virtual
void
startExpandingMacro
(
unsigned
offset
,
...
...
@@ -74,6 +76,6 @@ public:
virtual
void
stopSkippingBlocks
(
unsigned
offset
)
=
0
;
};
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_CLIENT_H
src/
plugins/cpptools/rpp
/pp-engine.cpp
→
src/
libs/cplusplus
/pp-engine.cpp
View file @
14ddfc45
...
...
@@ -57,7 +57,6 @@
#include
<QtDebug>
#include
<algorithm>
using
namespace
rpp
;
using
namespace
CPlusPlus
;
namespace
{
...
...
@@ -907,16 +906,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
env
.
bind
(
macro
);
QByteArray
macroText
;
macroText
.
reserve
(
64
);
macroText
+=
"#define "
;
macroText
+=
macroId
;
macroText
+=
' '
;
macroText
+=
macro
.
definition
;
macroText
+=
'\n'
;
client
->
macroAdded
(
macroId
,
macroText
);
if
(
client
)
client
->
macroAdded
(
macro
);
}
void
pp
::
processIf
(
TokenIterator
firstToken
,
TokenIterator
lastToken
)
...
...
@@ -1020,13 +1011,10 @@ void pp::processUndef(TokenIterator firstToken, TokenIterator lastToken)
if
(
tk
->
is
(
T_IDENTIFIER
))
{
const
QByteArray
macroName
=
tokenText
(
*
tk
);
env
.
remove
(
macroName
);
const
Macro
*
macro
=
env
.
remove
(
macroName
);
QByteArray
macroText
;
macroText
+=
"#undef "
;
macroText
+=
macroName
;
macroText
+=
'\n'
;
client
->
macroAdded
(
macroName
,
macroText
);
if
(
client
&&
macro
)
client
->
macroAdded
(
*
macro
);
}
}
...
...
src/
plugins/cpptools/rpp
/pp-engine.h
→
src/
libs/cplusplus
/pp-engine.h
View file @
14ddfc45
...
...
@@ -62,7 +62,7 @@ namespace CPlusPlus {
class
Token
;
}
namespace
rpp
{
namespace
CPlusPlus
{
struct
Value
{
...
...
@@ -134,7 +134,7 @@ namespace rpp {
#undef PP_DEFINE_BIN_OP
};
class
pp
class
CPLUSPLUS_EXPORT
pp
{
Client
*
client
;
Environment
&
env
;
...
...
@@ -200,7 +200,7 @@ namespace rpp {
Value
evalExpression
(
TokenIterator
firstToken
,
TokenIterator
lastToken
,
const
QByteArray
&
source
)
const
;
const
QByteArray
&
source
)
const
;
QVector
<
CPlusPlus
::
Token
>
tokenize
(
const
QByteArray
&
text
)
const
;
...
...
@@ -226,6 +226,6 @@ namespace rpp {
bool
isQtReservedWord
(
const
QByteArray
&
name
)
const
;
};
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_ENGINE_H
src/
plugins/cpptools/rpp
/pp-environment.cpp
→
src/
libs/cplusplus
/pp-environment.cpp
View file @
14ddfc45
...
...
@@ -54,7 +54,7 @@
#include
"pp.h"
#include
<cstring>
using
namespace
rpp
;
using
namespace
CPlusPlus
;
Environment
::
Environment
()
:
currentLine
(
0
),
...
...
@@ -115,12 +115,12 @@ Macro *Environment::bind(const Macro &__macro)
return
m
;
}
void
Environment
::
remove
(
const
QByteArray
&
name
)
Macro
*
Environment
::
remove
(
const
QByteArray
&
name
)
{
Macro
macro
;
macro
.
name
=
name
;
macro
.
hidden
=
true
;
bind
(
macro
);
return
bind
(
macro
);
}
bool
Environment
::
isBuiltinMacro
(
const
QByteArray
&
s
)
const
...
...
src/
plugins/cpptools/rpp
/pp-environment.h
→
src/
libs/cplusplus
/pp-environment.h
View file @
14ddfc45
...
...
@@ -53,14 +53,16 @@
#ifndef PP_ENVIRONMENT_H
#define PP_ENVIRONMENT_H
#include
"CPlusPlusForwardDeclarations.h"
#include
<QVector>
#include
<QByteArray>
namespace
rpp
{
namespace
CPlusPlus
{
struct
Macro
;
class
Macro
;
class
Environment
class
CPLUSPLUS_EXPORT
Environment
{
public:
Environment
();
...
...
@@ -70,7 +72,7 @@ public:
Macro
*
macroAt
(
unsigned
index
)
const
;
Macro
*
bind
(
const
Macro
&
macro
);
void
remove
(
const
QByteArray
&
name
);
Macro
*
remove
(
const
QByteArray
&
name
);
Macro
*
resolve
(
const
QByteArray
&
name
)
const
;
bool
isBuiltinMacro
(
const
QByteArray
&
name
)
const
;
...
...
@@ -104,6 +106,6 @@ private:
int
_hash_count
;
};
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_ENVIRONMENT_H
src/
plugins/cpptools/rpp
/pp-fwd.h
→
src/
libs/cplusplus
/pp-fwd.h
View file @
14ddfc45
File moved
src/
plugins/cpptools/rpp
/pp-internal.h
→
src/
libs/cplusplus
/pp-internal.h
View file @
14ddfc45
...
...
@@ -55,7 +55,7 @@
#include
<QByteArray>
namespace
rpp
{
namespace
CPlusPlus
{
namespace
_PP_internal
{
inline
bool
comment_p
(
const
char
*
__first
,
const
char
*
__last
)
...
...
@@ -73,6 +73,6 @@ inline bool comment_p (const char *__first, const char *__last)
}
}
// _PP_internal
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_INTERNAL_H
src/
plugins/cpptools/rpp
/pp-macro-expander.cpp
→
src/
libs/cplusplus
/pp-macro-expander.cpp
View file @
14ddfc45
...
...
@@ -35,7 +35,7 @@
#include
"pp-macro-expander.h"
#include
<QDateTime>
using
namespace
rpp
;
using
namespace
CPlusPlus
;
MacroExpander
::
MacroExpander
(
Environment
&
env
,
pp_frame
*
frame
)
:
env
(
env
),
frame
(
frame
),
...
...
src/
plugins/cpptools/rpp
/pp-macro-expander.h
→
src/
libs/cplusplus
/pp-macro-expander.h
View file @
14ddfc45
...
...
@@ -53,7 +53,7 @@
#ifndef PP_MACRO_EXPANDER_H
#define PP_MACRO_EXPANDER_H
namespace
rpp
{
namespace
CPlusPlus
{
struct
pp_frame
{
...
...
@@ -97,7 +97,7 @@ namespace rpp {
int
generated_lines
;
};
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_MACRO_EXPANDER_H
src/
plugins/cpptools/rpp
/pp-macro.h
→
src/
libs/cplusplus
/pp-macro.h
View file @
14ddfc45
...
...
@@ -53,43 +53,44 @@
#ifndef PP_MACRO_H
#define PP_MACRO_H
#include
<CPlusPlusForwardDeclarations.h>
#include
<QByteArray>
#include
<QVector>
namespace
rpp
{
namespace
CPlusPlus
{
class
CPLUSPLUS_EXPORT
Macro
{
public:
QByteArray
name
;
QByteArray
definition
;
QVector
<
QByteArray
>
formals
;
QByteArray
fileName
;
int
line
;
Macro
*
next
;
unsigned
hashcode
;
struct
Macro
union
{
QByteArray
name
;
QByteArray
definition
;
QVector
<
QByteArray
>
formals
;
QByteArray
fileName
;
int
line
;
int
lines
;
Macro
*
next
;
unsigned
hashcode
;
unsigned
state
;
union
struct
{
unsigned
state
;
struct
{
unsigned
hidden
:
1
;
unsigned
function_like
:
1
;
unsigned
variadics
:
1
;
};
unsigned
hidden
:
1
;
unsigned
function_like
:
1
;
unsigned
variadics
:
1
;
};
};
inline
Macro
()
:
inline
Macro
()
:
line
(
0
),
lines
(
0
),
next
(
0
),
hashcode
(
0
),
state
(
0
)
{
}
};
{
}
};
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_MACRO_H
src/
plugins/cpptools/rpp
/pp-scanner.h
→
src/
libs/cplusplus
/pp-scanner.h
View file @
14ddfc45
...
...
@@ -53,7 +53,7 @@
#ifndef PP_SCANNER_H
#define PP_SCANNER_H
namespace
rpp
{
namespace
CPlusPlus
{
struct
pp_skip_blanks
{
...
...
@@ -373,7 +373,7 @@ struct pp_skip_argument
}
};
}
// namespace
rpp
}
// namespace
CPlusPlus
#endif // PP_SCANNER_H
...
...
src/
plugins/cpptools/rpp
/pp.h
→
src/
libs/cplusplus
/pp.h
View file @
14ddfc45
File moved
src/plugins/cmakeprojectmanager/cmakeproject.cpp
View file @
14ddfc45
...
...
@@ -34,6 +34,8 @@
#include
"cmakeproject.h"
#include
"cmakeprojectconstants.h"
#include
"cmakeprojectnodes.h"
#include
"cmakestep.h"
#include
"makestep.h"
#include
<extensionsystem/pluginmanager.h>
#include
<cpptools/cppmodelmanagerinterface.h>
...
...
@@ -188,7 +190,7 @@ QString CMakeProject::buildDirectory(const QString &buildConfiguration) const
{
Q_UNUSED
(
buildConfiguration
)
//TODO
return
""
;
return
QFileInfo
(
m_fileName
).
absolutePath
()
;
}
ProjectExplorer
::
BuildStepConfigWidget
*
CMakeProject
::
createConfigWidget
()
...
...
@@ -225,13 +227,29 @@ QStringList CMakeProject::files(FilesMode fileMode) const
void
CMakeProject
::
saveSettingsImpl
(
ProjectExplorer
::
PersistentSettingsWriter
&
writer
)
{
// TODO
Q_UNUSED
(
writer
)
Q_UNUSED
(
writer
)
;
}
void
CMakeProject
::
restoreSettingsImpl
(
ProjectExplorer
::
PersistentSettingsReader
&
reader
)
{
// TODO
Q_UNUSED
(
reader
)
Q_UNUSED
(
reader
);
if
(
buildConfigurations
().
isEmpty
())
{
// No build configuration, adding those
// TODO do we want to create one build configuration per target?
// or how do we want to handle that?
CMakeStep
*
cmakeStep
=
new
CMakeStep
(
this
);
MakeStep
*
makeStep
=
new
MakeStep
(
this
);
insertBuildStep
(
0
,
cmakeStep
);
insertBuildStep
(
1
,
makeStep
);
addBuildConfiguration
(
"all"
);
setActiveBuildConfiguration
(
"all"
);
}
// Restoring is fine
}
...
...
@@ -376,12 +394,36 @@ void CMakeCbpParser::parseBuild()
void
CMakeCbpParser
::
parseTarget
()
{
m_targetOutput
.
clear
();
m_targetType
=
false
;
while
(
!
atEnd
())
{
readNext
();
if
(
isEndElement
())
{
if
(
m_targetType
&&
!
m_targetOutput
.
isEmpty
())
{
qDebug
()
<<
"found target "
<<
m_targetOutput
;
m_targets
.
insert
(
m_targetOutput
);
}
return
;
}
else
if
(
name
()
==
"Compiler"
)
{
parseCompiler
();
}
else
if
(
name
()
==
"Option"
)
{
parseTargetOption
();
}
else
if
(
isStartElement
())
{
parseUnknownElement
();
}
}
}
void
CMakeCbpParser
::
parseTargetOption
()
{
if
(
attributes
().
hasAttribute
(
"output"
))
m_targetOutput
=
attributes
().
value
(
"output"
).
toString
();
else
if
(
attributes
().
hasAttribute
(
"type"
)
&&
attributes
().
value
(
"type"
)
==
"1"
)
m_targetType
=
true
;
while
(
!
atEnd
())
{
readNext
();
if
(
isEndElement
())
{
return
;
}
else
if
(
isStartElement
())
{
parseUnknownElement
();
}
...
...
src/plugins/cmakeprojectmanager/cmakeproject.h
View file @
14ddfc45
...
...
@@ -123,13 +123,18 @@ private:
void
parseProject
();
void
parseBuild
();
void
parseTarget
();
void
parseTargetOption
();
void
parseCompiler
();
void
parseAdd
();
void
parseUnit
();
void
parseUnknownElement
();
QSet
<
QString
>
m_targets
;
QList
<
ProjectExplorer
::
FileNode
*>
m_fileList
;
QStringList
m_includeFiles
;
QString
m_targetOutput
;
bool
m_targetType
;
};
class
CMakeFile
:
public
Core
::
IFile
...
...
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