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
f73284fb
Kaydet (Commit)
f73284fb
authored
Kas 12, 2015
tarafından
Noel Grandin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
new loplugin ptrvector - find bad comparison of container<unique_ptr>
Change-Id: Idb18ae1ca2f7c644680703dc3b7dd3cd6000e040
üst
5493402f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
1 deletion
+83
-1
ptrvector.cxx
compilerplugins/clang/ptrvector.cxx
+81
-0
conditio.cxx
sc/source/core/data/conditio.cxx
+2
-1
No files found.
compilerplugins/clang/ptrvector.cxx
0 → 100644
Dosyayı görüntüle @
f73284fb
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <cassert>
#include <string>
#include <iostream>
#include <fstream>
#include <set>
#include "plugin.hxx"
#include "compat.hxx"
/**
Check for calls to operator== on a std::container< std::unique_ptr >, which is not useful,
because std::container will compare the pointers so it is never true
*/
namespace
{
class
PtrVector
:
public
RecursiveASTVisitor
<
PtrVector
>
,
public
loplugin
::
Plugin
{
public
:
explicit
PtrVector
(
InstantiationData
const
&
data
)
:
Plugin
(
data
)
{}
virtual
void
run
()
override
{
TraverseDecl
(
compiler
.
getASTContext
().
getTranslationUnitDecl
());
}
bool
shouldVisitTemplateInstantiations
()
const
{
return
true
;
}
bool
VisitCXXOperatorCallExpr
(
const
CXXOperatorCallExpr
*
);
};
bool
PtrVector
::
VisitCXXOperatorCallExpr
(
const
CXXOperatorCallExpr
*
expr
)
{
if
(
ignoreLocation
(
expr
))
{
return
true
;
}
if
(
expr
->
getOperator
()
!=
clang
::
OverloadedOperatorKind
::
OO_EqualEqual
&&
expr
->
getOperator
()
!=
clang
::
OverloadedOperatorKind
::
OO_ExclaimEqual
)
{
return
true
;
}
if
(
isa
<
CXXNullPtrLiteralExpr
>
(
expr
->
getArg
(
1
)))
{
return
true
;
}
const
Expr
*
argExpr
=
expr
->
getArg
(
0
);
std
::
string
s
=
argExpr
->
getType
().
getDesugaredType
(
compiler
.
getASTContext
()).
getAsString
();
if
(
s
.
find
(
"iterator"
)
!=
std
::
string
::
npos
)
{
return
true
;
}
if
(
s
.
find
(
"array"
)
==
std
::
string
::
npos
&&
s
.
find
(
"deque"
)
==
std
::
string
::
npos
&&
s
.
find
(
"list"
)
==
std
::
string
::
npos
&&
s
.
find
(
"vector"
)
==
std
::
string
::
npos
&&
s
.
find
(
"set"
)
==
std
::
string
::
npos
&&
s
.
find
(
"map"
)
==
std
::
string
::
npos
&&
s
.
find
(
"stack"
)
==
std
::
string
::
npos
&&
s
.
find
(
"queue"
)
==
std
::
string
::
npos
)
{
return
true
;
}
if
(
s
.
find
(
"unique_ptr"
)
!=
std
::
string
::
npos
)
{
expr
->
getArg
(
1
)
->
dump
();
report
(
DiagnosticsEngine
::
Warning
,
"do not call operator== on a std container containing a unique_ptr "
+
s
,
expr
->
getExprLoc
());
}
return
true
;
}
loplugin
::
Plugin
::
Registration
<
PtrVector
>
X
(
"ptrvector"
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/core/data/conditio.cxx
Dosyayı görüntüle @
f73284fb
...
...
@@ -23,6 +23,7 @@
#include <svl/zforlist.hxx>
#include <rtl/math.hxx>
#include <unotools/collatorwrapper.hxx>
#include <comphelper/stl_types.hxx>
#include <com/sun/star/sheet/ConditionOperator2.hpp>
...
...
@@ -1831,7 +1832,7 @@ bool ScConditionalFormat::EqualEntries( const ScConditionalFormat& r ) const
//TODO: Test for same entries in reverse order?
for
(
size_t
i
=
0
;
i
<
size
();
i
++
)
if
(
!
(
maEntries
==
r
.
maEntries
)
)
if
(
!
::
comphelper
::
ContainerUniquePtrEquals
(
maEntries
,
r
.
maEntries
)
)
return
false
;
// right now don't check for same range
...
...
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