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
b4c9c0d1
Kaydet (Commit)
b4c9c0d1
authored
Eyl 11, 2017
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More clang::*Type vs. llvm::*Type ambiguities
Change-Id: I21133976793ab018c633dda077029666308526db
üst
5bbfa7ab
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
36 deletions
+40
-36
cstylecast.cxx
compilerplugins/clang/cstylecast.cxx
+3
-3
dyncastvisibility.cxx
compilerplugins/clang/dyncastvisibility.cxx
+2
-2
faileddyncast.cxx
compilerplugins/clang/faileddyncast.cxx
+2
-2
implicitboolconversion.cxx
compilerplugins/clang/implicitboolconversion.cxx
+5
-3
refcounting.cxx
compilerplugins/clang/refcounting.cxx
+10
-10
salbool.cxx
compilerplugins/clang/salbool.cxx
+6
-4
useuniqueptr.cxx
compilerplugins/clang/useuniqueptr.cxx
+1
-1
vclwidgets.cxx
compilerplugins/clang/vclwidgets.cxx
+11
-11
No files found.
compilerplugins/clang/cstylecast.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -26,8 +26,8 @@ bool areSimilar(QualType type1, QualType type2) {
if
(
!
t2
->
isPointerType
())
{
return
false
;
}
auto
t1a
=
t1
->
getAs
<
PointerType
>
();
auto
t2a
=
t2
->
getAs
<
PointerType
>
();
auto
t1a
=
t1
->
getAs
<
clang
::
PointerType
>
();
auto
t2a
=
t2
->
getAs
<
clang
::
PointerType
>
();
t1
=
t1a
->
getPointeeType
().
getTypePtr
();
t2
=
t2a
->
getPointeeType
().
getTypePtr
();
}
else
if
(
t1
->
isMemberPointerType
())
{
...
...
@@ -77,7 +77,7 @@ bool areSimilar(QualType type1, QualType type2) {
QualType
resolvePointers
(
QualType
type
)
{
while
(
type
->
isPointerType
())
{
type
=
type
->
getAs
<
PointerType
>
()
->
getPointeeType
();
type
=
type
->
getAs
<
clang
::
PointerType
>
()
->
getPointeeType
();
}
return
type
;
}
...
...
compilerplugins/clang/dyncastvisibility.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -91,7 +91,7 @@ public:
if
(
auto
const
t
=
td
->
getAs
<
ReferenceType
>
())
{
td
=
t
->
getPointeeType
();
}
while
(
auto
const
t
=
td
->
getAs
<
PointerType
>
())
{
while
(
auto
const
t
=
td
->
getAs
<
clang
::
PointerType
>
())
{
td
=
t
->
getPointeeType
();
}
auto
const
rtd
=
td
->
getAs
<
RecordType
>
();
...
...
@@ -104,7 +104,7 @@ public:
return
true
;
}
auto
ts
=
expr
->
getSubExpr
()
->
getType
();
while
(
auto
const
t
=
ts
->
getAs
<
PointerType
>
())
{
while
(
auto
const
t
=
ts
->
getAs
<
clang
::
PointerType
>
())
{
ts
=
t
->
getPointeeType
();
}
auto
const
rts
=
ts
->
getAs
<
RecordType
>
();
...
...
compilerplugins/clang/faileddyncast.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -22,12 +22,12 @@ bool isAlwaysNull(CXXDynamicCastExpr const * expr) {
QualType
SrcType
=
expr
->
getSubExpr
()
->
getType
();
QualType
DestType
=
expr
->
getType
();
if
(
const
PointerType
*
SrcPTy
=
SrcType
->
getAs
<
PointerType
>
())
{
if
(
const
clang
::
PointerType
*
SrcPTy
=
SrcType
->
getAs
<
clang
::
PointerType
>
())
{
SrcType
=
SrcPTy
->
getPointeeType
();
#if 0
DestType = DestType->castAs<PointerType>()->getPointeeType();
#else
auto
DstPTy
=
DestType
->
getAs
<
PointerType
>
();
auto
DstPTy
=
DestType
->
getAs
<
clang
::
PointerType
>
();
if
(
!
DstPTy
)
return
false
;
DestType
=
DstPTy
->
getPointeeType
();
...
...
compilerplugins/clang/implicitboolconversion.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -412,7 +412,7 @@ bool ImplicitBoolConversion::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr)
=
ignoreParenImpCastAndComma
(
expr
->
getImplicitObjectArgument
())
->
getType
();
if
(
dyn_cast
<
MemberExpr
>
(
expr
->
getCallee
())
->
isArrow
())
{
ty
=
ty
->
getAs
<
PointerType
>
()
->
getPointeeType
();
ty
=
ty
->
getAs
<
clang
::
PointerType
>
()
->
getPointeeType
();
}
TemplateSpecializationType
const
*
ct
=
ty
->
getAs
<
TemplateSpecializationType
>
();
...
...
@@ -913,7 +913,8 @@ bool ImplicitBoolConversion::isExternCFunctionCall(
if
(
d
!=
nullptr
)
{
FunctionDecl
const
*
fd
=
dyn_cast
<
FunctionDecl
>
(
d
);
if
(
fd
!=
nullptr
)
{
PointerType
const
*
pt
=
fd
->
getType
()
->
getAs
<
PointerType
>
();
clang
::
PointerType
const
*
pt
=
fd
->
getType
()
->
getAs
<
clang
::
PointerType
>
();
QualType
t2
(
pt
==
nullptr
?
fd
->
getType
()
:
pt
->
getPointeeType
());
*
functionType
=
t2
->
getAs
<
FunctionProtoType
>
();
assert
(
...
...
@@ -927,7 +928,8 @@ bool ImplicitBoolConversion::isExternCFunctionCall(
}
VarDecl
const
*
vd
=
dyn_cast
<
VarDecl
>
(
d
);
if
(
vd
!=
nullptr
)
{
PointerType
const
*
pt
=
vd
->
getType
()
->
getAs
<
PointerType
>
();
clang
::
PointerType
const
*
pt
=
vd
->
getType
()
->
getAs
<
clang
::
PointerType
>
();
*
functionType
=
((
pt
==
nullptr
?
vd
->
getType
()
:
pt
->
getPointeeType
())
->
getAs
<
FunctionProtoType
>
());
...
...
compilerplugins/clang/refcounting.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -110,16 +110,16 @@ bool isDerivedFrom(const CXXRecordDecl *decl, DeclChecker base) {
}
bool
containsXInterfaceSubclass
(
const
Type
*
pType0
);
bool
containsXInterfaceSubclass
(
const
clang
::
Type
*
pType0
);
bool
containsXInterfaceSubclass
(
const
QualType
&
qType
)
{
return
containsXInterfaceSubclass
(
qType
.
getTypePtr
());
}
bool
containsXInterfaceSubclass
(
const
Type
*
pType0
)
{
bool
containsXInterfaceSubclass
(
const
clang
::
Type
*
pType0
)
{
if
(
!
pType0
)
return
false
;
const
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
const
clang
::
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
if
(
!
pType
)
return
false
;
const
CXXRecordDecl
*
pRecordDecl
=
pType
->
getAsCXXRecordDecl
();
...
...
@@ -229,7 +229,7 @@ bool containsXInterfaceSubclass(const Type* pType0) {
// ignore
return
false
;
}
else
if
(
pType
->
isArrayType
())
{
const
ArrayType
*
pArrayType
=
dyn_cast
<
ArrayType
>
(
pType
);
const
clang
::
ArrayType
*
pArrayType
=
dyn_cast
<
clang
::
ArrayType
>
(
pType
);
QualType
elementType
=
pArrayType
->
getElementType
();
return
containsXInterfaceSubclass
(
elementType
);
}
else
{
...
...
@@ -237,10 +237,10 @@ bool containsXInterfaceSubclass(const Type* pType0) {
}
}
bool
containsSvRefBaseSubclass
(
const
Type
*
pType0
)
{
bool
containsSvRefBaseSubclass
(
const
clang
::
Type
*
pType0
)
{
if
(
!
pType0
)
return
false
;
const
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
const
clang
::
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
if
(
!
pType
)
return
false
;
const
CXXRecordDecl
*
pRecordDecl
=
pType
->
getAsCXXRecordDecl
();
...
...
@@ -269,7 +269,7 @@ bool containsSvRefBaseSubclass(const Type* pType0) {
// ignore
return
false
;
}
else
if
(
pType
->
isArrayType
())
{
const
ArrayType
*
pArrayType
=
dyn_cast
<
ArrayType
>
(
pType
);
const
clang
::
ArrayType
*
pArrayType
=
dyn_cast
<
clang
::
ArrayType
>
(
pType
);
QualType
elementType
=
pArrayType
->
getElementType
();
return
containsSvRefBaseSubclass
(
elementType
.
getTypePtr
());
}
else
{
...
...
@@ -277,10 +277,10 @@ bool containsSvRefBaseSubclass(const Type* pType0) {
}
}
bool
containsSalhelperReferenceObjectSubclass
(
const
Type
*
pType0
)
{
bool
containsSalhelperReferenceObjectSubclass
(
const
clang
::
Type
*
pType0
)
{
if
(
!
pType0
)
return
false
;
const
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
const
clang
::
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
if
(
!
pType
)
return
false
;
const
CXXRecordDecl
*
pRecordDecl
=
pType
->
getAsCXXRecordDecl
();
...
...
@@ -311,7 +311,7 @@ bool containsSalhelperReferenceObjectSubclass(const Type* pType0) {
// ignore
return
false
;
}
else
if
(
pType
->
isArrayType
())
{
const
ArrayType
*
pArrayType
=
dyn_cast
<
ArrayType
>
(
pType
);
const
clang
::
ArrayType
*
pArrayType
=
dyn_cast
<
clang
::
ArrayType
>
(
pType
);
QualType
elementType
=
pArrayType
->
getElementType
();
return
containsSalhelperReferenceObjectSubclass
(
elementType
.
getTypePtr
());
}
else
{
...
...
compilerplugins/clang/salbool.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -262,7 +262,8 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
FunctionDecl
const
*
fd
=
dyn_cast
<
FunctionDecl
>
(
d
);
if
(
fd
!=
nullptr
)
{
if
(
!
hasBoolOverload
(
fd
,
false
))
{
PointerType
const
*
pt
=
fd
->
getType
()
->
getAs
<
PointerType
>
();
clang
::
PointerType
const
*
pt
=
fd
->
getType
()
->
getAs
<
clang
::
PointerType
>
();
QualType
t2
(
pt
==
nullptr
?
fd
->
getType
()
:
pt
->
getPointeeType
());
ft
=
t2
->
getAs
<
FunctionProtoType
>
();
...
...
@@ -275,7 +276,8 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
}
else
{
VarDecl
const
*
vd
=
dyn_cast
<
VarDecl
>
(
d
);
if
(
vd
!=
nullptr
)
{
PointerType
const
*
pt
=
vd
->
getType
()
->
getAs
<
PointerType
>
();
clang
::
PointerType
const
*
pt
=
vd
->
getType
()
->
getAs
<
clang
::
PointerType
>
();
ft
=
(
pt
==
nullptr
?
vd
->
getType
()
:
pt
->
getPointeeType
())
->
getAs
<
FunctionProtoType
>
();
}
...
...
@@ -290,7 +292,7 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
b
=
!
t
.
isConstQualified
()
&&
isSalBool
(
t
);
}
else
if
(
t
->
isPointerType
())
{
for
(;;)
{
auto
t2
=
t
->
getAs
<
PointerType
>
();
auto
t2
=
t
->
getAs
<
clang
::
PointerType
>
();
if
(
t2
==
nullptr
)
{
break
;
}
...
...
@@ -479,7 +481,7 @@ bool SalBool::VisitReturnStmt(ReturnStmt const * stmt) {
return
true
;
}
for
(;;)
{
auto
t2
=
t
->
getAs
<
PointerType
>
();
auto
t2
=
t
->
getAs
<
clang
::
PointerType
>
();
if
(
t2
==
nullptr
)
{
break
;
}
...
...
compilerplugins/clang/useuniqueptr.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -337,7 +337,7 @@ void UseUniquePtr::CheckForDeleteOfPOD(const CompoundStmt* compoundStmt)
if
(
tagDecl
->
isUnion
())
continue
;
auto
pointerType
=
dyn_cast
<
PointerType
>
(
fieldDecl
->
getType
()
->
getUnqualifiedDesugaredType
());
auto
pointerType
=
dyn_cast
<
clang
::
PointerType
>
(
fieldDecl
->
getType
()
->
getUnqualifiedDesugaredType
());
QualType
elementType
=
pointerType
->
getPointeeType
();
auto
tc
=
loplugin
::
TypeCheck
(
elementType
);
if
(
!
elementType
.
isPODType
(
compiler
.
getASTContext
())
...
...
compilerplugins/clang/vclwidgets.cxx
Dosyayı görüntüle @
b4c9c0d1
...
...
@@ -47,7 +47,7 @@ public:
bool
VisitCXXConstructExpr
(
const
CXXConstructExpr
*
);
bool
VisitBinaryOperator
(
const
BinaryOperator
*
);
private
:
void
checkAssignmentForVclPtrToRawConversion
(
const
SourceLocation
&
sourceLoc
,
const
Type
*
lhsType
,
const
Expr
*
rhs
);
void
checkAssignmentForVclPtrToRawConversion
(
const
SourceLocation
&
sourceLoc
,
const
clang
::
Type
*
lhsType
,
const
Expr
*
rhs
);
bool
isDisposeCallingSuperclassDispose
(
const
CXXMethodDecl
*
pMethodDecl
);
bool
mbCheckingMemcpy
=
false
;
};
...
...
@@ -85,7 +85,7 @@ bool isDerivedFromVclReferenceBase(const CXXRecordDecl *decl) {
return
false
;
}
bool
containsVclReferenceBaseSubclass
(
const
Type
*
pType0
);
bool
containsVclReferenceBaseSubclass
(
const
clang
::
Type
*
pType0
);
bool
containsVclReferenceBaseSubclass
(
const
QualType
&
qType
)
{
auto
check
=
loplugin
::
TypeCheck
(
qType
);
...
...
@@ -99,10 +99,10 @@ bool containsVclReferenceBaseSubclass(const QualType& qType) {
return
containsVclReferenceBaseSubclass
(
qType
.
getTypePtr
());
}
bool
containsVclReferenceBaseSubclass
(
const
Type
*
pType0
)
{
bool
containsVclReferenceBaseSubclass
(
const
clang
::
Type
*
pType0
)
{
if
(
!
pType0
)
return
false
;
const
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
const
clang
::
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
if
(
!
pType
)
return
false
;
const
CXXRecordDecl
*
pRecordDecl
=
pType
->
getAsCXXRecordDecl
();
...
...
@@ -132,7 +132,7 @@ bool containsVclReferenceBaseSubclass(const Type* pType0) {
QualType
pointeeType
=
pType
->
getPointeeType
();
return
containsVclReferenceBaseSubclass
(
pointeeType
);
}
else
if
(
pType
->
isArrayType
())
{
const
ArrayType
*
pArrayType
=
dyn_cast
<
ArrayType
>
(
pType
);
const
clang
::
ArrayType
*
pArrayType
=
dyn_cast
<
clang
::
ArrayType
>
(
pType
);
QualType
elementType
=
pArrayType
->
getElementType
();
return
containsVclReferenceBaseSubclass
(
elementType
);
}
else
{
...
...
@@ -276,9 +276,9 @@ bool VCLWidgets::VisitBinaryOperator(const BinaryOperator * binaryOperator)
// Look for places where we are accidentally assigning a returned-by-value VclPtr<T> to a T*, which generally
// ends up in a use-after-free.
void
VCLWidgets
::
checkAssignmentForVclPtrToRawConversion
(
const
SourceLocation
&
spellingLocation
,
const
Type
*
lhsType
,
const
Expr
*
rhs
)
void
VCLWidgets
::
checkAssignmentForVclPtrToRawConversion
(
const
SourceLocation
&
spellingLocation
,
const
clang
::
Type
*
lhsType
,
const
Expr
*
rhs
)
{
if
(
!
lhsType
||
!
isa
<
PointerType
>
(
lhsType
))
{
if
(
!
lhsType
||
!
isa
<
clang
::
PointerType
>
(
lhsType
))
{
return
;
}
if
(
!
rhs
)
{
...
...
@@ -736,7 +736,7 @@ bool VCLWidgets::isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodD
return
true
;
}
bool
containsVclPtr
(
const
Type
*
pType0
);
bool
containsVclPtr
(
const
clang
::
Type
*
pType0
);
bool
containsVclPtr
(
const
QualType
&
qType
)
{
auto
check
=
loplugin
::
TypeCheck
(
qType
);
...
...
@@ -750,16 +750,16 @@ bool containsVclPtr(const QualType& qType) {
return
containsVclPtr
(
qType
.
getTypePtr
());
}
bool
containsVclPtr
(
const
Type
*
pType0
)
{
bool
containsVclPtr
(
const
clang
::
Type
*
pType0
)
{
if
(
!
pType0
)
return
false
;
const
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
const
clang
::
Type
*
pType
=
pType0
->
getUnqualifiedDesugaredType
();
if
(
!
pType
)
return
false
;
if
(
pType
->
isPointerType
())
{
return
false
;
}
else
if
(
pType
->
isArrayType
())
{
const
ArrayType
*
pArrayType
=
dyn_cast
<
ArrayType
>
(
pType
);
const
clang
::
ArrayType
*
pArrayType
=
dyn_cast
<
clang
::
ArrayType
>
(
pType
);
QualType
elementType
=
pArrayType
->
getElementType
();
return
containsVclPtr
(
elementType
);
}
else
{
...
...
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