@@ -63,103 +63,6 @@ struct ScopeInfo2 {
6363
6464enum class TokenDebug : std::uint8_t { None, ValueFlow, ValueType };
6565
66- // TODO: move these to Token when TokenImpl has been moved into the implementation
67- enum CppcheckAttributesType : std::uint8_t { LOW, HIGH };
68- enum class Cpp11init : std::uint8_t { UNKNOWN, CPP11INIT, NOINIT };
69-
70- struct TokenImpl {
71- nonneg int mVarId {};
72- nonneg int mFileIndex {};
73- nonneg int mLineNumber {};
74- nonneg int mColumn {};
75- nonneg int mExprId {};
76-
77- // original template argument location
78- int mTemplateArgFileIndex {-1 };
79- int mTemplateArgLineNumber {-1 };
80- int mTemplateArgColumn {-1 };
81-
82- /* *
83- * A value from 0-100 that provides a rough idea about where in the token
84- * list this token is located.
85- */
86- nonneg int mProgressValue {};
87-
88- /* *
89- * Token index. Position in token list
90- */
91- nonneg int mIndex {};
92-
93- /* * Bitfield bit count. */
94- short mBits = -1 ;
95-
96- // AST..
97- Token* mAstOperand1 {};
98- Token* mAstOperand2 {};
99- Token* mAstParent {};
100-
101- // symbol database information
102- const Scope* mScope {};
103- union {
104- const Function *mFunction ;
105- const Variable *mVariable ;
106- const ::Type* mType ;
107- const Enumerator *mEnumerator ;
108- };
109-
110- // original name like size_t
111- std::string* mOriginalName {};
112-
113- // If this token came from a macro replacement list, this is the name of that macro
114- std::string* mMacroName {};
115-
116- // ValueType
117- ValueType* mValueType {};
118-
119- // ValueFlow
120- std::list<ValueFlow::Value>* mValues {};
121-
122- // Pointer to a template in the template simplifier
123- std::set<TemplateSimplifier::TokenAndName*>* mTemplateSimplifierPointers {};
124-
125- // Pointer to the object representing this token's scope
126- std::shared_ptr<ScopeInfo2> mScopeInfo ;
127-
128- // __cppcheck_in_range__
129- struct CppcheckAttributes {
130- CppcheckAttributesType type{LOW};
131- MathLib::bigint value{};
132- CppcheckAttributes* next{};
133- };
134- CppcheckAttributes* mCppcheckAttributes {};
135-
136- // alignas expressions
137- std::unique_ptr<std::vector<std::string>> mAttributeAlignas ;
138- void addAttributeAlignas (const std::string& a) {
139- if (!mAttributeAlignas )
140- mAttributeAlignas = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
141- if (std::find (mAttributeAlignas ->cbegin (), mAttributeAlignas ->cend (), a) == mAttributeAlignas ->cend ())
142- mAttributeAlignas ->push_back (a);
143- }
144-
145- std::string mAttributeCleanup ;
146-
147- // For memoization, to speed up parsing of huge arrays #8897
148- Cpp11init mCpp11init {Cpp11init::UNKNOWN};
149-
150- TokenDebug mDebug {};
151-
152- void setCppcheckAttribute (CppcheckAttributesType type, MathLib::bigint value);
153- bool getCppcheckAttribute (CppcheckAttributesType type, MathLib::bigint &value) const ;
154-
155- TokenImpl () : mFunction (nullptr ) {}
156-
157- ~TokenImpl ();
158-
159- TokenImpl (const TokenImpl &) = delete ;
160- TokenImpl operator =(const TokenImpl &) = delete ;
161- };
162-
16366// / @addtogroup Core
16467// / @{
16568
@@ -176,7 +79,104 @@ struct TokenImpl {
17679class CPPCHECKLIB Token {
17780 friend class TestToken ;
17881
82+ public:
83+ enum CppcheckAttributesType : std::uint8_t { LOW, HIGH };
84+ enum class Cpp11init : std::uint8_t { UNKNOWN, CPP11INIT, NOINIT };
85+
17986private:
87+ struct Impl {
88+ nonneg int mVarId {};
89+ nonneg int mFileIndex {};
90+ nonneg int mLineNumber {};
91+ nonneg int mColumn {};
92+ nonneg int mExprId {};
93+
94+ // original template argument location
95+ int mTemplateArgFileIndex {-1 };
96+ int mTemplateArgLineNumber {-1 };
97+ int mTemplateArgColumn {-1 };
98+
99+ /* *
100+ * A value from 0-100 that provides a rough idea about where in the token
101+ * list this token is located.
102+ */
103+ nonneg int mProgressValue {};
104+
105+ /* *
106+ * Token index. Position in token list
107+ */
108+ nonneg int mIndex {};
109+
110+ /* * Bitfield bit count. */
111+ short mBits = -1 ;
112+
113+ // AST..
114+ Token* mAstOperand1 {};
115+ Token* mAstOperand2 {};
116+ Token* mAstParent {};
117+
118+ // symbol database information
119+ const Scope* mScope {};
120+ union {
121+ const Function *mFunction ;
122+ const Variable *mVariable ;
123+ const ::Type* mType ;
124+ const Enumerator *mEnumerator ;
125+ };
126+
127+ // original name like size_t
128+ std::string* mOriginalName {};
129+
130+ // If this token came from a macro replacement list, this is the name of that macro
131+ std::string* mMacroName {};
132+
133+ // ValueType
134+ ValueType* mValueType {};
135+
136+ // ValueFlow
137+ std::list<ValueFlow::Value>* mValues {};
138+
139+ // Pointer to a template in the template simplifier
140+ std::set<TemplateSimplifier::TokenAndName*>* mTemplateSimplifierPointers {};
141+
142+ // Pointer to the object representing this token's scope
143+ std::shared_ptr<ScopeInfo2> mScopeInfo ;
144+
145+ // __cppcheck_in_range__
146+ struct CppcheckAttributes {
147+ CppcheckAttributesType type{LOW};
148+ MathLib::bigint value{};
149+ CppcheckAttributes* next{};
150+ };
151+ CppcheckAttributes* mCppcheckAttributes {};
152+
153+ // alignas expressions
154+ std::unique_ptr<std::vector<std::string>> mAttributeAlignas ;
155+ void addAttributeAlignas (const std::string& a) {
156+ if (!mAttributeAlignas )
157+ mAttributeAlignas = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
158+ if (std::find (mAttributeAlignas ->cbegin (), mAttributeAlignas ->cend (), a) == mAttributeAlignas ->cend ())
159+ mAttributeAlignas ->push_back (a);
160+ }
161+
162+ std::string mAttributeCleanup ;
163+
164+ // For memoization, to speed up parsing of huge arrays #8897
165+ Cpp11init mCpp11init {Cpp11init::UNKNOWN};
166+
167+ TokenDebug mDebug {};
168+
169+ void setCppcheckAttribute (CppcheckAttributesType type, MathLib::bigint value);
170+ bool getCppcheckAttribute (CppcheckAttributesType type, MathLib::bigint &value) const ;
171+
172+ Impl () : mFunction (nullptr ) {}
173+
174+ ~Impl ();
175+
176+ Impl (const Impl &) = delete ;
177+ Impl operator =(const Impl &) = delete ;
178+ };
179+
180180 const TokenList& mList ;
181181 std::shared_ptr<TokensFrontBack> mTokensFrontBack ;
182182
@@ -1503,7 +1503,7 @@ class CPPCHECKLIB Token {
15031503
15041504 uint64_t mFlags {};
15051505
1506- TokenImpl * mImpl {};
1506+ Impl * mImpl {};
15071507
15081508 /* *
15091509 * Get specified flag state.
0 commit comments