Lines Matching defs:clang

22 #include "clang/AST/ASTContext.h"
23 #include "clang/AST/Attr.h"
24 #include "clang/AST/RecordLayout.h"
104 clang::BuiltinType::Kind builtinTypeKind;
114 {clang::BuiltinType::Bool, DataTypeBoolean,
116 {clang::BuiltinType::Char_U, DataTypeUnsigned8,
118 {clang::BuiltinType::UChar, DataTypeUnsigned8,
120 {clang::BuiltinType::Char16, DataTypeSigned16,
122 {clang::BuiltinType::Char32, DataTypeSigned32,
124 {clang::BuiltinType::UShort, DataTypeUnsigned16,
126 {clang::BuiltinType::UInt, DataTypeUnsigned32,
128 {clang::BuiltinType::ULong, DataTypeUnsigned64,
130 {clang::BuiltinType::ULongLong, DataTypeUnsigned64,
133 {clang::BuiltinType::Char_S, DataTypeSigned8,
135 {clang::BuiltinType::SChar, DataTypeSigned8,
137 {clang::BuiltinType::Short, DataTypeSigned16,
139 {clang::BuiltinType::Int, DataTypeSigned32,
141 {clang::BuiltinType::Long, DataTypeSigned64,
143 {clang::BuiltinType::LongLong, DataTypeSigned64,
145 {clang::BuiltinType::Half, DataTypeFloat16,
147 {clang::BuiltinType::Float, DataTypeFloat32,
149 {clang::BuiltinType::Double, DataTypeFloat64,
180 static const clang::Type *TypeExportableHelper(
181 const clang::Type *T,
182 llvm::SmallPtrSet<const clang::Type*, 8>& SPS,
184 const clang::VarDecl *VD,
185 const clang::RecordDecl *TopLevelRecord,
190 const clang::NamedDecl *ND,
191 const clang::RecordDecl *TopLevelRecord,
208 static const clang::Type *ConstantArrayTypeExportableHelper(
209 const clang::ConstantArrayType *CAT,
210 llvm::SmallPtrSet<const clang::Type*, 8>& SPS,
212 const clang::VarDecl *VD,
213 const clang::RecordDecl *TopLevelRecord,
216 const clang::Type *ElementType = GetConstantArrayElementType(CAT);
222 const clang::ExtVectorType *EVT =
223 static_cast<const clang::ExtVectorType*>(ElementType);
226 const clang::Type *BaseElementType = GetExtVectorElementType(EVT);
248 BuiltinInfo *FindBuiltinType(clang::BuiltinType::Kind builtinTypeKind) {
257 static const clang::Type *TypeExportableHelper(
258 clang::Type const *T,
259 llvm::SmallPtrSet<clang::Type const *, 8> &SPS,
261 clang::VarDecl const *VD,
262 clang::RecordDecl const *TopLevelRecord,
271 const clang::Type *CTI = T->getCanonicalTypeInternal().getTypePtr();
274 case clang::Type::Builtin: {
275 const clang::BuiltinType *BT = static_cast<const clang::BuiltinType*>(CTI);
278 case clang::Type::Record: {
293 clang::RecordDecl *RD = T->getAsStructureType()->getDecl();
319 for (clang::RecordDecl::field_iterator FI = RD->field_begin(),
323 const clang::FieldDecl *FD = *FI;
324 const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
346 case clang::Type::FunctionProto:
347 case clang::Type::FunctionNoProto:
351 case clang::Type::Pointer: {
360 const clang::PointerType *PT = static_cast<const clang::PointerType*>(CTI);
361 const clang::Type *PointeeType = GetPointeeType(PT);
363 if (PointeeType->getTypeClass() == clang::Type::Pointer) {
391 case clang::Type::ExtVector: {
392 const clang::ExtVectorType *EVT =
393 static_cast<const clang::ExtVectorType*>(CTI);
399 const clang::Type *ElementType = GetExtVectorElementType(EVT);
401 if ((ElementType->getTypeClass() != clang::Type::Builtin) ||
408 case clang::Type::ConstantArray: {
409 const clang::ConstantArrayType *CAT =
410 static_cast<const clang::ConstantArrayType*>(CTI);
415 case clang::Type::Enum: {
435 static const clang::Type *TypeExportable(const clang::Type *T,
437 const clang::VarDecl *VD,
439 llvm::SmallPtrSet<const clang::Type*, 8> SPS =
440 llvm::SmallPtrSet<const clang::Type*, 8>();
446 const clang::VarDecl *VD, bool InCompositeType,
453 (VD->getFormalLinkage() == clang::ExternalLinkage)) {
455 const clang::Type *T = GetCanonicalType(VD->getType().getTypePtr());
456 if (T->getTypeClass() != clang::Type::Pointer) {
488 clang::ASTContext &C,
489 const clang::Type *&T,
490 const clang::NamedDecl *ND,
491 clang::SourceLocation Loc,
492 llvm::SmallPtrSet<const clang::Type*, 8>& SPS,
494 clang::RecordDecl *UnionDecl,
504 const clang::Type *CTI = T->getCanonicalTypeInternal().getTypePtr();
507 case clang::Type::Record: {
509 const clang::VarDecl *VD = (ND ? llvm::dyn_cast<clang::VarDecl>(ND) : nullptr);
526 clang::RecordDecl *RD = nullptr;
554 for (clang::RecordDecl::field_iterator FI = RD->field_begin(),
558 const clang::FieldDecl *FD = *FI;
559 const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
571 case clang::Type::Builtin: {
573 clang::QualType QT = T->getCanonicalTypeInternal();
596 case clang::Type::Pointer: {
628 const clang::PointerType *PT = static_cast<const clang::PointerType*>(CTI);
629 const clang::Type *PointeeType = GetPointeeType(PT);
636 case clang::Type::ExtVector: {
637 const clang::ExtVectorType *EVT =
638 static_cast<const clang::ExtVectorType*>(CTI);
639 const clang::Type *ElementType = GetExtVectorElementType(EVT);
644 ND->getFormalLinkage() == clang::ExternalLinkage) {
654 case clang::Type::ConstantArray: {
655 const clang::ConstantArrayType *CAT = static_cast<const clang::ConstantArrayType*>(CTI);
656 const clang::Type *ElementType = GetConstantArrayElementType(CAT);
682 bool RSExportType::NormalizeType(const clang::Type *&T,
685 const clang::VarDecl *VD,
705 bool RSExportType::ValidateType(slang::RSContext *Context, clang::ASTContext &C,
706 clang::QualType QT, const clang::NamedDecl *ND,
707 clang::SourceLocation Loc,
710 const clang::Type *T = QT.getTypePtr();
711 llvm::SmallPtrSet<const clang::Type*, 8> SPS =
712 llvm::SmallPtrSet<const clang::Type*, 8>();
716 if (auto VD = llvm::dyn_cast_or_null<clang::VarDecl>(ND)) {
717 if (VD->getFormalLinkage() == clang::ExternalLinkage) {
728 clang::VarDecl *VD, unsigned int TargetAPI,
732 (VD->getFormalLinkage() == clang::ExternalLinkage));
735 const clang::Type
736 *RSExportType::GetTypeOfDecl(const clang::DeclaratorDecl *DD) {
738 clang::QualType T = DD->getType();
748 llvm::StringRef RSExportType::GetTypeName(const clang::Type* T) {
753 const clang::Type *CTI = T->getCanonicalTypeInternal().getTypePtr();
756 case clang::Type::Builtin: {
757 const clang::BuiltinType *BT = static_cast<const clang::BuiltinType*>(CTI);
765 case clang::Type::Record: {
766 clang::RecordDecl *RD;
781 for (clang::TagDecl::redecl_iterator RI = RD->redecls_begin(),
795 case clang::Type::Pointer: {
797 const clang::PointerType *P = static_cast<const clang::PointerType*>(CTI);
798 const clang::Type *PT = GetPointeeType(P);
810 case clang::Type::ExtVector: {
811 const clang::ExtVectorType *EVT =
812 static_cast<const clang::ExtVectorType*>(CTI);
816 case clang::Type::ConstantArray : {
830 const clang::Type *T,
841 const clang::Type *CTI = T->getCanonicalTypeInternal().getTypePtr();
845 case clang::Type::Record: {
887 case clang::Type::Builtin: {
891 case clang::Type::Pointer: {
893 static_cast<const clang::PointerType*>(CTI),
899 case clang::Type::ExtVector: {
901 static_cast<const clang::ExtVectorType*>(CTI),
905 case clang::Type::ConstantArray: {
908 static_cast<const clang::ConstantArrayType*>(CTI));
921 RSExportType *RSExportType::Create(RSContext *Context, const clang::Type *T,
922 ExportKind EK, const clang::VarDecl *VD) {
932 const clang::VarDecl *VD) {
947 const llvm::StringRef &Name, clang::SourceLocation Loc)
983 bool RSExportPrimitiveType::IsPrimitiveType(const clang::Type *T) {
984 if ((T != nullptr) && (T->getTypeClass() == clang::Type::Builtin))
1009 DataType RSExportPrimitiveType::GetRSSpecificType(const clang::Type *T) {
1011 if ((T == nullptr) || (T->getTypeClass() != clang::Type::Record))
1031 bool RSExportPrimitiveType::IsStructureTypeWithRSObject(const clang::Type *T) {
1039 const clang::RecordType *RT = T->getAsStructureType();
1044 const clang::RecordDecl *RD = RT->getDecl();
1052 for (clang::RecordDecl::field_iterator FI = RD->field_begin(),
1058 const clang::FieldDecl *FD = *FI;
1059 const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
1105 RSExportPrimitiveType::GetDataType(RSContext *Context, const clang::Type *T) {
1110 case clang::Type::Builtin: {
1111 const clang::BuiltinType *BT =
1112 static_cast<const clang::BuiltinType*>(T->getCanonicalTypeInternal().getTypePtr());
1123 case clang::Type::Record: {
1139 const clang::Type *T,
1152 const clang::Type *T) {
1253 const clang::PointerType *PT,
1255 const clang::Type *PointeeType = GetPointeeType(PT);
1258 if (PointeeType->getTypeClass() != clang::Type::Pointer) {
1296 RSExportVectorType::GetTypeName(const clang::ExtVectorType *EVT) {
1297 const clang::Type *ElementType = GetExtVectorElementType(EVT);
1300 if ((ElementType->getTypeClass() != clang::Type::Builtin))
1303 const clang::BuiltinType *BT =
1304 static_cast<const clang::BuiltinType*>(
1324 const clang::ExtVectorType *EVT,
1327 slangAssert(EVT != nullptr && EVT->getTypeClass() == clang::Type::ExtVector);
1329 const clang::Type *ElementType = GetExtVectorElementType(EVT);
1356 const clang::RecordType *RT,
1359 slangAssert((RT != nullptr) && (RT->getTypeClass() == clang::Type::Record));
1364 const clang::RecordDecl* RD = RT->getDecl();
1376 clang::RecordDecl::field_iterator FIT = RD->field_begin();
1377 const clang::FieldDecl *FD = *FIT;
1378 const clang::Type *FT = RSExportType::GetTypeOfDecl(FD);
1379 if ((FT == nullptr) || (FT->getTypeClass() != clang::Type::ConstantArray)) {
1386 const clang::ConstantArrayType *CAT =
1387 static_cast<const clang::ConstantArrayType *>(FT);
1388 const clang::Type *ElementType = GetConstantArrayElementType(CAT);
1390 (ElementType->getTypeClass() != clang::Type::Builtin) ||
1391 (static_cast<const clang::BuiltinType *>(ElementType)->getKind() !=
1392 clang::BuiltinType::Float)) {
1442 const clang::ConstantArrayType *CAT) {
1443 slangAssert(CAT != nullptr && CAT->getTypeClass() == clang::Type::ConstantArray);
1450 const clang::Type *ElementType = GetConstantArrayElementType(CAT);
1485 const clang::RecordType *RT,
1488 slangAssert(RT != nullptr && RT->getTypeClass() == clang::Type::Record);
1490 const clang::RecordDecl *RD = RT->getDecl();
1499 // Struct layout construct by clang. We rely on this for obtaining the
1501 const clang::ASTRecordLayout *RL =
1510 RD->hasAttr<clang::PackedAttr>(),
1516 for (clang::RecordDecl::field_iterator FI = RD->field_begin(),
1522 slangAssert(FI->getKind() == clang::Decl::Field);
1523 clang::FieldDecl *FD = *FI;
1540 // clang static analysis complains about a potential memory leak