MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / HasTypeWithSubType

Function HasTypeWithSubType

InsightsHelpers.cpp:1260–1282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1258
1259template<typename QT, typename SUB_T, typename SUB_T2 = void>
1260static bool HasTypeWithSubType(const QualType& t)
1261{
1262 if(const auto* lref = dyn_cast_or_null<QT>(t.getTypePtrOrNull())) {
1263 const auto subType = GetDesugarType(lref->getPointeeType());
1264 const auto& ct = subType.getCanonicalType();
1265 const auto* plainSubType = ct.getTypePtrOrNull();
1266
1267 if(const auto* st = dyn_cast_or_null<SUB_T>(plainSubType)) {
1268 if constexpr(std::is_same_v<void, SUB_T2>) {
1269 return true;
1270
1271 } else {
1272 const auto subType = GetDesugarType(st->getPointeeType());
1273 const auto& ct = subType.getCanonicalType();
1274 const auto* plainSubType = ct.getTypePtrOrNull();
1275
1276 return isa<SUB_T2>(plainSubType);
1277 }
1278 }
1279 }
1280
1281 return false;
1282}
1283//-----------------------------------------------------------------------------
1284
1285template<typename QT, typename SUB_T>

Callers

nothing calls this directly

Calls 1

GetDesugarTypeFunction · 0.85

Tested by

no test coverage detected