@@ -103,6 +103,7 @@ class DeclDB {
103103 clang::QualType scUIntBaseType;
104104 clang::QualType scUnsignedType;
105105 clang::QualType scSignedType;
106+ clang::QualType scBitVector;
106107
107108 clang::QualType scModuleType;
108109 clang::QualType scPortBaseType;
@@ -173,6 +174,10 @@ DeclDB::DeclDB(const clang::ASTContext &ctx)
173174 SCT_TOOL_ASSERT (matches.size () == 1 , " Error declaration match" );
174175 scUnsignedType = matches[0 ].getNodeAs <CXXRecordDecl>(" sc_unsigned" )->getTypeForDecl ()->getCanonicalTypeInternal ();
175176
177+ matches = match (cxxRecordDecl (hasName (" sc_dt::sc_bv_base" ), isDefinition ()).bind (" sc_bv_base" ), astCtx);
178+ SCT_TOOL_ASSERT (matches.size () == 1 , " Error declaration match" );
179+ scBitVector = matches[0 ].getNodeAs <CXXRecordDecl>(" sc_bv_base" )->getTypeForDecl ()->getCanonicalTypeInternal ();
180+
176181 matches = match (cxxRecordDecl (hasName (" sc_core::sc_module" ), isDefinition ()).bind (" sc_module" ), astCtx);
177182 SCT_TOOL_ASSERT (matches.size () == 1 , " Error declaration match" );
178183 scModuleType = matches[0 ].getNodeAs <CXXRecordDecl>(" sc_module" )->getTypeForDecl ()->getCanonicalTypeInternal ();
@@ -317,12 +322,18 @@ bool isScBigUInt(clang::QualType type)
317322 return isDerivedFrom (type, db->scUnsignedType );
318323}
319324
325+ bool isScBitVector (clang::QualType type)
326+ {
327+ type = getPureType (type);
328+ return isDerivedFrom (type, db->scBitVector );
329+ }
330+
320331bool isAnyScInteger (clang::QualType type)
321332{
322333 if (type.isNull ()) return false ;
323334
324335 return isScInt (type) || isScUInt (type) ||
325- isScBigInt (type) || isScBigUInt (type);
336+ isScBigInt (type) || isScBigUInt (type) || isScBitVector (type) ;
326337}
327338
328339bool isAnyScIntegerRef (QualType type, bool checkPointer)
@@ -342,6 +353,7 @@ bool isAnyScIntegerRef(QualType type, bool checkPointer)
342353 std::string typeStr = type.getAsString ();
343354 return (typeStr.find (" sc_uint_base" ) != std::string::npos ||
344355 typeStr.find (" sc_int_base" ) != std::string::npos ||
356+ typeStr.find (" sc_bv_base" ) != std::string::npos ||
345357 typeStr.find (" sc_uint_bitref" ) != std::string::npos ||
346358 typeStr.find (" sc_int_bitref" ) != std::string::npos ||
347359 typeStr.find (" sc_uint_subref" ) != std::string::npos ||
@@ -364,8 +376,7 @@ bool isScNotSupported(QualType type, bool checkPointer)
364376 type = getPureType (type);
365377
366378 std::string typeStr = type.getAsString ();
367- return (typeStr.find (" sc_bv" ) != std::string::npos ||
368- typeStr.find (" sc_lv" ) != std::string::npos ||
379+ return (typeStr.find (" sc_lv" ) != std::string::npos ||
369380 typeStr.find (" sc_bit" ) != std::string::npos ||
370381 typeStr.find (" sc_logic" ) != std::string::npos ||
371382 typeStr.find (" sc_fix" ) != std::string::npos ||
@@ -497,7 +508,7 @@ llvm::Optional<std::pair<size_t, bool>> getIntTraits(clang::QualType type,
497508 return std::pair<size_t , bool >(width, isUnsigned);
498509
499510 } else
500- if (auto width = getScUintBiguint (type)) {
511+ if (auto width = getScUintBiguintBitVec (type)) {
501512 return std::pair<size_t , bool >(width.getValue (), true );
502513
503514 } else
@@ -543,13 +554,12 @@ llvm::Optional<size_t> getAnyTypeWidth(clang::QualType type, bool checkPointer,
543554 return llvm::None;
544555}
545556
546- // Is @sc_uint or @sc_biguint types
547- Optional<size_t > getScUintBiguint (QualType type)
557+ Optional<size_t > getScUintBiguintBitVec (QualType type)
548558{
549559 if (type.isNull ()) return llvm::None;
550560 type = getPureType (type);
551561
552- if (isScUInt (type) || isScBigUInt (type)) {
562+ if (isScUInt (type) || isScBigUInt (type) || isScBitVector (type) ) {
553563 auto rdecl = type->getAsCXXRecordDecl ();
554564 SCT_TOOL_ASSERT (rdecl, " SC integer is not record" );
555565
@@ -563,7 +573,6 @@ Optional<size_t> getScUintBiguint(QualType type)
563573 return Optional<size_t >();
564574}
565575
566- // Is @sc_int or @sc_bigint types
567576Optional<size_t > getScIntBigint (QualType type)
568577{
569578 if (type.isNull ()) return llvm::None;
0 commit comments