summaryrefslogtreecommitdiff
path: root/src/plugins/scanner/cpp/Token.h
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-04-04 14:43:49 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2020-04-27 10:07:51 +0000
commitfbbddb1b67ab30b1c73a9ff1ae41ee5e344c0197 (patch)
tree78f1b6a5c82d2893f737f82699f27a7d1374e017 /src/plugins/scanner/cpp/Token.h
parent37c992559fc79fd73828b653f80d0f2c3234568f (diff)
downloadqbs-fbbddb1b67ab30b1c73a9ff1ae41ee5e344c0197.tar.gz
clang-tidy: Fix 'cppcoreguidelines-pro-type-member-init' warnings
Also, fix undefined behavior when setting and reading different field of a union (Lexer, Token) - according to the C++ Standard, it is not allowed to use a union to zero members of a struct. Treat these warnings as errors now. Change-Id: I0f6d071217ef55e2c75c51138fcff47048eca62f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/scanner/cpp/Token.h')
-rw-r--r--src/plugins/scanner/cpp/Token.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/plugins/scanner/cpp/Token.h b/src/plugins/scanner/cpp/Token.h
index 846aa5a12..a042c1087 100644
--- a/src/plugins/scanner/cpp/Token.h
+++ b/src/plugins/scanner/cpp/Token.h
@@ -295,9 +295,6 @@ enum Kind {
class CPLUSPLUS_EXPORT Token
{
public:
- Token();
- ~Token();
-
inline bool is(unsigned k) const { return f.kind == k; }
inline bool isNot(unsigned k) const { return f.kind != k; }
#ifndef CPLUSPLUS_NO_PARSER
@@ -348,15 +345,12 @@ public:
unsigned pad : 3;
unsigned length : 16;
};
- union {
- unsigned flags;
- Flags f;
- };
+ Flags f{};
unsigned offset = 0;
union {
- void *ptr;
+ void *ptr = nullptr;
#ifndef CPLUSPLUS_NO_PARSER
const Literal *literal;
const NumericLiteral *number;