@@ -121,6 +121,15 @@ struct TokenImpl {
121121 };
122122 CppcheckAttributes* mCppcheckAttributes {};
123123
124+ // alignas expressions
125+ std::unique_ptr<std::vector<std::string>> mAttributeAlignas ;
126+ void addAttributeAlignas (const std::string& a) {
127+ if (!mAttributeAlignas )
128+ mAttributeAlignas = std::unique_ptr<std::vector<std::string>>(new std::vector<std::string>());
129+ if (std::find (mAttributeAlignas ->cbegin (), mAttributeAlignas ->cend (), a) == mAttributeAlignas ->cend ())
130+ mAttributeAlignas ->push_back (a);
131+ }
132+
124133 // For memoization, to speed up parsing of huge arrays #8897
125134 enum class Cpp11init { UNKNOWN, CPP11INIT, NOINIT } mCpp11init = Cpp11init::UNKNOWN;
126135
@@ -533,6 +542,15 @@ class CPPCHECKLIB Token {
533542 void isAttributeMaybeUnused (const bool value) {
534543 setFlag (fIsAttributeMaybeUnused , value);
535544 }
545+ std::vector<std::string> getAttributeAlignas () const {
546+ return mImpl ->mAttributeAlignas ? *mImpl ->mAttributeAlignas : std::vector<std::string>();
547+ }
548+ bool hasAttributeAlignas () const {
549+ return !!mImpl ->mAttributeAlignas ;
550+ }
551+ void addAttributeAlignas (const std::string& a) {
552+ mImpl ->addAttributeAlignas (a);
553+ }
536554 void setCppcheckAttribute (TokenImpl::CppcheckAttributes::Type type, MathLib::bigint value) {
537555 mImpl ->setCppcheckAttribute (type, value);
538556 }
0 commit comments