Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
7c4d3ea6
Kaydet (Commit)
7c4d3ea6
authored
Eki 09, 2012
tarafından
Luboš Luňák
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
don't check next statement after if body if there's also an else part
Change-Id: I04265acd821187f529562691f35ede93b84368fa
üst
4d3c6a04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
bodynotinblock.cxx
compilerplugins/clang/bodynotinblock.cxx
+7
-2
bodynotinblock.hxx
compilerplugins/clang/bodynotinblock.hxx
+1
-1
No files found.
compilerplugins/clang/bodynotinblock.cxx
Dosyayı görüntüle @
7c4d3ea6
...
@@ -54,7 +54,7 @@ void BodyNotInBlock::traverseStatement( const Stmt* stmt, StmtParents& parents )
...
@@ -54,7 +54,7 @@ void BodyNotInBlock::traverseStatement( const Stmt* stmt, StmtParents& parents )
parents
.
push_back
(
*
it
);
parents
.
push_back
(
*
it
);
if
(
const
IfStmt
*
ifstmt
=
dyn_cast
<
IfStmt
>
(
*
it
))
if
(
const
IfStmt
*
ifstmt
=
dyn_cast
<
IfStmt
>
(
*
it
))
{
{
checkBody
(
ifstmt
->
getThen
(),
parents
,
0
);
checkBody
(
ifstmt
->
getThen
(),
parents
,
0
,
ifstmt
->
getElse
()
!=
NULL
);
checkBody
(
ifstmt
->
getElse
(),
parents
,
0
);
checkBody
(
ifstmt
->
getElse
(),
parents
,
0
);
}
}
else
if
(
const
WhileStmt
*
whilestmt
=
dyn_cast
<
WhileStmt
>
(
*
it
))
else
if
(
const
WhileStmt
*
whilestmt
=
dyn_cast
<
WhileStmt
>
(
*
it
))
...
@@ -70,7 +70,7 @@ void BodyNotInBlock::traverseStatement( const Stmt* stmt, StmtParents& parents )
...
@@ -70,7 +70,7 @@ void BodyNotInBlock::traverseStatement( const Stmt* stmt, StmtParents& parents )
parents
.
pop_back
();
parents
.
pop_back
();
}
}
void
BodyNotInBlock
::
checkBody
(
const
Stmt
*
body
,
const
StmtParents
&
parents
,
int
stmtType
)
void
BodyNotInBlock
::
checkBody
(
const
Stmt
*
body
,
const
StmtParents
&
parents
,
int
stmtType
,
bool
dontGoUp
)
{
{
if
(
body
==
NULL
||
parents
.
size
()
<
2
)
if
(
body
==
NULL
||
parents
.
size
()
<
2
)
return
;
return
;
...
@@ -127,6 +127,11 @@ void BodyNotInBlock::checkBody( const Stmt* body, const StmtParents& parents, in
...
@@ -127,6 +127,11 @@ void BodyNotInBlock::checkBody( const Stmt* body, const StmtParents& parents, in
// make it visible the two statements are not in the same body.
// make it visible the two statements are not in the same body.
if
(
dyn_cast
<
CompoundStmt
>
(
parents
[
parent_pos
]
))
if
(
dyn_cast
<
CompoundStmt
>
(
parents
[
parent_pos
]
))
return
;
return
;
// If the body to be checked is a body of an if statement that has also
// an else part, don't go up, the else is after the body and should make
// it clear the body does not continue there.
if
(
dontGoUp
)
return
;
}
}
}
}
...
...
compilerplugins/clang/bodynotinblock.hxx
Dosyayı görüntüle @
7c4d3ea6
...
@@ -27,7 +27,7 @@ class BodyNotInBlock
...
@@ -27,7 +27,7 @@ class BodyNotInBlock
private
:
private
:
typedef
std
::
vector
<
const
Stmt
*
>
StmtParents
;
typedef
std
::
vector
<
const
Stmt
*
>
StmtParents
;
void
traverseStatement
(
const
Stmt
*
stmt
,
StmtParents
&
parents
);
void
traverseStatement
(
const
Stmt
*
stmt
,
StmtParents
&
parents
);
void
checkBody
(
const
Stmt
*
body
,
const
StmtParents
&
parents
,
int
stmtType
);
void
checkBody
(
const
Stmt
*
body
,
const
StmtParents
&
parents
,
int
stmtType
,
bool
dontGoUp
=
false
);
};
};
}
// namespace
}
// namespace
...
...
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