From bfdcbf861fc06fc1616ac029e766276e61315b04 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 4 Apr 2018 09:07:16 +0200 Subject: Clang: Fix parse errors in clazy/tidy demo project ...otherwise not all intended diagnostics can be demonstrated. Change-Id: I2f69862cc6c8a2e58059d9075ad6fd7c7e72b4a5 Reviewed-by: Ivan Donchevskii --- share/qtcreator/cplusplus/examples/clazy_example.cpp | 7 +++++-- share/qtcreator/cplusplus/examples/tidy_example.cpp | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'share') diff --git a/share/qtcreator/cplusplus/examples/clazy_example.cpp b/share/qtcreator/cplusplus/examples/clazy_example.cpp index 9d48f1bb7ba..3fef3cb8a5a 100644 --- a/share/qtcreator/cplusplus/examples/clazy_example.cpp +++ b/share/qtcreator/cplusplus/examples/clazy_example.cpp @@ -42,7 +42,7 @@ class TestObject : public QObject public: TestObject(); - TestObject(const TestObject& other); + TestObject(const TestObject& other) {} bool event(QEvent *event) override { @@ -51,7 +51,7 @@ public: } public slots: - void someSlot(); + void someSlot() {} // -Wclazy-function-args-by-value void someOtherSlot(const QPoint &point) @@ -136,3 +136,6 @@ TestObject::TestObject() // -Wclazy-qstring-arg QString("%1 %2").arg("1").arg("2"); } + +// Note: A fatal error like an unresolved include will make clazy stop emitting any diagnostics. +// #include "clazy_example.moc" diff --git a/share/qtcreator/cplusplus/examples/tidy_example.cpp b/share/qtcreator/cplusplus/examples/tidy_example.cpp index 3d094608183..dc921114ea1 100644 --- a/share/qtcreator/cplusplus/examples/tidy_example.cpp +++ b/share/qtcreator/cplusplus/examples/tidy_example.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "tidy_example.h" @@ -57,11 +59,11 @@ nb::A a; class Base { public: - Base(); + Base() {} // google-explicit-constructor - Base(int arg); - virtual ~Base(); + Base(int arg) {} + virtual ~Base() = default; Base(const Base &) = default; Base(Base &&) = default; @@ -175,7 +177,7 @@ public: } // cppcoreguidelines-pro-type-reinterpret-cast - return a + c + reinterpret_cast(&val); + return a + c + reinterpret_cast(&val); } }; -- cgit v1.2.3