Commit dbd3e82f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Run clang-tidy on CI

Only with the performance- checks enabled for now
parent 7b9aa28e
Pipeline #67416 passed with stages
in 13 minutes and 10 seconds
......@@ -9,7 +9,7 @@ before_script:
- echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list
- apt-get update
- apt-get build-dep --yes --no-install-recommends poppler
- apt-get install --yes --no-install-recommends ninja-build libcurl4-openssl-dev git ca-certificates locales libc++-dev libc++abi-dev clang libgtk-3-dev
- apt-get install --yes --no-install-recommends ninja-build libcurl4-openssl-dev git ca-certificates locales libc++-dev libc++abi-dev clang libgtk-3-dev clang-tidy
- echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
- locale-gen
......@@ -40,7 +40,7 @@ build_clang_libcpp:
script:
- git clone --branch ${CI_COMMIT_REF_NAME} --depth 1 ${TEST_DATA_URL} test-data || git clone --depth 1 ${UPSTREAM_TEST_DATA_URL} test-data
- mkdir -p build && cd build
- CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data ..
- CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*;-warnings-as-errors=*" ..
- ninja
- ctest --output-on-failure
......
......@@ -173,7 +173,7 @@ destination::destination(destination_private *dd)
/**
Move constructor.
*/
destination::destination(destination &&other)
destination::destination(destination &&other) noexcept
{
*this = std::move(other);
}
......@@ -270,7 +270,7 @@ bool destination::is_change_zoom() const
/**
Move assignment operator.
*/
destination& destination::operator=(destination &&other)
destination& destination::operator=(destination &&other) noexcept
{
if (this != &other) {
d = other.d;
......
/*
* Copyright (C) 2019, Masamichi Hosoda <trueroad@trueroad.jp>
* Copyright (C) 2019, Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -41,7 +42,7 @@ public:
};
~destination();
destination(destination &&other);
destination(destination &&other) noexcept;
type_enum type() const;
int page_number() const;
......@@ -54,7 +55,7 @@ public:
bool is_change_top() const;
bool is_change_zoom() const;
destination& operator=(destination &&other);
destination& operator=(destination &&other) noexcept;
private:
destination(destination_private *dd);
......
/*
* Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
* Copyright (C) 2017, 2018, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2017-2019, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2017, Jason Alan Palmer <jalanpalmer@gmail.com>
* Copyright (C) 2018, Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
* Copyright (C) 2018, Adam Reichold <adam.reichold@t-online.de>
......@@ -300,8 +300,8 @@ text_box_data::~text_box_data() = default;
text_box::~text_box() = default;
text_box& text_box::operator=(text_box&& a) = default;
text_box::text_box(text_box&& a) = default;
text_box& text_box::operator=(text_box&& a) noexcept = default;
text_box::text_box(text_box&& a) noexcept = default;
text_box::text_box(text_box_data *data) : m_data{data}
{
......
/*
* Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
* Copyright (C) 2018, Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
* Copyright (C) 2018, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2018, 2019, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath@gmail.com>
* Copyright (C) 2018, Aleksey Nikolaev <nae202@gmail.com>
*
......@@ -36,8 +36,8 @@ class POPPLER_CPP_EXPORT text_box
{
friend class page;
public:
text_box(text_box&&);
text_box& operator=(text_box&&);
text_box(text_box&&) noexcept;
text_box& operator=(text_box&&) noexcept;
~text_box();
......
......@@ -5,7 +5,7 @@
// This file is licensed under the GPLv2 or later
//
// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
// Copyright 2018 Albert Astals Cid <aacid@kde.org>
// Copyright 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2018 Oliver Sander <oliver.sander@tu-dresden.de>
//
//========================================================================
......@@ -21,14 +21,14 @@ X509CertificateInfo::PublicKeyInfo::PublicKeyInfo() :
{
}
X509CertificateInfo::PublicKeyInfo::PublicKeyInfo(X509CertificateInfo::PublicKeyInfo &&other)
X509CertificateInfo::PublicKeyInfo::PublicKeyInfo(X509CertificateInfo::PublicKeyInfo &&other) noexcept
{
publicKey = std::move(other.publicKey);
publicKeyType = other.publicKeyType;
publicKeyStrength = other.publicKeyStrength;
}
X509CertificateInfo::PublicKeyInfo &X509CertificateInfo::PublicKeyInfo::operator=(X509CertificateInfo::PublicKeyInfo &&other)
X509CertificateInfo::PublicKeyInfo &X509CertificateInfo::PublicKeyInfo::operator=(X509CertificateInfo::PublicKeyInfo &&other) noexcept
{
publicKey = std::move(other.publicKey);
publicKeyType = other.publicKeyType;
......@@ -40,9 +40,18 @@ X509CertificateInfo::EntityInfo::EntityInfo() = default;
X509CertificateInfo::EntityInfo::~EntityInfo() = default;
X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) = default;
X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) noexcept = default;
X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) = default;
// TODO when we stop supporting gcc 5.4 use this instead of the manually defined one
// X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) noexcept = default;
X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) noexcept
{
commonName = std::move(other.commonName);
distinguishedName = std::move(other.distinguishedName);
email = std::move(other.email);
organization = std::move(other.organization);
return *this;
}
X509CertificateInfo::X509CertificateInfo() :
ku_extensions(KU_NONE),
......
......@@ -5,7 +5,7 @@
// This file is licensed under the GPLv2 or later
//
// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
// Copyright 2018 Albert Astals Cid <aacid@kde.org>
// Copyright 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2018 Oliver Sander <oliver.sander@tu-dresden.de>
//
//========================================================================
......@@ -46,8 +46,8 @@ public:
struct PublicKeyInfo {
PublicKeyInfo();
PublicKeyInfo(PublicKeyInfo &&);
PublicKeyInfo &operator=(PublicKeyInfo &&);
PublicKeyInfo(PublicKeyInfo &&) noexcept;
PublicKeyInfo &operator=(PublicKeyInfo &&) noexcept;
PublicKeyInfo(const PublicKeyInfo &) = delete;
PublicKeyInfo &operator=(const PublicKeyInfo &) = delete;
......@@ -61,8 +61,8 @@ public:
EntityInfo();
~EntityInfo();
EntityInfo(EntityInfo &&);
EntityInfo &operator=(EntityInfo &&);
EntityInfo(EntityInfo &&) noexcept;
EntityInfo &operator=(EntityInfo &&) noexcept;
EntityInfo(const EntityInfo &) = delete;
EntityInfo &operator=(const EntityInfo &) = delete;
......
......@@ -183,13 +183,13 @@ public:
template<typename T> Object(T) = delete;
Object(Object&& other)
Object(Object&& other) noexcept
{
std::memcpy(reinterpret_cast<void*>(this), &other, sizeof(Object));
other.type = objDead;
}
Object& operator=(Object&& other)
Object& operator=(Object&& other) noexcept
{
free();
......
......@@ -473,7 +473,7 @@ bool PDFDoc::checkEncryption(const GooString *ownerPassword, const GooString *us
static PDFSubtypePart pdfPartFromString(PDFSubtype subtype, GooString *pdfSubtypeVersion) {
const std::regex regex("PDF/(?:A|X|VT|E|UA)-([[:digit:]])(?:[[:alpha:]]{1,2})?:?([[:digit:]]{4})?");
std::smatch match;
std::string pdfsubver = pdfSubtypeVersion->toStr();
const std::string &pdfsubver = pdfSubtypeVersion->toStr();
PDFSubtypePart subtypePart = subtypePartNone;
if (std::regex_search(pdfsubver, match, regex)) {
......@@ -533,7 +533,7 @@ static PDFSubtypePart pdfPartFromString(PDFSubtype subtype, GooString *pdfSubtyp
static PDFSubtypeConformance pdfConformanceFromString(GooString *pdfSubtypeVersion) {
const std::regex regex("PDF/(?:A|X|VT|E|UA)-[[:digit:]]([[:alpha:]]+)");
std::smatch match;
const std::string pdfsubver = pdfSubtypeVersion->toStr();
const std::string &pdfsubver = pdfSubtypeVersion->toStr();
PDFSubtypeConformance pdfConf = subtypeConfNone;
// match contains the PDF conformance (A, B, G, N, P, PG or U)
......
......@@ -1244,7 +1244,7 @@ void Annotation::storeBaseAnnotationProperties( QDomNode & annNode, QDomDocument
bE.setAttribute( QStringLiteral("b"), QString::number( (double)brect.bottom() ) );
// Sub-Node-2 - penStyle
const QVector<double> dashArray = s.dashArray();
const QVector<double> &dashArray = s.dashArray();
if ( s.width() != 1 || s.lineStyle() != Solid || s.xCorners() != 0 ||
s.yCorners() != 0.0 || dashArray.size() != 1 || dashArray[0] != 3 )
{
......
......@@ -434,7 +434,7 @@ class LinkMoviePrivate : public LinkPrivate
: Link( *new LinkGotoPrivate( linkArea, destination ) )
{
Q_D( LinkGoto );
d->extFileName = extFileName;
d->extFileName = std::move(extFileName); // TODO remove when extFileName moves to be a const &
}
LinkGoto::~LinkGoto()
......
......@@ -2,6 +2,7 @@
*
* Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
* Copyright (C) 2019 Oliver Sander <oliver.sander@tu-dresden.de>
* Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -50,12 +51,12 @@ OutlineItem &OutlineItem::operator=(const OutlineItem &other)
return *this;
}
OutlineItem::OutlineItem(OutlineItem &&other) : m_data{other.m_data}
OutlineItem::OutlineItem(OutlineItem &&other) noexcept : m_data{other.m_data}
{
other.m_data = nullptr;
}
OutlineItem &OutlineItem::operator=(OutlineItem &&other)
OutlineItem &OutlineItem::operator=(OutlineItem &&other) noexcept
{
qSwap(m_data, other.m_data);
......
......@@ -1006,8 +1006,8 @@ delete it;
OutlineItem(const OutlineItem &other);
OutlineItem &operator=(const OutlineItem &other);
OutlineItem(OutlineItem &&other);
OutlineItem &operator=(OutlineItem &&other);
OutlineItem(OutlineItem &&other) noexcept;
OutlineItem &operator=(OutlineItem &&other) noexcept;
/**
Indicates whether an item is null, i.e. whether it does not represent a valid item in the outline of some PDF document.
......
......@@ -12,7 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2018 Stefan Brüns <stefan.bruens@rwth-aachen.de>
// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
//
// To see a description of the changes please see the Changelog file that
......@@ -69,7 +69,7 @@ SplashPath::SplashPath(SplashPath *path) {
}
}
SplashPath::SplashPath(SplashPath&& path) {
SplashPath::SplashPath(SplashPath&& path) noexcept {
length = path.length;
size = path.size;
pts = path.pts;
......
......@@ -11,7 +11,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2018 Stefan Brüns <stefan.bruens@rwth-aachen.de>
//
// To see a description of the changes please see the Changelog file that
......@@ -75,7 +75,7 @@ public:
SplashPath(const SplashPath&) = delete;
SplashPath& operator=(const SplashPath&) = delete;
SplashPath(SplashPath&& path);
SplashPath(SplashPath&& path) noexcept;
// Append <path> to <this>.
void append(SplashPath *path);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment