Run clang-tidy on CI

Only with the performance- checks enabled for now
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 47991d4..71b4e5c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@
   - 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 @@
   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
 
diff --git a/cpp/poppler-destination.cpp b/cpp/poppler-destination.cpp
index eb95581..e74da58 100644
--- a/cpp/poppler-destination.cpp
+++ b/cpp/poppler-destination.cpp
@@ -173,7 +173,7 @@
 /**
  Move constructor.
  */
-destination::destination(destination &&other)
+destination::destination(destination &&other) noexcept
 {
     *this = std::move(other);
 }
@@ -270,7 +270,7 @@
 /**
  Move assignment operator.
  */
-destination& destination::operator=(destination &&other)
+destination& destination::operator=(destination &&other) noexcept
 {
     if (this != &other) {
         d = other.d;
diff --git a/cpp/poppler-destination.h b/cpp/poppler-destination.h
index 964c1b5..7036b0b 100644
--- a/cpp/poppler-destination.h
+++ b/cpp/poppler-destination.h
@@ -1,5 +1,6 @@
 /*
  * 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 @@
     };
 
     ~destination();
-    destination(destination &&other);
+    destination(destination &&other) noexcept;
 
     type_enum type() const;
     int page_number() const;
@@ -54,7 +55,7 @@
     bool is_change_top() const;
     bool is_change_zoom() const;
 
-    destination& operator=(destination &&other);
+    destination& operator=(destination &&other) noexcept;
 
 private:
     destination(destination_private *dd);
diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp
index 426f0db..1f76758 100644
--- a/cpp/poppler-page.cpp
+++ b/cpp/poppler-page.cpp
@@ -1,6 +1,6 @@
 /*
  * 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::~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}
 {
diff --git a/cpp/poppler-page.h b/cpp/poppler-page.h
index a7dcc87..bd7f1fc 100644
--- a/cpp/poppler-page.h
+++ b/cpp/poppler-page.h
@@ -1,7 +1,7 @@
 /*
  * 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 @@
 {
     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();
 
diff --git a/poppler/CertificateInfo.cc b/poppler/CertificateInfo.cc
index c33705c..70aff81 100644
--- a/poppler/CertificateInfo.cc
+++ b/poppler/CertificateInfo.cc
@@ -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 &&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(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),
diff --git a/poppler/CertificateInfo.h b/poppler/CertificateInfo.h
index ec51e72..fde3b0d 100644
--- a/poppler/CertificateInfo.h
+++ b/poppler/CertificateInfo.h
@@ -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 @@
   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 @@
     EntityInfo();
     ~EntityInfo();
 
-    EntityInfo(EntityInfo &&);
-    EntityInfo &operator=(EntityInfo &&);
+    EntityInfo(EntityInfo &&) noexcept;
+    EntityInfo &operator=(EntityInfo &&) noexcept;
 
     EntityInfo(const EntityInfo &) = delete;
     EntityInfo &operator=(const EntityInfo &) = delete;
diff --git a/poppler/Object.h b/poppler/Object.h
index 2dbc9e9..77ae34b 100644
--- a/poppler/Object.h
+++ b/poppler/Object.h
@@ -183,13 +183,13 @@
 
   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();
 
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index dd619c6..60defc2 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -473,7 +473,7 @@
 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 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)
diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc
index 5f23782..bb5be98 100644
--- a/qt5/src/poppler-annotation.cc
+++ b/qt5/src/poppler-annotation.cc
@@ -1244,7 +1244,7 @@
     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 )
     {
diff --git a/qt5/src/poppler-link.cc b/qt5/src/poppler-link.cc
index f2d1655..d473094 100644
--- a/qt5/src/poppler-link.cc
+++ b/qt5/src/poppler-link.cc
@@ -434,7 +434,7 @@
 		: 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()
diff --git a/qt5/src/poppler-outline.cc b/qt5/src/poppler-outline.cc
index ad83139..dd452b4 100644
--- a/qt5/src/poppler-outline.cc
+++ b/qt5/src/poppler-outline.cc
@@ -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 @@
   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);
 
diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h
index 847671e..1460690 100644
--- a/qt5/src/poppler-qt5.h
+++ b/qt5/src/poppler-qt5.h
@@ -1006,8 +1006,8 @@
       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.
diff --git a/splash/SplashPath.cc b/splash/SplashPath.cc
index 163ab77..32bbd4f 100644
--- a/splash/SplashPath.cc
+++ b/splash/SplashPath.cc
@@ -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) noexcept {
   length = path.length;
   size = path.size;
   pts = path.pts;
diff --git a/splash/SplashPath.h b/splash/SplashPath.h
index e20d533..95514b4 100644
--- a/splash/SplashPath.h
+++ b/splash/SplashPath.h
@@ -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 @@
 
   SplashPath(const SplashPath&) = delete;
   SplashPath& operator=(const SplashPath&) = delete;
-  SplashPath(SplashPath&& path);
+  SplashPath(SplashPath&& path) noexcept;
 
   // Append <path> to <this>.
   void append(SplashPath *path);