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
e333adb1
Kaydet (Commit)
e333adb1
authored
Eyl 12, 2014
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
loplugin:salbool: exclude sal_Bool vars passed to non-const ref
Change-Id: I45b323b326cc56cfc48e0abaa52d51fd86adbf79
üst
86aed3ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
salbool.cxx
compilerplugins/clang/salbool.cxx
+47
-0
No files found.
compilerplugins/clang/salbool.cxx
Dosyayı görüntüle @
e333adb1
...
@@ -119,6 +119,8 @@ public:
...
@@ -119,6 +119,8 @@ public:
bool
VisitUnaryAddrOf
(
UnaryOperator
const
*
op
);
bool
VisitUnaryAddrOf
(
UnaryOperator
const
*
op
);
bool
VisitCallExpr
(
CallExpr
*
expr
);
bool
VisitCStyleCastExpr
(
CStyleCastExpr
*
expr
);
bool
VisitCStyleCastExpr
(
CStyleCastExpr
*
expr
);
bool
VisitCXXStaticCastExpr
(
CXXStaticCastExpr
*
expr
);
bool
VisitCXXStaticCastExpr
(
CXXStaticCastExpr
*
expr
);
...
@@ -210,6 +212,51 @@ bool SalBool::VisitUnaryAddrOf(UnaryOperator const * op) {
...
@@ -210,6 +212,51 @@ bool SalBool::VisitUnaryAddrOf(UnaryOperator const * op) {
return
true
;
return
true
;
}
}
bool
SalBool
::
VisitCallExpr
(
CallExpr
*
expr
)
{
Decl
const
*
d
=
expr
->
getCalleeDecl
();
FunctionProtoType
const
*
ft
=
nullptr
;
if
(
d
!=
nullptr
)
{
FunctionDecl
const
*
fd
=
dyn_cast
<
FunctionDecl
>
(
d
);
if
(
fd
!=
nullptr
)
{
PointerType
const
*
pt
=
fd
->
getType
()
->
getAs
<
PointerType
>
();
QualType
t2
(
pt
==
nullptr
?
fd
->
getType
()
:
pt
->
getPointeeType
());
ft
=
t2
->
getAs
<
FunctionProtoType
>
();
assert
(
ft
!=
nullptr
||
!
compiler
.
getLangOpts
().
CPlusPlus
||
(
fd
->
getBuiltinID
()
!=
Builtin
::
NotBuiltin
&&
isa
<
FunctionNoProtoType
>
(
t2
)));
// __builtin_*s have no proto type?
}
else
{
VarDecl
const
*
vd
=
dyn_cast
<
VarDecl
>
(
d
);
if
(
vd
!=
nullptr
)
{
PointerType
const
*
pt
=
vd
->
getType
()
->
getAs
<
PointerType
>
();
ft
=
(
pt
==
nullptr
?
vd
->
getType
()
:
pt
->
getPointeeType
())
->
getAs
<
FunctionProtoType
>
();
}
}
}
if
(
ft
!=
nullptr
)
{
for
(
unsigned
i
=
0
;
i
!=
compat
::
getNumParams
(
*
ft
);
++
i
)
{
QualType
t
(
compat
::
getParamType
(
*
ft
,
i
));
if
(
t
->
isLValueReferenceType
())
{
t
=
t
.
getNonReferenceType
();
if
(
!
t
.
isConstQualified
()
&&
isSalBool
(
t
)
&&
i
<
expr
->
getNumArgs
())
{
DeclRefExpr
*
ref
=
dyn_cast
<
DeclRefExpr
>
(
expr
->
getArg
(
i
));
if
(
ref
!=
nullptr
)
{
VarDecl
const
*
d
=
dyn_cast
<
VarDecl
>
(
ref
->
getDecl
());
if
(
d
!=
nullptr
)
{
varDecls_
.
erase
(
d
);
}
}
}
}
}
}
return
true
;
}
bool
SalBool
::
VisitCStyleCastExpr
(
CStyleCastExpr
*
expr
)
{
bool
SalBool
::
VisitCStyleCastExpr
(
CStyleCastExpr
*
expr
)
{
if
(
ignoreLocation
(
expr
))
{
if
(
ignoreLocation
(
expr
))
{
return
true
;
return
true
;
...
...
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