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
e02e0f40
Kaydet (Commit)
e02e0f40
authored
Eki 26, 2017
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use compat::getSubExprAsWritten; clean up
Change-Id: I8f984c3b3833437f6b4d65ab99da608a6868ff74
üst
4c1bfd35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
implicitboolconversion.cxx
compilerplugins/clang/implicitboolconversion.cxx
+20
-19
No files found.
compilerplugins/clang/implicitboolconversion.cxx
Dosyayı görüntüle @
e02e0f40
...
...
@@ -859,29 +859,30 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr(
}
return
true
;
}
ExplicitCastExpr
const
*
sub
=
dyn_cast
<
ExplicitCastExpr
>
(
expr
->
getSubExpr
()
->
IgnoreParenImpCasts
());
if
(
sub
!=
nullptr
&&
(
sub
->
getSubExpr
()
->
IgnoreParenImpCasts
()
->
getType
().
IgnoreParens
()
==
expr
->
getType
().
IgnoreParens
())
&&
isBool
(
sub
->
getSubExpr
()
->
IgnoreParenImpCasts
()))
if
(
auto
const
sub
=
dyn_cast
<
ExplicitCastExpr
>
(
compat
::
getSubExprAsWritten
(
expr
)))
{
// Ignore "normalizing cast" bool(b) from sal_Bool b to bool, then
// implicitly cast back again to sal_Bool:
if
(
dyn_cast
<
CXXFunctionalCastExpr
>
(
sub
)
!=
nullptr
&&
sub
->
getType
()
->
isBooleanType
()
&&
isSalBool
(
expr
->
getType
())
&&
isSalBool
(
sub
->
getSubExpr
()
->
IgnoreParenImpCasts
()
->
getType
()))
auto
const
subsub
=
compat
::
getSubExprAsWritten
(
sub
);
if
(
subsub
->
getType
().
IgnoreParens
()
==
expr
->
getType
().
IgnoreParens
()
&&
isBool
(
subsub
))
{
// Ignore "normalizing cast" bool(b) from sal_Bool b to bool, then
// implicitly cast back again to sal_Bool:
if
(
dyn_cast
<
CXXFunctionalCastExpr
>
(
sub
)
!=
nullptr
&&
sub
->
getType
()
->
isBooleanType
()
&&
isSalBool
(
expr
->
getType
())
&&
isSalBool
(
subsub
->
getType
()))
{
return
true
;
}
report
(
DiagnosticsEngine
::
Warning
,
(
"explicit conversion (%0) from %1 to %2 implicitly cast back"
" to %3"
),
expr
->
getLocStart
())
<<
sub
->
getCastKindName
()
<<
subsub
->
getType
()
<<
sub
->
getType
()
<<
expr
->
getType
()
<<
expr
->
getSourceRange
();
return
true
;
}
report
(
DiagnosticsEngine
::
Warning
,
"explicit conversion (%0) from %1 to %2 implicitly cast back to %3"
,
expr
->
getLocStart
())
<<
sub
->
getCastKindName
()
<<
sub
->
getSubExpr
()
->
IgnoreParenImpCasts
()
->
getType
()
<<
sub
->
getType
()
<<
expr
->
getType
()
<<
expr
->
getSourceRange
();
return
true
;
}
if
(
expr
->
getType
()
->
isBooleanType
()
&&
!
isBoolExpr
(
expr
->
getSubExpr
())
&&
!
calls
.
empty
())
...
...
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