We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64763f4 commit 4d1e6e0Copy full SHA for 4d1e6e0
CMakeLists.txt
@@ -107,6 +107,7 @@ else()
107
-Wno-unused-macros
108
-Wno-switch-enum
109
-Wno-unknown-pragmas
110
+ -Wsuggest-override
111
)
112
113
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@@ -126,6 +127,12 @@ else()
126
127
#-Wduplicated-cond
128
#-Wduplicated-branches
129
-Wlogical-op
130
+
131
+ #-Wsuggest-attribute=pure
132
+ #-Wsuggest-attribute=const
133
+ #-Wsuggest-attribute=noreturn
134
+ -Wsuggest-final-types
135
+ -Wsuggest-final-methods
136
137
endif()
138
Regex/Common.h
@@ -35,14 +35,14 @@ uint8_t GET_OP_CODE(T *p) noexcept {
35
* escape.
36
*--------------------------------------------------------------------*/
37
template <class R, class Ch>
38
-R literal_escape(Ch ch) noexcept {
+constexpr R literal_escape(Ch ch) noexcept {
39
40
- static const char valid_escape[] = {
+ constexpr char valid_escape[] = {
41
'a', 'b', 'e', 'f', 'n', 'r', 't', 'v', '(', ')', '-', '[', ']', '<',
42
'>', '{', '}', '.', '\\', '|', '^', '$', '*', '+', '?', '&', '\0'
43
};
44
45
- static const char value[] = {
+ constexpr char value[] = {
46
'\a', '\b', 0x1B, // Escape character in ASCII character set.
47
'\f', '\n', '\r', '\t', '\v', '(', ')', '-', '[', ']', '<', '>', '{',
48
'}', '.', '\\', '|', '^', '$', '*', '+', '?', '&', '\0'
Util/include/Util/utils.h
@@ -2,8 +2,10 @@
2
#ifndef UTILS_H_
3
#define UTILS_H_
4
5
+#include <QtGlobal>
6
7
template <int (&F)(int), class Ch>
-int safe_ctype (Ch c) {
8
+constexpr int safe_ctype (Ch c) {
9
return F(static_cast<unsigned char>(c));
10
}
11
src/RangesetTable.cpp
@@ -9,7 +9,7 @@ namespace {
// --------------------------------------------------------------------------
12
-const std::array<uint8_t, N_RANGESETS> rangeset_labels = {
+constexpr std::array<uint8_t, N_RANGESETS> rangeset_labels = {
13
58, 10, 15, 1, 27, 52, 14, 3, 61, 13, 31, 30, 45, 28, 41, 55,
14
33, 20, 62, 34, 42, 18, 57, 47, 24, 49, 19, 50, 25, 38, 40, 2,
15
21, 39, 59, 22, 60, 4, 6, 16, 29, 37, 48, 46, 54, 43, 32, 56,
src/TextArea.cpp
@@ -3204,9 +3204,12 @@ void TextArea::TextDResize(bool widthChanged) {
3204
the top character no longer pointing at a valid line start */
3205
if (continuousWrap_ && wrapMargin_ == 0 && widthChanged) {
3206
const TextCursor oldFirstChar = firstChar_;
3207
- nBufferLines_ = TextDCountLines(buffer_->BufStartOfBuffer(), buffer_->BufEndOfBuffer(), /*startPosIsLineStart=*/true);
+ const TextCursor start = buffer_->BufStartOfBuffer();
3208
+ const TextCursor end = buffer_->BufEndOfBuffer();
3209
3210
+ nBufferLines_ = TextDCountLines(start, end, /*startPosIsLineStart=*/true);
3211
firstChar_ = TextDStartOfLine(firstChar_);
- topLineNum_ = TextDCountLines(buffer_->BufStartOfBuffer(), firstChar_, /*startPosIsLineStart=*/true) + 1;
3212
+ topLineNum_ = TextDCountLines(start, firstChar_, /*startPosIsLineStart=*/true) + 1;
3213
offsetAbsLineNum(oldFirstChar);
3214
3215
src/TextAreaMimeData.h
@@ -13,7 +13,7 @@ class TextAreaMimeData : public QMimeData {
~TextAreaMimeData() override = default;
public:
16
- QStringList formats() const override;
+ QStringList formats() const override final;
17
bool hasFormat(const QString &mimeType) const override;
18
19
protected:
0 commit comments