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
F
flatpak-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
Marco Bubke
flatpak-qt-creator
Commits
fd8cd69a
Commit
fd8cd69a
authored
Jun 26, 2009
by
Roberto Raggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduced Document::CheckMode.
parent
0b1bc40b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
20 deletions
+46
-20
src/libs/cplusplus/CppDocument.cpp
src/libs/cplusplus/CppDocument.cpp
+3
-1
src/libs/cplusplus/CppDocument.h
src/libs/cplusplus/CppDocument.h
+6
-1
src/plugins/cpptools/cppmodelmanager.cpp
src/plugins/cpptools/cppmodelmanager.cpp
+8
-2
src/shared/cplusplus/CheckDeclaration.cpp
src/shared/cplusplus/CheckDeclaration.cpp
+18
-16
src/shared/cplusplus/Semantic.cpp
src/shared/cplusplus/Semantic.cpp
+8
-0
src/shared/cplusplus/Semantic.h
src/shared/cplusplus/Semantic.h
+3
-0
No files found.
src/libs/cplusplus/CppDocument.cpp
View file @
fd8cd69a
...
...
@@ -314,11 +314,13 @@ bool Document::parse(ParseMode mode)
return
_translationUnit
->
parse
(
m
);
}
void
Document
::
check
()
void
Document
::
check
(
CheckMode
mode
)
{
Q_ASSERT
(
!
_globalNamespace
);
Semantic
semantic
(
_control
);
if
(
mode
==
FastCheck
)
semantic
.
setSkipFunctionBodies
(
true
);
_globalNamespace
=
_control
->
newNamespace
(
0
);
Scope
*
globals
=
_globalNamespace
->
members
();
...
...
src/libs/cplusplus/CppDocument.h
View file @
fd8cd69a
...
...
@@ -105,7 +105,12 @@ public:
bool
isParsed
()
const
;
bool
parse
(
ParseMode
mode
=
ParseTranlationUnit
);
void
check
();
enum
CheckMode
{
FullCheck
,
FastCheck
};
void
check
(
CheckMode
mode
=
FullCheck
);
void
releaseSource
();
void
releaseTranslationUnit
();
...
...
src/plugins/cpptools/cppmodelmanager.cpp
View file @
fd8cd69a
...
...
@@ -610,10 +610,16 @@ public:
void
operator
()(
Document
::
Ptr
doc
)
{
_doc
=
doc
;
Document
::
CheckMode
mode
=
Document
::
FastCheck
;
if
(
_workingCopy
.
contains
(
doc
->
fileName
()))
mode
=
Document
::
FullCheck
;
doc
->
parse
();
doc
->
check
();
doc
->
check
(
mode
);
if
(
_workingCopy
.
contains
(
doc
->
fileName
())
)
{
if
(
mode
==
Document
::
FullCheck
)
{
// run the binding pass
NamespaceBindingPtr
ns
=
bind
(
doc
,
_snapshot
);
...
...
src/shared/cplusplus/CheckDeclaration.cpp
View file @
fd8cd69a
...
...
@@ -304,26 +304,28 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
ast
->
symbol
=
fun
;
_scope
->
enterSymbol
(
fun
);
if
(
ast
->
ctor_initializer
)
{
bool
looksLikeCtor
=
false
;
if
(
ty
.
isValid
()
||
!
fun
->
identity
())
looksLikeCtor
=
false
;
else
if
(
fun
->
identity
()
->
isNameId
()
||
fun
->
identity
()
->
isTemplateNameId
())
looksLikeCtor
=
true
;
if
(
!
looksLikeCtor
)
{
translationUnit
()
->
error
(
ast
->
ctor_initializer
->
firstToken
(),
"only constructors take base initializers"
);
if
(
!
semantic
()
->
skipFunctionBodies
())
{
if
(
ast
->
ctor_initializer
)
{
bool
looksLikeCtor
=
false
;
if
(
ty
.
isValid
()
||
!
fun
->
identity
())
looksLikeCtor
=
false
;
else
if
(
fun
->
identity
()
->
isNameId
()
||
fun
->
identity
()
->
isTemplateNameId
())
looksLikeCtor
=
true
;
if
(
!
looksLikeCtor
)
{
translationUnit
()
->
error
(
ast
->
ctor_initializer
->
firstToken
(),
"only constructors take base initializers"
);
}
}
}
const
int
previousVisibility
=
semantic
()
->
switchVisibility
(
Symbol
::
Public
);
const
int
previousMethodKey
=
semantic
()
->
switchMethodKey
(
Function
::
NormalMethod
);
const
int
previousVisibility
=
semantic
()
->
switchVisibility
(
Symbol
::
Public
);
const
int
previousMethodKey
=
semantic
()
->
switchMethodKey
(
Function
::
NormalMethod
);
semantic
()
->
check
(
ast
->
function_body
,
fun
->
members
());
semantic
()
->
check
(
ast
->
function_body
,
fun
->
members
());
semantic
()
->
switchMethodKey
(
previousMethodKey
);
semantic
()
->
switchVisibility
(
previousVisibility
);
semantic
()
->
switchMethodKey
(
previousMethodKey
);
semantic
()
->
switchVisibility
(
previousVisibility
);
}
return
false
;
}
...
...
src/shared/cplusplus/Semantic.cpp
View file @
fd8cd69a
...
...
@@ -67,6 +67,7 @@ public:
Data
(
Semantic
*
semantic
,
Control
*
control
)
:
semantic
(
semantic
),
control
(
control
),
skipFunctionBodies
(
false
),
visibility
(
Symbol
::
Public
),
methodKey
(
Function
::
NormalMethod
),
checkSpecifier
(
0
),
...
...
@@ -89,6 +90,7 @@ public:
Semantic
*
semantic
;
Control
*
control
;
bool
skipFunctionBodies
;
int
visibility
;
int
methodKey
;
CheckSpecifier
*
checkSpecifier
;
...
...
@@ -142,6 +144,12 @@ Name *Semantic::check(NameAST *name, Scope *scope)
Name
*
Semantic
::
check
(
NestedNameSpecifierAST
*
name
,
Scope
*
scope
)
{
return
d
->
checkName
->
check
(
name
,
scope
);
}
bool
Semantic
::
skipFunctionBodies
()
const
{
return
d
->
skipFunctionBodies
;
}
void
Semantic
::
setSkipFunctionBodies
(
bool
skipFunctionBodies
)
{
d
->
skipFunctionBodies
=
skipFunctionBodies
;
}
int
Semantic
::
currentVisibility
()
const
{
return
d
->
visibility
;
}
...
...
src/shared/cplusplus/Semantic.h
View file @
fd8cd69a
...
...
@@ -84,6 +84,9 @@ public:
Name
*
check
(
NestedNameSpecifierAST
*
name
,
Scope
*
scope
);
bool
skipFunctionBodies
()
const
;
void
setSkipFunctionBodies
(
bool
skipFunctionBodies
);
int
currentVisibility
()
const
;
int
switchVisibility
(
int
visibility
);
...
...
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