@@ -666,6 +666,37 @@ SValue ScState::createArrayInState(clang::QualType arrayType, unsigned level)
666666 }
667667}
668668
669+ SValue ScState::createStdArrayInState (clang::QualType arrayType, unsigned level)
670+ {
671+ if (isStdArray (arrayType)) {
672+ auto elmType = getTemplateArgAsType (arrayType, 0 );
673+ SCT_TOOL_ASSERT (elmType, " createStdArrayInState : No type inferred" );
674+ auto sizeArg = sc::getTemplateArg (arrayType, 1 );
675+ SCT_TOOL_ASSERT (sizeArg, " createStdArrayInState : No size inferred" );
676+ size_t size = sizeArg->getAsIntegral ().getZExtValue ();
677+
678+ // Create array object
679+ SValue arrayRootVal = SValue (*elmType, size, 0 );
680+
681+ // Fill array with elements
682+ for (unsigned i = 0 ; i < size; i++) {
683+ // Recursive call to create sub-arrays
684+ SValue eval = createStdArrayInState (*elmType, level);
685+ // Put sub_array value into @aval
686+ arrayRootVal.getArray ().setOffset (i);
687+ putValue (arrayRootVal, eval, false ); // @val -> @eval
688+ setValueLevel (arrayRootVal, level);
689+ }
690+ if (arrayRootVal.getArray ().getSize () > 0 ) {
691+ arrayRootVal.getArray ().setOffset (0 );
692+ }
693+ return arrayRootVal;
694+
695+ } else {
696+ return NO_VALUE;
697+ }
698+ }
699+
669700// \return <value found, array with unknown index returned>
670701std::pair<bool , bool >
671702ScState::getValue (const SValue& lval, SValue& rval, bool deReference,
@@ -1671,7 +1702,7 @@ vector<SValue>ScState::getAllRecordArrayElementsForAny(const SValue& val,
16711702
16721703// Is value simple enough to store its value, if not no value put to state
16731704// Not used for now
1674- bool ScState::isSimpleValue (const SValue& val) const
1705+ /* bool ScState::isSimpleValue(const SValue& val) const
16751706{
16761707 // Go up and count array number
16771708 vector<SValue> valStack;
@@ -1693,7 +1724,7 @@ bool ScState::isSimpleValue(const SValue& val) const
16931724 const QualType& type = val.getType();
16941725 bool comlType = (arrNum == 1) && sc::isArray(type);
16951726 return !comlType;
1696- }
1727+ }*/
16971728
16981729// Get all fields for given record value with
16991730// TODO: update for inner records
0 commit comments