Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
5a0b7f8e
Commit
5a0b7f8e
authored
Dec 08, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added initializers to the formal arguments.
parent
d20cdc64
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
9 deletions
+32
-9
src/libs/cplusplus/GenTemplateInstance.cpp
src/libs/cplusplus/GenTemplateInstance.cpp
+1
-1
src/libs/cplusplus/TypePrettyPrinter.cpp
src/libs/cplusplus/TypePrettyPrinter.cpp
+6
-0
src/shared/cplusplus/CheckDeclaration.cpp
src/shared/cplusplus/CheckDeclaration.cpp
+14
-2
src/shared/cplusplus/CheckName.cpp
src/shared/cplusplus/CheckName.cpp
+1
-1
src/shared/cplusplus/Symbols.cpp
src/shared/cplusplus/Symbols.cpp
+6
-3
src/shared/cplusplus/Symbols.h
src/shared/cplusplus/Symbols.h
+4
-2
No files found.
src/libs/cplusplus/GenTemplateInstance.cpp
View file @
5a0b7f8e
...
@@ -144,7 +144,7 @@ private:
...
@@ -144,7 +144,7 @@ private:
originalArgument
->
name
());
originalArgument
->
name
());
arg
->
setType
(
q
->
apply
(
originalArgument
->
type
()));
arg
->
setType
(
q
->
apply
(
originalArgument
->
type
()));
arg
->
setInitializer
(
originalArgument
->
hasI
nitializer
());
arg
->
setInitializer
(
originalArgument
->
i
nitializer
());
fun
->
arguments
()
->
enterSymbol
(
arg
);
fun
->
arguments
()
->
enterSymbol
(
arg
);
}
}
...
...
src/libs/cplusplus/TypePrettyPrinter.cpp
View file @
5a0b7f8e
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include "Overview.h"
#include "Overview.h"
#include "TypePrettyPrinter.h"
#include "TypePrettyPrinter.h"
#include <FullySpecifiedType.h>
#include <FullySpecifiedType.h>
#include <Literals.h>
#include <CoreTypes.h>
#include <CoreTypes.h>
#include <Symbols.h>
#include <Symbols.h>
#include <Scope.h>
#include <Scope.h>
...
@@ -334,6 +335,11 @@ void TypePrettyPrinter::visit(Function *type)
...
@@ -334,6 +335,11 @@ void TypePrettyPrinter::visit(Function *type)
_text
+=
argumentText
(
arg
->
type
(),
name
);
_text
+=
argumentText
(
arg
->
type
(),
name
);
if
(
const
StringLiteral
*
initializer
=
arg
->
initializer
())
{
_text
+=
QLatin1String
(
" ="
);
_text
+=
QString
::
fromUtf8
(
initializer
->
chars
(),
initializer
->
size
());
}
if
(
index
+
1
==
_overview
->
markedArgument
())
if
(
index
+
1
==
_overview
->
markedArgument
())
const_cast
<
Overview
*>
(
_overview
)
->
setMarkedArgumentEnd
(
_text
.
length
());
const_cast
<
Overview
*>
(
_overview
)
->
setMarkedArgumentEnd
(
_text
.
length
());
}
}
...
...
src/shared/cplusplus/CheckDeclaration.cpp
View file @
5a0b7f8e
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#include "Symbols.h"
#include "Symbols.h"
#include "Control.h"
#include "Control.h"
#include "Literals.h"
#include "Literals.h"
#include <string>
#include <cassert>
#include <cassert>
using
namespace
CPlusPlus
;
using
namespace
CPlusPlus
;
...
@@ -419,8 +420,19 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
...
@@ -419,8 +420,19 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
ast
->
expression
,
_scope
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
ast
->
expression
,
_scope
);
Argument
*
arg
=
control
()
->
newArgument
(
sourceLocation
,
argName
);
Argument
*
arg
=
control
()
->
newArgument
(
sourceLocation
,
argName
);
ast
->
symbol
=
arg
;
ast
->
symbol
=
arg
;
if
(
ast
->
expression
)
if
(
ast
->
expression
)
{
arg
->
setInitializer
(
true
);
unsigned
startOfExpression
=
ast
->
expression
->
firstToken
();
unsigned
endOfExpression
=
ast
->
expression
->
lastToken
();
std
::
string
buffer
;
for
(
unsigned
index
=
startOfExpression
;
index
!=
endOfExpression
;
++
index
)
{
const
Token
&
tk
=
tokenAt
(
index
);
if
(
tk
.
whitespace
()
||
tk
.
newline
())
buffer
+=
' '
;
buffer
+=
tk
.
spell
();
}
const
StringLiteral
*
initializer
=
control
()
->
findOrInsertStringLiteral
(
buffer
.
c_str
(),
buffer
.
size
());
arg
->
setInitializer
(
initializer
);
}
arg
->
setType
(
argTy
);
arg
->
setType
(
argTy
);
_scope
->
enterSymbol
(
arg
);
_scope
->
enterSymbol
(
arg
);
return
false
;
return
false
;
...
...
src/shared/cplusplus/CheckName.cpp
View file @
5a0b7f8e
...
@@ -426,7 +426,7 @@ bool CheckName::visit(ObjCMessageArgumentDeclarationAST *ast)
...
@@ -426,7 +426,7 @@ bool CheckName::visit(ObjCMessageArgumentDeclarationAST *ast)
Argument
*
arg
=
control
()
->
newArgument
(
ast
->
firstToken
(),
_name
);
Argument
*
arg
=
control
()
->
newArgument
(
ast
->
firstToken
(),
_name
);
ast
->
argument
=
arg
;
ast
->
argument
=
arg
;
arg
->
setType
(
type
);
arg
->
setType
(
type
);
arg
->
setInitializer
(
false
);
arg
->
setInitializer
(
0
);
_scope
->
enterSymbol
(
arg
);
_scope
->
enterSymbol
(
arg
);
}
}
...
...
src/shared/cplusplus/Symbols.cpp
View file @
5a0b7f8e
...
@@ -128,17 +128,20 @@ void Declaration::visitSymbol0(SymbolVisitor *visitor)
...
@@ -128,17 +128,20 @@ void Declaration::visitSymbol0(SymbolVisitor *visitor)
Argument
::
Argument
(
TranslationUnit
*
translationUnit
,
unsigned
sourceLocation
,
const
Name
*
name
)
Argument
::
Argument
(
TranslationUnit
*
translationUnit
,
unsigned
sourceLocation
,
const
Name
*
name
)
:
Symbol
(
translationUnit
,
sourceLocation
,
name
),
:
Symbol
(
translationUnit
,
sourceLocation
,
name
),
_initializer
(
false
)
_initializer
(
0
)
{
}
{
}
Argument
::~
Argument
()
Argument
::~
Argument
()
{
}
{
}
bool
Argument
::
hasInitializer
()
const
bool
Argument
::
hasInitializer
()
const
{
return
_initializer
!=
0
;
}
const
StringLiteral
*
Argument
::
initializer
()
const
{
return
_initializer
;
}
{
return
_initializer
;
}
void
Argument
::
setInitializer
(
bool
hasI
nitializer
)
void
Argument
::
setInitializer
(
const
StringLiteral
*
i
nitializer
)
{
_initializer
=
hasI
nitializer
;
}
{
_initializer
=
i
nitializer
;
}
void
Argument
::
setType
(
const
FullySpecifiedType
&
type
)
void
Argument
::
setType
(
const
FullySpecifiedType
&
type
)
{
_type
=
type
;
}
{
_type
=
type
;
}
...
...
src/shared/cplusplus/Symbols.h
View file @
5a0b7f8e
...
@@ -148,7 +148,9 @@ public:
...
@@ -148,7 +148,9 @@ public:
void
setType
(
const
FullySpecifiedType
&
type
);
void
setType
(
const
FullySpecifiedType
&
type
);
bool
hasInitializer
()
const
;
bool
hasInitializer
()
const
;
void
setInitializer
(
bool
hasInitializer
);
const
StringLiteral
*
initializer
()
const
;
void
setInitializer
(
const
StringLiteral
*
initializer
);
// Symbol's interface
// Symbol's interface
virtual
FullySpecifiedType
type
()
const
;
virtual
FullySpecifiedType
type
()
const
;
...
@@ -164,7 +166,7 @@ protected:
...
@@ -164,7 +166,7 @@ protected:
private:
private:
FullySpecifiedType
_type
;
FullySpecifiedType
_type
;
bool
_initializer
:
1
;
const
StringLiteral
*
_initializer
;
};
};
class
CPLUSPLUS_EXPORT
ScopedSymbol
:
public
Symbol
class
CPLUSPLUS_EXPORT
ScopedSymbol
:
public
Symbol
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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