@@ -61,7 +61,7 @@ static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader)
6161 if (elementName == " type" ) {
6262 container.type .templateParameter = xmlReader.attributes ().value (" templateParameter" ).toString ();
6363 container.type .string = xmlReader.attributes ().value (" string" ).toString ();
64- } else if (elementName == " size" || elementName == " access" || elementName == " other" ) {
64+ } else if (elementName == " size" || elementName == " access" || elementName == " other" || elementName == " rangeItemRecordType " ) {
6565 const QString indexOperator = xmlReader.attributes ().value (" indexOperator" ).toString ();
6666 if (elementName == " access" && indexOperator == " array-like" )
6767 container.access_arrayLike = true ;
@@ -82,7 +82,12 @@ static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader)
8282 container.sizeFunctions .append (function);
8383 else if (elementName == " access" )
8484 container.accessFunctions .append (function);
85- else
85+ else if (elementName == " rangeItemRecordType" ) {
86+ struct CppcheckLibraryData ::Container::RangeItemRecordType rangeItemRecordType;
87+ rangeItemRecordType.name = xmlReader.attributes ().value (" name" ).toString ();
88+ rangeItemRecordType.templateParameter = xmlReader.attributes ().value (" templateParameter" ).toString ();
89+ container.rangeItemRecordTypeList .append (rangeItemRecordType);
90+ } else
8691 container.otherFunctions .append (function);
8792 }
8893 } else {
@@ -105,9 +110,23 @@ static QString loadUndefine(const QXmlStreamReader &xmlReader)
105110 return xmlReader.attributes ().value (" name" ).toString ();
106111}
107112
108- static QString loadSmartPointer (const QXmlStreamReader &xmlReader)
113+ static CppcheckLibraryData::SmartPointer loadSmartPointer (QXmlStreamReader &xmlReader)
109114{
110- return xmlReader.attributes ().value (" class-name" ).toString ();
115+ CppcheckLibraryData::SmartPointer smartPointer;
116+ smartPointer.name = xmlReader.attributes ().value (" class-name" ).toString ();
117+ QXmlStreamReader::TokenType type;
118+ while ((type = xmlReader.readNext ()) != QXmlStreamReader::EndElement ||
119+ xmlReader.name ().toString () != " smart-pointer" ) {
120+ if (type != QXmlStreamReader::StartElement)
121+ continue ;
122+ const QString elementName = xmlReader.name ().toString ();
123+ if (elementName == " unique" ) {
124+ smartPointer.unique = true ;
125+ } else {
126+ unhandledElement (xmlReader);
127+ }
128+ }
129+ return smartPointer;
111130}
112131
113132static CppcheckLibraryData::TypeChecks loadTypeChecks (QXmlStreamReader &xmlReader)
@@ -210,6 +229,20 @@ static CppcheckLibraryData::Function loadFunction(QXmlStreamReader &xmlReader, c
210229 function.warn .reason = xmlReader.attributes ().value (" reason" ).toString ();
211230 function.warn .alternatives = xmlReader.attributes ().value (" alternatives" ).toString ();
212231 function.warn .msg = xmlReader.readElementText ();
232+ } else if (elementName == " not-overlapping-data" ) {
233+ const QStringList attributeList {" ptr1-arg" , " ptr2-arg" , " size-arg" , " strlen-arg" };
234+ for (const QString &attr : attributeList) {
235+ if (xmlReader.attributes ().hasAttribute (attr)) {
236+ function.notOverlappingDataArgs [attr] = xmlReader.attributes ().value (attr).toString ();
237+ }
238+ }
239+ } else if (elementName == " container" ) {
240+ const QStringList attributeList {" action" , " yields" };
241+ for (const QString &attr : attributeList) {
242+ if (xmlReader.attributes ().hasAttribute (attr)) {
243+ function.containerAttributes [attr] = xmlReader.attributes ().value (attr).toString ();
244+ }
245+ }
213246 } else {
214247 unhandledElement (xmlReader);
215248 }
@@ -493,6 +526,20 @@ static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString &
493526 xmlWriter.writeEndElement ();
494527}
495528
529+ static void writeContainerRangeItemRecords (QXmlStreamWriter &xmlWriter, const QList<struct CppcheckLibraryData ::Container::RangeItemRecordType> &rangeItemRecords)
530+ {
531+ if (rangeItemRecords.isEmpty ())
532+ return ;
533+ xmlWriter.writeStartElement (" rangeItemRecordType" );
534+ for (const CppcheckLibraryData::Container::RangeItemRecordType &item : rangeItemRecords) {
535+ xmlWriter.writeStartElement (" member" );
536+ xmlWriter.writeAttribute (" name" , item.name );
537+ xmlWriter.writeAttribute (" templateParameter" , item.templateParameter );
538+ xmlWriter.writeEndElement ();
539+ }
540+ xmlWriter.writeEndElement ();
541+ }
542+
496543static void writeContainer (QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::Container &container)
497544{
498545 xmlWriter.writeStartElement (" container" );
@@ -519,6 +566,7 @@ static void writeContainer(QXmlStreamWriter &xmlWriter, const CppcheckLibraryDat
519566 writeContainerFunctions (xmlWriter, " size" , container.size_templateParameter , container.sizeFunctions );
520567 writeContainerFunctions (xmlWriter, " access" , container.access_arrayLike ?1 :-1 , container.accessFunctions );
521568 writeContainerFunctions (xmlWriter, " other" , -1 , container.otherFunctions );
569+ writeContainerRangeItemRecords (xmlWriter, container.rangeItemRecordTypeList );
522570 xmlWriter.writeEndElement ();
523571}
524572
@@ -632,7 +680,20 @@ static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData
632680
633681 xmlWriter.writeEndElement ();
634682 }
635-
683+ if (!function.notOverlappingDataArgs .isEmpty ()) {
684+ xmlWriter.writeStartElement (" not-overlapping-data" );
685+ foreach (const QString value, function.notOverlappingDataArgs ) {
686+ xmlWriter.writeAttribute (function.notOverlappingDataArgs .key (value), value);
687+ }
688+ xmlWriter.writeEndElement ();
689+ }
690+ if (!function.containerAttributes .isEmpty ()) {
691+ xmlWriter.writeStartElement (" container" );
692+ foreach (const QString value, function.containerAttributes ) {
693+ xmlWriter.writeAttribute (function.containerAttributes .key (value), value);
694+ }
695+ xmlWriter.writeEndElement ();
696+ }
636697 xmlWriter.writeEndElement ();
637698}
638699
@@ -835,9 +896,12 @@ QString CppcheckLibraryData::toString() const
835896 writeTypeChecks (xmlWriter, check);
836897 }
837898
838- for (const QString &smartPtr : smartPointers) {
899+ for (const SmartPointer &smartPtr : smartPointers) {
839900 xmlWriter.writeStartElement (" smart-pointer" );
840- xmlWriter.writeAttribute (" class-name" , smartPtr);
901+ xmlWriter.writeAttribute (" class-name" , smartPtr.name );
902+ if (smartPtr.unique ) {
903+ xmlWriter.writeEmptyElement (" unique" );
904+ }
841905 xmlWriter.writeEndElement ();
842906 }
843907
0 commit comments